|
@@ -310,7 +310,7 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0
|
310
|
310
|
// public:
|
311
|
311
|
|
312
|
312
|
#if HAS_ADC_BUTTONS
|
313
|
|
- uint32_t Temperature::current_ADCKey_raw = 0;
|
|
313
|
+ uint32_t Temperature::current_ADCKey_raw = 1024;
|
314
|
314
|
uint8_t Temperature::ADCKey_count = 0;
|
315
|
315
|
#endif
|
316
|
316
|
|
|
@@ -2300,6 +2300,7 @@ void Temperature::isr() {
|
2300
|
2300
|
|
2301
|
2301
|
#if HAS_ADC_BUTTONS
|
2302
|
2302
|
static unsigned int raw_ADCKey_value = 0;
|
|
2303
|
+ static bool ADCKey_pressed = false;
|
2303
|
2304
|
#endif
|
2304
|
2305
|
|
2305
|
2306
|
#if ENABLED(SLOW_PWM_HEATERS)
|
|
@@ -2702,16 +2703,19 @@ void Temperature::isr() {
|
2702
|
2703
|
next_sensor_state = adc_sensor_state; // redo this state
|
2703
|
2704
|
else if (ADCKey_count < 16) {
|
2704
|
2705
|
raw_ADCKey_value = HAL_READ_ADC();
|
2705
|
|
- if (raw_ADCKey_value > 900) {
|
2706
|
|
- //ADC Key release
|
2707
|
|
- ADCKey_count = 0;
|
2708
|
|
- current_ADCKey_raw = 0;
|
2709
|
|
- }
|
2710
|
|
- else {
|
2711
|
|
- current_ADCKey_raw += raw_ADCKey_value;
|
|
2706
|
+ if (raw_ADCKey_value <= 900) {
|
|
2707
|
+ NOMORE(current_ADCKey_raw, raw_ADCKey_value);
|
2712
|
2708
|
ADCKey_count++;
|
2713
|
2709
|
}
|
|
2710
|
+ else { //ADC Key release
|
|
2711
|
+ if (ADCKey_count > 0) ADCKey_count++; else ADCKey_pressed = false;
|
|
2712
|
+ if (ADCKey_pressed) {
|
|
2713
|
+ ADCKey_count = 0;
|
|
2714
|
+ current_ADCKey_raw = 1024;
|
|
2715
|
+ }
|
|
2716
|
+ }
|
2714
|
2717
|
}
|
|
2718
|
+ if (ADCKey_count == 16) ADCKey_pressed = true;
|
2715
|
2719
|
break;
|
2716
|
2720
|
#endif // ADC_KEYPAD
|
2717
|
2721
|
|