From cc58b635a34cf89fa6301096a19e0a816817aa50 Mon Sep 17 00:00:00 2001 From: panky-codes Date: Thu, 11 Mar 2021 10:54:14 +0100 Subject: Basic logic done. Need to change the timer source to get ms. Also need to replace with paddle app in displayApp.cpp and ApplicationList.cpp later. --- src/displayapp/DisplayApp.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/displayapp/DisplayApp.cpp') diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 6e3fd0bf..ad58e13d 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -12,6 +12,7 @@ #include "displayapp/screens/FirmwareValidation.h" #include "displayapp/screens/InfiniPaint.h" #include "displayapp/screens/Paddle.h" +#include "displayapp/screens/StopWatch.h" #include "displayapp/screens/Meter.h" #include "displayapp/screens/Music.h" #include "displayapp/screens/Navigation.h" @@ -203,7 +204,8 @@ void DisplayApp::RunningState() { case Apps::Meter: currentScreen.reset(new Screens::Meter(this)); break; case Apps::Twos: currentScreen.reset(new Screens::Twos(this)); break; case Apps::Paint: currentScreen.reset(new Screens::InfiniPaint(this, lvgl)); break; - case Apps::Paddle: currentScreen.reset(new Screens::Paddle(this, lvgl)); break; + //TODO: Change it back + case Apps::StopWatch: currentScreen.reset(new Screens::StopWatch(this, dateTimeController)); break; case Apps::Brightness : currentScreen.reset(new Screens::Brightness(this, brightnessController)); break; case Apps::Music : currentScreen.reset(new Screens::Music(this, systemTask.nimble().music())); break; case Apps::Navigation : currentScreen.reset(new Screens::Navigation(this, systemTask.nimble().navigation())); break; -- cgit v1.2.3-70-g09d2 From abc30028a2b3d0089bca880a73e7fbad9d7cd9bb Mon Sep 17 00:00:00 2001 From: panky-codes Date: Mon, 15 Mar 2021 21:35:36 +0100 Subject: Removed unused variables. Tested. --- src/displayapp/DisplayApp.cpp | 2 +- src/displayapp/screens/StopWatch.cpp | 10 +++++----- src/displayapp/screens/StopWatch.h | 5 ++--- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src/displayapp/DisplayApp.cpp') diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index ad58e13d..7fa2d127 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -205,7 +205,7 @@ void DisplayApp::RunningState() { case Apps::Twos: currentScreen.reset(new Screens::Twos(this)); break; case Apps::Paint: currentScreen.reset(new Screens::InfiniPaint(this, lvgl)); break; //TODO: Change it back - case Apps::StopWatch: currentScreen.reset(new Screens::StopWatch(this, dateTimeController)); break; + case Apps::StopWatch: currentScreen.reset(new Screens::StopWatch(this)); break; case Apps::Brightness : currentScreen.reset(new Screens::Brightness(this, brightnessController)); break; case Apps::Music : currentScreen.reset(new Screens::Music(this, systemTask.nimble().music())); break; case Apps::Navigation : currentScreen.reset(new Screens::Navigation(this, systemTask.nimble().navigation())); break; diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index 733e92d9..b23194ab 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -36,18 +36,18 @@ namespace { } static void play_pause_event_handler(lv_obj_t* obj, lv_event_t event) { - StopWatch* stopWatch = static_cast(obj->user_data); + auto stopWatch = static_cast(obj->user_data); stopWatch->playPauseBtnEventHandler(event); } static void stop_lap_event_handler(lv_obj_t* obj, lv_event_t event) { - StopWatch* stopWatch = static_cast(obj->user_data); + auto stopWatch = static_cast(obj->user_data); stopWatch->stopLapBtnEventHandler(event); } -StopWatch::StopWatch(DisplayApp* app, const Pinetime::Controllers::DateTime& dateTime) - : Screen(app), dateTime {dateTime}, running {true}, currentState {States::INIT}, currentEvent {Events::STOP}, startTime {}, - oldTimeElapsed {}, currentTimeSeparated {}, lapBuffer {}, lapNr {}, lapPressed {false} { +StopWatch::StopWatch(DisplayApp* app) + : Screen(app), running {true}, currentState {States::INIT}, currentEvent {Events::STOP}, startTime {}, oldTimeElapsed {}, + currentTimeSeparated {}, lapBuffer {}, lapNr {}, lapPressed {false} { time = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed); diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h index a5cf5ceb..2b9c67a4 100644 --- a/src/displayapp/screens/StopWatch.h +++ b/src/displayapp/screens/StopWatch.h @@ -63,7 +63,7 @@ namespace Pinetime::Applications::Screens { class StopWatch : public Screen { public: - StopWatch(DisplayApp* app, const Pinetime::Controllers::DateTime& dateTime); + StopWatch(DisplayApp* app); ~StopWatch() override; bool Refresh() override; bool OnButtonPushed() override; @@ -71,7 +71,6 @@ namespace Pinetime::Applications::Screens { void stopLapBtnEventHandler(lv_event_t event); private: - const Pinetime::Controllers::DateTime& dateTime; bool running; States currentState; Events currentEvent; @@ -84,4 +83,4 @@ namespace Pinetime::Applications::Screens { lv_obj_t *time, *msecTime, *btnPlayPause, *btnStopLap, *txtPlayPause, *txtStopLap; lv_obj_t *lapOneText, *lapTwoText; }; -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2 From dd9d6cd23ed6b65a33d4fc377ee304f2dfec2742 Mon Sep 17 00:00:00 2001 From: panky-codes Date: Sun, 21 Mar 2021 11:15:31 +0100 Subject: Reverted the paddle app in displayapp.cpp --- src/displayapp/DisplayApp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/displayapp/DisplayApp.cpp') diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index d29864e8..2e81c99b 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -205,10 +205,10 @@ void DisplayApp::RunningState() { break; case Apps::SysInfo: currentScreen.reset(new Screens::SystemInfo(this, dateTimeController, batteryController, brightnessController, bleController, watchdog)); break; case Apps::Meter: currentScreen.reset(new Screens::Meter(this)); break; + case Apps::StopWatch: currentScreen.reset(new Screens::StopWatch(this)); break; case Apps::Twos: currentScreen.reset(new Screens::Twos(this)); break; case Apps::Paint: currentScreen.reset(new Screens::InfiniPaint(this, lvgl)); break; - //TODO: Change it back - case Apps::StopWatch: currentScreen.reset(new Screens::StopWatch(this)); break; + case Apps::Paddle: currentScreen.reset(new Screens::Paddle(this, lvgl)); break; case Apps::Brightness : currentScreen.reset(new Screens::Brightness(this, brightnessController)); break; case Apps::Music : currentScreen.reset(new Screens::Music(this, systemTask.nimble().music())); break; case Apps::Navigation : currentScreen.reset(new Screens::Navigation(this, systemTask.nimble().navigation())); break; -- cgit v1.2.3-70-g09d2