fix(bot): !temp and {temp} fall back to the chip's temperature

Same gap as the screens had: the bot reply, a typed message's {temp} and
the placeholder lists read only the sensors, so a board without one (the
L1) answered !temp with n/a while its telemetry carried a temperature.
The fallback moves to LocalSensors.h, shared by the screens, expandMsg()
and sensorPlaceholders(); the latter now takes the chip's temperature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-23 22:55:19 +02:00
co-authored by Claude Opus 5.5
parent 21feec0972
commit 24156769f0
11 changed files with 43 additions and 36 deletions
+1 -1
View File
@@ -175,7 +175,7 @@ void UITask::botRow(int row) {
lv_obj_set_scrollbar_mode(chips, LV_SCROLLBAR_MODE_OFF);
s_chip_ta = _nav_ta;
for (int i = 0; i < botcfg::REPLY_PLACEHOLDER_COUNT; i++) botChip(botcfg::REPLY_PLACEHOLDERS[i], chips);
msgtext::sensorPlaceholders(&sensors, [](const char* ph, void* c) {
msgtext::sensorPlaceholders(&sensors, board.getMCUTemperature(), [](const char* ph, void* c) {
if (strcmp(ph, "{batt}") != 0) botChip(ph, c); // already there
}, chips);
}
@@ -621,7 +621,7 @@ void UITask::homeFieldText(uint8_t f, char* v, int n) {
if (_sensors && (s_lpp_ms == 0 || millis() - s_lpp_ms > 5000)) {
s_lpp_ms = millis() | 1;
s_lpp.reset();
telemetry::querySensors(*_sensors, board.getMCUTemperature(), s_lpp);
queryLocalSensors(*_sensors, board.getMCUTemperature(), s_lpp);
}
in.lpp = s_lpp.getBuffer();
in.lpp_len = s_lpp.getSize();
@@ -12,7 +12,7 @@ static int s_edit = -1; // quick message being edited
static void collect() {
s_ph_n = 0;
msgtext::placeholders(&sensors, [](const char* ph, void*) { if (s_ph_n < PH_MAX) s_ph[s_ph_n++] = ph; }, nullptr);
msgtext::placeholders(&sensors, board.getMCUTemperature(), [](const char* ph, void*) { if (s_ph_n < PH_MAX) s_ph[s_ph_n++] = ph; }, nullptr);
}
// The placeholders as small buttons; `cb` gets the index as user data.