Report one operating point, not two
source-pr / source (pull_request) Successful in 13s

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.
This commit is contained in:
2026-10-22 10:51:45 -06:00
parent 2b07d27c67
commit 64e1a9ae2b
+4 -4
View File
@@ -162,8 +162,8 @@ fn hardware_json(snapshot: Option<HardwareSnapshot>) -> 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<HardwareSnapshot>) -> 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());
}