mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-25 07:34:05 -06:00
adccmds: Continue to query analog inputs after a shutdown
Continue to sample the ADC input pins even if the MCU goes into a shutdown state. This enables the printer to continue reporting temperatures even on an mcu error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
744c6d114e
commit
d03cf2b83f
5 changed files with 20 additions and 10 deletions
|
@ -43,7 +43,7 @@ analog_in_event(struct timer *timer)
|
|||
return SF_RESCHEDULE;
|
||||
}
|
||||
if (a->value < a->min_value || a->value > a->max_value)
|
||||
shutdown("ADC out of range");
|
||||
try_shutdown("ADC out of range");
|
||||
sched_wake_task(&analog_wake);
|
||||
a->next_begin_time += a->rest_time;
|
||||
a->timer.waketime = a->next_begin_time;
|
||||
|
@ -115,6 +115,12 @@ analog_in_shutdown(void)
|
|||
struct analog_in *a;
|
||||
foreach_oid(i, a, command_config_analog_in) {
|
||||
gpio_adc_cancel_sample(a->pin);
|
||||
if (a->sample_count) {
|
||||
a->state = a->sample_count + 1;
|
||||
a->next_begin_time += a->rest_time;
|
||||
a->timer.waketime = a->next_begin_time;
|
||||
sched_add_timer(&a->timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
DECL_SHUTDOWN(analog_in_shutdown);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue