add null board
This commit is contained in:
@@ -184,7 +184,12 @@ fn safe_main() -> anyhow::Result<()> {
|
||||
}
|
||||
|
||||
println!("cur is {}", cur);
|
||||
board.update_charge_indicator();
|
||||
match board.battery_monitor.average_current_milli_ampere() {
|
||||
Ok(charging) => {
|
||||
board.set_charge_indicator(charging > 20)
|
||||
}
|
||||
Err(_) => {}
|
||||
}
|
||||
|
||||
if board.get_restart_to_conf() {
|
||||
log(LogMessage::ConfigModeSoftwareOverride, 0, 0, "", "");
|
||||
@@ -362,12 +367,12 @@ fn safe_main() -> anyhow::Result<()> {
|
||||
if pump_ineffective {
|
||||
log(
|
||||
LogMessage::ConsecutivePumpCountLimit,
|
||||
pump_count as u32,
|
||||
pump_count,
|
||||
plant_config.max_consecutive_pump_count as u32,
|
||||
&(plant_id+1).to_string(),
|
||||
"",
|
||||
);
|
||||
board.fault(plant_id, true);
|
||||
board.fault(plant_id, true)?;
|
||||
}
|
||||
log(
|
||||
LogMessage::PumpPlant,
|
||||
@@ -638,28 +643,30 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
|
||||
loop {
|
||||
unsafe {
|
||||
let mut lock = BOARD_ACCESS.lock().unwrap();
|
||||
lock.update_charge_indicator();
|
||||
if let Ok(charging) = lock.battery_monitor.average_current_milli_ampere() {
|
||||
lock.set_charge_indicator(charging > 20)
|
||||
}
|
||||
match wait_type {
|
||||
WaitType::MissingConfig => {
|
||||
// Keep existing behavior: circular filling pattern
|
||||
led_count %= 8;
|
||||
led_count += 1;
|
||||
for i in 0..8 {
|
||||
lock.fault(i, i < led_count);
|
||||
let _ = lock.fault(i, i < led_count);
|
||||
}
|
||||
}
|
||||
WaitType::ConfigButton => {
|
||||
// Alternating pattern: 1010 1010 -> 0101 0101
|
||||
pattern_step = (pattern_step + 1) % 2;
|
||||
for i in 0..8 {
|
||||
lock.fault(i, (i + pattern_step) % 2 == 0);
|
||||
let _ = lock.fault(i, (i + pattern_step) % 2 == 0);
|
||||
}
|
||||
}
|
||||
WaitType::MqttConfig => {
|
||||
// Moving dot pattern
|
||||
pattern_step = (pattern_step + 1) % 8;
|
||||
for i in 0..8 {
|
||||
lock.fault(i, i == pattern_step);
|
||||
let _ = lock.fault(i, i == pattern_step);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -672,7 +679,7 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
|
||||
|
||||
// Clear all LEDs
|
||||
for i in 0..8 {
|
||||
lock.fault(i, false);
|
||||
let _ = lock.fault(i, false);
|
||||
}
|
||||
drop(lock);
|
||||
vTaskDelay(delay);
|
||||
|
||||
Reference in New Issue
Block a user