sforkowany z mirror/meshtastic-firmware
commit
40c63c0615
|
@ -1,3 +1,3 @@
|
|||
|
||||
|
||||
export VERSION=1.1.3
|
||||
export VERSION=1.1.4
|
|
@ -138,19 +138,11 @@ int32_t Power::runOnce()
|
|||
{
|
||||
readPowerStatus();
|
||||
|
||||
#ifdef PMU_IRQ
|
||||
if (pmu_irq) {
|
||||
pmu_irq = false;
|
||||
#ifdef TBEAM_V10
|
||||
// WE no longer use the IRQ line to wake the CPU (due to false wakes from sleep), but we do poll
|
||||
// the IRQ status by reading the registers over I2C
|
||||
axp.readIRQ();
|
||||
|
||||
DEBUG_MSG("pmu irq!\n");
|
||||
|
||||
if (axp.isChargingIRQ()) {
|
||||
DEBUG_MSG("Battery start charging\n");
|
||||
}
|
||||
if (axp.isChargingDoneIRQ()) {
|
||||
DEBUG_MSG("Battery fully charged\n");
|
||||
}
|
||||
if (axp.isVbusRemoveIRQ()) {
|
||||
DEBUG_MSG("USB unplugged\n");
|
||||
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
||||
|
@ -159,6 +151,15 @@ int32_t Power::runOnce()
|
|||
DEBUG_MSG("USB plugged In\n");
|
||||
powerFSM.trigger(EVENT_POWER_CONNECTED);
|
||||
}
|
||||
/*
|
||||
Other things we could check if we cared...
|
||||
|
||||
if (axp.isChargingIRQ()) {
|
||||
DEBUG_MSG("Battery start charging\n");
|
||||
}
|
||||
if (axp.isChargingDoneIRQ()) {
|
||||
DEBUG_MSG("Battery fully charged\n");
|
||||
}
|
||||
if (axp.isBattPlugInIRQ()) {
|
||||
DEBUG_MSG("Battery inserted\n");
|
||||
}
|
||||
|
@ -168,8 +169,8 @@ int32_t Power::runOnce()
|
|||
if (axp.isPEKShortPressIRQ()) {
|
||||
DEBUG_MSG("PEK short button press\n");
|
||||
}
|
||||
*/
|
||||
axp.clearIRQ();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Only read once every 20 seconds once the power status for the app has been initialized
|
||||
|
|
|
@ -118,12 +118,21 @@ static void serialEnter()
|
|||
{
|
||||
setBluetoothEnable(false);
|
||||
screen->setOn(true);
|
||||
screen->print("Using API...\n");
|
||||
}
|
||||
|
||||
static void powerEnter()
|
||||
{
|
||||
screen->setOn(true);
|
||||
setBluetoothEnable(true);
|
||||
screen->print("Powered...\n");
|
||||
}
|
||||
|
||||
static void powerExit()
|
||||
{
|
||||
screen->setOn(true);
|
||||
setBluetoothEnable(true);
|
||||
screen->print("Unpowered...\n");
|
||||
}
|
||||
|
||||
static void onEnter()
|
||||
|
@ -156,7 +165,7 @@ State stateDARK(darkEnter, NULL, NULL, "DARK");
|
|||
State stateSERIAL(serialEnter, NULL, NULL, "SERIAL");
|
||||
State stateBOOT(bootEnter, NULL, NULL, "BOOT");
|
||||
State stateON(onEnter, NULL, NULL, "ON");
|
||||
State statePOWER(powerEnter, NULL, NULL, "POWER");
|
||||
State statePOWER(powerEnter, NULL, powerExit, "POWER");
|
||||
Fsm powerFSM(&stateBOOT);
|
||||
|
||||
void PowerFSM_setup()
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
#define EVENT_POWER_DISCONNECTED 14
|
||||
|
||||
extern Fsm powerFSM;
|
||||
extern State statePOWER;
|
||||
extern State statePOWER, stateSERIAL;
|
||||
|
||||
void PowerFSM_setup();
|
||||
|
|
|
@ -128,7 +128,8 @@ class PowerFSMThread : public OSThread
|
|||
|
||||
/// If we are in power state we force the CPU to wake every 10ms to check for serial characters (we don't yet wake
|
||||
/// cpu for serial rx - FIXME)
|
||||
canSleep = (powerFSM.getState() != &statePOWER);
|
||||
auto state = powerFSM.getState();
|
||||
canSleep = (state != &statePOWER) && (state != &stateSERIAL);
|
||||
|
||||
return 10;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue