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
+4 -2
View File
@@ -6,6 +6,7 @@
#include <helpers/SensorManager.h>
#include "NodePrefs.h" // localTm()
#include <helpers/sensors/LPPDataHelpers.h>
#include "LocalSensors.h"
// Expands placeholders in tmpl into out (out_len bytes).
// {loc} — GPS coordinates (lat/lon) or "no GPS"
@@ -26,14 +27,15 @@ inline void expandMsg(const char* tmpl, char* out, int out_len,
SensorManager* sm = nullptr,
float batt_volts = -1.0f,
const char* sender_name = nullptr,
int hops = -1) {
int hops = -1,
float mcu_temp = NAN) { // the chip's, for {temp} without a sensor
// 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] = {};
if (sm) {
CayenneLPP lpp(100);
sm->querySensors(0xFF, lpp);
queryLocalSensors(*sm, mcu_temp, lpp);
LPPReader r(lpp.getBuffer(), lpp.getSize());
uint8_t ch, type;
while (r.readHeader(ch, type)) {