diff --git a/crates/alkane-gui/src/model.rs b/crates/alkane-gui/src/model.rs index 4ca0f490..d60ba18f 100644 --- a/crates/alkane-gui/src/model.rs +++ b/crates/alkane-gui/src/model.rs @@ -1046,8 +1046,20 @@ impl MinerRow { /// counted as operator-paused when it is not currently mining and its raw /// operating-state string says so (case-insensitively), shared by the live /// scan (`scan::to_row`) and the fixtures/tests. +/// +/// "Paused" covers every intentional, resumable halt -- operator- or +/// firmware-initiated -- not just the literal "Paused" state: a miner an operator +/// stopped is halted on purpose, not broken, so it must read blue in Health and +/// count under the Paused KPI rather than "not hashing". Firmwares spell it +/// differently: VNish reports "stopped", Braiins uses Paused/Stopped/Suspended, +/// others "paused". A failure is a distinct Error state (never matched here) and +/// still reads as broken (round 19 #19). pub fn is_paused(operating_state: &str, is_mining: bool) -> bool { - !is_mining && operating_state.to_lowercase().contains("pause") + if is_mining { + return false; + } + let s = operating_state.to_lowercase(); + s.contains("pause") || s.contains("stop") || s.contains("suspend") } /// The typed-confirmation gate for the irreversible firmware-flash action: the @@ -3020,8 +3032,16 @@ mod tests { fn is_paused_detection() { assert!(is_paused("Paused", false)); assert!(is_paused("PAUSED (manual)", false)); - assert!(!is_paused("Paused", true), "mining overrides an even stale 'paused' state string"); + // Intentional halts other firmwares report: VNish "Stopped" (miner_state + // "stopped"), Braiins "Suspended", a "Stopping" transition (round 19 #19 / + // 10.4.1.122 read as broken before this). + assert!(is_paused("Stopped", false), "an operator-stopped miner is paused, not broken"); + assert!(is_paused("Stopping", false)); + assert!(is_paused("Suspended", false)); + assert!(!is_paused("Stopped", true), "mining overrides a stale 'stopped' state string"); assert!(!is_paused("Mining", false)); + assert!(!is_paused("Error", false), "a failure is broken, not paused"); + assert!(!is_paused("Idling", false), "plain idle is not an explicit halt"); assert!(!is_paused("", false)); } diff --git a/crates/alkane-gui/src/ui.rs b/crates/alkane-gui/src/ui.rs index 8f46500f..bbbaaced 100644 --- a/crates/alkane-gui/src/ui.rs +++ b/crates/alkane-gui/src/ui.rs @@ -439,27 +439,32 @@ fn encode_component_health( max_boards: usize, ) -> String { let mut segs: Vec = Vec::new(); - segs.push((Some(health_color(pal, r.power_health())), SHAPE_BOLT.to_string())); - segs.push((Some(health_color(pal, r.control_health())), SHAPE_BRAIN.to_string())); + // A paused/stopped miner is intentionally halted, not broken: every component + // it reports as idle (power off, fans spun down, boards not hashing) is + // expected, not a fault, so colour each one blue instead of its red/amber + // health colour -- otherwise a paused miner reads as broken (round 19 #19, + // extended: originally boards only, but idle fans/power still showed red). + // A genuinely undetected component (Unreachable) stays grey: even when paused, + // "not present" is not "paused". + let col = |h: crate::model::CompHealth| { + if r.paused && h != crate::model::CompHealth::Unreachable { + pal.accent + } else { + health_color(pal, h) + } + }; + segs.push((Some(col(r.power_health())), SHAPE_BOLT.to_string())); + segs.push((Some(col(r.control_health())), SHAPE_BRAIN.to_string())); let fans = r.fan_healths(); for h in &fans { - segs.push((Some(health_color(pal, *h)), SHAPE_FAN.to_string())); + segs.push((Some(col(*h)), SHAPE_FAN.to_string())); } for _ in fans.len()..max_fans { segs.push((None, SHAPE_GAP.to_string())); } let boards = r.board_healths(); for h in &boards { - // A paused miner's boards are intentionally idle, not faulty: show every - // detected board blue instead of its (red) health colour, while every - // other component keeps its normal colour. A genuinely undetected board - // stays grey (round 19 #19). - let color = if r.paused && *h != crate::model::CompHealth::Unreachable { - pal.accent - } else { - health_color(pal, *h) - }; - segs.push((Some(color), SHAPE_CHIP.to_string())); + segs.push((Some(col(*h)), SHAPE_CHIP.to_string())); } for _ in boards.len()..max_boards { segs.push((None, SHAPE_GAP.to_string()));