gui: don't recompute a misleading static forecast after a run ends
On DONE/Stop, the forecast used to revert to show_schedule() seeded
with the *current* temperature - which by then is wherever the brew
ended up (e.g. near the last step's target), so walking the whole
original schedule again from there produced a nonsensical total
("152 min" for a brew that actually took ~250). Now it just leaves the
dynamic view's last frame (the real measured history) up instead.
Recomputing from the current temperature is still correct for a fresh
Load, where no run has happened yet - distinguished via whether
sud_start_time was set before this transition.
This commit is contained in:
+17
-3
@@ -783,13 +783,27 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
# fresh for this run.
|
# fresh for this run.
|
||||||
self.forecast_history = []
|
self.forecast_history = []
|
||||||
elif self.sud_state not in SUD_RUNNING_STATES and self.sud_state != SUD_PAUSED_STATE:
|
elif self.sud_state not in SUD_RUNNING_STATES and self.sud_state != SUD_PAUSED_STATE:
|
||||||
|
was_running = self.sud_start_time is not None
|
||||||
self.sud_start_time = None
|
self.sud_start_time = None
|
||||||
self.sud_paused_total = 0.0
|
self.sud_paused_total = 0.0
|
||||||
self.sud_pause_started_at = None
|
self.sud_pause_started_at = None
|
||||||
# on_plot_timer() only redraws the dynamic forecast while
|
# on_plot_timer() only redraws the dynamic forecast while
|
||||||
# sud_start_time is set - revert to the static view now,
|
# sud_start_time is set.
|
||||||
# rather than leaving the last dynamic draw frozen.
|
if was_running:
|
||||||
if self.sud_schedule:
|
# A run just finished or was stopped - leave the
|
||||||
|
# dynamic view's last frame (the actual measured
|
||||||
|
# history) up rather than recomputing a "static"
|
||||||
|
# plan from here, which would walk the *whole*
|
||||||
|
# original schedule again starting from wherever
|
||||||
|
# the brew happens to have ended up (e.g. close to
|
||||||
|
# the last step's target), producing a nonsensical
|
||||||
|
# total.
|
||||||
|
pass
|
||||||
|
elif self.sud_schedule:
|
||||||
|
# Fresh load (or reconnecting to an already-idle
|
||||||
|
# server) - no run has happened yet, so the upfront
|
||||||
|
# plan starting from the current temperature is
|
||||||
|
# exactly right.
|
||||||
start_theta = self.plot_temp_ist if self.plot_temp_ist else 20.0
|
start_theta = self.plot_temp_ist if self.plot_temp_ist else 20.0
|
||||||
self.forecast_plot.show_schedule(self.sud_schedule, start_theta, self.sud_name)
|
self.forecast_plot.show_schedule(self.sud_schedule, start_theta, self.sud_name)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user