Skip to content

Commit 80b7461

Browse files
committed
Set 13 or 12bit depending on S3 or not
1 parent ad6a315 commit 80b7461

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/components/analogIO/Wippersnapper_AnalogIO.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
#include "Wippersnapper_AnalogIO.h"
18-
#include "Wippersnapper.h"
1918

2019
/***********************************************************************************/
2120
/*!
@@ -89,7 +88,11 @@ void Wippersnapper_AnalogIO::setADCResolution(int resolution) {
8988
_nativeResolution = 12;
9089
#elif defined(ARDUINO_ARCH_ESP32)
9190
scaleAnalogRead = true; // probably should be false, handled in bsp
92-
_nativeResolution = 13; // S3 ADC is 13-bit, others are 12-bit
91+
#if defined(ESP32S3)
92+
_nativeResolution = 13; // S3 ADC is 13-bit, others are 12-bit
93+
#else
94+
_nativeResolution = 12;
95+
#endif
9396
#elif defined(ARDUINO_ARCH_RP2040)
9497
scaleAnalogRead = true;
9598
_nativeResolution = 10;
@@ -233,10 +236,8 @@ uint16_t Wippersnapper_AnalogIO::getPinValue(int pin) {
233236
/**********************************************************/
234237
float Wippersnapper_AnalogIO::getPinValueVolts(int pin) {
235238
#ifdef ARDUINO_ARCH_ESP32
236-
WS_DEBUG_PRINTLN("ESP32: Using analogReadMilliVolts()");
237239
return analogReadMilliVolts(pin) / 1000.0;
238240
#else
239-
WS_DEBUG_PRINTLN("Using old getPinValueVolts()");
240241
uint16_t rawValue = getPinValue(pin);
241242
return rawValue * getAref() / 65536;
242243
#endif

0 commit comments

Comments
 (0)