diff --git a/src/PowerFSMThread.h b/src/PowerFSMThread.h index 541522f43..b757f3abb 100644 --- a/src/PowerFSMThread.h +++ b/src/PowerFSMThread.h @@ -33,7 +33,7 @@ class PowerFSMThread : public OSThread powerFSM.trigger(EVENT_SHUTDOWN); } - return 10; + return 100; } }; diff --git a/src/main.cpp b/src/main.cpp index b3671c020..c8fc61e4c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -432,6 +432,10 @@ void setup() auto i2cCount = i2cScanner->countDevices(); if (i2cCount == 0) { LOG_INFO("No I2C devices found\n"); + Wire.end(); +#ifdef I2C_SDA1 + Wire1.end(); +#endif } else { LOG_INFO("%i I2C devices found\n", i2cCount); } @@ -576,10 +580,13 @@ void setup() // but we need to do this after main cpu init (esp32setup), because we need the random seed set nodeDB.init(); - // If we're taking on the repeater role, use flood router - if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) + // If we're taking on the repeater role, use flood router and turn off 3V3_S rail because peripherals are not needed + if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) { router = new FloodingRouter(); - else +#ifdef PIN_3V3_EN + digitalWrite(PIN_3V3_EN, LOW); +#endif + } else router = new ReliableRouter(); #if HAS_BUTTON || defined(ARCH_RASPBERRY_PI) @@ -653,7 +660,10 @@ void setup() readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time) - gps = GPS::createGps(); + // If we're taking on the repeater role, ignore GPS + if (config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) { + gps = GPS::createGps(); + } if (gps) { gpsStatus->observe(&gps->newStatus); } else { @@ -941,4 +951,4 @@ void loop() mainDelay.delay(delayMsec); } // if (didWake) LOG_DEBUG("wake!\n"); -} +} \ No newline at end of file diff --git a/src/platform/nrf52/NRF52Bluetooth.cpp b/src/platform/nrf52/NRF52Bluetooth.cpp index c29739542..dd81929c8 100644 --- a/src/platform/nrf52/NRF52Bluetooth.cpp +++ b/src/platform/nrf52/NRF52Bluetooth.cpp @@ -211,6 +211,7 @@ void NRF52Bluetooth::shutdown() // Shutdown bluetooth for minimum power draw LOG_INFO("Disable NRF52 bluetooth\n"); Bluefruit.Advertising.stop(); + Bluefruit.setTxPower(0); // Minimum power } bool NRF52Bluetooth::isConnected() @@ -333,4 +334,4 @@ void NRF52Bluetooth::onPairingCompleted(uint16_t conn_handle, uint8_t auth_statu LOG_INFO("BLE pairing failed\n"); screen->stopBluetoothPinScreen(); -} +} \ No newline at end of file