Merge branch 'InfiniTimeOrg:main' into main

This commit is contained in:
liamcharger 2024-03-15 17:08:40 -04:00 committed by GitHub
commit 642511c69f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 18 additions and 22 deletions

View file

@ -140,10 +140,10 @@ namespace Pinetime {
} }
template <> template <>
struct AppTraits<Apps:MyApp> { struct AppTraits<Apps::MyApp> {
static constexpr Apps app = Apps::MyApp; static constexpr Apps app = Apps::MyApp;
static constexpr const char* icon = Screens::Symbol::myApp; static constexpr const char* icon = Screens::Symbols::myApp;
static Screens::Screens* Create(AppController& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::MyApp(); return new Screens::MyApp();
} }
}; };
@ -176,7 +176,7 @@ Now we have our very own app, but InfiniTime does not know about it yet.
The first step is to include your `MyApp.cpp` (or any new cpp files for that matter) The first step is to include your `MyApp.cpp` (or any new cpp files for that matter)
in the compilation by adding it to [CMakeLists.txt](/CMakeLists.txt). in the compilation by adding it to [CMakeLists.txt](/CMakeLists.txt).
The next step to making it launch-able is to give your app an id. The next step to making it launch-able is to give your app an id.
To do this, add an entry in the enum class `Pinetime::Applications::Apps` ([displayapp/Apps.h](/src/displayapp/Apps.h)). To do this, add an entry in the enum class `Pinetime::Applications::Apps` ([displayapp/apps/Apps.h](/src/displayapp/apps/Apps.h.in)).
Name this entry after your app. Add `#include "displayapp/screens/MyApp.h"` Name this entry after your app. Add `#include "displayapp/screens/MyApp.h"`
to the file [displayapp/DisplayApp.cpp](/src/displayapp/DisplayApp.cpp). to the file [displayapp/DisplayApp.cpp](/src/displayapp/DisplayApp.cpp).

View file

@ -256,7 +256,7 @@ void WatchFaceAnalog::Refresh() {
if (currentDateTime.IsUpdated()) { if (currentDateTime.IsUpdated()) {
UpdateClock(); UpdateClock();
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get()); currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
if (currentDate.IsUpdated()) { if (currentDate.IsUpdated()) {
lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day()); lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
} }

View file

@ -43,8 +43,7 @@ namespace Pinetime {
Utility::DirtyValue<bool> bleState {}; Utility::DirtyValue<bool> bleState {};
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime; Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime;
Utility::DirtyValue<bool> notificationState {false}; Utility::DirtyValue<bool> notificationState {false};
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20 Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
lv_obj_t* minor_scales; lv_obj_t* minor_scales;
lv_obj_t* major_scales; lv_obj_t* major_scales;

View file

@ -244,7 +244,7 @@ void WatchFaceCasioStyleG7710::Refresh() {
} }
lv_obj_realign(label_time); lv_obj_realign(label_time);
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get()); currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
if (currentDate.IsUpdated()) { if (currentDate.IsUpdated()) {
const char* weekNumberFormat = "%V"; const char* weekNumberFormat = "%V";

View file

@ -51,8 +51,7 @@ namespace Pinetime {
Utility::DirtyValue<uint8_t> heartbeat {}; Utility::DirtyValue<uint8_t> heartbeat {};
Utility::DirtyValue<bool> heartbeatRunning {}; Utility::DirtyValue<bool> heartbeatRunning {};
Utility::DirtyValue<bool> notificationState {}; Utility::DirtyValue<bool> notificationState {};
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20 Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
lv_point_t line_icons_points[3] {{0, 5}, {117, 5}, {122, 0}}; lv_point_t line_icons_points[3] {{0, 5}, {117, 5}, {122, 0}};
lv_point_t line_day_of_week_number_points[4] {{0, 0}, {100, 0}, {95, 95}, {0, 95}}; lv_point_t line_day_of_week_number_points[4] {{0, 0}, {100, 0}, {95, 95}, {0, 95}};

View file

@ -125,7 +125,7 @@ void WatchFaceDigital::Refresh() {
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
} }
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get()); currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
if (currentDate.IsUpdated()) { if (currentDate.IsUpdated()) {
uint16_t year = dateTimeController.Year(); uint16_t year = dateTimeController.Year();
uint8_t day = dateTimeController.Day(); uint8_t day = dateTimeController.Day();

View file

@ -54,8 +54,7 @@ namespace Pinetime {
Utility::DirtyValue<bool> notificationState {}; Utility::DirtyValue<bool> notificationState {};
Utility::DirtyValue<std::optional<Pinetime::Controllers::SimpleWeatherService::CurrentWeather>> currentWeather {}; Utility::DirtyValue<std::optional<Pinetime::Controllers::SimpleWeatherService::CurrentWeather>> currentWeather {};
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20 Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
lv_obj_t* label_time; lv_obj_t* label_time;
lv_obj_t* label_time_ampm; lv_obj_t* label_time_ampm;

View file

@ -423,7 +423,7 @@ void WatchFaceInfineat::Refresh() {
lv_obj_align(labelMinutes, timeContainer, LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_align(labelMinutes, timeContainer, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
} }
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get()); currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
if (currentDate.IsUpdated()) { if (currentDate.IsUpdated()) {
uint8_t day = dateTimeController.Day(); uint8_t day = dateTimeController.Day();
Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek(); Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek();

View file

@ -55,8 +55,7 @@ namespace Pinetime {
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime {}; Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime {};
Utility::DirtyValue<uint32_t> stepCount {}; Utility::DirtyValue<uint32_t> stepCount {};
Utility::DirtyValue<bool> notificationState {}; Utility::DirtyValue<bool> notificationState {};
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20 Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
// Lines making up the side cover // Lines making up the side cover
lv_obj_t* lineBattery; lv_obj_t* lineBattery;

View file

@ -125,7 +125,7 @@ void WatchFaceTerminal::Refresh() {
lv_label_set_text_fmt(label_time, "[TIME]#11cc55 %02d:%02d:%02d", hour, minute, second); lv_label_set_text_fmt(label_time, "[TIME]#11cc55 %02d:%02d:%02d", hour, minute, second);
} }
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get()); currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
if (currentDate.IsUpdated()) { if (currentDate.IsUpdated()) {
uint16_t year = dateTimeController.Year(); uint16_t year = dateTimeController.Year();
Controllers::DateTime::Months month = dateTimeController.Month(); Controllers::DateTime::Months month = dateTimeController.Month();

View file

@ -45,8 +45,7 @@ namespace Pinetime {
Utility::DirtyValue<uint8_t> heartbeat {}; Utility::DirtyValue<uint8_t> heartbeat {};
Utility::DirtyValue<bool> heartbeatRunning {}; Utility::DirtyValue<bool> heartbeatRunning {};
Utility::DirtyValue<bool> notificationState {}; Utility::DirtyValue<bool> notificationState {};
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20 Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
lv_obj_t* label_time; lv_obj_t* label_time;
lv_obj_t* label_date; lv_obj_t* label_date;

View file

@ -36,17 +36,19 @@ namespace {
SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
: app {app}, : app {app},
settings {settingsController},
checkboxList( checkboxList(
0, 0,
1, 1,
"Bluetooth", "Bluetooth",
Symbols::bluetooth, Symbols::bluetooth,
settingsController.GetBleRadioEnabled() ? 0 : 1, settingsController.GetBleRadioEnabled() ? 0 : 1,
[&settings = settingsController](uint32_t index) { [this](uint32_t index) {
const bool priorMode = settings.GetBleRadioEnabled(); const bool priorMode = settings.GetBleRadioEnabled();
const bool newMode = options[index].radioEnabled; const bool newMode = options[index].radioEnabled;
if (newMode != priorMode) { if (newMode != priorMode) {
settings.SetBleRadioEnabled(newMode); settings.SetBleRadioEnabled(newMode);
this->app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
} }
}, },
CreateOptionArray()) { CreateOptionArray()) {
@ -54,6 +56,4 @@ SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pine
SettingBluetooth::~SettingBluetooth() { SettingBluetooth::~SettingBluetooth() {
lv_obj_clean(lv_scr_act()); lv_obj_clean(lv_scr_act());
// Pushing the message in the OnValueChanged function causes a freeze?
app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
} }

View file

@ -20,6 +20,7 @@ namespace Pinetime {
private: private:
DisplayApp* app; DisplayApp* app;
Pinetime::Controllers::Settings& settings;
CheckboxList checkboxList; CheckboxList checkboxList;
}; };
} }