Merge branch 'master' into tft-gui-work

This commit is contained in:
Manuel 2024-05-28 20:37:27 +02:00 committed by GitHub
commit 1dec9ea7e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 2 deletions

View File

@ -59,9 +59,18 @@ class PowerStatus : public Status
int getBatteryVoltageMv() const { return batteryVoltageMv; } int getBatteryVoltageMv() const { return batteryVoltageMv; }
/** /**
* Note: 0% battery means 'unknown/this board doesn't have a battery installed' * Note: for boards with battery pin or PMU, 0% battery means 'unknown/this board doesn't have a battery installed'
*/ */
#if defined(HAS_PMU) || defined(BATTERY_PIN)
uint8_t getBatteryChargePercent() const { return getHasBattery() ? batteryChargePercent : 0; } uint8_t getBatteryChargePercent() const { return getHasBattery() ? batteryChargePercent : 0; }
#endif
/**
* Note: for boards without battery pin and PMU, 101% battery means 'the board is using external power'
*/
#if !defined(HAS_PMU) && !defined(BATTERY_PIN)
uint8_t getBatteryChargePercent() const { return getHasBattery() ? batteryChargePercent : 101; }
#endif
bool matches(const PowerStatus *newStatus) const bool matches(const PowerStatus *newStatus) const
{ {

View File

@ -40,6 +40,7 @@ Board Information: https://wiki.uniteng.com/en/meshtastic/station-g2
#define SX126X_MAX_POWER 19 #define SX126X_MAX_POWER 19
#endif #endif
/*
#define BATTERY_PIN 4 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage #define BATTERY_PIN 4 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#define ADC_CHANNEL ADC1_GPIO4_CHANNEL #define ADC_CHANNEL ADC1_GPIO4_CHANNEL
#define ADC_MULTIPLIER 4 #define ADC_MULTIPLIER 4
@ -50,3 +51,4 @@ Board Information: https://wiki.uniteng.com/en/meshtastic/station-g2
#define BAT_NOBATVOLT 4460 #define BAT_NOBATVOLT 4460
#define CELL_TYPE_LION // same curve for liion/lipo #define CELL_TYPE_LION // same curve for liion/lipo
#define NUM_CELLS 2 #define NUM_CELLS 2
*/