mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-01 21:08:19 +00:00
companion: scope joystick-only state to joystick builds
- #ifdef-gate _pending_joystick_{ping,admin}_tag fields + setters
under CONFIG_ZEPHCORE_UI_DESIGN_JOYSTICK (saves 8 bytes per
CompanionMesh instance on button-UI builds)
- gate logTx ui_notify_packet_sent() to joystick builds only;
was firing on every TX for any UI variant (dead code on button UI)
- drop redundant _pending_login manual set in CMD_SEND_LOGIN;
BaseChatMesh::sendLogin's onLoginSent hook owns it now, just
clear the other pending fields explicitly
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user