Browse Source

🩹 Fix ADC math overflow

Scott Lahteine 2 years ago
parent
commit
a63205a034
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      Marlin/src/lcd/marlinui.cpp

+ 1
- 1
Marlin/src/lcd/marlinui.cpp View File

@@ -1206,7 +1206,7 @@ void MarlinUI::init() {
1206 1206
     #define ADC_BUTTON_VALUE(r)  raw_adc_t(HAL_ADC_RANGE * (ADC_BUTTONS_VALUE_SCALE) * r / (r + ADC_BUTTONS_R_PULLUP))
1207 1207
 
1208 1208
     static constexpr raw_adc_t adc_button_tolerance = HAL_ADC_RANGE *   25 / 1024,
1209
-                                   adc_other_button = HAL_ADC_RANGE * 1000 / 1024;
1209
+                                   adc_other_button = raw_adc_t(uint32_t(HAL_ADC_RANGE * 1000UL) / 1024UL);
1210 1210
     static const _stADCKeypadTable_ stADCKeyTable[] PROGMEM = {
1211 1211
       // VALUE_MIN, VALUE_MAX, KEY
1212 1212
       { adc_other_button, HAL_ADC_RANGE, 1 + BLEN_KEYPAD_F1     }, // F1

Loading…
Cancel
Save