77#include " components/ble/BleController.h"
88#include " components/brightness/BrightnessController.h"
99#include " components/datetime/DateTimeController.h"
10+ #include " components/motion/MotionController.h"
1011#include " drivers/Watchdog.h"
1112
1213using namespace Pinetime ::Applications::Screens;
1314
15+ namespace {
16+ const char * ToString (const Pinetime::Controllers::MotionController::DeviceTypes deviceType) {
17+ switch (deviceType) {
18+ case Pinetime::Controllers::MotionController::DeviceTypes::BMA421:
19+ return " BMA421" ;
20+ case Pinetime::Controllers::MotionController::DeviceTypes::BMA425:
21+ return " BMA425" ;
22+ }
23+ return " ???" ;
24+ }
25+ }
26+
1427SystemInfo::SystemInfo (Pinetime::Applications::DisplayApp* app,
1528 Pinetime::Controllers::DateTime& dateTimeController,
1629 Pinetime::Controllers::Battery& batteryController,
1730 Pinetime::Controllers::BrightnessController& brightnessController,
1831 Pinetime::Controllers::Ble& bleController,
19- Pinetime::Drivers::WatchdogView& watchdog)
32+ Pinetime::Drivers::WatchdogView& watchdog,
33+ Pinetime::Controllers::MotionController& motionController)
2034 : Screen(app),
2135 dateTimeController {dateTimeController},
2236 batteryController {batteryController},
2337 brightnessController {brightnessController},
2438 bleController {bleController},
2539 watchdog {watchdog},
40+ motionController{motionController},
2641 screens {app,
2742 0 ,
2843 {[this ]() -> std::unique_ptr<Screen> {
@@ -132,9 +147,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
132147 // hack to not use the flot functions from printf
133148 uint8_t batteryVoltageBytes[2 ];
134149 batteryVoltageBytes[1 ] = static_cast <uint8_t >(batteryVoltage); // truncate whole numbers
135- batteryVoltageBytes[0 ] =
136- static_cast <uint8_t >((batteryVoltage - batteryVoltageBytes[1 ]) * 100 ); // remove whole part of flt and shift 2 places over
137- //
150+ batteryVoltageBytes[0 ] = static_cast <uint8_t >((batteryVoltage - batteryVoltageBytes[1 ]) * 100 ); // remove whole part of flt and shift 2 places over
138151
139152 lv_obj_t * label = lv_label_create (lv_scr_act (), nullptr );
140153 lv_label_set_recolor (label, true );
@@ -144,7 +157,8 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
144157 " #444444 Uptime#\n %02lud %02lu:%02lu:%02lu\n "
145158 " #444444 Battery# %d%%/%1i.%02iv\n "
146159 " #444444 Backlight# %s\n "
147- " #444444 Last reset# %s\n " ,
160+ " #444444 Last reset# %s\n "
161+ " #444444 Accel.# %s\n " ,
148162 dateTimeController.Day (),
149163 static_cast <uint8_t >(dateTimeController.Month ()),
150164 dateTimeController.Year (),
@@ -159,7 +173,8 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
159173 batteryVoltageBytes[1 ],
160174 batteryVoltageBytes[0 ],
161175 brightnessController.ToString (),
162- resetReason);
176+ resetReason,
177+ ToString (motionController.DeviceType ()));
163178 lv_obj_align (label, lv_scr_act (), LV_ALIGN_CENTER, 0 , 0 );
164179 return std::make_unique<Screens::Label>(1 , 5 , app, label);
165180}
0 commit comments