until my TBEAM is fixed, leave GPS power on in sleep sometimes

This commit is contained in:
geeksville 2020-02-24 11:21:08 -08:00
parent 0ce1bbb758
commit a3df099f60
5 changed files with 21 additions and 6 deletions

View File

@ -24,6 +24,7 @@ being I have it set at 2 minutes to ensure enough time for a GPS lock from scrat
Items to complete before the first beta release.
* "AXP192 interrupt is not firing, remove this temporary polling of battery state"
* make mesh aware network timing state machine (sync wake windows to gps time)
* turn light sleep on aggressively (while lora is on but BLE off)
* research and implement better mesh algorithm

View File

@ -6,6 +6,7 @@
#include "screen.h"
#include "PowerFSM.h"
#include "GPS.h"
#include "main.h"
static void sdsEnter()
{
@ -28,6 +29,8 @@ static void lsEnter()
delay(10); // Kinda yucky - wait until radio says say we can shutdown (finished in process sends/receives)
gps.prepareSleep(); // abandon in-process parsing
if(!isUSBPowered) // FIXME - temp hack until we can put gps in sleep mode, if we have AC when we go to sleep then leave GPS on
setGPSPower(false); // kill GPS power
}

View File

@ -1,4 +1,6 @@
#pragma once
extern bool axp192_found;
extern bool ssd1306_found;
extern bool ssd1306_found;
extern bool isCharging;
extern bool isUSBPowered;

View File

@ -175,8 +175,8 @@ void axp192Init()
axp.clearIRQ();
#endif
isCharging = axp.isChargeing();
isUSBPowered = axp.isVBUSPlug();
isCharging = axp.isChargeing() ? 1 : 0;
isUSBPowered = axp.isVBUSPlug() ? 1 : 0;
}
else
{
@ -356,11 +356,15 @@ void loop()
DEBUG_MSG("pmu irq!\n");
isCharging = axp.isChargeing();
isUSBPowered = axp.isVBUSPlug();
isCharging = axp.isChargeing() ? 1 : 0;
isUSBPowered = axp.isVBUSPlug() ? 1 : 0;
axp.clearIRQ();
}
// FIXME AXP192 interrupt is not firing, remove this temporary polling of battery state
isCharging = axp.isChargeing() ? 1 : 0;
isUSBPowered = axp.isVBUSPlug() ? 1 : 0;
#endif
}
#endif

View File

@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "screen.h"
#include "mesh-pb-constants.h"
#include "NodeDB.h"
#include "main.h"
#define FONT_HEIGHT 14 // actually 13 for "ariel 10" but want a little extra space
#define FONT_HEIGHT_16 (ArialMT_Plain_16[1] + 1)
@ -442,8 +443,12 @@ void drawDebugInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, i
static char channelStr[20];
snprintf(channelStr, sizeof(channelStr), "%s", channelSettings.name);
// We don't show battery levels yet - for now just lie and show debug info
static char batStr[20];
snprintf(batStr, sizeof(channelStr), "Batt %x%%", (isCharging << 1) + isUSBPowered);
const char *fields[] = {
"Batt 89%",
batStr,
"GPS 75%",
usersStr,
channelStr,