joystick UI: drop dead members + refresh stale doc comments

JoystickUITask had two write-only fields after the recent refactors:
_msgcount (only reader getMsgCount() had no callers anywhere) and
_started_at (initialized, written in begin(), never read). Remove
both fields, their writes, and getMsgCount().

msgRead()'s auto-leave-Unread side-effect is preserved — it uses the
function parameter directly, not the field.

Also: update the loop() doc to drop the "calls poll()" reference and
the battery-cache comment to drop the "from housekeeping" wording —
both concepts gone since Phase C.
This commit is contained in:
liquidraver
2026-05-21 13:25:02 +02:00
parent 2630ce9096
commit fcf4e8d1cb
2 changed files with 9 additions and 10 deletions
@@ -199,12 +199,12 @@ JoystickUITask::JoystickUITask()
_next_refresh(0), _screen_off_ms(AUTO_OFF_MILLIS), _was_display_on(false),
_cached_batt_mv(0), _battery_display_mode(0),
_brightness(100), _wake_on_msg(true), _ble_connected(false),
_ble_enabled(true), _msgcount(0), _noise_floor(-120),
_ble_enabled(true), _noise_floor(-120),
_pkt_recv(0), _pkt_sent(0), _pkt_errors(0), _alert_expiry(0),
_locked(false), _lock_step(0),
_compose_is_contact(false), _compose_channel_idx(-1),
_ch_preview_count(0), _ch_preview_head(JOYSTICK_OFFLINE_QUEUE_SIZE - 1),
_started_at(0), _initialized(false)
_initialized(false)
{
memset(_alert, 0, sizeof(_alert));
memset(_compose_channel_name, 0, sizeof(_compose_channel_name));
@@ -222,7 +222,6 @@ void JoystickUITask::begin(BaseChatMesh *mesh, mesh::ZephyrRTCClock *rtc, NodePr
_mesh = mesh;
_rtc = rtc;
_prefs = prefs;
_started_at = k_uptime_get_32();
if (prefs && prefs->display_brightness >= 10) {
_brightness = prefs->display_brightness;
@@ -671,7 +670,7 @@ void JoystickUITask::toggleWakeOnMsg()
/* ===== Notifications from mesh ===== */
void JoystickUITask::newMsg(uint8_t path_len, const char *from_name, const char *text, int msgcount)
{
_msgcount = msgcount;
(void)msgcount; /* tracked by CompanionMesh; we mirror via msgRead() side-effect only */
if (_unread) {
/* When BLE phone is connected it pulls offline queue and marks read;
* keep the message in our local history but don't count as unread. */
@@ -726,7 +725,9 @@ void JoystickUITask::newChannelMsg(const char *channel_name, const char *text,
void JoystickUITask::msgRead(int msgcount)
{
_msgcount = msgcount;
/* Called from CompanionMesh when the BLE-offline-queue drains to 0
* (phone synced); auto-navigate home if the user is sitting on the
* Unread list looking at what just got cleared. */
if (msgcount == 0 && _curr == _unread) {
gotoHomeScreen();
}
@@ -44,7 +44,8 @@ public:
/* Call once after mesh/prefs are loaded */
void begin(BaseChatMesh *mesh, mesh::ZephyrRTCClock *rtc, NodePrefs *prefs);
/* Call from mesh event loop: processes input, renders, calls poll() */
/* Call from mesh event loop: drains the key queue, dispatches lifecycle
* events on display-state transitions, and renders when due. */
void loop();
/* Called from CompanionMesh callbacks (mesh thread context) */
@@ -113,7 +114,6 @@ public:
/* Message / compose accessors */
int getUnreadCount();
int getStoredMsgCount() const;
int getMsgCount() const { return _msgcount; }
int getContactMsgCount(const char *contact_name) const;
bool getContactMsgAt(const char *contact_name, int idx, const char *&out_msg,
uint32_t &out_ts, uint8_t *out_path = nullptr) const;
@@ -145,7 +145,7 @@ public:
NodePrefs *getPrefs() const { return _prefs; }
JoystickDisplay &getDisplay() { return _display; }
/* Battery (updated via ui_set_battery from housekeeping) */
/* Battery cache (updated via ui_set_battery from ui_refresh_battery's render-path call) */
void setCachedBattMilliVolts(uint16_t mv) { _cached_batt_mv = mv; }
/* Radio stats (fed from main companion loop) */
@@ -239,7 +239,6 @@ private:
bool _wake_on_msg;
bool _ble_connected;
bool _ble_enabled;
int _msgcount;
int16_t _noise_floor;
uint32_t _pkt_recv, _pkt_sent, _pkt_errors;
@@ -293,6 +292,5 @@ private:
static struct k_msgq _key_queue;
/* Startup */
uint32_t _started_at;
bool _initialized;
};