kopia lustrzana https://github.com/meshtastic/firmware
Adjusted adc_multiplier for heltec2.1 and added adc_mulitplier_override (#1183)
rodzic
856f2f9589
commit
c867af8522
|
@ -100,6 +100,10 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||
#ifndef ADC_MULTIPLIER
|
||||
#define ADC_MULTIPLIER 2.0
|
||||
#endif
|
||||
// Override variant or default ADC_MULTIPLIER if we have the override pref
|
||||
float operativeAdcMultiplier = radioConfig.preferences.adc_multiplier_override > 0 ?
|
||||
radioConfig.preferences.adc_multiplier_override :
|
||||
ADC_MULTIPLIER;
|
||||
|
||||
#ifdef BATTERY_PIN
|
||||
// Do not call analogRead() often.
|
||||
|
@ -109,7 +113,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||
uint32_t raw = analogRead(BATTERY_PIN);
|
||||
float scaled;
|
||||
#ifndef VBAT_RAW_TO_SCALED
|
||||
scaled = 1000.0 * ADC_MULTIPLIER * (AREF_VOLTAGE / 1024.0) * raw;
|
||||
scaled = 1000.0 * operativeAdcMultiplier * (AREF_VOLTAGE / 1024.0) * raw;
|
||||
#else
|
||||
scaled = VBAT_RAW_TO_SCALED(raw); //defined in variant.h
|
||||
#endif
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#define LORA_DIO1 35 // Not really used
|
||||
#define LORA_DIO2 34 // Not really used
|
||||
|
||||
// ratio of voltage divider = 3.20 (schematic R12=100k, R10=220k)
|
||||
// device to device variations, the actual ratio can be between 3.2 and 4
|
||||
#define ADC_MULTIPLIER 3.6 // best fit
|
||||
#define ADC_MULTIPLIER 3.8
|
||||
|
||||
#define BATTERY_PIN 37 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||
#define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Plugin.
|
||||
|
|
Ładowanie…
Reference in New Issue