1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 07:17:59 +00:00

🩹 Fix ADC math overflow

This commit is contained in:
Scott Lahteine 2022-03-22 20:11:10 -05:00
parent 92d3a038c2
commit a63205a034

View File

@ -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