mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-07 21:52:05 +00:00
Compare commits
14 Commits
d0986e7c98
...
26f7c05d10
Author | SHA1 | Date | |
---|---|---|---|
![]() |
26f7c05d10 | ||
![]() |
46c7d74760 | ||
![]() |
15d2ae17f8 | ||
![]() |
91579c4650 | ||
![]() |
79b710a108 | ||
![]() |
c75bc54a90 | ||
![]() |
8d52bc413b | ||
![]() |
2082a87771 | ||
![]() |
983dd95091 | ||
![]() |
7f49c6d2bc | ||
![]() |
2388960fb2 | ||
![]() |
5271582062 | ||
![]() |
e0a697feb6 | ||
![]() |
1526781b83 |
@ -9,7 +9,7 @@ plugins:
|
|||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- checkov@3.2.436
|
- checkov@3.2.436
|
||||||
- renovate@40.41.0
|
- renovate@40.42.2
|
||||||
- prettier@3.5.3
|
- prettier@3.5.3
|
||||||
- trufflehog@3.88.35
|
- trufflehog@3.88.35
|
||||||
- yamllint@1.37.1
|
- yamllint@1.37.1
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 24c7a3d287a4bd269ce191827e5dabd8ce8f57a7
|
Subproject commit db60f07ac298b6161ca553b3868b542cceadcac4
|
@ -214,13 +214,29 @@ static void adcDisable()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif //BATTERY_PIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple battery level sensor that assumes the battery voltage is attached via a voltage-divider to an analog input
|
* A simple battery level sensor that assumes the battery voltage is attached via a voltage-divider to an analog input
|
||||||
*/
|
*/
|
||||||
class AnalogBatteryLevel : public HasBatteryLevel
|
class AnalogBatteryLevel : public HasBatteryLevel
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
||||||
|
/// in power
|
||||||
|
|
||||||
|
/// For heltecs with no battery connected, the measured voltage is 2204, so
|
||||||
|
// need to be higher than that, in this case is 2500mV (3000-500)
|
||||||
|
const uint16_t OCV[NUM_OCV_POINTS] = {OCV_ARRAY};
|
||||||
|
const float chargingVolt = (OCV[0] + 10) * NUM_CELLS;
|
||||||
|
const float noBatVolt = (OCV[NUM_OCV_POINTS - 1] - 500) * NUM_CELLS;
|
||||||
|
// Start value from minimum voltage for the filter to not start from 0
|
||||||
|
// that could trigger some events.
|
||||||
|
// This value is over-written by the first ADC reading, it the voltage seems reasonable.
|
||||||
|
bool initial_read_done = false;
|
||||||
|
float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS);
|
||||||
|
uint32_t last_read_time_ms = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Battery state of charge, from 0 to 100 or -1 for unknown
|
* Battery state of charge, from 0 to 100 or -1 for unknown
|
||||||
@ -475,22 +491,6 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
return isVbusIn();
|
return isVbusIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
|
||||||
/// in power
|
|
||||||
|
|
||||||
/// For heltecs with no battery connected, the measured voltage is 2204, so
|
|
||||||
// need to be higher than that, in this case is 2500mV (3000-500)
|
|
||||||
const uint16_t OCV[NUM_OCV_POINTS] = {OCV_ARRAY};
|
|
||||||
const float chargingVolt = (OCV[0] + 10) * NUM_CELLS;
|
|
||||||
const float noBatVolt = (OCV[NUM_OCV_POINTS - 1] - 500) * NUM_CELLS;
|
|
||||||
// Start value from minimum voltage for the filter to not start from 0
|
|
||||||
// that could trigger some events.
|
|
||||||
// This value is over-written by the first ADC reading, it the voltage seems reasonable.
|
|
||||||
bool initial_read_done = false;
|
|
||||||
float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS);
|
|
||||||
uint32_t last_read_time_ms = 0;
|
|
||||||
|
|
||||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT)
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT)
|
||||||
|
|
||||||
uint16_t getRAKVoltage() { return rak9154Sensor.getBusVoltageMv(); }
|
uint16_t getRAKVoltage() { return rak9154Sensor.getBusVoltageMv(); }
|
||||||
@ -502,7 +502,6 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
return rak9154Sensor.isRunning();
|
return rak9154Sensor.isRunning();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_STM32WL)
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_STM32WL)
|
||||||
uint16_t getINAVoltage()
|
uint16_t getINAVoltage()
|
||||||
{
|
{
|
||||||
@ -654,6 +653,23 @@ bool Power::analogInit()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the INA sensor for power monitoring.
|
||||||
|
*
|
||||||
|
* @return true if the INA sensor is ready, false otherwise.
|
||||||
|
*/
|
||||||
|
bool Power::inaInit()
|
||||||
|
{
|
||||||
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_STM32WL)
|
||||||
|
bool result = analogLevel.hasINA();
|
||||||
|
batteryLevel = &analogLevel;
|
||||||
|
|
||||||
|
LOG_DEBUG("Power::inaInit INA sensor is %s", result ? "ready" : "not ready yet");
|
||||||
|
return result;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the Power class.
|
* Initializes the Power class.
|
||||||
*
|
*
|
||||||
@ -667,6 +683,8 @@ bool Power::setup()
|
|||||||
found = lipoInit();
|
found = lipoInit();
|
||||||
if (!found)
|
if (!found)
|
||||||
found = analogInit();
|
found = analogInit();
|
||||||
|
if (!found)
|
||||||
|
found = inaInit();
|
||||||
|
|
||||||
#ifdef NRF_APM
|
#ifdef NRF_APM
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -34,7 +34,7 @@ void PowerFSM_setup(){};
|
|||||||
static bool isPowered()
|
static bool isPowered()
|
||||||
{
|
{
|
||||||
// Circumvent the battery sensing logic and assumes constant power if no battery pin or power mgmt IC
|
// Circumvent the battery sensing logic and assumes constant power if no battery pin or power mgmt IC
|
||||||
#if !defined(BATTERY_PIN) && !defined(HAS_AXP192) && !defined(HAS_AXP2101) && !defined(NRF_APM)
|
#if !defined(HAS_BATTERY) && !defined(BATTERY_PIN) && !defined(HAS_AXP192) && !defined(HAS_AXP2101) && !defined(NRF_APM)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -61,14 +61,14 @@ class PowerStatus : public Status
|
|||||||
/**
|
/**
|
||||||
* Note: for boards with battery pin or PMU, 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)
|
#if defined(HAS_PMU) || defined(BATTERY_PIN) || defined(HAS_BATTERY)
|
||||||
uint8_t getBatteryChargePercent() const { return getHasBattery() ? batteryChargePercent : 0; }
|
uint8_t getBatteryChargePercent() const { return getHasBattery() ? batteryChargePercent : 0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: for boards without battery pin and PMU, 101% battery means 'the board is using external power'
|
* Note: for boards without battery pin and PMU, 101% battery means 'the board is using external power'
|
||||||
*/
|
*/
|
||||||
#if !defined(HAS_PMU) && !defined(BATTERY_PIN)
|
#if !defined(HAS_PMU) && !defined(BATTERY_PIN) && !defined(HAS_BATTERY)
|
||||||
uint8_t getBatteryChargePercent() const { return getHasBattery() ? batteryChargePercent : 101; }
|
uint8_t getBatteryChargePercent() const { return getHasBattery() ? batteryChargePercent : 101; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -297,6 +297,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#ifndef HAS_BLUETOOTH
|
#ifndef HAS_BLUETOOTH
|
||||||
#define HAS_BLUETOOTH 0
|
#define HAS_BLUETOOTH 0
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef HAS_BATTERY
|
||||||
|
#define HAS_BATTERY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HW_VENDOR
|
#ifndef HW_VENDOR
|
||||||
#error HW_VENDOR must be defined
|
#error HW_VENDOR must be defined
|
||||||
|
15
src/main.cpp
15
src/main.cpp
@ -337,12 +337,12 @@ void setup()
|
|||||||
|
|
||||||
#ifdef LED_POWER
|
#ifdef LED_POWER
|
||||||
pinMode(LED_POWER, OUTPUT);
|
pinMode(LED_POWER, OUTPUT);
|
||||||
digitalWrite(LED_POWER, HIGH);
|
digitalWrite(LED_POWER, LED_STATE_ON);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USER_LED
|
#ifdef USER_LED
|
||||||
pinMode(USER_LED, OUTPUT);
|
pinMode(USER_LED, OUTPUT);
|
||||||
digitalWrite(USER_LED, LOW);
|
digitalWrite(USER_LED, HIGH ^ LED_STATE_ON);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(T_DECK)
|
#if defined(T_DECK)
|
||||||
@ -530,12 +530,14 @@ void setup()
|
|||||||
tftSetup();
|
tftSetup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAS_PMU)
|
||||||
// Currently only the tbeam has a PMU
|
// Currently only the tbeam has a PMU
|
||||||
// PMU initialization needs to be placed before i2c scanning
|
// PMU initialization needs to be placed before i2c scanning
|
||||||
power = new Power();
|
power = new Power();
|
||||||
power->setStatusHandler(powerStatus);
|
power->setStatusHandler(powerStatus);
|
||||||
powerStatus->observe(&power->newStatus);
|
powerStatus->observe(&power->newStatus);
|
||||||
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
|
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !MESHTASTIC_EXCLUDE_I2C
|
#if !MESHTASTIC_EXCLUDE_I2C
|
||||||
// We need to scan here to decide if we have a screen for nodeDB.init() and because power has been applied to
|
// We need to scan here to decide if we have a screen for nodeDB.init() and because power has been applied to
|
||||||
@ -1276,6 +1278,15 @@ void setup()
|
|||||||
1000);
|
1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(HAS_PMU)
|
||||||
|
// Currently only the tbeam has a PMU
|
||||||
|
// PMU initialization needs to be placed before i2c scanning
|
||||||
|
power = new Power();
|
||||||
|
power->setStatusHandler(powerStatus);
|
||||||
|
powerStatus->observe(&power->newStatus);
|
||||||
|
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
|
||||||
|
#endif
|
||||||
|
|
||||||
// This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values
|
// This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values
|
||||||
PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS
|
PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS
|
||||||
powerFSMthread = new PowerFSMThread();
|
powerFSMthread = new PowerFSMThread();
|
||||||
|
@ -65,6 +65,8 @@ PB_BIND(meshtastic_Config_SessionkeyConfig, meshtastic_Config_SessionkeyConfig,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,6 +88,23 @@ typedef enum _meshtastic_Config_DeviceConfig_RebroadcastMode {
|
|||||||
meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY = 5
|
meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY = 5
|
||||||
} meshtastic_Config_DeviceConfig_RebroadcastMode;
|
} meshtastic_Config_DeviceConfig_RebroadcastMode;
|
||||||
|
|
||||||
|
/* Defines buzzer behavior for audio feedback */
|
||||||
|
typedef enum _meshtastic_Config_DeviceConfig_BuzzerMode {
|
||||||
|
/* Default behavior.
|
||||||
|
Buzzer is enabled for all audio feedback including button presses and alerts. */
|
||||||
|
meshtastic_Config_DeviceConfig_BuzzerMode_ALL_ENABLED = 0,
|
||||||
|
/* Disabled.
|
||||||
|
All buzzer audio feedback is disabled. */
|
||||||
|
meshtastic_Config_DeviceConfig_BuzzerMode_DISABLED = 1,
|
||||||
|
/* Notifications Only.
|
||||||
|
Buzzer is enabled only for notifications and alerts, but not for button presses.
|
||||||
|
External notification config determines the specifics of the notification behavior. */
|
||||||
|
meshtastic_Config_DeviceConfig_BuzzerMode_NOTIFICATIONS_ONLY = 2,
|
||||||
|
/* Non-notification system buzzer tones only.
|
||||||
|
Buzzer is enabled only for non-notification tones such as button presses, startup, shutdown, but not for alerts. */
|
||||||
|
meshtastic_Config_DeviceConfig_BuzzerMode_SYSTEM_ONLY = 3
|
||||||
|
} meshtastic_Config_DeviceConfig_BuzzerMode;
|
||||||
|
|
||||||
/* Bit field of boolean configuration options, indicating which optional
|
/* Bit field of boolean configuration options, indicating which optional
|
||||||
fields to include when assembling POSITION messages.
|
fields to include when assembling POSITION messages.
|
||||||
Longitude, latitude, altitude, speed, heading, and DOP
|
Longitude, latitude, altitude, speed, heading, and DOP
|
||||||
@ -335,6 +352,9 @@ typedef struct _meshtastic_Config_DeviceConfig {
|
|||||||
char tzdef[65];
|
char tzdef[65];
|
||||||
/* If true, disable the default blinking LED (LED_PIN) behavior on the device */
|
/* If true, disable the default blinking LED (LED_PIN) behavior on the device */
|
||||||
bool led_heartbeat_disabled;
|
bool led_heartbeat_disabled;
|
||||||
|
/* Controls buzzer behavior for audio feedback
|
||||||
|
Defaults to ENABLED */
|
||||||
|
meshtastic_Config_DeviceConfig_BuzzerMode buzzer_mode;
|
||||||
} meshtastic_Config_DeviceConfig;
|
} meshtastic_Config_DeviceConfig;
|
||||||
|
|
||||||
/* Position Config */
|
/* Position Config */
|
||||||
@ -618,6 +638,10 @@ extern "C" {
|
|||||||
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_MAX meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY
|
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_MAX meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY
|
||||||
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_ARRAYSIZE ((meshtastic_Config_DeviceConfig_RebroadcastMode)(meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY+1))
|
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_ARRAYSIZE ((meshtastic_Config_DeviceConfig_RebroadcastMode)(meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY+1))
|
||||||
|
|
||||||
|
#define _meshtastic_Config_DeviceConfig_BuzzerMode_MIN meshtastic_Config_DeviceConfig_BuzzerMode_ALL_ENABLED
|
||||||
|
#define _meshtastic_Config_DeviceConfig_BuzzerMode_MAX meshtastic_Config_DeviceConfig_BuzzerMode_SYSTEM_ONLY
|
||||||
|
#define _meshtastic_Config_DeviceConfig_BuzzerMode_ARRAYSIZE ((meshtastic_Config_DeviceConfig_BuzzerMode)(meshtastic_Config_DeviceConfig_BuzzerMode_SYSTEM_ONLY+1))
|
||||||
|
|
||||||
#define _meshtastic_Config_PositionConfig_PositionFlags_MIN meshtastic_Config_PositionConfig_PositionFlags_UNSET
|
#define _meshtastic_Config_PositionConfig_PositionFlags_MIN meshtastic_Config_PositionConfig_PositionFlags_UNSET
|
||||||
#define _meshtastic_Config_PositionConfig_PositionFlags_MAX meshtastic_Config_PositionConfig_PositionFlags_SPEED
|
#define _meshtastic_Config_PositionConfig_PositionFlags_MAX meshtastic_Config_PositionConfig_PositionFlags_SPEED
|
||||||
#define _meshtastic_Config_PositionConfig_PositionFlags_ARRAYSIZE ((meshtastic_Config_PositionConfig_PositionFlags)(meshtastic_Config_PositionConfig_PositionFlags_SPEED+1))
|
#define _meshtastic_Config_PositionConfig_PositionFlags_ARRAYSIZE ((meshtastic_Config_PositionConfig_PositionFlags)(meshtastic_Config_PositionConfig_PositionFlags_SPEED+1))
|
||||||
@ -669,6 +693,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define meshtastic_Config_DeviceConfig_role_ENUMTYPE meshtastic_Config_DeviceConfig_Role
|
#define meshtastic_Config_DeviceConfig_role_ENUMTYPE meshtastic_Config_DeviceConfig_Role
|
||||||
#define meshtastic_Config_DeviceConfig_rebroadcast_mode_ENUMTYPE meshtastic_Config_DeviceConfig_RebroadcastMode
|
#define meshtastic_Config_DeviceConfig_rebroadcast_mode_ENUMTYPE meshtastic_Config_DeviceConfig_RebroadcastMode
|
||||||
|
#define meshtastic_Config_DeviceConfig_buzzer_mode_ENUMTYPE meshtastic_Config_DeviceConfig_BuzzerMode
|
||||||
|
|
||||||
#define meshtastic_Config_PositionConfig_gps_mode_ENUMTYPE meshtastic_Config_PositionConfig_GpsMode
|
#define meshtastic_Config_PositionConfig_gps_mode_ENUMTYPE meshtastic_Config_PositionConfig_GpsMode
|
||||||
|
|
||||||
@ -692,7 +717,7 @@ extern "C" {
|
|||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}}
|
#define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}}
|
||||||
#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
|
#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0, _meshtastic_Config_DeviceConfig_BuzzerMode_MIN}
|
||||||
#define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN}
|
#define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN}
|
||||||
#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, "", 0, 0}
|
#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, "", 0, 0}
|
||||||
@ -703,7 +728,7 @@ extern "C" {
|
|||||||
#define meshtastic_Config_SecurityConfig_init_default {{0, {0}}, {0, {0}}, 0, {{0, {0}}, {0, {0}}, {0, {0}}}, 0, 0, 0, 0}
|
#define meshtastic_Config_SecurityConfig_init_default {{0, {0}}, {0, {0}}, 0, {{0, {0}}, {0, {0}}, {0, {0}}}, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_SessionkeyConfig_init_default {0}
|
#define meshtastic_Config_SessionkeyConfig_init_default {0}
|
||||||
#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}}
|
#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}}
|
||||||
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
|
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0, _meshtastic_Config_DeviceConfig_BuzzerMode_MIN}
|
||||||
#define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN}
|
#define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN}
|
||||||
#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, "", 0, 0}
|
#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, "", 0, 0}
|
||||||
@ -726,6 +751,7 @@ extern "C" {
|
|||||||
#define meshtastic_Config_DeviceConfig_disable_triple_click_tag 10
|
#define meshtastic_Config_DeviceConfig_disable_triple_click_tag 10
|
||||||
#define meshtastic_Config_DeviceConfig_tzdef_tag 11
|
#define meshtastic_Config_DeviceConfig_tzdef_tag 11
|
||||||
#define meshtastic_Config_DeviceConfig_led_heartbeat_disabled_tag 12
|
#define meshtastic_Config_DeviceConfig_led_heartbeat_disabled_tag 12
|
||||||
|
#define meshtastic_Config_DeviceConfig_buzzer_mode_tag 13
|
||||||
#define meshtastic_Config_PositionConfig_position_broadcast_secs_tag 1
|
#define meshtastic_Config_PositionConfig_position_broadcast_secs_tag 1
|
||||||
#define meshtastic_Config_PositionConfig_position_broadcast_smart_enabled_tag 2
|
#define meshtastic_Config_PositionConfig_position_broadcast_smart_enabled_tag 2
|
||||||
#define meshtastic_Config_PositionConfig_fixed_position_tag 3
|
#define meshtastic_Config_PositionConfig_fixed_position_tag 3
|
||||||
@ -849,7 +875,8 @@ X(a, STATIC, SINGULAR, BOOL, double_tap_as_button_press, 8) \
|
|||||||
X(a, STATIC, SINGULAR, BOOL, is_managed, 9) \
|
X(a, STATIC, SINGULAR, BOOL, is_managed, 9) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, disable_triple_click, 10) \
|
X(a, STATIC, SINGULAR, BOOL, disable_triple_click, 10) \
|
||||||
X(a, STATIC, SINGULAR, STRING, tzdef, 11) \
|
X(a, STATIC, SINGULAR, STRING, tzdef, 11) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, led_heartbeat_disabled, 12)
|
X(a, STATIC, SINGULAR, BOOL, led_heartbeat_disabled, 12) \
|
||||||
|
X(a, STATIC, SINGULAR, UENUM, buzzer_mode, 13)
|
||||||
#define meshtastic_Config_DeviceConfig_CALLBACK NULL
|
#define meshtastic_Config_DeviceConfig_CALLBACK NULL
|
||||||
#define meshtastic_Config_DeviceConfig_DEFAULT NULL
|
#define meshtastic_Config_DeviceConfig_DEFAULT NULL
|
||||||
|
|
||||||
@ -995,7 +1022,7 @@ extern const pb_msgdesc_t meshtastic_Config_SessionkeyConfig_msg;
|
|||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_CONFIG_PB_H_MAX_SIZE meshtastic_Config_size
|
#define MESHTASTIC_MESHTASTIC_CONFIG_PB_H_MAX_SIZE meshtastic_Config_size
|
||||||
#define meshtastic_Config_BluetoothConfig_size 10
|
#define meshtastic_Config_BluetoothConfig_size 10
|
||||||
#define meshtastic_Config_DeviceConfig_size 98
|
#define meshtastic_Config_DeviceConfig_size 100
|
||||||
#define meshtastic_Config_DisplayConfig_size 32
|
#define meshtastic_Config_DisplayConfig_size 32
|
||||||
#define meshtastic_Config_LoRaConfig_size 85
|
#define meshtastic_Config_LoRaConfig_size 85
|
||||||
#define meshtastic_Config_NetworkConfig_IpV4Config_size 20
|
#define meshtastic_Config_NetworkConfig_IpV4Config_size 20
|
||||||
|
@ -55,6 +55,8 @@ typedef enum _meshtastic_Language {
|
|||||||
meshtastic_Language_SLOVENIAN = 15,
|
meshtastic_Language_SLOVENIAN = 15,
|
||||||
/* Ukrainian */
|
/* Ukrainian */
|
||||||
meshtastic_Language_UKRAINIAN = 16,
|
meshtastic_Language_UKRAINIAN = 16,
|
||||||
|
/* Bulgarian */
|
||||||
|
meshtastic_Language_BULGARIAN = 17,
|
||||||
/* Simplified Chinese (experimental) */
|
/* Simplified Chinese (experimental) */
|
||||||
meshtastic_Language_SIMPLIFIED_CHINESE = 30,
|
meshtastic_Language_SIMPLIFIED_CHINESE = 30,
|
||||||
/* Traditional Chinese (experimental) */
|
/* Traditional Chinese (experimental) */
|
||||||
|
@ -360,7 +360,7 @@ extern const pb_msgdesc_t meshtastic_BackupPreferences_msg;
|
|||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
/* meshtastic_NodeDatabase_size depends on runtime parameters */
|
/* meshtastic_NodeDatabase_size depends on runtime parameters */
|
||||||
#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_BackupPreferences_size
|
#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_BackupPreferences_size
|
||||||
#define meshtastic_BackupPreferences_size 2269
|
#define meshtastic_BackupPreferences_size 2271
|
||||||
#define meshtastic_ChannelFile_size 718
|
#define meshtastic_ChannelFile_size 718
|
||||||
#define meshtastic_DeviceState_size 1722
|
#define meshtastic_DeviceState_size 1722
|
||||||
#define meshtastic_NodeInfoLite_size 196
|
#define meshtastic_NodeInfoLite_size 196
|
||||||
|
@ -187,7 +187,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size
|
#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size
|
||||||
#define meshtastic_LocalConfig_size 745
|
#define meshtastic_LocalConfig_size 747
|
||||||
#define meshtastic_LocalModuleConfig_size 669
|
#define meshtastic_LocalModuleConfig_size 669
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -258,6 +258,12 @@ typedef enum _meshtastic_HardwareModel {
|
|||||||
meshtastic_HardwareModel_SEEED_WIO_TRACKER_L1_EINK = 100,
|
meshtastic_HardwareModel_SEEED_WIO_TRACKER_L1_EINK = 100,
|
||||||
/* Reserved ID for future and past use */
|
/* Reserved ID for future and past use */
|
||||||
meshtastic_HardwareModel_QWANTZ_TINY_ARMS = 101,
|
meshtastic_HardwareModel_QWANTZ_TINY_ARMS = 101,
|
||||||
|
/* *
|
||||||
|
Lilygo T-Deck Pro */
|
||||||
|
meshtastic_HardwareModel_T_DECK_PRO = 102,
|
||||||
|
/* *
|
||||||
|
Lilygo TLora Pager */
|
||||||
|
meshtastic_HardwareModel_T_LORA_PAGER = 103,
|
||||||
/* ------------------------------------------------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits.
|
Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits.
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------ */
|
------------------------------------------------------------------------------------------------------------------------------------------ */
|
||||||
|
@ -122,7 +122,8 @@ class Power : private concurrency::OSThread
|
|||||||
bool analogInit();
|
bool analogInit();
|
||||||
/// Setup a Lipo battery level sensor
|
/// Setup a Lipo battery level sensor
|
||||||
bool lipoInit();
|
bool lipoInit();
|
||||||
|
/// Setup INA battery level sensor
|
||||||
|
bool inaInit();
|
||||||
private:
|
private:
|
||||||
// open circuit voltage lookup table
|
// open circuit voltage lookup table
|
||||||
uint8_t low_voltage_counter;
|
uint8_t low_voltage_counter;
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#define GPS_POWER_TOGGLE // Moved definition from platformio.ini to here
|
#define GPS_POWER_TOGGLE // Moved definition from platformio.ini to here
|
||||||
|
|
||||||
#define BUTTON_PIN 39 // The middle button GPIO on the T-Beam
|
#define BUTTON_PIN 39 // The middle button GPIO on the T-Beam
|
||||||
|
// Note: On the ESP32 base version, gpio34-39 are input-only, and do not have internal pull-ups.
|
||||||
|
// If 39 is not being used for a button, it is suggested to remove the #define.
|
||||||
#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_CHANNEL ADC1_GPIO35_CHANNEL
|
||||||
#define ADC_MULTIPLIER 1.85 // (R1 = 470k, R2 = 680k)
|
#define ADC_MULTIPLIER 1.85 // (R1 = 470k, R2 = 680k)
|
||||||
|
@ -23,6 +23,14 @@
|
|||||||
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
|
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
|
||||||
// #define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
|
// #define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
|
||||||
|
|
||||||
|
// Enables battery-related code and requires BATTERY_IMMUTABLE to be defined.
|
||||||
|
// Ensure a valid address is configured for the INA sensor from which voltage readings are to be obtained.
|
||||||
|
#define HAS_BATTERY
|
||||||
|
#define BATTERY_IMMUTABLE
|
||||||
|
// Disable ina charging detection to prevent charge percentage readings going to 100% while battery is charging.
|
||||||
|
#define DISABLE_INA_CHARGING_DETECTION
|
||||||
|
|
||||||
|
|
||||||
#define HAS_CPU_SHUTDOWN 1
|
#define HAS_CPU_SHUTDOWN 1
|
||||||
#define USE_SX1262
|
#define USE_SX1262
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user