From 662105c1b6a55f54a5e5dd2a28d062e30d99dbf8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 14 Oct 2017 01:51:58 -0500 Subject: [PATCH] ADC sensor fix inspired by 'Evgen2' on Twitter --- Marlin/temperature.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index e2ea53784..9eb098f8d 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -2093,7 +2093,8 @@ void Temperature::isr() { } // temp_count >= OVERSAMPLENR // Go to the next state, up to SensorsReady - adc_sensor_state = (ADCSensorState)((int(adc_sensor_state) + 1) % int(StartupDelay)); + adc_sensor_state = (ADCSensorState)(int(adc_sensor_state) + 1); + if (adc_sensor_state > SensorsReady) adc_sensor_state = (ADCSensorState)0; #if ENABLED(BABYSTEPPING) LOOP_XYZ(axis) {