Publish the live operating point every control period
source-pr / source (pull_request) Successful in 12s
source-pr / source (pull_request) Successful in 12s
A client watching the API during a run saw the boot-time snapshot: status was published at boot and again when the loop exited, so frequency and voltage were frozen at their starting values for the whole run. The loop now publishes each period, which is what makes the UI and the API honest while the machine is actually mining.
This commit is contained in:
@@ -266,6 +266,7 @@ fn boot_hal(mut args: impl Iterator<Item = String>) -> Result<(), Box<dyn Error>
|
||||
);
|
||||
|
||||
let mut client = HalClient::connect(std::path::Path::new(&socket))?;
|
||||
let label = app::target_label(&config.target);
|
||||
for _ in 0..ticks {
|
||||
let hottest = client.read_temperature_mc(0).ok();
|
||||
let power_w = client.read_power_w().ok().map(f32::from);
|
||||
@@ -284,6 +285,9 @@ fn boot_hal(mut args: impl Iterator<Item = String>) -> Result<(), Box<dyn Error>
|
||||
client.set_fan_target(0, pwm)?;
|
||||
}
|
||||
}
|
||||
// Publish every period: a client watching the API must see the live operating point,
|
||||
// not the boot-time snapshot.
|
||||
status.set_hardware(app::snapshot(&runtime, &label));
|
||||
if let Some(reason) = runtime.stop_reason() {
|
||||
println!("stopped: {reason:?}");
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user