mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-24 01:16:55 +00:00
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
This commit is contained in:
parent
5eac227550
commit
abaa37133d
@ -33,7 +33,7 @@ class PowerFSMThread : public OSThread
|
|||||||
powerFSM.trigger(EVENT_SHUTDOWN);
|
powerFSM.trigger(EVENT_SHUTDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 10;
|
return 100;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
20
src/main.cpp
20
src/main.cpp
@ -432,6 +432,10 @@ void setup()
|
|||||||
auto i2cCount = i2cScanner->countDevices();
|
auto i2cCount = i2cScanner->countDevices();
|
||||||
if (i2cCount == 0) {
|
if (i2cCount == 0) {
|
||||||
LOG_INFO("No I2C devices found\n");
|
LOG_INFO("No I2C devices found\n");
|
||||||
|
Wire.end();
|
||||||
|
#ifdef I2C_SDA1
|
||||||
|
Wire1.end();
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("%i I2C devices found\n", i2cCount);
|
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
|
// but we need to do this after main cpu init (esp32setup), because we need the random seed set
|
||||||
nodeDB.init();
|
nodeDB.init();
|
||||||
|
|
||||||
// If we're taking on the repeater role, use flood router
|
// 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)
|
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||||
router = new FloodingRouter();
|
router = new FloodingRouter();
|
||||||
else
|
#ifdef PIN_3V3_EN
|
||||||
|
digitalWrite(PIN_3V3_EN, LOW);
|
||||||
|
#endif
|
||||||
|
} else
|
||||||
router = new ReliableRouter();
|
router = new ReliableRouter();
|
||||||
|
|
||||||
#if HAS_BUTTON || defined(ARCH_RASPBERRY_PI)
|
#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)
|
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) {
|
if (gps) {
|
||||||
gpsStatus->observe(&gps->newStatus);
|
gpsStatus->observe(&gps->newStatus);
|
||||||
} else {
|
} else {
|
||||||
@ -941,4 +951,4 @@ void loop()
|
|||||||
mainDelay.delay(delayMsec);
|
mainDelay.delay(delayMsec);
|
||||||
}
|
}
|
||||||
// if (didWake) LOG_DEBUG("wake!\n");
|
// if (didWake) LOG_DEBUG("wake!\n");
|
||||||
}
|
}
|
@ -211,6 +211,7 @@ void NRF52Bluetooth::shutdown()
|
|||||||
// Shutdown bluetooth for minimum power draw
|
// Shutdown bluetooth for minimum power draw
|
||||||
LOG_INFO("Disable NRF52 bluetooth\n");
|
LOG_INFO("Disable NRF52 bluetooth\n");
|
||||||
Bluefruit.Advertising.stop();
|
Bluefruit.Advertising.stop();
|
||||||
|
Bluefruit.setTxPower(0); // Minimum power
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NRF52Bluetooth::isConnected()
|
bool NRF52Bluetooth::isConnected()
|
||||||
@ -333,4 +334,4 @@ void NRF52Bluetooth::onPairingCompleted(uint16_t conn_handle, uint8_t auth_statu
|
|||||||
LOG_INFO("BLE pairing failed\n");
|
LOG_INFO("BLE pairing failed\n");
|
||||||
|
|
||||||
screen->stopBluetoothPinScreen();
|
screen->stopBluetoothPinScreen();
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user