Only redraw spinner while waiting for connection
This commit is contained in:
parent
f8fe64b1b3
commit
1c1aad5846
@ -42,9 +42,9 @@
|
||||
#define CLOCK_X MARGIN_LEFT
|
||||
#define CLOCK_Y 113
|
||||
|
||||
#define STATUS_X 95
|
||||
#define STATUS_X 83
|
||||
#define STATUS_Y CLOCK_Y
|
||||
#define STATUS_WIDTH (10 * CX)
|
||||
#define STATUS_WIDTH (12 * CX)
|
||||
#define STATUS_HEIGHT CY
|
||||
|
||||
// Function definitions
|
||||
@ -104,14 +104,18 @@ void setState(Args&&... args) {
|
||||
|
||||
void StateConnecting::enter() {
|
||||
Serial.println("Entering StateConnecting");
|
||||
|
||||
display.fillRect(STATUS_X, STATUS_Y, STATUS_WIDTH, STATUS_HEIGHT, COLOR_BG);
|
||||
display.setCursor(STATUS_X, STATUS_Y);
|
||||
display.printf("connecting");
|
||||
}
|
||||
|
||||
void StateConnecting::tick() {
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
display.fillRect(STATUS_X, STATUS_Y, STATUS_WIDTH, STATUS_HEIGHT, COLOR_BG);
|
||||
display.setCursor(STATUS_X, STATUS_Y);
|
||||
display.printf(" connect %c", "|/-\\"[currentTick % 4]);
|
||||
delay(250);
|
||||
display.fillRect(STATUS_X + 11 * CX, STATUS_Y, CX, CY, COLOR_BG);
|
||||
display.setCursor(STATUS_X + 11 * CX, STATUS_Y);
|
||||
display.print("|/-\\"[currentTick % 4]);
|
||||
delay(125);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,7 +123,7 @@ void StateConnecting::tick() {
|
||||
}
|
||||
|
||||
// Fetching is a bit of an ugly duckling; it performs all its logic in enter().
|
||||
// This is because request it does is synchronous.
|
||||
// This is because the request it does is synchronous.
|
||||
// Sadly this means no animation is possible right now.
|
||||
// At least the fetch call still does yield() under the hood :)
|
||||
void StateFetching::enter() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user