fix: harden CLI and GPS handling

This commit is contained in:
mikecarper committed 2026-08-27 17:59:44 -07:00
1 parent 5a26d4ddd1
commit a0165cb38b
9 files changed
+192 -94

No files matched your search

+2 -2
View File
@@ -576,7 +576,7 @@ void MyMesh::onContactOverwrite(const uint8_t* pub_key) {
ContactInfo* contact = lookupContactByPubKey(pub_key, PUB_KEY_SIZE);
if (contact) scheduleContactWriteAfterRelease(*contact);
_store->deleteBlobByKey(pub_key, PUB_KEY_SIZE); // delete from storage
if (_serial->isConnected()) {
if (_serial != NULL && _serial->isConnected()) {
out_frame[0] = PUSH_CODE_CONTACT_DELETED;
memcpy(&out_frame[1], pub_key, PUB_KEY_SIZE);
_serial->writeFrame(out_frame, 1 + PUB_KEY_SIZE);
@@ -584,7 +584,7 @@ void MyMesh::onContactOverwrite(const uint8_t* pub_key) {
}
void MyMesh::onContactsFull() {
if (_serial->isConnected()) {
if (_serial != NULL && _serial->isConnected()) {
out_frame[0] = PUSH_CODE_CONTACTS_FULL;
_serial->writeFrame(out_frame, 1);
}
+1
View File
@@ -784,6 +784,7 @@ void SensorMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_i
uint8_t temp[166];
char *command = (char *) &data[5];
char *reply = (char *) &temp[5];
*reply = 0;
handleCommand(sender_timestamp, command, reply, i,
packet->getPathHashSize());
+1
View File
@@ -165,6 +165,7 @@ void loop() {
if (len > 0 && command[len - 1] == '\r') { // received complete line
command[len - 1] = 0; // replace newline with C string null terminator
char reply[160];
reply[0] = 0;
the_mesh.handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
if (reply[0]) {
Serial.print(" -> "); Serial.println(reply);