Skip to content

Commit a63205a

Browse files
committed
🩹 Fix ADC math overflow
1 parent 92d3a03 commit a63205a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Marlin/src/lcd/marlinui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ void MarlinUI::init() {
12061206
#define ADC_BUTTON_VALUE(r) raw_adc_t(HAL_ADC_RANGE * (ADC_BUTTONS_VALUE_SCALE) * r / (r + ADC_BUTTONS_R_PULLUP))
12071207

12081208
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);
12101210
static const _stADCKeypadTable_ stADCKeyTable[] PROGMEM = {
12111211
// VALUE_MIN, VALUE_MAX, KEY
12121212
{ adc_other_button, HAL_ADC_RANGE, 1 + BLEN_KEYPAD_F1 }, // F1

0 commit comments

Comments
 (0)