fix text message display when new text arrives

The problem was we were pulsing the display power briefly down while
reentering the ON state (because the ON states exit rule turned it off).
Instead we now just turn off the screen on entry to DARK or LS states
1.2-legacy
geeksville 2020-03-04 16:46:57 -08:00
rodzic 2ce95ed2ce
commit 951f5d11d5
5 zmienionych plików z 23 dodań i 17 usunięć

10
TODO.md
Wyświetl plik

@ -2,12 +2,6 @@
Items to complete soon (next couple of alpha releases).
* (fixed I think) text messages are not showing on local screen if screen was on
* (needs testing) fixed the following during a plane flight:
Have state machine properly enter deep sleep based on loss of mesh and phone comms.
Default to enter deep sleep if no LORA received for two hours (indicates user has probably left the mesh).
* lower wait_bluetooth_secs to 30 seconds once we have the GPS power on (but GPS in sleep mode) across light sleep. For the time
being I have it set at 2 minutes to ensure enough time for a GPS lock from scratch.
@ -192,3 +186,7 @@ Items after the first final candidate release.
until the phone pulls those packets. Ever so often power on bluetooth just so we can see if the phone wants to send some packets. Possibly might need ULP processor to help with this wake process.
* do hibernation mode to get power draw down to 2.5uA https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/
* fix GPS.zeroOffset calculation it is wrong
* (needs testing) fixed the following during a plane flight:
Have state machine properly enter deep sleep based on loss of mesh and phone comms.
Default to enter deep sleep if no LORA received for two hours (indicates user has probably left the mesh).
* (fixed I think) text messages are not showing on local screen if screen was on

Wyświetl plik

@ -212,7 +212,7 @@ class MySecurity : public BLESecurityCallbacks
}
// Remove our custom screen
screen_set_frames();
screen.setFrames();
}
};

Wyświetl plik

@ -25,6 +25,8 @@ static void sdsEnter()
static void lsEnter()
{
screen.setOn(false);
while (!service.radio.rf95.canSleep())
delay(10); // Kinda yucky - wait until radio says say we can shutdown (finished in process sends/receives)
@ -80,6 +82,7 @@ static void lsExit()
static void nbEnter()
{
screen.setOn(false);
setBluetoothEnable(false);
// FIXME - check if we already have packets for phone and immediately trigger EVENT_PACKETS_FOR_PHONE
@ -96,10 +99,7 @@ static void onEnter()
setBluetoothEnable(true);
}
static void onExit()
{
screen.setOn(false);
}
static void wakeForPing()
{
}
@ -113,7 +113,7 @@ State stateSDS(sdsEnter, NULL, NULL, "SDS");
State stateLS(lsEnter, lsIdle, lsExit, "LS");
State stateNB(nbEnter, NULL, NULL, "NB");
State stateDARK(darkEnter, NULL, NULL, "DARK");
State stateON(onEnter, NULL, onExit, "ON");
State stateON(onEnter, NULL, NULL, "ON");
Fsm powerFSM(&stateDARK);
void PowerFSM_setup()

Wyświetl plik

@ -140,6 +140,7 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
{
MeshPacket &mp = devicestate.rx_text_message;
NodeInfo *node = nodeDB.getNode(mp.from);
// DEBUG_MSG("drawing text message from 0x%x: %s\n", mp.from, mp.payload.variant.data.payload.bytes);
// Demo for drawStringMaxWidth:
// with the third parameter you can define the width after which words will be wrapped.
@ -508,11 +509,14 @@ void Screen::setOn(bool on)
{
if (on)
{
DEBUG_MSG("Turning on screen\n");
dispdev.displayOn();
setPeriod(1); // redraw ASAP
}
else
else {
DEBUG_MSG("Turning off screen\n");
dispdev.displayOff();
}
screenOn = on;
}
}
@ -630,7 +634,7 @@ void Screen::doTask()
if (millis() > 3 * 1000) // we show the boot screen for a few seconds only
{
showingBootScreen = false;
screen_set_frames();
setFrames();
}
}
else // standard screen loop handling ehre
@ -638,7 +642,7 @@ void Screen::doTask()
// If the # nodes changes, we need to regen our list of screens
if (nodeDB.updateGUI || nodeDB.updateTextMessage)
{
screen_set_frames();
setFrames();
nodeDB.updateGUI = false;
nodeDB.updateTextMessage = false;
}
@ -674,7 +678,7 @@ void screen_start_bluetooth(uint32_t pin)
}
// restore our regular frame list
void screen_set_frames()
void Screen::setFrames()
{
DEBUG_MSG("showing standard frames\n");

Wyświetl plik

@ -35,6 +35,10 @@ public:
/// Handle a button press
void onPress();
/// Rebuilt our list of screens
void setFrames();
private:
};
extern Screen screen;