Skip to content

Commit 08704ea

Browse files
committed
- fix ESP32 ADC for new toolchain version
1 parent 9500762 commit 08704ea

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Marlin/src/HAL/ESP32/HAL.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,17 @@ int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); }
209209
// ADC
210210
// ------------------------
211211

212-
#define ADC1_CHANNEL(pin) ADC1_GPIO ## pin ## _CHANNEL
213-
212+
//https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/peripherals/adc.html
214213
adc1_channel_t get_channel(int pin) {
215214
switch (pin) {
216-
case 39: return ADC1_CHANNEL(39);
217-
case 36: return ADC1_CHANNEL(36);
218-
case 35: return ADC1_CHANNEL(35);
219-
case 34: return ADC1_CHANNEL(34);
220-
case 33: return ADC1_CHANNEL(33);
221-
case 32: return ADC1_CHANNEL(32);
215+
case 39: return ADC1_CHANNEL_3;
216+
case 36: return ADC1_CHANNEL_0;
217+
case 35: return ADC1_CHANNEL_7;
218+
case 34: return ADC1_CHANNEL_6;
219+
case 33: return ADC1_CHANNEL_5;
220+
case 32: return ADC1_CHANNEL_4;
221+
case 37: return ADC1_CHANNEL_1;
222+
case 38: return ADC1_CHANNEL_2;
222223
}
223224
return ADC1_CHANNEL_MAX;
224225
}

0 commit comments

Comments
 (0)