|
@@ -229,11 +229,15 @@ void MarlinHAL::adc_init() {
|
229
|
229
|
}
|
230
|
230
|
}
|
231
|
231
|
|
|
232
|
+#ifndef ADC_REFERENCE_VOLTAGE
|
|
233
|
+ #define ADC_REFERENCE_VOLTAGE 3.3
|
|
234
|
+#endif
|
|
235
|
+
|
232
|
236
|
void MarlinHAL::adc_start(const pin_t pin) {
|
233
|
237
|
const adc1_channel_t chan = get_channel(pin);
|
234
|
238
|
uint32_t mv;
|
235
|
239
|
esp_adc_cal_get_voltage((adc_channel_t)chan, &characteristics[attenuations[chan]], &mv);
|
236
|
|
- adc_result = mv * 1023.0 / 3300.0;
|
|
240
|
+ adc_result = mv * 1023.0f / float(ADC_REFERENCE_VOLTAGE) / 1000.0f;
|
237
|
241
|
|
238
|
242
|
// Change the attenuation level based on the new reading
|
239
|
243
|
adc_atten_t atten;
|