diff --git a/zephcore/app/CompanionMesh.cpp b/zephcore/app/CompanionMesh.cpp index f174637..09b6d1a 100644 --- a/zephcore/app/CompanionMesh.cpp +++ b/zephcore/app/CompanionMesh.cpp @@ -195,8 +195,10 @@ CompanionMesh::CompanionMesh(mesh::Radio &radio, mesh::MillisecondClock &ms, mes _pending_telemetry = 0; _pending_discovery = 0; _pending_req = 0; +#if IS_ENABLED(CONFIG_ZEPHCORE_UI_DESIGN_JOYSTICK) _pending_joystick_ping_tag = 0; _pending_joystick_admin_tag = 0; +#endif _pending_channel_head = 0; _pending_channel_tail = 0; _pending_channel_count = 0; @@ -1077,7 +1079,7 @@ uint8_t CompanionMesh::onContactRequest(const ContactInfo &contact, uint32_t sen void CompanionMesh::logTx(mesh::Packet *, int) { -#if ZEPHCORE_HAS_UI_TASK +#if IS_ENABLED(CONFIG_ZEPHCORE_UI_DESIGN_JOYSTICK) ui_notify_packet_sent(); #endif } @@ -2428,8 +2430,9 @@ bool CompanionMesh::handleProtocolFrame(const uint8_t *data, size_t len) int result = sendLogin(*contact, password, est_timeout); LOG_DBG("CMD_SEND_LOGIN: sendLogin returned %d, est_timeout=%u", result, est_timeout); if (result != MSG_SEND_FAILED) { - clearPendingReqs(); - memcpy(&_pending_login, contact->id.pub_key, 4); // match in onContactResponse() + /* _pending_login was set by onLoginSent (BaseChatMesh::sendLogin hook); + * clear the other pending fields manually — clearPendingReqs() would wipe it. */ + _pending_status = _pending_telemetry = _pending_discovery = _pending_req = 0; LOG_DBG("CMD_SEND_LOGIN: _pending_login set to %08x", _pending_login); uint8_t rsp[10]; rsp[0] = PACKET_SENT; diff --git a/zephcore/app/CompanionMesh.h b/zephcore/app/CompanionMesh.h index eb79ad9..a04af8d 100644 --- a/zephcore/app/CompanionMesh.h +++ b/zephcore/app/CompanionMesh.h @@ -318,8 +318,10 @@ private: uint32_t _pending_telemetry; uint32_t _pending_discovery; uint32_t _pending_req; +#ifdef CONFIG_ZEPHCORE_UI_DESIGN_JOYSTICK uint32_t _pending_joystick_ping_tag; /* tag-based match, checked before pubkey-based _pending_status */ uint32_t _pending_joystick_admin_tag; /* same protection for admin binary requests */ +#endif /* Lazy contacts/channels write - batches rapid updates */ int64_t _dirty_contacts_expiry; @@ -346,12 +348,14 @@ private: * joystick ping is independent of BLE request state. */ } +#ifdef CONFIG_ZEPHCORE_UI_DESIGN_JOYSTICK public: void setJoystickPingTag(uint32_t tag) { _pending_joystick_ping_tag = tag; } void clearJoystickPingTag() { _pending_joystick_ping_tag = 0; } void setJoystickAdminTag(uint32_t tag) { _pending_joystick_admin_tag = tag; } void clearJoystickAdminTag() { _pending_joystick_admin_tag = 0; } private: +#endif bool writeFrame(const uint8_t *data, size_t len); void sendPacketOk();