-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and fix PID sensor (PID_USE_LOCAL_SENSOR) read race condition (
#22162) * Refactor and fix PID sensor (PID_USE_LOCAL_SENSOR) read race condition Refactor PID since it was calling pid.tick willy-nilly upon demand from MQTT and the web instead of on a periodic basis (and was being called with time interval of 0 when those times lined up!). Refactor web/mqtt display because there was shared code (that code turned out to be misguided and belonged in Every_Second loop, but now we are also similar to 39 thermostat) Logging revealed that the vast majority of the time the sensor JSON was parsed to obtain current sensor data when using PID local sensor, it was failing to parse (and it would typically only work for a second around TELE_PERIOD, but even then, not reliably). This bug almost certainly affects xdrv_39_thermostat too, but using xsns_75_prometheus.ino as a template, we are able to update PV once per second, which allows us to be a lot more responsive. There is no danger of being "too responsive" because that's the point of PID, and the PID loop already scales feedback by interval between ticks. * Reduce logging of PID now that query side-effects removed * Comment out all new logging, but leave present for next debugger
- Loading branch information
Showing
1 changed file
with
116 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
694691e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You remove line 255
PIDShowSensor(); // set actual process value
Refer to:
PID-Feature computes with outdated temperature values #17636
Now we are back to outdated temperature values. Now
missing: