Selaa lähdekoodia

🐛 MKS TinyBee - 2.5V ADC Vref (#23903)

John Robertson 3 vuotta sitten
vanhempi
commit
653c847bfb
No account linked to committer's email address
2 muutettua tiedostoa jossa 10 lisäystä ja 1 poistoa
  1. 5
    1
      Marlin/src/HAL/ESP32/HAL.cpp
  2. 5
    0
      Marlin/src/pins/esp32/pins_MKS_TINYBEE.h

+ 5
- 1
Marlin/src/HAL/ESP32/HAL.cpp Näytä tiedosto

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

+ 5
- 0
Marlin/src/pins/esp32/pins_MKS_TINYBEE.h Näytä tiedosto

@@ -114,6 +114,11 @@
114 114
 //#define E1_AUTO_FAN_PIN                    149  // need to update Configuration_adv.h @section extruder
115 115
 
116 116
 //
117
+// ADC Reference Voltage
118
+//
119
+#define ADC_REFERENCE_VOLTAGE                2.5  // 2.5V reference VDDA
120
+
121
+//
117 122
 // MicroSD card
118 123
 //
119 124
 #define SD_MOSI_PIN                           23

Loading…
Peruuta
Tallenna