mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 11:16:34 +00:00
Fix Non-ESP32 Analog read resolution
This commit is contained in:
parent
b9fcfa86c9
commit
2f33f8e5a8
@ -35,6 +35,7 @@
|
||||
#define ANALOG_RANGE 1023 // 4095 = 12, 2047 = 11, 1023 = 10
|
||||
#define ANALOG_PERCENT 10 // backward compatible div10 range
|
||||
#endif // ESP8266
|
||||
|
||||
#ifdef ESP32
|
||||
#undef ANALOG_RESOLUTION
|
||||
#define ANALOG_RESOLUTION 12 // 12 = 4095, 11 = 2047, 10 = 1023
|
||||
@ -305,10 +306,8 @@ void AdcInit(void) {
|
||||
|
||||
if (Adcs.present) {
|
||||
#ifdef ESP32
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
analogSetWidth(ANALOG_RESOLUTION); // Default 12 bits (0 - 4095)
|
||||
#endif // CONFIG_IDF_TARGET_ESP32
|
||||
analogSetAttenuation(ADC_11db); // Default 11db
|
||||
analogReadResolution(ANALOG_RESOLUTION); // Default 12 bits (0 - 4095)
|
||||
analogSetAttenuation(ADC_11db); // Default 11db
|
||||
#endif
|
||||
for (uint32_t idx = 0; idx < Adcs.present; idx++) {
|
||||
AdcGetSettings(idx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user