TDeckBoard.cpp — both * 3 / 2 thresholds changed to > designCapacity_mAh, so FCC=3000 with DC=2500 now triggers the Qmax + stored FCC correction.

SerialBLEInterface.cpp — added esp_bt.h include and three esp_ble_tx_power_set calls at +9 dBm after BLEDevice::init(), covering default, advertising, and scan power types.

MyMesh.h — FIRMWARE_VER_CODE bumped from 10 → 11.
MyMesh.cpp — The RESP_CODE_DEVICE_INFO frame construction now:
Byte 2: sends 0xFF (sentinel) when MAX_CONTACTS > 510, otherwise the normal MAX_CONTACTS / 2. Older apps interpret 0xFF as 510 contacts — completely harmless.
Bytes 80-81 (new, appended after the version string): uint16_t little-endian with the true MAX_CONTACTS value. Apps that understand v11+ read it here. Apps < v11 ignore trailing bytes — the BLE/serial frame protocol is length-delimited, so extra bytes at the tail are safe.

platformio.ini — Both BLE builds (meck_audio_ble, meck_4g_ble) bumped from 510 → 2000.

mymesh.cpp: writeContactRespFrame return type change (return _serial->writeFrame() result)
checkSerialInterface() batch-fill loop.
This commit is contained in:
pelgraine
2026-04-07 20:04:36 +10:00
parent 8aa0f0388e
commit 595f0073f9
8 changed files with 65 additions and 547 deletions
+22 -13
View File
@@ -166,7 +166,7 @@ void MyMesh::writeDisabledFrame() {
_serial->writeFrame(buf, 1);
}
void MyMesh::writeContactRespFrame(uint8_t code, const ContactInfo &contact) {
size_t MyMesh::writeContactRespFrame(uint8_t code, const ContactInfo &contact) {
int i = 0;
out_frame[i++] = code;
memcpy(&out_frame[i], contact.id.pub_key, PUB_KEY_SIZE);
@@ -186,7 +186,7 @@ void MyMesh::writeContactRespFrame(uint8_t code, const ContactInfo &contact) {
i += 4;
memcpy(&out_frame[i], &contact.lastmod, 4);
i += 4;
_serial->writeFrame(out_frame, i);
return _serial->writeFrame(out_frame, i);
}
void MyMesh::updateContactFromFrame(ContactInfo &contact, uint32_t& last_mod, const uint8_t *frame, int len) {
@@ -3142,20 +3142,29 @@ void MyMesh::checkSerialInterface() {
} else if (_iter_started // check if our ContactsIterator is 'running'
&& !_serial->isWriteBusy() // don't spam the Serial Interface too quickly!
) {
// Batch-fill: queue multiple contacts per loop iteration so the BLE
// send queue stays saturated during sync. writeFrame() returns 0
// when the queue is full, which naturally throttles us.
ContactInfo contact;
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
bool done = false;
int queued = 0;
while (!done && queued < 8) { // up to 8 per iteration to avoid starving loop()
if (_iter.hasNext(this, contact)) {
if (contact.lastmod > _iter_filter_since) { // apply the 'since' filter
if (writeContactRespFrame(RESP_CODE_CONTACT, contact) == 0) break; // queue full
queued++;
if (contact.lastmod > _most_recent_lastmod) {
_most_recent_lastmod = contact.lastmod;
}
}
} else { // EOF
out_frame[0] = RESP_CODE_END_OF_CONTACTS;
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;
done = true;
}
} else { // EOF
out_frame[0] = RESP_CODE_END_OF_CONTACTS;
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;
}
//} else if (!_serial->isWriteBusy()) {
// checkConnections(); // TODO - deprecate the 'Connections' stuff
+4 -4
View File
@@ -5,14 +5,14 @@
#include "AbstractUITask.h"
/*------------ Frame Protocol --------------*/
#define FIRMWARE_VER_CODE 10
#define FIRMWARE_VER_CODE 11
#ifndef FIRMWARE_BUILD_DATE
#define FIRMWARE_BUILD_DATE "31 March 2026"
#define FIRMWARE_BUILD_DATE "7 April 2026"
#endif
#ifndef FIRMWARE_VERSION
#define FIRMWARE_VERSION "Meck v1.6"
#define FIRMWARE_VERSION "Meck v1.6.1"
#endif
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
@@ -243,7 +243,7 @@ private:
void writeOKFrame();
void writeErrFrame(uint8_t err_code);
void writeDisabledFrame();
void writeContactRespFrame(uint8_t code, const ContactInfo &contact);
size_t writeContactRespFrame(uint8_t code, const ContactInfo &contact);
void updateContactFromFrame(ContactInfo &contact, uint32_t& last_mod, const uint8_t *frame, int len);
void addToOfflineQueue(const uint8_t frame[], int len);
int getFromOfflineQueue(uint8_t frame[]);