From dd3f293cca606ff2d21555fc513cf89794238043 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Thu, 8 Apr 2021 14:17:38 +0200 Subject: [PATCH 01/20] Fixing ACR write padding --- ad9959/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ad9959/src/lib.rs b/ad9959/src/lib.rs index 206d90a..f5d80a9 100644 --- a/ad9959/src/lib.rs +++ b/ad9959/src/lib.rs @@ -582,7 +582,9 @@ impl ProfileSerializer { } if let Some(acr) = acr { - self.add_write(Register::ACR, &acr.to_be_bytes()); + let mut data = [0; 3]; + data[1..=2].copy_from_slice(&acr.to_be_bytes()); + self.add_write(Register::ACR, &data); } } From bf3dae814da274052c05f4dde3d3a835fe907af5 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Thu, 8 Apr 2021 14:58:28 +0200 Subject: [PATCH 02/20] Updating ACR to 32-bit --- ad9959/src/lib.rs | 11 +++++------ src/hardware/pounder/dds_output.rs | 5 +++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ad9959/src/lib.rs b/ad9959/src/lib.rs index f5d80a9..a8fc48e 100644 --- a/ad9959/src/lib.rs +++ b/ad9959/src/lib.rs @@ -558,13 +558,14 @@ impl ProfileSerializer { /// * `channels` - A list of channels to apply the configuration to. /// * `ftw` - If provided, indicates a frequency tuning word for the channels. /// * `pow` - If provided, indicates a phase offset word for the channels. - /// * `acr` - If provided, indicates the amplitude control register for the channels. + /// * `acr` - If provided, indicates the amplitude control register for the channels. The ACR + /// should be stored in the 3 LSB of the word. pub fn update_channels( &mut self, channels: &[Channel], ftw: Option, pow: Option, - acr: Option, + acr: Option, ) { let mut csr: u8 = *0u8.set_bits(1..3, self.mode as u8); for channel in channels.iter() { @@ -582,9 +583,7 @@ impl ProfileSerializer { } if let Some(acr) = acr { - let mut data = [0; 3]; - data[1..=2].copy_from_slice(&acr.to_be_bytes()); - self.add_write(Register::ACR, &data); + self.add_write(Register::ACR, &acr.to_be_bytes()[1..=4]); } } @@ -608,7 +607,6 @@ impl ProfileSerializer { // Pad the buffer to 32-bit alignment by adding dummy writes to CSR and LSRR. let padding = 4 - (self.index % 4); match padding { - 0 => {} 1 => { // For a pad size of 1, we have to pad with 5 bytes to align things. self.add_write(Register::CSR, &[(self.mode as u8) << 1]); @@ -616,6 +614,7 @@ impl ProfileSerializer { } 2 => self.add_write(Register::CSR, &[(self.mode as u8) << 1]), 3 => self.add_write(Register::LSRR, &[0, 0, 0]), + 4 => {} _ => unreachable!(), } diff --git a/src/hardware/pounder/dds_output.rs b/src/hardware/pounder/dds_output.rs index c7c5e6d..e755482 100644 --- a/src/hardware/pounder/dds_output.rs +++ b/src/hardware/pounder/dds_output.rs @@ -144,14 +144,15 @@ impl<'a> ProfileBuilder<'a> { /// * `channels` - A list of channels to apply the configuration to. /// * `ftw` - If provided, indicates a frequency tuning word for the channels. /// * `pow` - If provided, indicates a phase offset word for the channels. - /// * `acr` - If provided, indicates the amplitude control register for the channels. + /// * `acr` - If provided, indicates the amplitude control register for the channels. The + /// 24-bits of the ACR should be stored in the last 3 LSB. #[allow(dead_code)] pub fn update_channels( mut self, channels: &[Channel], ftw: Option, pow: Option, - acr: Option, + acr: Option, ) -> Self { self.serializer.update_channels(channels, ftw, pow, acr); self From 4a2d4af5088ec91f78097bed80f3b7efc303c1ec Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Thu, 8 Apr 2021 15:00:30 +0200 Subject: [PATCH 03/20] Fixing end index --- ad9959/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ad9959/src/lib.rs b/ad9959/src/lib.rs index a8fc48e..9b7d77b 100644 --- a/ad9959/src/lib.rs +++ b/ad9959/src/lib.rs @@ -583,7 +583,7 @@ impl ProfileSerializer { } if let Some(acr) = acr { - self.add_write(Register::ACR, &acr.to_be_bytes()[1..=4]); + self.add_write(Register::ACR, &acr.to_be_bytes()[1..=3]); } } From 35aa3eb606fde3c090418512c67b1d724c064269 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Thu, 8 Apr 2021 15:04:34 +0200 Subject: [PATCH 04/20] Fixing other AD9959 profile issues --- ad9959/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ad9959/src/lib.rs b/ad9959/src/lib.rs index 9b7d77b..89192b6 100644 --- a/ad9959/src/lib.rs +++ b/ad9959/src/lib.rs @@ -610,10 +610,10 @@ impl ProfileSerializer { 1 => { // For a pad size of 1, we have to pad with 5 bytes to align things. self.add_write(Register::CSR, &[(self.mode as u8) << 1]); - self.add_write(Register::LSRR, &[0, 0, 0]); + self.add_write(Register::LSRR, &[0, 0]); } 2 => self.add_write(Register::CSR, &[(self.mode as u8) << 1]), - 3 => self.add_write(Register::LSRR, &[0, 0, 0]), + 3 => self.add_write(Register::LSRR, &[0, 0]), 4 => {} _ => unreachable!(), From 090ec4650d5817f9770cfebbff1e2528dd090815 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Thu, 8 Apr 2021 16:05:51 +0200 Subject: [PATCH 05/20] Update ad9959/src/lib.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Robert Jördens --- ad9959/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ad9959/src/lib.rs b/ad9959/src/lib.rs index 89192b6..21dfa21 100644 --- a/ad9959/src/lib.rs +++ b/ad9959/src/lib.rs @@ -559,7 +559,8 @@ impl ProfileSerializer { /// * `ftw` - If provided, indicates a frequency tuning word for the channels. /// * `pow` - If provided, indicates a phase offset word for the channels. /// * `acr` - If provided, indicates the amplitude control register for the channels. The ACR - /// should be stored in the 3 LSB of the word. + /// should be stored in the 3 LSB of the word. Note that if amplitude scaling is to be used, + /// the "Amplitude multiplier enable" bit must be set. pub fn update_channels( &mut self, channels: &[Channel], From 7372bcc2e237504be33006b31edccd075e65d28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Thu, 8 Apr 2021 16:20:28 +0200 Subject: [PATCH 06/20] miniconf.py: add iir example --- miniconf.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/miniconf.py b/miniconf.py index 019ebcb..0901127 100644 --- a/miniconf.py +++ b/miniconf.py @@ -83,9 +83,12 @@ class Miniconf: def main(): parser = argparse.ArgumentParser( description='Miniconf command line interface.', - epilog='''Example: - %(prog)s -v -b mqtt dt/sinara/stabilizer afe/0 '"G10"' - ''') + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog='''Examples: +%(prog)s dt/sinara/stabilizer afe/0 '"G10"' +%(prog)s dt/sinara/stabilizer iir_ch/0/0 \ +'{"y_min": -32767, "y_max": 32767, "y_offset": 0, "ba": [1.0, 0, 0, 0, 0]}' +''') parser.add_argument('-v', '--verbose', action='count', default=0, help='Increase logging verbosity') parser.add_argument('--broker', '-b', default='mqtt', type=str, From a3511f522315ffbe287742bb826fb109cd55f72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Thu, 8 Apr 2021 16:26:22 +0200 Subject: [PATCH 07/20] cli: print response directly --- miniconf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miniconf.py b/miniconf.py index 0901127..d7fd615 100644 --- a/miniconf.py +++ b/miniconf.py @@ -111,7 +111,7 @@ def main(): async def configure_settings(): interface = await Miniconf.create(args.prefix, args.broker) response = await interface.command(args.path, json.loads(args.value)) - print(f"Response: {response}") + print(response) loop.run_until_complete(configure_settings()) From 7329d0f24151cb49d46fb5e81145c6c4bfeb5a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Thu, 8 Apr 2021 17:11:44 +0200 Subject: [PATCH 08/20] cli,hitl: allow more settings per invokation, expand example --- hitl/run.sh | 4 +++- miniconf.py | 15 +++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hitl/run.sh b/hitl/run.sh index a01a472..8fe9a3a 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -22,4 +22,6 @@ python3 -m pip install -r requirements.txt ping -c 5 -w 20 stabilizer-hitl # Test the MQTT interface. -python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' +python3 miniconf.py dt/sinara/stabilizer afe/0='"G2"' +python3 miniconf.py dt/sinara/stabilizer afe/0='"G1"' iir_ch/0/0=\ +'{"y_min": -32767, "y_max": 32767, "y_offset": 0, "ba": [1.0, 0, 0, 0, 0]}' diff --git a/miniconf.py b/miniconf.py index d7fd615..b059f78 100644 --- a/miniconf.py +++ b/miniconf.py @@ -85,8 +85,7 @@ def main(): description='Miniconf command line interface.', formatter_class=argparse.RawDescriptionHelpFormatter, epilog='''Examples: -%(prog)s dt/sinara/stabilizer afe/0 '"G10"' -%(prog)s dt/sinara/stabilizer iir_ch/0/0 \ +%(prog)s dt/sinara/stabilizer afe/0='"G2"' iir_ch/0/0=\ '{"y_min": -32767, "y_max": 32767, "y_offset": 0, "ba": [1.0, 0, 0, 0, 0]}' ''') parser.add_argument('-v', '--verbose', action='count', default=0, @@ -95,10 +94,8 @@ def main(): help='The MQTT broker address') parser.add_argument('prefix', type=str, help='The MQTT topic prefix of the target') - parser.add_argument('path', type=str, - help='The setting path to configure') - parser.add_argument('value', type=str, - help='The value of setting in JSON format') + parser.add_argument('settings', metavar="KEY=VALUE", nargs='+', + help='JSON encoded values for settings path keys.') args = parser.parse_args() @@ -110,8 +107,10 @@ def main(): async def configure_settings(): interface = await Miniconf.create(args.prefix, args.broker) - response = await interface.command(args.path, json.loads(args.value)) - print(response) + for kv in args.settings: + path, value = kv.split("=", 1) + response = await interface.command(path, json.loads(value)) + print(response) loop.run_until_complete(configure_settings()) From f26e0b100e0485132e5285368debed9b49b0dc93 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Fri, 9 Apr 2021 11:25:58 +0200 Subject: [PATCH 09/20] Adding check wait for HITL --- .github/workflows/hitl.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/hitl.yml b/.github/workflows/hitl.yml index b8611d4..a888e06 100644 --- a/.github/workflows/hitl.yml +++ b/.github/workflows/hitl.yml @@ -16,3 +16,9 @@ jobs: event-type: stabilizer repository: quartiq/hitl client-payload: '{"github": ${{ toJson(github) }}}' + + - uses: fountainhead/action-wait-for-check@v1.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + checkName: HITL + ref: ${{ github.event.pull_request.head.sha }} From 9d22febe64fbd1f8f69d08b3d7c80bbefad73a81 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Fri, 9 Apr 2021 11:27:27 +0200 Subject: [PATCH 10/20] Fixing indent --- .github/workflows/hitl.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/hitl.yml b/.github/workflows/hitl.yml index a888e06..5f920fc 100644 --- a/.github/workflows/hitl.yml +++ b/.github/workflows/hitl.yml @@ -17,8 +17,8 @@ jobs: repository: quartiq/hitl client-payload: '{"github": ${{ toJson(github) }}}' - - uses: fountainhead/action-wait-for-check@v1.0.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - checkName: HITL - ref: ${{ github.event.pull_request.head.sha }} + - uses: fountainhead/action-wait-for-check@v1.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + checkName: HITL + ref: ${{ github.event.pull_request.head.sha }} From f83973f1a261ea9f916c5eb8b3e7e39f1b15514a Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Fri, 9 Apr 2021 11:43:30 +0200 Subject: [PATCH 11/20] Renaming HITL workflow --- .github/workflows/hitl.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hitl.yml b/.github/workflows/hitl.yml index 5f920fc..0a39a6e 100644 --- a/.github/workflows/hitl.yml +++ b/.github/workflows/hitl.yml @@ -1,4 +1,4 @@ -name: HITL +name: HITL Run Request on: workflow_dispatch: From 26d83da684d6eeb3486c4e99cc200d81dce6378d Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Fri, 9 Apr 2021 12:33:54 +0200 Subject: [PATCH 12/20] Adding sleep on startup --- .github/workflows/hitl.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/hitl.yml b/.github/workflows/hitl.yml index 0a39a6e..85a00d4 100644 --- a/.github/workflows/hitl.yml +++ b/.github/workflows/hitl.yml @@ -17,6 +17,9 @@ jobs: repository: quartiq/hitl client-payload: '{"github": ${{ toJson(github) }}}' + - name: Wait for startup + runs: sleep 30 + - uses: fountainhead/action-wait-for-check@v1.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} From 48b69fa9e622aa33e062387c8fd574bc3442eb1c Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Fri, 9 Apr 2021 12:34:41 +0200 Subject: [PATCH 13/20] Fixing run --- .github/workflows/hitl.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hitl.yml b/.github/workflows/hitl.yml index 85a00d4..b594353 100644 --- a/.github/workflows/hitl.yml +++ b/.github/workflows/hitl.yml @@ -18,7 +18,7 @@ jobs: client-payload: '{"github": ${{ toJson(github) }}}' - name: Wait for startup - runs: sleep 30 + run: sleep 30 - uses: fountainhead/action-wait-for-check@v1.0.0 with: From de554d08d9e6d83e3d73e5eb7276f872d2b4fdb3 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Fri, 9 Apr 2021 13:24:46 +0200 Subject: [PATCH 14/20] Renaming to HITL Trigger --- .github/workflows/{hitl.yml => hitl_trigger.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{hitl.yml => hitl_trigger.yml} (96%) diff --git a/.github/workflows/hitl.yml b/.github/workflows/hitl_trigger.yml similarity index 96% rename from .github/workflows/hitl.yml rename to .github/workflows/hitl_trigger.yml index b594353..7b82503 100644 --- a/.github/workflows/hitl.yml +++ b/.github/workflows/hitl_trigger.yml @@ -1,4 +1,4 @@ -name: HITL Run Request +name: HITL Trigger on: workflow_dispatch: From 02aa5d2ed76f7010be5c655ba935dedbec96efa5 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Fri, 9 Apr 2021 13:35:23 +0200 Subject: [PATCH 15/20] Adding program step to HITL runner --- .github/workflows/hitl_trigger.yml | 2 +- hitl/run.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hitl_trigger.yml b/.github/workflows/hitl_trigger.yml index 7b82503..6897847 100644 --- a/.github/workflows/hitl_trigger.yml +++ b/.github/workflows/hitl_trigger.yml @@ -23,5 +23,5 @@ jobs: - uses: fountainhead/action-wait-for-check@v1.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} - checkName: HITL + checkName: HITL Run Status ref: ${{ github.event.pull_request.head.sha }} diff --git a/hitl/run.sh b/hitl/run.sh index 8fe9a3a..156c128 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -15,6 +15,8 @@ python3 -m venv --system-site-packages py . py/bin/activate python3 -m pip install -r requirements.txt +cargo flash --bin dual-iir --release --chip STM32H743ZITx + # Test pinging Stabilizer. This exercises that: # * DHCP is functional and an IP has been acquired # * Stabilizer's network is functioning as intended From 02b6b3873130d0edd6111e65b6874da731ae2248 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Fri, 9 Apr 2021 13:36:35 +0200 Subject: [PATCH 16/20] Renaming job to hitl-trigger --- .github/workflows/hitl_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hitl_trigger.yml b/.github/workflows/hitl_trigger.yml index 6897847..62abb96 100644 --- a/.github/workflows/hitl_trigger.yml +++ b/.github/workflows/hitl_trigger.yml @@ -6,7 +6,7 @@ on: branches: [ master ] jobs: - hitl: + hitl-trigger: runs-on: ubuntu-latest environment: hitl steps: From 5bd46593b5b2a5a999a5e8a349a4a3d22b6baa06 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Fri, 9 Apr 2021 13:43:15 +0200 Subject: [PATCH 17/20] Using manual elf path --- hitl/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hitl/run.sh b/hitl/run.sh index 156c128..483a8a3 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -15,7 +15,7 @@ python3 -m venv --system-site-packages py . py/bin/activate python3 -m pip install -r requirements.txt -cargo flash --bin dual-iir --release --chip STM32H743ZITx +cargo flash --elf target/thumbv7em-none-eabihf/release/dual-iir --chip STM32H743ZITx # Test pinging Stabilizer. This exercises that: # * DHCP is functional and an IP has been acquired From c4336f7bf9a15ff6677e5dc82081329b8cffa48d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Fri, 9 Apr 2021 21:40:58 +0200 Subject: [PATCH 18/20] ci: add PR labeler --- .github/labeler.yml | 4 ++++ .github/workflows/labeler.yml | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..9b3dd5c --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,4 @@ +# add changes-hitl label if any hitl scripts are changed +# REVIEW those changes before approving HITL deployment! +changes-hitl: + - any: [hitl/*] diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..82b4e70 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,12 @@ +name: "Pull Request Labeler" +on: + pull_request_target: + branches: [master] + +jobs: + labeler: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v3 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" From 61e1a2a1c6427be6594d31939c4f37fb42c42d15 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Tue, 13 Apr 2021 12:28:05 +0200 Subject: [PATCH 19/20] Correcting I2C MAC address read --- src/hardware/configuration.rs | 11 ++++------ src/hardware/eeprom.rs | 40 ++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/hardware/configuration.rs b/src/hardware/configuration.rs index dfab1e0..0351db9 100644 --- a/src/hardware/configuration.rs +++ b/src/hardware/configuration.rs @@ -495,13 +495,10 @@ pub fn setup( .set_speed(hal::gpio::Speed::VeryHigh); } - let mac_addr = match eeprom::read_eui48(&mut eeprom_i2c) { - Err(_) => { - info!("Could not read EEPROM, using default MAC address"); - smoltcp::wire::EthernetAddress([0x10, 0xE2, 0xD5, 0x00, 0x03, 0x00]) - } - Ok(raw_mac) => smoltcp::wire::EthernetAddress(raw_mac), - }; + let mac_addr = smoltcp::wire::EthernetAddress(eeprom::read_eui48( + &mut eeprom_i2c, + &mut delay, + )); let network_devices = { // Configure the ethernet controller diff --git a/src/hardware/eeprom.rs b/src/hardware/eeprom.rs index d84dd70..b9b237c 100644 --- a/src/hardware/eeprom.rs +++ b/src/hardware/eeprom.rs @@ -1,12 +1,42 @@ -use embedded_hal::blocking::i2c::WriteRead; +use embedded_hal::blocking::{delay::DelayMs, i2c::WriteRead}; +// The EEPROM is a variant without address bits, so the 3 LSB of this word are "dont-cares". const I2C_ADDR: u8 = 0x50; -pub fn read_eui48(i2c: &mut T) -> Result<[u8; 6], T::Error> +// The MAC address is stored in the last 6 bytes of the 256 byte address space. +const MAC_POINTER: u8 = 0xFA; + +pub fn read_eui48(i2c: &mut T, delay: &mut impl DelayMs) -> [u8; 6] where T: WriteRead, { - let mut buffer = [0u8; 6]; - i2c.write_read(I2C_ADDR, &[0xFA_u8], &mut buffer)?; - Ok(buffer) + let mut previous_read: Option<[u8; 6]> = None; + // On Stabilizer v1.1 and earlier hardware, there is a fault where the I2C bus is not connected + // to the CPU until the P12V0A rail enables, which can take many seconds, or may never come up + // at all. During these transient turn-on conditions, we may fail the I2C read operation. To + // accomodate this, we repeat the I2C read for a set number of attempts with a fixed delay + // between them. Then, we wait for the bus to stabilize by waiting until the MAC address + // read-out is identical for two consecutive reads. + for _ in 0..40 { + let mut buffer = [0u8; 6]; + if i2c + .write_read(I2C_ADDR, &[MAC_POINTER], &mut buffer) + .is_ok() + { + if let Some(old_read) = previous_read { + if old_read == buffer { + return buffer; + } + } + + previous_read.replace(buffer); + } else { + // Remove any pending previous read if we failed the last attempt. + previous_read.take(); + } + + delay.delay_ms(100); + } + + panic!("Failed to read MAC address"); } From d1ab5093e6411a5293101be1de0ea2332ebbb156 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Tue, 13 Apr 2021 13:58:56 +0200 Subject: [PATCH 20/20] Updating badge to utilize nightly workflow --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4250d6a..f91976a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![QUARTIQ Matrix Chat](https://img.shields.io/matrix/quartiq:matrix.org)](https://matrix.to/#/#quartiq:matrix.org) [![Continuous Integration](https://github.com/quartiq/stabilizer/actions/workflows/ci.yml/badge.svg)](https://github.com/quartiq/stabilizer/actions/workflows/ci.yml) -[![HITL (private)](https://github.com/quartiq/hitl/workflows/Stabilizer/badge.svg)](https://github.com/quartiq/hitl/actions?query=workflow%3AStabilizer) +[![Stabilizer HITL [Nightly]](https://github.com/quartiq/hitl/actions/workflows/stabilizer-nightly.yml/badge.svg)](https://github.com/quartiq/hitl/actions/workflows/stabilizer-nightly.yml) # Stabilizer Firmware