mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-12-02 08:09:36 +00:00
🩹 Fix ADC math overflow
This commit is contained in:
parent
92d3a038c2
commit
a63205a034
@ -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))
|
#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,
|
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 = {
|
static const _stADCKeypadTable_ stADCKeyTable[] PROGMEM = {
|
||||||
// VALUE_MIN, VALUE_MAX, KEY
|
// VALUE_MIN, VALUE_MAX, KEY
|
||||||
{ adc_other_button, HAL_ADC_RANGE, 1 + BLEN_KEYPAD_F1 }, // F1
|
{ adc_other_button, HAL_ADC_RANGE, 1 + BLEN_KEYPAD_F1 }, // F1
|
||||||
|
Loading…
Reference in New Issue
Block a user