From 64e1a9ae2b05daf3d03ae2071757658f16de9b11 Mon Sep 17 00:00:00 2001 From: Noah <2+noah@noreply.gitea.bluefla.re> Date: Thu, 22 Oct 2026 10:51:45 -0600 Subject: [PATCH] Report one operating point, not two The live frequency and the boot-time operating point were both in the hardware document, so a client could read 563 MHz in one field and 300 MHz in another. The document and the cgminer stats now both derive the operating point from the live frequency and the envelope, which is also what makes the reported voltage correct. --- src/management.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/management.rs b/src/management.rs index ba404a0..4013169 100644 --- a/src/management.rs +++ b/src/management.rs @@ -162,8 +162,8 @@ fn hardware_json(snapshot: Option) -> Value { "f_max_mhz": plan.envelope.f_max_mhz, }, "operating_point": { - "voltage_mv": plan.operating_point.voltage_mv, - "frequency_mhz": plan.operating_point.frequency_mhz, + "voltage_mv": plan.envelope.voltage_for(snapshot.frequency_mhz), + "frequency_mhz": snapshot.frequency_mhz, "confirmed": plan.operating_point.confirmed, }, "chains": plan.chains.iter().map(|chain| json!({ @@ -193,7 +193,7 @@ fn stats_json(snapshot: Option) -> Value { "Chip": snapshot.plan.chip.name(), "PSU": snapshot.plan.psu, "FrequencyMHz": snapshot.frequency_mhz, - "VoltageMV": snapshot.plan.operating_point.voltage_mv, + "VoltageMV": snapshot.plan.envelope.voltage_for(snapshot.frequency_mhz), "Target": snapshot.target, "ActiveChains": snapshot.active_chains.len(), "Stopped": snapshot.stopped, @@ -431,7 +431,7 @@ mod tests { let stats = &reply["STATS"][0]; assert_eq!(stats["Profile"], "s19jpro-bm1362-pic"); assert_eq!(stats["FrequencyMHz"], 512); - assert_eq!(stats["VoltageMV"], 1200); + assert_eq!(stats["VoltageMV"], 1312); assert_eq!(stats["ActiveChains"], 1); assert!(stats["Stopped"].is_null()); }