mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-22 11:17:49 +10:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2733af43f1 | ||
|
|
885bffa4e8 | ||
|
|
bde6a166d0 | ||
|
|
80bf8940a1 |
+10
-1
@@ -878,7 +878,16 @@ void Power::readPowerStatus()
|
|||||||
|
|
||||||
// Notify any status instances that are observing us
|
// Notify any status instances that are observing us
|
||||||
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isChargingNow, batteryVoltageMv, batteryChargePercent);
|
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isChargingNow, batteryVoltageMv, batteryChargePercent);
|
||||||
if (millis() > lastLogTime + 50 * 1000) {
|
|
||||||
|
// Log battery-presence transitions once; skip OptUnknown so we don't lie before the first probe.
|
||||||
|
static OptionalBool prevHasBattery = OptUnknown;
|
||||||
|
if (hasBattery != OptUnknown && hasBattery != prevHasBattery) {
|
||||||
|
LOG_INFO("Power: battery hardware %s", hasBattery == OptTrue ? "detected" : "absent (USB-only)");
|
||||||
|
prevHasBattery = hasBattery;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Periodic telemetry only emits when a battery is actually present (otherwise values are constant -1/0).
|
||||||
|
if (hasBattery == OptTrue && !Throttle::isWithinTimespanMs(lastLogTime, 50 * 1000)) {
|
||||||
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(),
|
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(),
|
||||||
powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
||||||
lastLogTime = millis();
|
lastLogTime = millis();
|
||||||
|
|||||||
@@ -80,14 +80,6 @@ static unsigned char userprefs_admin_key_1[] = USERPREFS_USE_ADMIN_KEY_1;
|
|||||||
static unsigned char userprefs_admin_key_2[] = USERPREFS_USE_ADMIN_KEY_2;
|
static unsigned char userprefs_admin_key_2[] = USERPREFS_USE_ADMIN_KEY_2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Weak empty variant initialization function.
|
|
||||||
// May be redefined by variant files.
|
|
||||||
void variantDefaultConfig() __attribute__((weak));
|
|
||||||
void variantDefaultConfig() {}
|
|
||||||
|
|
||||||
void variantDefaultModuleConfig() __attribute__((weak));
|
|
||||||
void variantDefaultModuleConfig() {}
|
|
||||||
|
|
||||||
#ifdef HELTEC_MESH_NODE_T114
|
#ifdef HELTEC_MESH_NODE_T114
|
||||||
|
|
||||||
uint32_t read8(uint8_t bits, uint8_t dummy, uint8_t cs, uint8_t sck, uint8_t mosi, uint8_t dc, uint8_t rst)
|
uint32_t read8(uint8_t bits, uint8_t dummy, uint8_t cs, uint8_t sck, uint8_t mosi, uint8_t dc, uint8_t rst)
|
||||||
@@ -793,8 +785,6 @@ void NodeDB::installDefaultConfig(bool preserveKey = false)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
initConfigIntervals();
|
initConfigIntervals();
|
||||||
variantDefaultConfig();
|
|
||||||
variantDefaultModuleConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeDB::initConfigIntervals()
|
void NodeDB::initConfigIntervals()
|
||||||
|
|||||||
@@ -12,11 +12,7 @@ build_flags =
|
|||||||
-mfix-esp32-psram-cache-issue
|
-mfix-esp32-psram-cache-issue
|
||||||
|
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
Ethernet
|
Ethernet
|
||||||
|
|
||||||
build_src_filter =
|
|
||||||
${esp32s3_base.build_src_filter}
|
|
||||||
+<../variants/esp32s3/ELECROW-ThinkNode-G3/*>
|
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${esp32s3_base.lib_deps}
|
${esp32s3_base.lib_deps}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
#include "mesh/NodeDB.h"
|
|
||||||
|
|
||||||
void variantDefaultConfig()
|
|
||||||
{
|
|
||||||
config.network.eth_enabled = true;
|
|
||||||
}
|
|
||||||
@@ -11,11 +11,7 @@ build_flags =
|
|||||||
-mfix-esp32-psram-cache-issue
|
-mfix-esp32-psram-cache-issue
|
||||||
|
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
Ethernet
|
Ethernet
|
||||||
|
|
||||||
build_src_filter =
|
|
||||||
${esp32s3_base.build_src_filter}
|
|
||||||
+<../variants/esp32s3/ELECROW-ThinkNode-M7/*>
|
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${esp32s3_base.lib_deps}
|
${esp32s3_base.lib_deps}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
#include "mesh/NodeDB.h"
|
|
||||||
|
|
||||||
void variantDefaultConfig()
|
|
||||||
{
|
|
||||||
config.network.eth_enabled = true;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user