Merge branch 'master' into ota

This commit is contained in:
Sacha Weatherstone 2022-10-09 16:44:24 +10:00 committed by GitHub
commit a17c40ad09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 9 deletions

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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);
}