Skip to content

Commit b857fdb

Browse files
NeroBurnerJF002
authored andcommitted
SystemTask: forward declare BatteryController to fix of cyclic dependency
SystemTask.h included BatteryController.h, and BatteryController.h included SystemTask.h. If unlucky the class SystemTask isn't created yet when BatteryController wants to use it. Fix that cyclic dependency by forward declaring the BatteryController class and including it in the SystemTask.cpp file, where it is needed.
1 parent 4aaa3a3 commit b857fdb

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/systemtask/SystemTask.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <libraries/log/nrf_log.h>
55

66
#include "BootloaderVersion.h"
7+
#include "components/battery/BatteryController.h"
78
#include "components/ble/BleController.h"
89
#include "drivers/Cst816s.h"
910
#include "drivers/St7789.h"

src/systemtask/SystemTask.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <components/motion/MotionController.h>
1414

1515
#include "systemtask/SystemMonitor.h"
16-
#include "components/battery/BatteryController.h"
1716
#include "components/ble/NimbleController.h"
1817
#include "components/ble/NotificationManager.h"
1918
#include "components/motor/MotorController.h"
@@ -47,6 +46,7 @@ namespace Pinetime {
4746
class Hrs3300;
4847
}
4948
namespace Controllers {
49+
class Battery;
5050
class TouchHandler;
5151
class ButtonHandler;
5252
}

0 commit comments

Comments
 (0)