mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 10:16:11 +00:00
feat: sensor placeholders in messages and keyboard picker
expandMsg now expands {temp}, {hum}, {pres}, {batt}, {alt}, {lux}, {dist},
{co2} from live sensor readings. The [{}] picker in the on-screen keyboard
shows only sensors currently detected by SensorManager and scrolls when
more than 3 items fit the overlay.
New SensorPlaceholders.h helper keeps sensor-to-keyboard wiring out of
UITask.cpp. MsgExpand.h handles all expansion logic centrally; MyMeshBot
and QuickMsgScreen pass &sensors and batt_volts to each call.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
26d3d7ab00
commit
42b51935b1
@@ -99,6 +99,7 @@ static const uint16_t HP_ALL = 0x01FF;
|
||||
|
||||
#include "KeyboardWidget.h"
|
||||
#include "FullscreenMsgView.h"
|
||||
#include "SensorPlaceholders.h"
|
||||
|
||||
class SettingsScreen : public UIScreen {
|
||||
UITask* _task;
|
||||
@@ -575,6 +576,7 @@ public:
|
||||
int slot = msgSlotIndex(_selected);
|
||||
_edit_slot = slot;
|
||||
_kb.begin(p ? p->custom_msgs[slot] : "");
|
||||
kbAddSensorPlaceholders(_kb, &sensors);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -667,9 +669,11 @@ class QuickMsgScreen : public UIScreen {
|
||||
}
|
||||
#endif
|
||||
NodePrefs* np = _task->getNodePrefs();
|
||||
float batt = (float)board.getBattMilliVolts() / 1000.0f;
|
||||
::expandMsg(tmpl, out, out_len, lat, lon, gps_valid,
|
||||
rtc_clock.getCurrentTime(),
|
||||
np ? np->tz_offset_hours : 0);
|
||||
np ? np->tz_offset_hours : 0,
|
||||
&sensors, batt);
|
||||
}
|
||||
|
||||
void setupMsgPick() {
|
||||
@@ -1624,6 +1628,7 @@ public:
|
||||
if (c == KEY_ENTER) {
|
||||
if (_msg_sel == 0) {
|
||||
_kb.begin();
|
||||
kbAddSensorPlaceholders(_kb, &sensors);
|
||||
_phase = KEYBOARD;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user