Skip to content

Commit

Permalink
🩹 Fix ADC math overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 23, 2022
1 parent 92d3a03 commit a63205a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ void MarlinUI::init() {
#define ADC_BUTTON_VALUE(r) raw_adc_t(HAL_ADC_RANGE * (ADC_BUTTONS_VALUE_SCALE) * r / (r + ADC_BUTTONS_R_PULLUP))

static constexpr raw_adc_t adc_button_tolerance = HAL_ADC_RANGE * 25 / 1024,
adc_other_button = HAL_ADC_RANGE * 1000 / 1024;
adc_other_button = raw_adc_t(uint32_t(HAL_ADC_RANGE * 1000UL) / 1024UL);
static const _stADCKeypadTable_ stADCKeyTable[] PROGMEM = {
// VALUE_MIN, VALUE_MAX, KEY
{ adc_other_button, HAL_ADC_RANGE, 1 + BLEN_KEYPAD_F1 }, // F1
Expand Down

0 comments on commit a63205a

Please sign in to comment.