Fix Incorrect Dac Calibration Algorithm #133
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "linuswck/thermostat:fix_incorrect_dac_cal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Dac calibration should not be that long. That should be a fast binary search and should not take 1s to complete calibration for each channel.
Printing the readings out reveals the incorrectness. Here is a sample of log.
Pay attention to "INFO - step: 16 start_value: 1 prev_value: 1, value: 65537 ..." The start value should have been changed to 65537. Thus, abnormal "linear search" can happen inside the incorrectly implemented binary search algorithm. In some marginal cases, "linear search" can take place starting from value 1 at step 8. This takes 3-4s+ to calibrate the Dac and thus watchdog is triggered indefinitely.
After this fix, Thermostat starts up instantly with no perceived waiting time. Removing
read_dac_feedback_until_stable()
fn remains necessary as it returns inconsistent value due to the lack of filtering.This fix is tested on 1 v2.2.2 and 2 v2.2.1 Thermostat Board. Electrical Test(comparing Vref with Iset voltage after calibration) and functional tests are done.
Other Changes
Revert the watchdog interval from 2s back to 1s. See #132