Split off setIsrTargetTemperatures and temp_mgr_pid() so that we can
propagate the target temperatures instantaneously down the pid/pwm chain
during emergencies.
This reduces the amount of code in disable_heater() itself, making it
a bit more maintenable.
The bed still isn't disabled on-the-spot yet, due to the heatbed_pwm
automaton. To be improved later.
*_temperature_raw: buffer for the ADC ISR (read by temp ISR)
*_temperature_isr: latest temperatures for PID regulation (copied from
_raw values)
*_temperature: latest temperature for user code
The flow:
- ADC ISR (async)
- perform oversampling
- call ADC callback: copy to _raw (async)
- temp ISR (timer)
- convert to C (_isr values)
- user code (async)
- check temp_meas_ready
- call updateTemperature()
- copy from _isr to current
- syncronize target temperatures
This removes PINDA value averaging (if needed, should be re-implemented
by averaging in user code where needed)
Use a new low-priority "temp_mgr_isr" running at constant rate for
temperature management.
This is done so that the temperatures are sampled at a constant
independent interval *and* with reduced jitter. Likewise for actual
PID management.
This will require further adjustment for the min/max/runaway display,
which cannot be done directly into this function anymore (the code will
need to disable heaters but flag for display to be handled in
manage_heaters).
Read from ADC as fast as possible using the ADC interrupt to get
more accurate instantaneous readings.
Decouple the temperature_isr from the adc reading interval, so that
the two can run independently for future use.
Setting pullups on the ADC should trigger the model-based check, making
this redundant and wasteful.
Keep the DEBUG_PULLUP_CRASH menu so that we can verify this behavior in
the future.
Fallback to use the default HIGH value if a frequency has not been
specified.
This makes the tone of "M300" and "M300 P<x>" identical as a result.
Supersedes #3339
Now that the position is a uint16_t instead of uint32_t, it is simpler to just sort the positions in place without using the uint8_t indices. Also, this approach is considerably lighter on the stack usage and it also removes a delay after the sorting happens