mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-24 05:50:16 +00:00
add a real BOOT state, to avoid glitch from redrawing bootscreen twice
also its the right thing to do ;-)
This commit is contained in:
parent
0d94458c4e
commit
53765298e1
@ -25,7 +25,7 @@ static void sdsEnter()
|
||||
|
||||
static void lsEnter()
|
||||
{
|
||||
DEBUG_MSG("lsEnter begin\n");
|
||||
DEBUG_MSG("lsEnter begin, ls_secs=%u\n", radioConfig.preferences.ls_secs);
|
||||
screen.setOn(false);
|
||||
|
||||
while (!service.radio.rf95.canSleep())
|
||||
@ -124,16 +124,23 @@ static void screenPress()
|
||||
screen.onPress();
|
||||
}
|
||||
|
||||
|
||||
static void bootEnter() {
|
||||
}
|
||||
|
||||
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 stateBOOT(bootEnter , NULL, NULL, "BOOT");
|
||||
State stateON(onEnter, NULL, NULL, "ON");
|
||||
Fsm powerFSM(&stateDARK);
|
||||
Fsm powerFSM(&stateBOOT);
|
||||
|
||||
void PowerFSM_setup()
|
||||
{
|
||||
powerFSM.add_transition(&stateDARK, &stateON, EVENT_BOOT, NULL, "Boot");
|
||||
powerFSM.add_timed_transition(&stateBOOT, &stateON, 3 * 1000, NULL,
|
||||
"boot timeout");
|
||||
|
||||
powerFSM.add_transition(&stateLS, &stateDARK, EVENT_WAKE_TIMER, wakeForPing, "Wake timer");
|
||||
|
||||
// Note we don't really use this transition, because when we wake from light sleep we _always_ transition to NB and then it
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define EVENT_RECEIVED_PACKET 3
|
||||
#define EVENT_PACKET_FOR_PHONE 4
|
||||
#define EVENT_RECEIVED_TEXT_MSG 5
|
||||
#define EVENT_BOOT 6
|
||||
// #define EVENT_BOOT 6 // now done with a timed transition
|
||||
#define EVENT_BLUETOOTH_PAIR 7
|
||||
#define EVENT_NODEDB_UPDATED 8 // NodeDB has a big enough change that we think you should turn on the screen
|
||||
#define EVENT_CONTACT_FROM_PHONE 9 // the phone just talked to us over bluetooth
|
||||
|
13
src/main.cpp
13
src/main.cpp
@ -243,18 +243,21 @@ void setup()
|
||||
if (ssd1306_found)
|
||||
screen.setup();
|
||||
|
||||
screen.showBootscreen();
|
||||
|
||||
// Now that the screen is on, show our bootscreen
|
||||
screen_print("Started...\n");
|
||||
|
||||
// Init GPS
|
||||
gps.setup();
|
||||
|
||||
screen_print("Started...\n");
|
||||
|
||||
service.init();
|
||||
|
||||
// This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values
|
||||
PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS
|
||||
|
||||
// setBluetoothEnable(false); we now don't start bluetooth until we enter the proper state
|
||||
setCPUFast(false); // 80MHz is fine for our slow peripherals
|
||||
|
||||
PowerFSM_setup();
|
||||
powerFSM.trigger(EVENT_BOOT); // transition to ON, FIXME, only do this for cold boots, not waking from SDS
|
||||
}
|
||||
|
||||
void initBluetooth()
|
||||
|
@ -57,7 +57,7 @@ Screen screen;
|
||||
static bool showingBluetooth;
|
||||
|
||||
/// If set to true (possibly from an ISR), we should turn on the screen the next time our idle loop runs.
|
||||
static bool showingBootScreen = true; // start by showing the bootscreen
|
||||
static bool showingBootScreen = false; // start by showing the bootscreen
|
||||
|
||||
bool Screen::isOn() { return screenOn; }
|
||||
|
||||
@ -584,7 +584,7 @@ void Screen::setup()
|
||||
// Scroll buffer
|
||||
dispdev.setLogBuffer(3, 32);
|
||||
|
||||
setOn(true); // update our screenOn bool
|
||||
setOn(false); // start with the screen off
|
||||
|
||||
#ifdef BICOLOR_DISPLAY
|
||||
dispdev.flipScreenVertically(); // looks better without this on lora32
|
||||
@ -593,10 +593,22 @@ void Screen::setup()
|
||||
// dispdev.setFont(Custom_ArialMT_Plain_10);
|
||||
|
||||
ui.disableAutoTransition(); // we now require presses
|
||||
ui.update(); // force an immediate draw of the bootscreen, because on some ssd1306 clones, the first draw command is discarded
|
||||
#endif
|
||||
}
|
||||
|
||||
void Screen::showBootscreen() {
|
||||
if(!disp)
|
||||
return;
|
||||
|
||||
showingBootScreen = true;
|
||||
setOn(true);
|
||||
|
||||
// Add frames - we subtract one from the framecount so there won't be a visual glitch when we take the boot screen out of the sequence.
|
||||
ui.setFrames(bootFrames, bootFrameCount);
|
||||
|
||||
ui.update(); // force an immediate draw of the bootscreen, because on some ssd1306 clones, the first draw command is discarded
|
||||
}
|
||||
|
||||
#define TRANSITION_FRAMERATE 30 // fps
|
||||
#define IDLE_FRAMERATE 10 // in fps
|
||||
|
||||
|
@ -38,6 +38,9 @@ public:
|
||||
|
||||
/// Rebuilt our list of screens
|
||||
void setFrames();
|
||||
|
||||
/// Show our logo (and turn the screen on)
|
||||
void showBootscreen();
|
||||
private:
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user