Skip to content

Commit b3f4831

Browse files
committed
Initialise DisplayApp components in DisplayApp context
1 parent 343962d commit b3f4831

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/displayapp/DisplayApp.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,6 @@ void DisplayApp::Start(System::BootErrors error) {
129129

130130
bootError = error;
131131

132-
lvgl.Init();
133-
motorController.Init();
134-
135-
if (error == System::BootErrors::TouchController) {
136-
LoadNewScreen(Apps::Error, DisplayApp::FullRefreshDirections::None);
137-
} else {
138-
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
139-
}
140-
141132
if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle)) {
142133
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
143134
}
@@ -146,17 +137,25 @@ void DisplayApp::Start(System::BootErrors error) {
146137
void DisplayApp::Process(void* instance) {
147138
auto* app = static_cast<DisplayApp*>(instance);
148139
NRF_LOG_INFO("displayapp task started!");
149-
app->InitHw();
140+
app->Init();
141+
142+
if (app->bootError == System::BootErrors::TouchController) {
143+
app->LoadNewScreen(Apps::Error, DisplayApp::FullRefreshDirections::None);
144+
} else {
145+
app->LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
146+
}
150147

151148
while (true) {
152149
app->Refresh();
153150
}
154151
}
155152

156-
void DisplayApp::InitHw() {
153+
void DisplayApp::Init() {
154+
lcd.Init();
155+
motorController.Init();
157156
brightnessController.Init();
158157
ApplyBrightness();
159-
lcd.Init();
158+
lvgl.Init();
160159
}
161160

162161
TickType_t DisplayApp::CalculateSleepTime() {

src/displayapp/DisplayApp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ namespace Pinetime {
121121

122122
TouchEvents GetGesture();
123123
static void Process(void* instance);
124-
void InitHw();
124+
void Init();
125125
void Refresh();
126126
void LoadNewScreen(Apps app, DisplayApp::FullRefreshDirections direction);
127127
void LoadScreen(Apps app, DisplayApp::FullRefreshDirections direction);

0 commit comments

Comments
 (0)