mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
refactor(ui): apply code review fixes — bugs, risk, optimisations, cleanup
Fixes 7 bugs (timing UB on unsigned long, abs() no-op, XBM CRC PROGMEM scan, CayenneLPP heap thrash ×2, UTF-8 reply prefix, lock-seq reset on wake), 3 risk items (notif melody stop guard, bot trigger pre-lowercase, lock-seq cleared on display wake), plus optimisations (fmtMsgAge/ getTextWidth caching, RTTTL builder consolidated to NodePrefs, HP_* constants and homePageLabel table moved to NodePrefs, DataStore flat lambda schema, translateUTF8Static factored out) and minor cleanup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,12 +8,12 @@ void MyMesh::tryBotReplyDM(const ContactInfo& from, const char* text) {
|
||||
millis() - _bot_last_dm_reply_ms > 10000UL))
|
||||
return;
|
||||
|
||||
const char* tr = _prefs.bot_trigger;
|
||||
const char* tr = _prefs.bot_trigger; // already lowercase (normalised at save/load time)
|
||||
int tlen = strlen(tr);
|
||||
bool matched = false;
|
||||
for (const char* t = text; *t && !matched; t++) {
|
||||
int i = 0;
|
||||
while (i < tlen && tolower((uint8_t)t[i]) == tolower((uint8_t)tr[i])) i++;
|
||||
while (i < tlen && tolower((uint8_t)t[i]) == (uint8_t)tr[i]) i++;
|
||||
if (i == tlen) matched = true;
|
||||
}
|
||||
if (!matched) return;
|
||||
@@ -45,12 +45,12 @@ void MyMesh::tryBotReplyChannel(uint8_t channel_idx, const char* text) {
|
||||
const char* sep = strstr(text, ": ");
|
||||
if (sep) msg = sep + 2;
|
||||
|
||||
const char* tr = _prefs.bot_trigger;
|
||||
const char* tr = _prefs.bot_trigger; // already lowercase (normalised at save/load time)
|
||||
int tlen = strlen(tr);
|
||||
bool matched = false;
|
||||
for (const char* t = msg; *t && !matched; t++) {
|
||||
int i = 0;
|
||||
while (i < tlen && tolower((uint8_t)t[i]) == tolower((uint8_t)tr[i])) i++;
|
||||
while (i < tlen && tolower((uint8_t)t[i]) == (uint8_t)tr[i]) i++;
|
||||
if (i == tlen) matched = true;
|
||||
}
|
||||
if (!matched) return;
|
||||
|
||||
Reference in New Issue
Block a user