From d4e65d8607ffd939da090295ecb6563dfadc07b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 8 Oct 2022 11:09:16 +0200 Subject: [PATCH 1/2] 1.0.1 RTC LIB is released on PIO Registry --- variants/m5stack_coreink/platformio.ini | 3 +-- variants/t-echo/platformio.ini | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/variants/m5stack_coreink/platformio.ini b/variants/m5stack_coreink/platformio.ini index 00c44628d..c33187da0 100644 --- a/variants/m5stack_coreink/platformio.ini +++ b/variants/m5stack_coreink/platformio.ini @@ -12,8 +12,7 @@ build_flags = lib_deps = ${esp32_base.lib_deps} zinggjm/GxEPD2@^1.4.9 -# lewisxhe/PCF8563_Library@^1.0.1 // switch to this one when it is released! - https://github.com/lewisxhe/PCF8563_Library.git#fe8cface109f63b5a4fb6abeaf87c6de0faa24c6 + lewisxhe/PCF8563_Library@^1.0.1 board_build.f_cpu = 240000000L upload_protocol = esptool upload_port = /dev/ttyACM* diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index 3582f7ed9..201c14657 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -14,6 +14,5 @@ lib_deps = ${nrf52840_base.lib_deps} https://github.com/meshtastic/GxEPD2#afce87a97dda1ac31d8a28dc8fa7c6f55dc96a61 adafruit/Adafruit BusIO@^1.13.2 -# lewisxhe/PCF8563_Library@^1.0.1 // switch to this one when it is released! - https://github.com/lewisxhe/PCF8563_Library.git#fe8cface109f63b5a4fb6abeaf87c6de0faa24c6 + lewisxhe/PCF8563_Library@^1.0.1 ;upload_protocol = fs From c9398e7b8af0bc64017b11e1be5d1cc0fb0e9521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 8 Oct 2022 11:20:54 +0200 Subject: [PATCH 2/2] - prevent crash when no messages defined - remove debug print --- src/modules/CannedMessageModule.cpp | 38 +++++++++++++---------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 2a8c793c5..b62aa2450 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -203,7 +203,7 @@ void CannedMessageModule::sendText(NodeNum dest, const char *message, bool wantR p->decoded.payload.size++; } - DEBUG_MSG("Sending message id=%d, msg=%.*s\n", p->id, p->decoded.payload.size, p->decoded.payload.bytes); + DEBUG_MSG("Sending message id=%d, dest=%x, msg=%.*s\n", p->id, p->to, p->decoded.payload.size, p->decoded.payload.bytes); service.sendToMesh(p); } @@ -266,19 +266,23 @@ int32_t CannedMessageModule::runOnce() e.frameChanged = true; this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE; } else if (this->runState == CANNED_MESSAGE_RUN_STATE_ACTION_UP) { - this->currentMessageIndex = getPrevIndex(); - this->freetext = ""; // clear freetext - this->cursor = 0; - this->destSelect = false; - this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE; - DEBUG_MSG("MOVE UP (%d):%s\n", this->currentMessageIndex, this->getCurrentMessage()); + if (this->messagesCount > 0) { + this->currentMessageIndex = getPrevIndex(); + this->freetext = ""; // clear freetext + this->cursor = 0; + this->destSelect = false; + this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE; + DEBUG_MSG("MOVE UP (%d):%s\n", this->currentMessageIndex, this->getCurrentMessage()); + } } else if (this->runState == CANNED_MESSAGE_RUN_STATE_ACTION_DOWN) { - this->currentMessageIndex = this->getNextIndex(); - this->freetext = ""; // clear freetext - this->cursor = 0; - this->destSelect = false; - this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE; - DEBUG_MSG("MOVE DOWN (%d):%s\n", this->currentMessageIndex, this->getCurrentMessage()); + if (this->messagesCount > 0) { + this->currentMessageIndex = this->getNextIndex(); + this->freetext = ""; // clear freetext + this->cursor = 0; + this->destSelect = false; + this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE; + DEBUG_MSG("MOVE DOWN (%d):%s\n", this->currentMessageIndex, this->getCurrentMessage()); + } } else if (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT) { e.frameChanged = true; switch (this->payload) { @@ -287,19 +291,15 @@ int32_t CannedMessageModule::runOnce() size_t numNodes = nodeDB.getNumNodes(); if(this->dest == NODENUM_BROADCAST) { this->dest = nodeDB.getNodeNum(); - DEBUG_MSG("Replacing NodeNum_BROADCAST with %x\n",nodeDB.getNodeNum()); } for (int i = 0; i < numNodes; i++) { - DEBUG_MSG("Considering %x\n",nodeDB.getNodeByIndex(i)->num); if (nodeDB.getNodeByIndex(i)->num == this->dest) { - DEBUG_MSG("Match - advance %i-\n",i); this->dest = (i > 0) ? nodeDB.getNodeByIndex(i-1)->num : nodeDB.getNodeByIndex(numNodes-1)->num; break; } } if(this->dest == nodeDB.getNodeNum()) { this->dest = NODENUM_BROADCAST; - DEBUG_MSG("Replacing %x with NodeNum_BROADCAST\n",nodeDB.getNodeNum()); } }else{ if (this->cursor > 0) { @@ -312,19 +312,15 @@ int32_t CannedMessageModule::runOnce() size_t numNodes = nodeDB.getNumNodes(); if(this->dest == NODENUM_BROADCAST) { this->dest = nodeDB.getNodeNum(); - DEBUG_MSG("Replacing NodeNum_BROADCAST with %x\n",nodeDB.getNodeNum()); } for (int i = 0; i < numNodes; i++) { - DEBUG_MSG("Considering %x\n",nodeDB.getNodeByIndex(i)->num); if (nodeDB.getNodeByIndex(i)->num == this->dest) { - DEBUG_MSG("Match - advance %i+\n",i); this->dest = (i < numNodes-1) ? nodeDB.getNodeByIndex(i+1)->num : nodeDB.getNodeByIndex(0)->num; break; } } if(this->dest == nodeDB.getNodeNum()) { this->dest = NODENUM_BROADCAST; - DEBUG_MSG("Replacing %x with NodeNum_BROADCAST\n",nodeDB.getNodeNum()); } }else{ if (this->cursor < this->freetext.length()) {