mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-03-30 17:05:52 +00:00
* companion radio: RESP_CODE_END_OF_CONTACTS change
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user