feat(advert): stav baterie jako ikonka na konci advertovaného jména

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5 committed 2026-09-21 19:13:38 +02:00
1 parent b0a2776be1
commit 793c309a4b
7 files changed
+331 -3

No files matched your search

+11
View File
@@ -77,6 +77,10 @@ public:
// just leave them at defaults.
uint8_t fairness_enabled = 0; // FairnessLimiter runtime kill switch
char filter_deny[128]; // channel-filter deny list, comma-separated node names
// Battery state as an icon on the advertised name (see BatteryIcon.h).
// Off by default: it costs bytes of the name, so it has to be asked for.
uint8_t batt_icon = 0; // boolean
uint16_t batt_icon_mv = 0; // low threshold in mV; 0 = BATT_ICON_LOW_MV
// FairnessLimiter runtime tuning; 0 = use the firmware build default.
uint8_t fair_group_cap = 0, fair_sender_cap = 0, fair_advert_cap = 0;
uint16_t fair_group_refill_s = 0, fair_sender_refill_s = 0, fair_advert_refill_s = 0;
@@ -179,6 +183,8 @@ private:
void structure() override {
def("adc_mult", _parent->adc_multiplier);
def("pwr_sav_en", _parent->powersaving_enabled);
def("bicon", _parent->batt_icon);
def("bicon_mv", _parent->batt_icon_mv);
}
public:
PowerPrefs(NodePrefs* parent) : _parent(parent) { }
@@ -321,8 +327,13 @@ class CommonCLI {
RegionMap* _region_map;
ClientACL* _acl;
char tmp[PRV_KEY_SIZE*2 + 4];
// Name handed to AdvertDataBuilder, which keeps the pointer until encodeTo();
// it has to outlive buildAdvertData(), hence a member and not a local.
char _adv_name[sizeof(NodePrefs::node_name) + 8];
bool _batt_low = false; // hysteresis state, see BatteryIcon.h
mesh::RTCClock* getRTCClock() { return _rtc; }
const char* advertName(bool with_loc);
void savePrefs();
void loadPrefsInt(FILESYSTEM* _fs, const char* filename);