Repeater and other power optimizations (#2999)

* End wire if we find no i2c devices

* Set tx-power to 0 on nrf bluetooth shutdown

* Change polling interval of PowerFSM to 100ms instead of 10ms

* Guard 3v3
pull/2998/head
Ben Meadors 2023-12-08 11:13:15 -06:00 zatwierdzone przez GitHub
rodzic 5eac227550
commit abaa37133d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 18 dodań i 7 usunięć

Wyświetl plik

@ -33,7 +33,7 @@ class PowerFSMThread : public OSThread
powerFSM.trigger(EVENT_SHUTDOWN);
}
return 10;
return 100;
}
};

Wyświetl plik

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

Wyświetl plik

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