diff --git a/src/main.cpp b/src/main.cpp index 28504b554..937f9091a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -263,6 +263,12 @@ void setup() // We need to enable 3.3V periphery in order to scan it pinMode(PIN_3V3_EN, OUTPUT); digitalWrite(PIN_3V3_EN, HIGH); + +#ifndef USE_EINK + // RAK-12039 set pin for Air quality sensor + pinMode(AQ_SET_PIN, OUTPUT); + digitalWrite(AQ_SET_PIN, HIGH); +#endif #endif // Currently only the tbeam has a PMU diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 7c529fe7b..a18d0a7b4 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -304,10 +304,11 @@ void NodeDB::init() int saveWhat = 0; // likewise - we always want the app requirements to come from the running appload - myNodeInfo.min_app_version = 20300; // format is Mmmss (where M is 1+the numeric major number. i.e. 20120 means 1.1.20 - + myNodeInfo.min_app_version = 20300; // format is Mmmss (where M is 1+the numeric major number. i.e. 20120 means 1.1.20 + myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand // Note! We do this after loading saved settings, so that if somehow an invalid nodenum was stored in preferences we won't // keep using that nodenum forever. Crummy guess at our nodenum (but we will check against the nodedb to avoid conflicts) + strncpy(myNodeInfo.firmware_version, optstr(APP_VERSION), sizeof(myNodeInfo.firmware_version)); pickNewNodeNum(); // Set our board type so we can share it with others @@ -362,7 +363,7 @@ void NodeDB::pickNewNodeNum() r = NUM_RESERVED; // don't pick a reserved node number meshtastic_NodeInfo *found; - while ((found = getNode(r))) { + while ((found = getNode(r)) && memcmp(found->user.macaddr, owner.macaddr, sizeof(owner.macaddr))) { NodeNum n = random(NUM_RESERVED, NODENUM_BROADCAST); // try a new random choice LOG_DEBUG("NOTE! Our desired nodenum 0x%x is in use, so trying for 0x%x\n", r, n); r = n; diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index 36ddefeb4..c630aa13b 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -172,6 +172,10 @@ void cpuDeepSleep(uint32_t msecToWake) setBluetoothEnable(false); #ifdef RAK4630 digitalWrite(PIN_3V3_EN, LOW); +#ifndef USE_EINK + // RAK-12039 set pin for Air quality sensor + digitalWrite(AQ_SET_PIN, LOW); +#endif #endif // FIXME, use system off mode with ram retention for key state? // FIXME, use non-init RAM per @@ -197,4 +201,4 @@ void clearBonds() nrf52Bluetooth->setup(); } nrf52Bluetooth->clearBonds(); -} +} \ No newline at end of file diff --git a/variants/rak4631/variant.h b/variants/rak4631/variant.h index 69a77a029..fe9f062c8 100644 --- a/variants/rak4631/variant.h +++ b/variants/rak4631/variant.h @@ -258,6 +258,7 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG #define PIN_ETHERNET_RESET 21 #define PIN_ETHERNET_SS PIN_EINK_CS #define ETH_SPI_PORT SPI1 +#define AQ_SET_PIN 10 #ifdef __cplusplus } @@ -267,4 +268,4 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG * Arduino objects - C++ only *----------------------------------------------------------------------------*/ -#endif +#endif \ No newline at end of file