Skip to content

Commit

Permalink
fix config equality
Browse files Browse the repository at this point in the history
  • Loading branch information
gferraro committed May 20, 2024
1 parent f5f5745 commit 9c8d631
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
1 change: 0 additions & 1 deletion src/attiny_rtc_i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ impl SharedI2C {
pub fn tc2_agent_request_audio_rec(&mut self, delay: &mut Delay) -> Result<bool, Error> {
match self.try_attiny_read_command(REG_TC2_AGENT_STATE, delay, None) {
Ok(state) => {
info!("agent state {}", state);
let rec_state: bool = (state & 1 << 1 == 2) && (state & 0x08 == 0x08);
Ok(rec_state)
}
Expand Down
2 changes: 0 additions & 2 deletions src/core0_audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ pub fn audio_task(
let mut take_test_rec = false;
if let Ok(test_rec) = shared_i2c.tc2_agent_request_audio_rec(&mut delay) {
take_test_rec = test_rec;
info!("Take test rec is {}", take_test_rec);
}
if do_recording || take_test_rec {
watchdog.feed();
Expand Down Expand Up @@ -288,7 +287,6 @@ pub fn audio_task(
),
&mut flash_storage,
);
watchdog.start(100.micros());
info!("Recording failed restarting and will try again");
loop {
nop();
Expand Down
8 changes: 7 additions & 1 deletion src/device_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ pub struct DeviceConfigInner {
pub is_audio_device: bool,
}

#[derive(PartialEq)]
pub struct DeviceConfig {
config_inner: DeviceConfigInner,
pub motion_detection_mask: DetectionMask,
pub cursor_position: usize,
}

impl PartialEq for DeviceConfig {
fn eq(&self, other: &Self) -> bool {
self.config_inner == other.config_inner
&& self.motion_detection_mask == other.motion_detection_mask
}
}

impl Format for DeviceConfig {
fn format(&self, fmt: Formatter) {}
}
Expand Down
2 changes: 1 addition & 1 deletion src/onboard_flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl OnboardFlashStatus {
}
}
2 => {
warn!("ECC error - uncorrectable error, data corrupted!");
// warn!("ECC error - uncorrectable error, data corrupted!");
EccStatus {
okay: false,
should_relocate: true,
Expand Down
33 changes: 16 additions & 17 deletions src/pdm_microphone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,23 +253,22 @@ impl PdmMicrophone {
if rx_transfer.is_done() && cycle >= WARMUP_CYCLES {
//this causes problems
warn!("Couldn't keep up with data {}", cycle);
// timer.delay_ms(1000);
// if use_async && transfer.is_some() {
// flash_storage.finish_transfer(
// None,
// None,
// transfer.take().unwrap(),
// address.take().unwrap(),
// true,
// );
// }
// if flash_storage.last_used_block_index.is_some() {
// flash_storage.erase_block_range(
// start_block_index,
// flash_storage.last_used_block_index.unwrap(),
// );
// }
// break;
if use_async && transfer.is_some() {
flash_storage.finish_transfer(
None,
None,
transfer.take().unwrap(),
address.take().unwrap(),
true,
);
}
if flash_storage.last_used_block_index.is_some() {
flash_storage.erase_block_range(
start_block_index,
flash_storage.last_used_block_index.unwrap(),
);
}
break;
}
// When a transfer is done we immediately enqueue the buffers again.
let (rx_buf, next_rx_transfer) = rx_transfer.wait();
Expand Down

0 comments on commit 9c8d631

Please sign in to comment.