Pass the timer as const

Doing this matches the other Controllers, which are also passed
as const to the StatusIcons.
This commit is contained in:
JustScott 2024-02-20 16:05:31 -06:00
parent 66930a55f5
commit 3fa9dbbac7
8 changed files with 15 additions and 17 deletions

View file

@ -11,7 +11,7 @@ void Timer::StartTimer(std::chrono::milliseconds duration) {
xTimerStart(timer, 0);
}
std::chrono::milliseconds Timer::GetTimeRemaining() {
std::chrono::milliseconds Timer::GetTimeRemaining() const {
if (IsRunning()) {
TickType_t remainingTime = xTimerGetExpiryTime(timer) - xTaskGetTickCount();
return std::chrono::milliseconds(remainingTime * 1000 / configTICK_RATE_HZ);
@ -23,6 +23,6 @@ void Timer::StopTimer() {
xTimerStop(timer, 0);
}
bool Timer::IsRunning() {
bool Timer::IsRunning() const {
return (xTimerIsTimerActive(timer) == pdTRUE);
}

View file

@ -15,9 +15,9 @@ namespace Pinetime {
void StopTimer();
std::chrono::milliseconds GetTimeRemaining();
std::chrono::milliseconds GetTimeRemaining() const;
bool IsRunning();
bool IsRunning() const;
private:
TimerHandle_t timer;

View file

@ -18,12 +18,12 @@ using namespace Pinetime::Applications::Screens;
WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController,
const Controllers::Battery& batteryController,
const Controllers::Ble& bleController,
const Controllers::Timer& timer,
Controllers::NotificationManager& notificationManager,
Controllers::Settings& settingsController,
Controllers::HeartRateController& heartRateController,
Controllers::MotionController& motionController,
Controllers::SimpleWeatherService& weatherService,
Controllers::Timer& timer)
Controllers::SimpleWeatherService& weatherService)
: currentDateTime {{}},
dateTimeController {dateTimeController},
notificationManager {notificationManager},
@ -31,7 +31,6 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController,
heartRateController {heartRateController},
motionController {motionController},
weatherService {weatherService},
timer {timer},
statusIcons(batteryController, bleController, timer) {
statusIcons.Create();

View file

@ -31,12 +31,12 @@ namespace Pinetime {
WatchFaceDigital(Controllers::DateTime& dateTimeController,
const Controllers::Battery& batteryController,
const Controllers::Ble& bleController,
const Controllers::Timer& timer,
Controllers::NotificationManager& notificationManager,
Controllers::Settings& settingsController,
Controllers::HeartRateController& heartRateController,
Controllers::MotionController& motionController,
Controllers::SimpleWeatherService& weather,
Controllers::Timer& timer);
Controllers::SimpleWeatherService& weather);
~WatchFaceDigital() override;
void Refresh() override;
@ -75,7 +75,6 @@ namespace Pinetime {
Controllers::HeartRateController& heartRateController;
Controllers::MotionController& motionController;
Controllers::SimpleWeatherService& weatherService;
Controllers::Timer& timer;
lv_task_t* taskRefresh;
Widgets::StatusIcons statusIcons;
@ -91,12 +90,12 @@ namespace Pinetime {
return new Screens::WatchFaceDigital(controllers.dateTimeController,
controllers.batteryController,
controllers.bleController,
controllers.timer,
controllers.notificationManager,
controllers.settingsController,
controllers.heartRateController,
controllers.motionController,
*controllers.weatherController,
controllers.timer);
*controllers.weatherController);
};
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {

View file

@ -34,7 +34,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
Controllers::MotorController& motorController,
Pinetime::Controllers::Settings& settingsController,
const Controllers::Ble& bleController,
Controllers::Timer& timer)
const Controllers::Timer& timer)
: app {app},
dateTimeController {dateTimeController},
brightness {brightness},

View file

@ -24,7 +24,7 @@ namespace Pinetime {
Controllers::MotorController& motorController,
Pinetime::Controllers::Settings& settingsController,
const Controllers::Ble& bleController,
Controllers::Timer& timer);
const Controllers::Timer& timer);
~QuickSettings() override;

View file

@ -3,7 +3,7 @@
using namespace Pinetime::Applications::Widgets;
StatusIcons::StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::Timer& timer)
StatusIcons::StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController, const Controllers::Timer& timer)
: batteryIcon(true), batteryController {batteryController}, bleController {bleController}, timer {timer} {
}

View file

@ -13,7 +13,7 @@ namespace Pinetime {
namespace Widgets {
class StatusIcons {
public:
StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::Timer& timer);
StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController, const Controllers::Timer& timer);
void Align();
void Create();
@ -27,7 +27,7 @@ namespace Pinetime {
Screens::BatteryIcon batteryIcon;
const Pinetime::Controllers::Battery& batteryController;
const Controllers::Ble& bleController;
Controllers::Timer& timer;
const Controllers::Timer& timer;
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
Utility::DirtyValue<bool> powerPresent {};