working sim

This commit is contained in:
tofasthacker 2023-10-03 19:02:33 -04:00
parent e19e870290
commit b488811f7f
6 changed files with 98 additions and 34 deletions

View File

@ -426,6 +426,7 @@ list(APPEND SOURCE_FILES
displayapp/screens/settings/SettingChimes.cpp displayapp/screens/settings/SettingChimes.cpp
displayapp/screens/settings/SettingShakeThreshold.cpp displayapp/screens/settings/SettingShakeThreshold.cpp
displayapp/screens/settings/SettingBluetooth.cpp displayapp/screens/settings/SettingBluetooth.cpp
displayapp/screens/settings/SettingQuickR.cpp
## Watch faces ## Watch faces
displayapp/screens/WatchFaceAnalog.cpp displayapp/screens/WatchFaceAnalog.cpp

View File

@ -13,7 +13,7 @@ namespace Pinetime {
enum class Notification : uint8_t { On, Off, Sleep }; enum class Notification : uint8_t { On, Off, Sleep };
enum class ChimesOption : uint8_t { None, Hours, HalfHours }; enum class ChimesOption : uint8_t { None, Hours, HalfHours };
enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 }; enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 };
enum class QuickApp : uint8_t { MusicPlayer = 0, Calculator = 1, Flashlight = 2, Step = 3, HeartRate = 4 }; //, Alarm = 5, Timer = 6, Stopwatch = 7 }; enum class QuickApp : uint8_t { MusicPlayer = 0, Calculator = 1, Timer = 2, Alarm = 3, HeartRate = 4 }; //, Alarm = 5, Timer = 6, Stopwatch = 7 };
enum class Colors : uint8_t { enum class Colors : uint8_t {
White, White,
Silver, Silver,

View File

@ -293,14 +293,9 @@ void DisplayApp::Refresh() {
return TouchEvents::SwipeLeft; return TouchEvents::SwipeLeft;
} }
}; };
std::bitset<5> quick_app = settingsController.getQuickRModes();
bool value = (quick_app[0] ? 1 : 0 );
NRF_LOG_INFO("Value of Quick app: %i", value);
if (!currentScreen->OnTouchEvent(gesture)) { if (!currentScreen->OnTouchEvent(gesture)) {
if (currentApp == Apps::Clock || currentApp == Apps::Music || currentApp == Apps::Calculator || currentApp == Apps::QuickSettings) { if (currentApp == Apps::Clock || currentApp == Apps::QuickSettings || (currentApp == Apps::Music && quick_app[0]) || (currentApp == Apps::Calculator && quick_app[1]) || (currentApp == Apps::Alarm && quick_app[2]) || (currentApp == Apps::Timer && quick_app[3]) || (currentApp == Apps::HeartRate && quick_app[4])) {
switch (gesture) { switch (gesture) {
case TouchEvents::SwipeUp: case TouchEvents::SwipeUp:
if (currentApp == Apps::Clock) { if (currentApp == Apps::Clock) {
@ -317,26 +312,10 @@ void DisplayApp::Refresh() {
} }
break; break;
case TouchEvents::SwipeRight: case TouchEvents::SwipeRight:
if (currentApp == Apps::Clock) { gotoquickapp(-1);
LoadNewScreen(Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim);
} else if (currentApp == Apps::QuickSettings && quick_app[1]) {
LoadNewScreen(Apps::Calculator, DisplayApp::FullRefreshDirections::RightAnim);
} else if (currentApp == Apps::Calculator && quick_app[0]) {
LoadNewScreen(Apps::Music, DisplayApp::FullRefreshDirections::RightAnim);
} else {
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::RightAnim);
}
break; break;
case TouchEvents::SwipeLeft: case TouchEvents::SwipeLeft:
if (currentApp == Apps::Clock && quick_app[0]) { gotoquickapp(1);
LoadNewScreen(Apps::Music, DisplayApp::FullRefreshDirections::LeftAnim);
} else if (currentApp == Apps::Music && quick_app[1]) {
LoadNewScreen(Apps::Calculator, DisplayApp::FullRefreshDirections::LeftAnim);
} else if (currentApp == Apps::Calculator) {
LoadNewScreen(Apps::QuickSettings, DisplayApp::FullRefreshDirections::LeftAnim);
} else {
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::LeftAnim);
}
break; break;
case TouchEvents::DoubleTap: case TouchEvents::DoubleTap:
PushMessageToSystemTask(System::Messages::GoToSleep); PushMessageToSystemTask(System::Messages::GoToSleep);
@ -355,6 +334,7 @@ void DisplayApp::Refresh() {
if (!currentScreen->OnButtonPushed()) { if (!currentScreen->OnButtonPushed()) {
if (currentApp == Apps::Clock) { if (currentApp == Apps::Clock) {
PushMessageToSystemTask(System::Messages::GoToSleep); PushMessageToSystemTask(System::Messages::GoToSleep);
} else { } else {
LoadPreviousScreen(); LoadPreviousScreen();
} }
@ -448,6 +428,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
// break; // break;
case Apps::None: case Apps::None:
case Apps::Clock: case Apps::Clock:
currentQ_app = 2;
currentScreen = std::make_unique<Screens::Clock>(dateTimeController, currentScreen = std::make_unique<Screens::Clock>(dateTimeController,
batteryController, batteryController,
bleController, bleController,
@ -651,3 +632,84 @@ void DisplayApp::ApplyBrightness() {
} }
brightnessController.Set(brightness); brightnessController.Set(brightness);
} }
void DisplayApp::gotoquickapp(int app_step){
NRF_LOG_INFO("QuickRing Swiped");
currentQ_app += app_step;
quick_app = settingsController.getQuickRModes();
while(true)
{
if(currentQ_app > 7)
{
currentQ_app = 1;
} else if(currentQ_app < 1)
{
currentQ_app = 7;
}
if(currentQ_app != 1 && currentQ_app != 2)
{
if(quick_app[currentQ_app-3])
{
break;
}
else
{
currentQ_app += (app_step);
}
}
else
{
break;
}
}
int quickringtotal = 2;
for(int i = 0; i < 5; i++){
quickringtotal += (quick_app[i] ? 1 : 0 );
}
NRF_LOG_INFO("case number current Q: %i", currentQ_app);
Apps app = Apps::Clock;
switch (currentQ_app) {
case 1:
app = Apps::QuickSettings;
break;
case 2:
app = Apps::Clock;
break;
case 3:
app = Apps::Music;
break;
case 4:
app = Apps::Calculator;
break;
case 5:
app = Apps::Alarm;
break;
case 6:
app = Apps::Timer;
break;
case 7:
app = Apps::HeartRate;
break;
default:
break;
}
if(app_step < 0){
LoadNewScreen(app, DisplayApp::FullRefreshDirections::RightAnim);
}
else
{
LoadNewScreen(app, DisplayApp::FullRefreshDirections::LeftAnim);
}
//appStackDirections.Pop();
//returnAppStack.Pop();
}

View File

@ -118,6 +118,8 @@ namespace Pinetime {
void LoadNewScreen(Apps app, DisplayApp::FullRefreshDirections direction); void LoadNewScreen(Apps app, DisplayApp::FullRefreshDirections direction);
void LoadScreen(Apps app, DisplayApp::FullRefreshDirections direction); void LoadScreen(Apps app, DisplayApp::FullRefreshDirections direction);
void PushMessageToSystemTask(Pinetime::System::Messages message); void PushMessageToSystemTask(Pinetime::System::Messages message);
void gotoquickapp(int app_step);
Apps nextApp = Apps::None; Apps nextApp = Apps::None;
DisplayApp::FullRefreshDirections nextDirection; DisplayApp::FullRefreshDirections nextDirection;
@ -129,6 +131,8 @@ namespace Pinetime {
Utility::StaticStack<FullRefreshDirections, returnAppStackSize> appStackDirections; Utility::StaticStack<FullRefreshDirections, returnAppStackSize> appStackDirections;
bool isDimmed = false; bool isDimmed = false;
int currentQ_app = 2;
std::bitset<5> quick_app;
}; };
} }
} }

View File

@ -41,7 +41,7 @@ SettingQuickR::SettingQuickR(Pinetime::Controllers::Settings& settingsController
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
for (unsigned int i = 0; i < options.size(); i++) { for (unsigned int i = 0; i < 5; i++) {
cbOption[i] = lv_checkbox_create(container1, nullptr); cbOption[i] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text(cbOption[i], options[i].name); lv_checkbox_set_text(cbOption[i], options[i].name);
if (settingsController.isQuickROn(static_cast<Controllers::Settings::QuickApp>(i))) { if (settingsController.isQuickROn(static_cast<Controllers::Settings::QuickApp>(i))) {
@ -59,7 +59,7 @@ SettingQuickR::~SettingQuickR() {
void SettingQuickR::UpdateSelected(lv_obj_t* object) { void SettingQuickR::UpdateSelected(lv_obj_t* object) {
// Find the index of the checkbox that triggered the event // Find the index of the checkbox that triggered the event
for (size_t i = 0; i < options.size(); i++) { for (size_t i = 0; i < 5; i++) {
if (cbOption[i] == object) { if (cbOption[i] == object) {
bool currentState = settingsController.isQuickROn(options[i].quickApp); bool currentState = settingsController.isQuickROn(options[i].quickApp);
settingsController.SetQuickRModes(options[i].quickApp, !currentState); settingsController.SetQuickRModes(options[i].quickApp, !currentState);
@ -71,7 +71,7 @@ void SettingQuickR::UpdateSelected(lv_obj_t* object) {
// This is needed because we can have extra logic when setting or unsetting wakeup modes, // This is needed because we can have extra logic when setting or unsetting wakeup modes,
// for example, when setting SingleTap, DoubleTap is unset and vice versa. // for example, when setting SingleTap, DoubleTap is unset and vice versa.
auto modes = settingsController.getQuickRModes(); auto modes = settingsController.getQuickRModes();
for (size_t i = 0; i < options.size(); ++i) { for (size_t i = 0; i < 5; ++i) {
lv_checkbox_set_checked(cbOption[i], modes[i]); lv_checkbox_set_checked(cbOption[i], modes[i]);
} }
} }

View File

@ -26,15 +26,12 @@ namespace Pinetime {
static constexpr std::array<Option, 5> options = {{ static constexpr std::array<Option, 5> options = {{
{Controllers::Settings::QuickApp::MusicPlayer, "Music Player"}, {Controllers::Settings::QuickApp::MusicPlayer, "Music Player"},
{Controllers::Settings::QuickApp::Calculator, "Calculator"}, {Controllers::Settings::QuickApp::Calculator, "Calculator"},
{Controllers::Settings::QuickApp::Flashlight, "Flashlight"}, {Controllers::Settings::QuickApp::Alarm, "Alarms"},
{Controllers::Settings::QuickApp::Step, "Steps"}, {Controllers::Settings::QuickApp::Timer, "Timer"},
{Controllers::Settings::QuickApp::HeartRate, "Heart Rate"}, {Controllers::Settings::QuickApp::HeartRate, "Heart Rate"},
// {Controllers::Settings::QuickApp::Alarm, "Alarm"},
// {Controllers::Settings::QuickApp::Timer, "Timer"},
// {Controllers::Settings::QuickApp::Stopwatch, "Stopwatch"},
}}; }};
lv_obj_t* cbOption[options.size()]; lv_obj_t* cbOption[5];
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
}; };
} }