diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 53405e757..601b83f9c 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -97,7 +97,7 @@ static uint16_t displayWidth, displayHeight; #define SCREEN_WIDTH displayWidth #define SCREEN_HEIGHT displayHeight -#if defined(USE_EINK) || defined(ILI9341_DRIVER) +#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) // The screen is bigger so use bigger fonts #define FONT_SMALL ArialMT_Plain_16 #define FONT_MEDIUM ArialMT_Plain_24 diff --git a/src/main.cpp b/src/main.cpp index 95da04014..c3f892bce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -233,6 +233,8 @@ void setup() delay(1); #endif + // We need to scan here to decide if we have a screen for nodeDB.init() + scanI2Cdevice(); #ifdef RAK4630 // scanEInkDevice(); #endif @@ -273,10 +275,12 @@ void setup() power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration /* - * Move the scanning I2C device to the back of power initialization. - * Some boards need to be powered on to correctly scan to the device address, such as t-beam-s3-core + * Repeat the scanning for I2C devices after power initialization. + * Boards with an PMU need to be powered on to correctly scan to the device address, such as t-beam-s3-core */ - scanI2Cdevice(); + if ((HW_VENDOR == HardwareModel_LILYGO_TBEAM_S3_CORE) || (HW_VENDOR == HardwareModel_TBEAM)) { + scanI2Cdevice(); + } // Init our SPI controller (must be before screen and lora) initSPI(); diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index fca3af305..92115d127 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -699,11 +699,23 @@ NodeInfo *NodeDB::getOrCreateNode(NodeNum n) if (!info) { if (*numNodes >= MAX_NUM_NODES) { - screen->print("error: node_db full!\n"); - DEBUG_MSG("ERROR! could not create new node, node_db is full! (%d nodes)", *numNodes); - return NULL; + screen->print("warning: node_db full! erasing oldest entry\n"); + // look for oldest node and erase it + uint32_t oldest = UINT32_MAX; + int oldestIndex = -1; + for (int i = 0; i < *numNodes; i++) { + if (nodes[i].last_heard < oldest) { + oldest = nodes[i].last_heard; + oldestIndex = i; + } + } + // Shove the remaining nodes down the chain + for (int i = oldestIndex; i < *numNodes - 1; i++) { + nodes[i] = nodes[i + 1]; + } + (*numNodes)--; } - // add the node + // add the node at the end info = &nodes[(*numNodes)++]; // everything is missing except the nodenum diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 54804859b..a21b63779 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -11,7 +11,7 @@ #include "graphics/fonts/OLEDDisplayFontsRU.h" #endif -#if defined(USE_EINK) || defined(ILI9341_DRIVER) +#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) // The screen is bigger so use bigger fonts #define FONT_SMALL ArialMT_Plain_16 #define FONT_MEDIUM ArialMT_Plain_24 diff --git a/src/platform/portduino/SimRadio.cpp b/src/platform/portduino/SimRadio.cpp index ccfaa3b03..b3af114e5 100644 --- a/src/platform/portduino/SimRadio.cpp +++ b/src/platform/portduino/SimRadio.cpp @@ -171,6 +171,8 @@ void SimRadio::onNotify(uint32_t notification) // Packet has been sent, count it toward our TX airtime utilization. uint32_t xmitMsec = getPacketTime(txp); airTime->logAirtime(TX_LOG, xmitMsec); + + delay(xmitMsec); // Model the time it is busy sending completeSending(); } } @@ -207,6 +209,9 @@ void SimRadio::startSend(MeshPacket * txp) void SimRadio::startReceive(MeshPacket *p) { isReceiving = true; + size_t length = getPacketLength(p); + uint32_t xmitMsec = getPacketTime(length); + delay(xmitMsec); // Model the time it is busy receiving handleReceiveInterrupt(p); }