feat(bot): room-server target, tab-carousel UI, per-target independence

Auto-Reply Bot gains a third target (room servers, alongside DM and
channel), new {name}/{hops} reply placeholders, and a DM all/favourites
allow-list. BotScreen is redesigned as a circular tab carousel (Direct /
Channel / Room / Other, same interaction as Nearby Nodes' filter tabs)
instead of one long scrolling list, which also exposed and fixed a
leftover coupling where Channel/Room trigger-replies and their !command
handling secretly depended on the DM tab's Enable/Commands toggles —
each target's Enable and Commands are now fully independent.

- NodePrefs: bot_room_enabled/prefix/trigger/reply, bot_dm_scope,
  bot_commands_ch/bot_commands_room (bot_commands_enabled repurposed as
  DM-only). SCHEMA_SENTINEL 0xC0DE001D -> 0xC0DE001F; sizeof unchanged
  at 2712 (new bytes absorbed existing padding, verified via a
  standalone host compile + offsetof check).
- DataStore: persists all new fields; seeds bot_commands_ch/room from
  the old shared bot_commands_enabled on upgrade so existing
  channel/room command behaviour isn't silently lost.
- MyMeshBot: tryBotReplyRoom/tryBotRoomCommand mirror the channel bot's
  shape but post via sendMessage (room relays to members itself);
  requires an existing login session with that room, same as a manual
  post would. botDmSenderAllowed() gates DM trigger-reply/commands on
  the favourites bit when bot_dm_scope=Fav.
- MsgExpand: {name}/{hops} as optional trailing params (default
  nullptr/-1, no existing caller affected) — deliberately not exposed
  on the general compose keyboard, only on bot Reply fields.
- QuickMsgScreen/UITask: room-target picker (mirrors the channel
  picker), routing through the existing room-login prompt when there's
  no saved password yet.
- BotScreen: tab carousel (LEFT/RIGHT switches tabs, UP/DOWN moves
  rows, Enter is now the only way to change a value); Enable split out
  of Channel/Room's combo row; Quiet Hours gained a stepper sub-mode;
  Commands moved from a shared toggle into each tab.
- docs/tools_screen.md updated for the new tab layout and behaviour.

Not build-verified — no PlatformIO toolchain in this environment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-07-10 20:16:59 +02:00
co-authored by Claude Sonnet 5
parent dfb993de53
commit afd7c0ee78
11 changed files with 744 additions and 181 deletions
+17 -1
View File
@@ -17,11 +17,15 @@
// {lux} — luminosity lux (requires sm)
// {dist} — distance m (requires sm)
// {co2} — CO2 concentration ppm (requires sm)
// {name} — sender's name (bot replies only; requires sender_name, else left literal)
// {hops} — hop count: "direct" or "N hops" (bot replies only; requires hops>=0, else left literal)
inline void expandMsg(const char* tmpl, char* out, int out_len,
double lat, double lon, bool gps_valid,
uint32_t utc_ts, int8_t tz_hours,
SensorManager* sm = nullptr,
float batt_volts = -1.0f) {
float batt_volts = -1.0f,
const char* sender_name = nullptr,
int hops = -1) {
// sv indices: 0=temp 1=hum 2=pres 3=batt 4=alt 5=lux 6=dist 7=co2
float sv[8] = {};
bool sv_ok[8] = {};
@@ -122,6 +126,18 @@ inline void expandMsg(const char* tmpl, char* out, int out_len,
if (sv_ok[7]) { char b[12]; snprintf(b,sizeof(b),"%.0fppm",sv[7]); APPEND(b,strlen(b)); }
else { APPEND("{co2}", 5); }
p += 5;
} else if (strncmp(p, "{name}", 6) == 0) {
if (sender_name && sender_name[0]) { APPEND(sender_name, strlen(sender_name)); }
else { APPEND("{name}", 6); }
p += 6;
} else if (strncmp(p, "{hops}", 6) == 0) {
if (hops >= 0) {
char b[10];
if (hops == 0) strcpy(b, "direct");
else snprintf(b, sizeof(b), "%u hops", (unsigned)hops);
APPEND(b, strlen(b));
} else { APPEND("{hops}", 6); }
p += 6;
} else {
out[oi++] = *p++;
}