From a5af1b5bcd12e25339c8d80133a2be725f1667b0 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Thu, 25 Sep 2025 09:39:11 +1000 Subject: [PATCH] * companion: disabled processing/sending of keep_alive packets (deprecated) * FIRMWARE_VER_LEVEL now moved to end of response payloads --- examples/companion_radio/MyMesh.cpp | 4 ++-- examples/simple_repeater/MyMesh.cpp | 5 +++-- examples/simple_room_server/MyMesh.cpp | 8 ++++---- examples/simple_sensor/SensorMesh.cpp | 5 +++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp index 509b0c63..a7f4e965 100644 --- a/examples/companion_radio/MyMesh.cpp +++ b/examples/companion_radio/MyMesh.cpp @@ -1690,8 +1690,8 @@ void MyMesh::checkSerialInterface() { _serial->writeFrame(out_frame, 5); _iter_started = false; } - } else if (!_serial->isWriteBusy()) { - checkConnections(); + //} else if (!_serial->isWriteBusy()) { + // checkConnections(); // TODO - deprecate the 'Connections' stuff } } diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index 55d87580..5ae05ffa 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -123,12 +123,13 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr uint32_t now = getRTCClock()->getCurrentTimeUnique(); memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp reply_data[4] = RESP_SERVER_LOGIN_OK; - reply_data[5] = FIRMWARE_VER_LEVEL; // Legacy: was recommended keep-alive interval (secs / 16) + reply_data[5] = 0; // Legacy: was recommended keep-alive interval (secs / 16) reply_data[6] = client->isAdmin() ? 1 : 0; reply_data[7] = client->permissions; getRNG()->random(&reply_data[8], 4); // random blob to help packet-hash uniqueness + reply_data[12] = FIRMWARE_VER_LEVEL; // New field - return 12; // reply length + return 13; // reply length } int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t *payload, size_t payload_len) { diff --git a/examples/simple_room_server/MyMesh.cpp b/examples/simple_room_server/MyMesh.cpp index dc3a66a9..398938e6 100644 --- a/examples/simple_room_server/MyMesh.cpp +++ b/examples/simple_room_server/MyMesh.cpp @@ -336,22 +336,22 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp // TODO: maybe reply with count of messages waiting to be synced for THIS client? reply_data[4] = RESP_SERVER_LOGIN_OK; - reply_data[5] = FIRMWARE_VER_LEVEL; // Legacy: was recommended keep-alive interval (secs / 16) + reply_data[5] = 0; // Legacy: was recommended keep-alive interval (secs / 16) reply_data[6] = (client->isAdmin() ? 1 : (client->permissions == 0 ? 2 : 0)); // LEGACY: reply_data[7] = getUnsyncedCount(client); reply_data[7] = client->permissions; // NEW getRNG()->random(&reply_data[8], 4); // random blob to help packet-hash uniqueness - // LEGACY: memcpy(&reply_data[8], "OK", 2); + reply_data[12] = FIRMWARE_VER_LEVEL; // New field next_push = futureMillis(PUSH_NOTIFY_DELAY_MILLIS); // delay next push, give RESPONSE packet time to arrive first if (packet->isRouteFlood()) { // let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response mesh::Packet *path = createPathReturn(sender, client->shared_secret, packet->path, packet->path_len, - PAYLOAD_TYPE_RESPONSE, reply_data, 12); + PAYLOAD_TYPE_RESPONSE, reply_data, 13); if (path) sendFlood(path, SERVER_RESPONSE_DELAY); } else { - mesh::Packet *reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, client->shared_secret, reply_data, 12); + mesh::Packet *reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, client->shared_secret, reply_data, 13); if (reply) { if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT sendDirect(reply, client->out_path, client->out_path_len, SERVER_RESPONSE_DELAY); diff --git a/examples/simple_sensor/SensorMesh.cpp b/examples/simple_sensor/SensorMesh.cpp index 157b2fb3..ba41ca45 100644 --- a/examples/simple_sensor/SensorMesh.cpp +++ b/examples/simple_sensor/SensorMesh.cpp @@ -366,12 +366,13 @@ uint8_t SensorMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* uint32_t now = getRTCClock()->getCurrentTimeUnique(); memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp reply_data[4] = RESP_SERVER_LOGIN_OK; - reply_data[5] = FIRMWARE_VER_LEVEL; + reply_data[5] = 0; reply_data[6] = client->isAdmin() ? 1 : 0; reply_data[7] = client->permissions; getRNG()->random(&reply_data[8], 4); // random blob to help packet-hash uniqueness + reply_data[12] = FIRMWARE_VER_LEVEL; - return 12; // reply length + return 13; // reply length } void SensorMesh::handleCommand(uint32_t sender_timestamp, char* command, char* reply) {