mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-01 10:19:59 +00:00
Add ADC channels to esp variants, plug code back in to make sure other archs work
This commit is contained in:
parent
6113a1fb70
commit
3219ad33ef
@ -18,7 +18,7 @@ static const char *TAG = "ADCmod";
|
|||||||
#define DELAY_FOREVER portMAX_DELAY
|
#define DELAY_FOREVER portMAX_DELAY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BATTERY_PIN
|
#if defined(BATTERY_PIN) && defined(ARCH_ESP32)
|
||||||
|
|
||||||
#ifndef BAT_MEASURE_ADC_UNIT // ADC1 is default
|
#ifndef BAT_MEASURE_ADC_UNIT // ADC1 is default
|
||||||
static const adc1_channel_t adc_channel = ADC_CHANNEL;
|
static const adc1_channel_t adc_channel = ADC_CHANNEL;
|
||||||
@ -28,12 +28,12 @@ static const adc2_channel_t adc_channel = ADC_CHANNEL;
|
|||||||
static const adc_unit_t unit = ADC_UNIT_2;
|
static const adc_unit_t unit = ADC_UNIT_2;
|
||||||
RTC_NOINIT_ATTR uint64_t RTC_reg_b;
|
RTC_NOINIT_ATTR uint64_t RTC_reg_b;
|
||||||
|
|
||||||
#endif
|
#endif // BAT_MEASURE_ADC_UNIT
|
||||||
|
|
||||||
esp_adc_cal_characteristics_t *adc_characs = (esp_adc_cal_characteristics_t *)calloc(1, sizeof(esp_adc_cal_characteristics_t));
|
esp_adc_cal_characteristics_t *adc_characs = (esp_adc_cal_characteristics_t *)calloc(1, sizeof(esp_adc_cal_characteristics_t));
|
||||||
|
|
||||||
static const adc_atten_t atten = ADC_ATTEN_DB_11;
|
static const adc_atten_t atten = ADC_ATTEN_DB_11;
|
||||||
#endif // BATTERY_PIN
|
#endif // BATTERY_PIN && ARCH_ESP32
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
#include "XPowersAXP192.tpp"
|
#include "XPowersAXP192.tpp"
|
||||||
@ -146,12 +146,13 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
// Set the number of samples, it has an effect of increasing sensitivity, especially in complex electromagnetic
|
// Set the number of samples, it has an effect of increasing sensitivity, especially in complex electromagnetic
|
||||||
// environment.
|
// environment.
|
||||||
uint32_t raw = 0;
|
uint32_t raw = 0;
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
#ifndef BAT_MEASURE_ADC_UNIT // ADC1
|
#ifndef BAT_MEASURE_ADC_UNIT // ADC1
|
||||||
for (int i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
for (int i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
||||||
raw += adc1_get_raw(adc_channel);
|
raw += adc1_get_raw(adc_channel);
|
||||||
}
|
}
|
||||||
#else // ADC2
|
#else // ADC2
|
||||||
uint32_t adc_buf = 0;
|
int32_t adc_buf = 0;
|
||||||
for (int i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
for (int i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
||||||
// ADC2 wifi bug workaround, see
|
// ADC2 wifi bug workaround, see
|
||||||
// https://github.com/espressif/arduino-esp32/issues/102
|
// https://github.com/espressif/arduino-esp32/issues/102
|
||||||
@ -161,11 +162,24 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
raw += adc_buf;
|
raw += adc_buf;
|
||||||
}
|
}
|
||||||
#endif // BAT_MEASURE_ADC_UNIT
|
#endif // BAT_MEASURE_ADC_UNIT
|
||||||
|
#else // !ARCH_ESP32
|
||||||
|
for (uint32_t i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
||||||
|
raw += analogRead(BATTERY_PIN);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
raw = raw / BATTERY_SENSE_SAMPLES;
|
raw = raw / BATTERY_SENSE_SAMPLES;
|
||||||
float scaled;
|
float scaled;
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
scaled = esp_adc_cal_raw_to_voltage(raw, adc_characs);
|
scaled = esp_adc_cal_raw_to_voltage(raw, adc_characs);
|
||||||
scaled *= operativeAdcMultiplier;
|
scaled *= operativeAdcMultiplier;
|
||||||
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled));
|
#else
|
||||||
|
#ifndef VBAT_RAW_TO_SCALED
|
||||||
|
scaled = 1000.0 * operativeAdcMultiplier * (AREF_VOLTAGE / 1024.0) * raw;
|
||||||
|
#else
|
||||||
|
scaled = VBAT_RAW_TO_SCALED(raw); // defined in variant.h
|
||||||
|
#endif // VBAT RAW TO SCALED
|
||||||
|
#endif // ARCH_ESP32
|
||||||
|
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled));
|
||||||
|
|
||||||
last_read_value = scaled;
|
last_read_value = scaled;
|
||||||
return scaled;
|
return scaled;
|
||||||
@ -255,16 +269,19 @@ bool Power::analogInit()
|
|||||||
LOG_DEBUG("Using analog input %d for battery level\n", BATTERY_PIN);
|
LOG_DEBUG("Using analog input %d for battery level\n", BATTERY_PIN);
|
||||||
|
|
||||||
// disable any internal pullups
|
// disable any internal pullups
|
||||||
pinMode(35, INPUT);
|
pinMode(BATTERY_PIN, INPUT);
|
||||||
#endif // BATTERY PIN
|
|
||||||
|
|
||||||
#ifndef BATTERY_SENSE_RESOLUTION_BITS
|
#ifndef BATTERY_SENSE_RESOLUTION_BITS
|
||||||
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
#define BATTERY_SENSE_RESOLUTION_BITS 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32 // ESP32 needs special analog stuff
|
||||||
// ESP32 needs special analog stuff
|
|
||||||
// configure ADC
|
#ifndef ADC_WIDTH // max resolution by default
|
||||||
|
static const adc_bits_width_t width = ADC_WIDTH_BIT_12;
|
||||||
|
#else
|
||||||
|
static const adc_bits_width_t width = ADC_WIDTH;
|
||||||
|
#endif
|
||||||
#ifndef BAT_MEASURE_ADC_UNIT // ADC1
|
#ifndef BAT_MEASURE_ADC_UNIT // ADC1
|
||||||
adc1_config_width(width);
|
adc1_config_width(width);
|
||||||
adc1_config_channel_atten(adc_channel, atten);
|
adc1_config_channel_atten(adc_channel, atten);
|
||||||
@ -291,7 +308,6 @@ bool Power::analogInit()
|
|||||||
#else
|
#else
|
||||||
analogReference(AR_INTERNAL); // 3.6V
|
analogReference(AR_INTERNAL); // 3.6V
|
||||||
#endif
|
#endif
|
||||||
adcStart(BATTERY_PIN);
|
|
||||||
analogReadResolution(BATTERY_SENSE_RESOLUTION_BITS); // Default of 12 is not very linear. Recommended to use 10 or 11
|
analogReadResolution(BATTERY_SENSE_RESOLUTION_BITS); // Default of 12 is not very linear. Recommended to use 10 or 11
|
||||||
// depending on needed resolution.
|
// depending on needed resolution.
|
||||||
|
|
||||||
@ -301,6 +317,7 @@ bool Power::analogInit()
|
|||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
#endif // BATTERY_PIN
|
||||||
#endif // !HAS_PMU
|
#endif // !HAS_PMU
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,8 +432,8 @@ void Power::readPowerStatus()
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// If we have a battery at all and it is less than 10% full, force deep sleep if we have more than 10 low readings in a
|
// If we have a battery at all and it is less than 10% full, force deep sleep if we have more than 10 low readings in
|
||||||
// row
|
// a row
|
||||||
if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
||||||
if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) {
|
if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) {
|
||||||
low_voltage_counter++;
|
low_voltage_counter++;
|
||||||
@ -494,10 +511,10 @@ int32_t Power::runOnce()
|
|||||||
* Init the power manager chip
|
* Init the power manager chip
|
||||||
*
|
*
|
||||||
* axp192 power
|
* axp192 power
|
||||||
DCDC1 0.7-3.5V @ 1200mA max -> OLED // If you turn this off you'll lose comms to the axp192 because the OLED and the axp192
|
DCDC1 0.7-3.5V @ 1200mA max -> OLED // If you turn this off you'll lose comms to the axp192 because the OLED and the
|
||||||
share the same i2c bus, instead use ssd1306 sleep mode DCDC2 -> unused DCDC3 0.7-3.5V @ 700mA max -> ESP32 (keep this on!) LDO1
|
axp192 share the same i2c bus, instead use ssd1306 sleep mode DCDC2 -> unused DCDC3 0.7-3.5V @ 700mA max -> ESP32 (keep this
|
||||||
30mA -> charges GPS backup battery // charges the tiny J13 battery by the GPS to power the GPS ram (for a couple of days), can
|
on!) LDO1 30mA -> charges GPS backup battery // charges the tiny J13 battery by the GPS to power the GPS ram (for a couple of
|
||||||
not be turned off LDO2 200mA -> LORA LDO3 200mA -> GPS
|
days), can not be turned off LDO2 200mA -> LORA LDO3 200mA -> GPS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool Power::axpChipInit()
|
bool Power::axpChipInit()
|
||||||
@ -624,7 +641,8 @@ bool Power::axpChipInit()
|
|||||||
// t-beam s3 core
|
// t-beam s3 core
|
||||||
/**
|
/**
|
||||||
* gnss module power channel
|
* gnss module power channel
|
||||||
* The default ALDO4 is off, you need to turn on the GNSS power first, otherwise it will be invalid during initialization
|
* The default ALDO4 is off, you need to turn on the GNSS power first, otherwise it will be invalid during
|
||||||
|
* initialization
|
||||||
*/
|
*/
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO4, 3300);
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO4, 3300);
|
||||||
PMU->enablePowerOutput(XPOWERS_ALDO4);
|
PMU->enablePowerOutput(XPOWERS_ALDO4);
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
#ifndef HAS_CPU_SHUTDOWN
|
#ifndef HAS_CPU_SHUTDOWN
|
||||||
#define HAS_CPU_SHUTDOWN 1
|
#define HAS_CPU_SHUTDOWN 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef DEFAULT_VREF
|
||||||
|
#define DEFAULT_VREF 1100
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
|
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
|
||||||
#define HAS_PMU
|
#define HAS_PMU
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "PowerStatus.h"
|
#include "PowerStatus.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
#include <esp_adc_cal.h>
|
#include <esp_adc_cal.h>
|
||||||
#include <soc/adc_channel.h>
|
#include <soc/adc_channel.h>
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Per @spattinson
|
* Per @spattinson
|
||||||
* MIN_BAT_MILLIVOLTS seems high. Typical 18650 are different chemistry to LiPo, even for LiPos that chart seems a bit off, other
|
* MIN_BAT_MILLIVOLTS seems high. Typical 18650 are different chemistry to LiPo, even for LiPos that chart seems a bit off, other
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#define HAS_SCREEN 0
|
#define HAS_SCREEN 0
|
||||||
#define I2C_SDA 4
|
#define I2C_SDA 4
|
||||||
#define I2C_SCL 5
|
#define I2C_SCL 5
|
||||||
|
#define BATTERY_PIN 34
|
||||||
|
#define ADC1_GPIO34_CHANNEL
|
||||||
|
|
||||||
// GPS
|
// GPS
|
||||||
#undef GPS_RX_PIN
|
#undef GPS_RX_PIN
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
#define GPS_TX_PIN 15
|
#define GPS_TX_PIN 15
|
||||||
#define GPS_UBLOX
|
#define GPS_UBLOX
|
||||||
|
|
||||||
#define BUTTON_PIN 39 // The middle button GPIO on the T-Beam
|
#define BUTTON_PIN 39 // The middle button GPIO on the T-Beam
|
||||||
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
|
#define ADC_CHANNEL ADC1_GPIO35_CHANNEL
|
||||||
#define ADC_MULTIPLIER 1.85 // (R1 = 470k, R2 = 680k)
|
#define ADC_MULTIPLIER 1.85 // (R1 = 470k, R2 = 680k)
|
||||||
#define EXT_PWR_DETECT 4 // Pin to detect connected external power source for LILYGO® TTGO T-Energy T18 and other DIY boards
|
#define EXT_PWR_DETECT 4 // Pin to detect connected external power source for LILYGO® TTGO T-Energy T18 and other DIY boards
|
||||||
#define EXT_NOTIFY_OUT 12 // Overridden default pin to use for Ext Notify Module (#975).
|
#define EXT_NOTIFY_OUT 12 // Overridden default pin to use for Ext Notify Module (#975).
|
||||||
|
@ -27,3 +27,5 @@
|
|||||||
#define ADC_MULTIPLIER 3.2
|
#define ADC_MULTIPLIER 3.2
|
||||||
|
|
||||||
#define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
|
#define ADC_CHANNEL ADC2_GPIO13_CHANNEL
|
||||||
|
#define BAT_MEASURE_ADC_UNIT 2
|
@ -29,5 +29,6 @@
|
|||||||
|
|
||||||
#define ADC_MULTIPLIER 3.8
|
#define ADC_MULTIPLIER 3.8
|
||||||
|
|
||||||
#define BATTERY_PIN 37 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 37 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
|
#define ADC_CHANNEL ADC1_GPIO37_CHANNEL
|
||||||
#define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
|
#define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
|
@ -27,3 +27,5 @@
|
|||||||
// ratio of voltage divider = 3.20 (R12=100k, R10=220k)
|
// ratio of voltage divider = 3.20 (R12=100k, R10=220k)
|
||||||
#define ADC_MULTIPLIER 3.2
|
#define ADC_MULTIPLIER 3.2
|
||||||
#define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
|
#define ADC_CHANNEL ADC2_GPIO13_CHANNEL
|
||||||
|
#define BAT_MEASURE_ADC_UNIT 2
|
@ -8,7 +8,8 @@
|
|||||||
#define BUTTON_PIN 0
|
#define BUTTON_PIN 0
|
||||||
|
|
||||||
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
#define ADC_MULTIPLIER 5.22
|
#define ADC_CHANNEL ADC1_GPIO1_CHANNEL
|
||||||
|
#define ADC_MULTIPLIER 4.9
|
||||||
|
|
||||||
#define USE_SX1262
|
#define USE_SX1262
|
||||||
|
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
#define BUTTON_PIN 0
|
#define BUTTON_PIN 0
|
||||||
|
|
||||||
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
#define ADC_MULTIPLIER 5.22
|
#define ADC_CHANNEL ADC1_GPIO1_CHANNEL
|
||||||
|
#define ADC_MULTIPLIER 4.9
|
||||||
|
|
||||||
#define USE_SX1262
|
#define USE_SX1262
|
||||||
|
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
// code)
|
// code)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
|
#define ADC_CHANNEL ADC1_GPIO35_CHANNEL
|
||||||
#define BATTERY_SENSE_SAMPLES 15 // Set the number of samples, It has an effect of increasing sensitivity.
|
#define BATTERY_SENSE_SAMPLES 15 // Set the number of samples, It has an effect of increasing sensitivity.
|
||||||
#define ADC_MULTIPLIER 2
|
#define ADC_MULTIPLIER 2
|
||||||
|
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
// Info:https://uniteng.com/wiki/doku.php?id=meshtastic:station#rf_design_-_lora_station_edition_g1
|
// Info:https://uniteng.com/wiki/doku.php?id=meshtastic:station#rf_design_-_lora_station_edition_g1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
|
#define ADC_CHANNEL ADC1_GPIO35_CHANNEL
|
||||||
#define BATTERY_SENSE_SAMPLES 30 // Set the number of samples, It has an effect of increasing sensitivity.
|
#define BATTERY_SENSE_SAMPLES 30 // Set the number of samples, It has an effect of increasing sensitivity.
|
||||||
#define ADC_MULTIPLIER 6.45
|
#define ADC_MULTIPLIER 6.45
|
||||||
#define BAT_FULLVOLT 12600
|
#define BAT_FULLVOLT 12600
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#define BUTTON_PIN 39
|
#define BUTTON_PIN 39
|
||||||
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 35 // 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 Module.
|
#define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
|
||||||
|
#define ADC_CHANNEL ADC1_GPIO35_CHANNEL
|
||||||
|
|
||||||
#define USE_RF95
|
#define USE_RF95
|
||||||
#define LORA_DIO0 26 // a No connect on the SX1262 module
|
#define LORA_DIO0 26 // a No connect on the SX1262 module
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
// ratio of voltage divider = 2.0 (R42=100k, R43=100k)
|
// ratio of voltage divider = 2.0 (R42=100k, R43=100k)
|
||||||
#define ADC_MULTIPLIER 2.11 // 2.0 + 10% for correction of display undervoltage.
|
#define ADC_MULTIPLIER 2.11 // 2.0 + 10% for correction of display undervoltage.
|
||||||
|
#define ADC_CHANNEL ADC1_GPIO1_CHANNEL
|
||||||
|
|
||||||
#define I2C_SDA 18 // I2C pins for this board
|
#define I2C_SDA 18 // I2C pins for this board
|
||||||
#define I2C_SCL 17
|
#define I2C_SCL 17
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#define GPS_TX_PIN 13 // per @eugene
|
#define GPS_TX_PIN 13 // per @eugene
|
||||||
|
|
||||||
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
|
#define ADC_CHANNEL ADC1_GPIO35_CHANNEL
|
||||||
|
|
||||||
#define I2C_SDA 21 // I2C pins for this board
|
#define I2C_SDA 21 // I2C pins for this board
|
||||||
#define I2C_SCL 22
|
#define I2C_SCL 22
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#define GPS_TX_PIN 13 // per @eugene
|
#define GPS_TX_PIN 13 // per @eugene
|
||||||
|
|
||||||
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
|
#define ADC_CHANNEL ADC1_GPIO35_CHANNEL
|
||||||
|
|
||||||
#define I2C_SDA 21 // I2C pins for this board
|
#define I2C_SDA 21 // I2C pins for this board
|
||||||
#define I2C_SCL 22
|
#define I2C_SCL 22
|
||||||
|
@ -4,9 +4,8 @@
|
|||||||
#define GPS_TX_PIN 13
|
#define GPS_TX_PIN 13
|
||||||
|
|
||||||
#define BATTERY_PIN 35
|
#define BATTERY_PIN 35
|
||||||
#define ADC_CHANNEL ADC_GPIO35_CHANNEL
|
#define ADC_CHANNEL ADC1_GPIO35_CHANNEL
|
||||||
#define BATTERY_SENSE_SAMPLES 30
|
#define BATTERY_SENSE_SAMPLES 30
|
||||||
#define DEFAULT_VREF 1100
|
|
||||||
|
|
||||||
// ratio of voltage divider = 2.0 (R42=100k, R43=100k)
|
// ratio of voltage divider = 2.0 (R42=100k, R43=100k)
|
||||||
#define ADC_MULTIPLIER 2
|
#define ADC_MULTIPLIER 2
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
// ratio of voltage divider = 2.0 (R42=100k, R43=100k)
|
// ratio of voltage divider = 2.0 (R42=100k, R43=100k)
|
||||||
#define ADC_MULTIPLIER 2.11 // 2.0 + 10% for correction of display undervoltage.
|
#define ADC_MULTIPLIER 2.11 // 2.0 + 10% for correction of display undervoltage.
|
||||||
|
#define ADC_CHANNEL ADC1_GPIO35_CHANNEL
|
||||||
|
|
||||||
#define I2C_SDA 21 // I2C pins for this board
|
#define I2C_SDA 21 // I2C pins for this board
|
||||||
#define I2C_SCL 22
|
#define I2C_SCL 22
|
||||||
|
Loading…
Reference in New Issue
Block a user