Crash if pullups get enabled on the thermistor inputs

This commit is contained in:
Alex Voinea 2022-01-28 15:22:08 +01:00
parent caca7bb9b8
commit b7806bf25f
5 changed files with 16 additions and 0 deletions

View File

@ -500,6 +500,7 @@ void raise_z_above(float target, bool plan=true);
extern "C" void softReset(); extern "C" void softReset();
void stack_error(); void stack_error();
void pullup_error(bool fromTempISR);
extern uint32_t IP_address; extern uint32_t IP_address;

View File

@ -1754,6 +1754,10 @@ void stack_error() {
crash_and_burn(dump_crash_reason::stack_error); crash_and_burn(dump_crash_reason::stack_error);
} }
void pullup_error(bool fromTempISR) {
crash_and_burn(fromTempISR ? dump_crash_reason::bad_pullup_temp_isr : dump_crash_reason::bad_pullup_step_isr);
}
void trace(); void trace();

View File

@ -299,6 +299,10 @@ ISR(TIMER1_COMPA_vect) {
if (sp < SP_min) SP_min = sp; if (sp < SP_min) SP_min = sp;
#endif //DEBUG_STACK_MONITOR #endif //DEBUG_STACK_MONITOR
// check for faulty pull-ups enabled on thermistor inputs
if (PORTF & 0x5F)
pullup_error(false);
#ifdef LIN_ADVANCE #ifdef LIN_ADVANCE
advance_isr_scheduler(); advance_isr_scheduler();
#else #else

View File

@ -1683,6 +1683,11 @@ void adc_ready(void) //callback from adc when sampling finished
FORCE_INLINE static void temperature_isr() FORCE_INLINE static void temperature_isr()
{ {
// check for faulty pull-ups enabled on thermistor inputs
if (PORTF & 0x5F)
pullup_error(true);
if (!temp_meas_ready) adc_cycle(); if (!temp_meas_ready) adc_cycle();
lcd_buttons_update(); lcd_buttons_update();

View File

@ -8,6 +8,8 @@ enum class dump_crash_reason : uint8_t
stack_error, stack_error,
watchdog, watchdog,
bad_isr, bad_isr,
bad_pullup_temp_isr,
bad_pullup_step_isr,
}; };
#ifdef XFLASH_DUMP #ifdef XFLASH_DUMP