Skip to content

Commit

Permalink
Provide reference to BrightnessController in DisplayApp
Browse files Browse the repository at this point in the history
For the simulator I need a way to get to the brightnessController object
and handle the set brightness-levels accoringly.

This is done by the constructor expecting a brightnessController object
instead of initializing one itself
  • Loading branch information
NeroBurner authored and JF002 committed Feb 19, 2022
1 parent f829427 commit 4079086
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
Pinetime::Controllers::MotionController& motionController,
Pinetime::Controllers::TimerController& timerController,
Pinetime::Controllers::AlarmController& alarmController,
Pinetime::Controllers::BrightnessController& brightnessController,
Pinetime::Controllers::TouchHandler& touchHandler)
: lcd {lcd},
lvgl {lvgl},
Expand All @@ -112,6 +113,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
motionController {motionController},
timerController {timerController},
alarmController {alarmController},
brightnessController {brightnessController},
touchHandler {touchHandler} {
}

Expand Down
3 changes: 2 additions & 1 deletion src/displayapp/DisplayApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ namespace Pinetime {
Pinetime::Controllers::MotionController& motionController,
Pinetime::Controllers::TimerController& timerController,
Pinetime::Controllers::AlarmController& alarmController,
Pinetime::Controllers::BrightnessController& brightnessController,
Pinetime::Controllers::TouchHandler& touchHandler);
void Start(System::BootErrors error);
void PushMessage(Display::Messages msg);
Expand All @@ -87,10 +88,10 @@ namespace Pinetime {
Pinetime::Controllers::MotionController& motionController;
Pinetime::Controllers::TimerController& timerController;
Pinetime::Controllers::AlarmController& alarmController;
Pinetime::Controllers::BrightnessController &brightnessController;
Pinetime::Controllers::TouchHandler& touchHandler;

Pinetime::Controllers::FirmwareValidator validator;
Controllers::BrightnessController brightnessController;

TaskHandle_t taskHandle;

Expand Down
1 change: 1 addition & 0 deletions src/displayapp/DisplayAppRecovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
Pinetime::Controllers::MotionController& motionController,
Pinetime::Controllers::TimerController& timerController,
Pinetime::Controllers::AlarmController& alarmController,
Pinetime::Controllers::BrightnessController& brightnessController,
Pinetime::Controllers::TouchHandler& touchHandler)
: lcd {lcd}, bleController {bleController} {

Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/DisplayAppRecovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace Pinetime {
class MotorController;
class TimerController;
class AlarmController;
class BrightnessController;
}

namespace System {
Expand All @@ -57,6 +58,7 @@ namespace Pinetime {
Pinetime::Controllers::MotionController& motionController,
Pinetime::Controllers::TimerController& timerController,
Pinetime::Controllers::AlarmController& alarmController,
Pinetime::Controllers::BrightnessController& brightnessController,
Pinetime::Controllers::TouchHandler& touchHandler);
void Start();
void Start(Pinetime::System::BootErrors){ Start(); };
Expand Down
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "components/battery/BatteryController.h"
#include "components/ble/BleController.h"
#include "components/ble/NotificationManager.h"
#include "components/brightness/BrightnessController.h"
#include "components/motor/MotorController.h"
#include "components/datetime/DateTimeController.h"
#include "components/heartrate/HeartRateController.h"
Expand Down Expand Up @@ -114,6 +115,7 @@ Pinetime::Controllers::TimerController timerController;
Pinetime::Controllers::AlarmController alarmController {dateTimeController};
Pinetime::Controllers::TouchHandler touchHandler(touchPanel, lvgl);
Pinetime::Controllers::ButtonHandler buttonHandler;
Pinetime::Controllers::BrightnessController brightnessController {};

Pinetime::Applications::DisplayApp displayApp(lcd,
lvgl,
Expand All @@ -129,6 +131,7 @@ Pinetime::Applications::DisplayApp displayApp(lcd,
motionController,
timerController,
alarmController,
brightnessController,
touchHandler);

Pinetime::System::SystemTask systemTask(spi,
Expand Down

0 comments on commit 4079086

Please sign in to comment.