From 5523daad9d9fd664fa800e7f21078078f8f2ea04 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Sat, 1 Feb 2025 17:04:26 +1100 Subject: [PATCH] * companion radio: RESP_CODE_END_OF_CONTACTS change --- examples/companion_radio/main.cpp | 8 +++++++- examples/simple_repeater/main.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index d67a074a..737ead06 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -132,6 +132,7 @@ class MyMesh : public BaseChatMesh { unsigned long last_msg_sent; ContactsIterator _iter; uint32_t _iter_filter_since; + uint32_t _most_recent_lastmod; bool _iter_started; uint8_t cmd_frame[MAX_FRAME_SIZE+1]; uint8_t out_frame[MAX_FRAME_SIZE+1]; @@ -513,6 +514,7 @@ public: // start iterator _iter = startContactsIterator(); _iter_started = true; + _most_recent_lastmod = 0; } } else if (cmd_frame[0] == CMD_SET_ADVERT_NAME && len >= 2) { int nlen = len - 1; @@ -610,10 +612,14 @@ public: if (_iter.hasNext(this, contact)) { if (contact.lastmod > _iter_filter_since) { // apply the 'since' filter writeContactRespFrame(RESP_CODE_CONTACT, contact); + if (contact.lastmod > _most_recent_lastmod) { + _most_recent_lastmod = contact.lastmod; // save for the RESP_CODE_END_OF_CONTACTS frame + } } } else { // EOF out_frame[0] = RESP_CODE_END_OF_CONTACTS; - _serial->writeFrame(out_frame, 1); + memcpy(&out_frame[1], &_most_recent_lastmod, 4); // include the most recent lastmod, so app can update their 'since' + _serial->writeFrame(out_frame, 5); _iter_started = false; } } diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index 74027d4b..230b15f8 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -19,7 +19,7 @@ /* ------------------------------ Config -------------------------------- */ -#define FIRMWARE_VER_TEXT "v2 (build: 31 Jan 2025)" +#define FIRMWARE_VER_TEXT "v2 (build: 1 Feb 2025)" #ifndef LORA_FREQ #define LORA_FREQ 915.0