Compare commits

...

2 Commits

Author SHA1 Message Date
Nivek-domo
62ca4d6553
Merge 40e4fa55b2 into 5d48d2c0a7 2025-04-20 16:23:19 +02:00
Nivek-domo
40e4fa55b2
Update Power.cpp
add voltage read correction for rak11310
2025-04-18 09:14:51 +02:00

View File

@ -295,6 +295,22 @@ class AnalogBatteryLevel : public HasBatteryLevel
raw = raw / BATTERY_SENSE_SAMPLES;
scaled = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / pow(2, BATTERY_SENSE_RESOLUTION_BITS)) * raw;
#endif
#if defined(RAK11310)
float voltage_raw = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / 1023) * raw;
LOG_INFO("[POWER DEBUG] AREF=%.2fV, ADC_RAW=%u, ADC_MULT=%.2f",
(double)AREF_VOLTAGE,
raw,
(double)operativeAdcMultiplier);
scaled = (voltage_raw * 1.22f) - 0.1f;
scaled = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / 4096) * raw;
LOG_INFO("[POWER CORRECTION] Before=%.2fmV, After=%.2fmV",
(double)voltage_raw,
(double)scaled);
#else
scaled = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / 1023) * raw;
#endif
adcDisable();
if (!initial_read_done) {