Skip to content

Commit 31862ed

Browse files
committed
Fix formatting and inconsistent flag behavior
1 parent b4f1cb8 commit 31862ed

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

src/displayapp/screens/WatchFaceMaze.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ WatchFaceMaze::WatchFaceMaze(Pinetime::Components::LittleVgl& lvgl,
199199
Controllers::MotorController& motor,
200200
const Controllers::Battery& batteryController,
201201
const Controllers::Ble& bleController)
202-
: dateTimeController{dateTimeController},
203-
settingsController{settingsController},
204-
motor{motor},
205-
batteryController{batteryController},
206-
bleController{bleController},
207-
lvgl{lvgl},
208-
maze{Maze()},
209-
prng{MazeRNG()} {
202+
: dateTimeController {dateTimeController},
203+
settingsController {settingsController},
204+
motor {motor},
205+
batteryController {batteryController},
206+
bleController {bleController},
207+
lvgl {lvgl},
208+
maze {Maze()},
209+
prng {MazeRNG()} {
210210

211211
// set it to be in the past so it always takes two clicks to go to the secret, even if you're fast
212212
lastLongClickTime = xTaskGetTickCount() - doubleDoubleClickDelay;
@@ -238,6 +238,8 @@ void WatchFaceMaze::HandleMazeRefresh() {
238238

239239
// Refresh if it's needed by some other component, a minute has passed on the watchface, or if generation has paused.
240240
if (screenRefreshRequired || (currentState == MazeScreen::WatchFace && currentDateTime.IsUpdated()) || pausedGeneration) {
241+
// make sure isUpdated flags are reset
242+
currentDateTime.IsUpdated();
241243

242244
// if generation wasn't paused (i.e. doing a ground up maze gen), set everything up
243245
if (!pausedGeneration) {
@@ -305,6 +307,10 @@ void WatchFaceMaze::UpdateBatteryDisplay(const bool forceRedraw) {
305307
// need to redraw battery stuff
306308
SwapActiveBuffer();
307309

310+
// make sure isUpdated flags are reset
311+
batteryPercent.IsUpdated();
312+
charging.IsUpdated();
313+
308314
// number of pixels between top of indicator and fill line. rounds up, so 0% is 24px but 1% is 23px
309315
const uint8_t fillLevel = 24 - ((uint16_t) (batteryPercent.Get()) * 24) / 100;
310316
constexpr lv_area_t area = {223, 3, 236, 26};
@@ -341,7 +347,7 @@ void WatchFaceMaze::UpdateBatteryDisplay(const bool forceRedraw) {
341347

342348
void WatchFaceMaze::UpdateBleDisplay(const bool forceRedraw) {
343349
bleConnected = bleController.IsConnected();
344-
if (forceRedraw || bleConnected.IsUpdated()) {
350+
if (bleConnected.IsUpdated() || forceRedraw) {
345351
// need to redraw BLE indicator
346352
SwapActiveBuffer();
347353

@@ -581,7 +587,6 @@ void WatchFaceMaze::GenerateMaze() {
581587
pausedGeneration = true;
582588
return;
583589
}
584-
585590
}
586591
}
587592
}
@@ -722,6 +727,7 @@ void WatchFaceMaze::ForceValidMaze() {
722727
coord_t x : 16;
723728
coord_t y : 16;
724729
};
730+
725731
std::stack<coordXY> backtrackStack;
726732

727733
while (true) {

src/displayapp/screens/WatchFaceMaze.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <numbers>
55
#include <stack>
66
#include "FreeRTOS.h"
7-
#include "task.h" // configTICK_RATE_HZ
7+
#include "task.h" // configTICK_RATE_HZ
88
#include "sys/unistd.h"
99
#include "displayapp/LittleVgl.h"
1010
#include "displayapp/apps/Apps.h"
@@ -274,7 +274,7 @@ namespace Pinetime {
274274
MazeRNG prng;
275275

276276
// Used for keeping track of minutes. It's what refreshes the screen every minute.
277-
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime{};
277+
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime {};
278278

279279
// Indicator values. Used for refreshing the respective indicators.
280280
Utility::DirtyValue<uint8_t> batteryPercent;
@@ -326,9 +326,9 @@ namespace Pinetime {
326326

327327
// Used for swipe sequences for easter eggs.
328328
// currentState is what is being displayed. It's generally categorized into "WatchFace" and "not WatchFace".
329-
// lastInputTime is for long clicking on the main watchface. If you long click twice in a certain timespan, it goes to the secret input
330-
// doubleDoubleClickDelay is the aforementioned 'certain timespan' to get to the secret input. In ticks.
331-
// screen. currentCode is the current swipe sequence that's being inputted.
329+
// lastInputTime is for long clicking on the main watchface. If you long click twice in a certain timespan, it goes to the secret
330+
// input doubleDoubleClickDelay is the aforementioned 'certain timespan' to get to the secret input. In ticks. screen. currentCode
331+
// is the current swipe sequence that's being inputted.
332332
MazeScreen currentState = MazeScreen::WatchFace;
333333
TickType_t lastLongClickTime;
334334
constexpr static uint32_t doubleDoubleClickDelay = pdMS_TO_TICKS(2500);

0 commit comments

Comments
 (0)