Add airplane mode feature

Implements 'Airplane mode' feature to disable and enable bluetooth/ble
Adds airplaneMode as a non-persisted setting
Adds a setting menu for switching airplane mode on and off
Displays an airplane symbol on the Digital watch face and the
    PineTimeStyle watch face when airplane mode is enabled
Always enables bluetooth/ble on boot (disable airplane mode)
Alphabetizes the settings menu options
Style cleanups

Closes #632
This commit is contained in:
James A. Jerkins
2021-12-23 20:30:14 -06:00
parent 3b0b48020d
commit 319030d9e1
23 changed files with 307 additions and 99 deletions

View File

@@ -17,7 +17,23 @@ namespace Pinetime {
RaiseWrist = 2,
};
enum class Colors : uint8_t {
White, Silver, Gray, Black, Red, Maroon, Yellow, Olive, Lime, Green, Cyan, Teal, Blue, Navy, Magenta, Purple, Orange
White,
Silver,
Gray,
Black,
Red,
Maroon,
Yellow,
Olive,
Lime,
Green,
Cyan,
Teal,
Blue,
Navy,
Magenta,
Purple,
Orange
};
struct PineTimeStyle {
Colors ColorTime = Colors::Teal;
@@ -146,18 +162,29 @@ namespace Pinetime {
}
settings.brightLevel = level;
};
Controllers::BrightnessController::Levels GetBrightness() const {
return settings.brightLevel;
};
void SetStepsGoal( uint32_t goal ) {
if ( goal != settings.stepsGoal ) {
void SetStepsGoal(uint32_t goal) {
if (goal != settings.stepsGoal) {
settingsChanged = true;
}
settings.stepsGoal = goal;
};
uint32_t GetStepsGoal() const { return settings.stepsGoal; };
uint32_t GetStepsGoal() const {
return settings.stepsGoal;
};
void SetAirplaneMode(bool mode) {
airplaneMode = mode;
};
bool GetAirplaneMode() const {
return airplaneMode;
};
private:
Pinetime::Controllers::FS& fs;
@@ -185,6 +212,10 @@ namespace Pinetime {
uint8_t appMenu = 0;
uint8_t settingsMenu = 0;
/* airplaneMode is intentionally not saved with the other watch settings and initialized
* to off (false) on every boot because we always want ble to be enabled on startup
*/
bool airplaneMode = false;
void LoadSettingsFromFile();
void SaveSettingsToFile();