Added a way to lock execution if the main screen fails to initialize
This commit is contained in:
+8
-2
@@ -4,12 +4,18 @@
|
||||
#include "UIDimensions.h"
|
||||
|
||||
Curses::Screen::Screen(Arduino_GFX *d, UIDimensions dims, UIDecorations decor)
|
||||
: display(d), dims(dims), decor(decor) {
|
||||
: display(d), dims(dims), decor(decor) {}
|
||||
|
||||
void Curses::Screen::Setup() {
|
||||
// This should always return the first available component
|
||||
this->mainWindowID = WindowPool::Allocate();
|
||||
if (this->mainWindowID != 0) {
|
||||
// Something wrong happened
|
||||
Serial2.print("Unexpected ID for main window: ");
|
||||
Serial2.println(this->mainWindowID);
|
||||
for (;;) {
|
||||
delay(1000);
|
||||
Serial2.println("Program interrupted due to setup failure");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
|
||||
int16_t mainWindowID;
|
||||
Screen(Arduino_GFX *d, UIDimensions dims, UIDecorations decor);
|
||||
void Setup();
|
||||
};
|
||||
}; // namespace Curses
|
||||
|
||||
|
||||
Reference in New Issue
Block a user