parent
34949a47c5
commit
ec2469a6c1
|
@ -202,7 +202,7 @@ void DisplayApp::Refresh() {
|
||||||
break;
|
break;
|
||||||
case Messages::TimerDone:
|
case Messages::TimerDone:
|
||||||
if (currentApp == Apps::Timer) {
|
if (currentApp == Apps::Timer) {
|
||||||
auto *timer = static_cast<Screens::Timer*>(currentScreen.get());
|
auto* timer = static_cast<Screens::Timer*>(currentScreen.get());
|
||||||
timer->setDone();
|
timer->setDone();
|
||||||
} else {
|
} else {
|
||||||
LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down);
|
LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down);
|
||||||
|
@ -268,7 +268,7 @@ void DisplayApp::Refresh() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nextApp != Apps::None) {
|
if (nextApp != Apps::None) {
|
||||||
LoadApp(nextApp, nextDirection);
|
LoadApp(nextApp, nextDirection);
|
||||||
nextApp = Apps::None;
|
nextApp = Apps::None;
|
||||||
}
|
}
|
||||||
|
@ -383,8 +383,8 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||||
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
||||||
break;
|
break;
|
||||||
case Apps::SysInfo:
|
case Apps::SysInfo:
|
||||||
currentScreen =
|
currentScreen = std::make_unique<Screens::SystemInfo>(
|
||||||
std::make_unique<Screens::SystemInfo>(this, dateTimeController, batteryController, brightnessController, bleController, watchdog, motionController);
|
this, dateTimeController, batteryController, brightnessController, bleController, watchdog, motionController);
|
||||||
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
||||||
break;
|
break;
|
||||||
case Apps::FlashLight:
|
case Apps::FlashLight:
|
||||||
|
@ -429,7 +429,7 @@ void DisplayApp::IdleState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayApp::PushMessage(Messages msg) {
|
void DisplayApp::PushMessage(Messages msg) {
|
||||||
if(in_isr()) {
|
if (in_isr()) {
|
||||||
BaseType_t xHigherPriorityTaskWoken;
|
BaseType_t xHigherPriorityTaskWoken;
|
||||||
xHigherPriorityTaskWoken = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken);
|
xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken);
|
||||||
|
@ -471,7 +471,7 @@ void DisplayApp::SetTouchMode(DisplayApp::TouchModes mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayApp::PushMessageToSystemTask(Pinetime::System::Messages message) {
|
void DisplayApp::PushMessageToSystemTask(Pinetime::System::Messages message) {
|
||||||
if(systemTask != nullptr)
|
if (systemTask != nullptr)
|
||||||
systemTask->PushMessage(message);
|
systemTask->PushMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,6 @@ namespace Pinetime {
|
||||||
bool Refresh() override;
|
bool Refresh() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool running = true;
|
|
||||||
|
|
||||||
lv_obj_t* labelText = nullptr;
|
lv_obj_t* labelText = nullptr;
|
||||||
lv_point_t pageIndicatorBasePoints[2];
|
lv_point_t pageIndicatorBasePoints[2];
|
||||||
lv_point_t pageIndicatorPoints[2];
|
lv_point_t pageIndicatorPoints[2];
|
||||||
|
|
|
@ -36,7 +36,6 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr
|
||||||
labelStep = lv_label_create(lv_scr_act(), NULL);
|
labelStep = lv_label_create(lv_scr_act(), NULL);
|
||||||
lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
|
lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
|
||||||
lv_label_set_text(labelStep, "Steps ---");
|
lv_label_set_text(labelStep, "Steps ---");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Motion::~Motion() {
|
Motion::~Motion() {
|
||||||
|
@ -50,13 +49,12 @@ bool Motion::Refresh() {
|
||||||
|
|
||||||
lv_label_set_text_fmt(labelStep, "Steps %lu", motionController.NbSteps());
|
lv_label_set_text_fmt(labelStep, "Steps %lu", motionController.NbSteps());
|
||||||
|
|
||||||
lv_label_set_text_fmt(label, "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#", motionController.X() / 0x10, motionController.Y() / 0x10, motionController.Z() / 0x10);
|
lv_label_set_text_fmt(label,
|
||||||
|
"X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#",
|
||||||
|
motionController.X() / 0x10,
|
||||||
|
motionController.Y() / 0x10,
|
||||||
|
motionController.Z() / 0x10);
|
||||||
lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10);
|
lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10);
|
||||||
|
|
||||||
return running;
|
return running;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Motion::OnButtonPushed() {
|
|
||||||
running = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ namespace Pinetime {
|
||||||
~Motion() override;
|
~Motion() override;
|
||||||
|
|
||||||
bool Refresh() override;
|
bool Refresh() override;
|
||||||
bool OnButtonPushed() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Controllers::MotionController& motionController;
|
Controllers::MotionController& motionController;
|
||||||
|
@ -29,9 +28,6 @@ namespace Pinetime {
|
||||||
lv_obj_t* label;
|
lv_obj_t* label;
|
||||||
|
|
||||||
lv_obj_t* labelStep;
|
lv_obj_t* labelStep;
|
||||||
static constexpr uint8_t nbStepsBufferSize = 9;
|
|
||||||
char nbStepsBuffer[nbStepsBufferSize + 1];
|
|
||||||
bool running = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,23 +264,23 @@ bool PineTimeStyle::Refresh() {
|
||||||
char hoursChar[3];
|
char hoursChar[3];
|
||||||
char ampmChar[5];
|
char ampmChar[5];
|
||||||
|
|
||||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
|
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
|
||||||
sprintf(hoursChar, "%02d", hour);
|
sprintf(hoursChar, "%02d", hour);
|
||||||
} else {
|
} else {
|
||||||
if (hour == 0 && hour != 12) {
|
if (hour == 0 && hour != 12) {
|
||||||
hour = 12;
|
hour = 12;
|
||||||
sprintf(ampmChar, "A\nM");
|
sprintf(ampmChar, "A\nM");
|
||||||
} else if (hour == 12 && hour != 0) {
|
} else if (hour == 12 && hour != 0) {
|
||||||
hour = 12;
|
hour = 12;
|
||||||
sprintf(ampmChar, "P\nM");
|
sprintf(ampmChar, "P\nM");
|
||||||
} else if (hour < 12 && hour != 0) {
|
} else if (hour < 12 && hour != 0) {
|
||||||
sprintf(ampmChar, "A\nM");
|
sprintf(ampmChar, "A\nM");
|
||||||
} else if (hour > 12 && hour != 0) {
|
} else if (hour > 12 && hour != 0) {
|
||||||
hour = hour - 12;
|
hour = hour - 12;
|
||||||
sprintf(ampmChar, "P\nM");
|
sprintf(ampmChar, "P\nM");
|
||||||
}
|
|
||||||
sprintf(hoursChar, "%02d", hour);
|
|
||||||
}
|
}
|
||||||
|
sprintf(hoursChar, "%02d", hour);
|
||||||
|
}
|
||||||
|
|
||||||
if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] ||
|
if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] ||
|
||||||
minutesChar[1] != displayedChar[3]) {
|
minutesChar[1] != displayedChar[3]) {
|
||||||
|
@ -292,9 +292,9 @@ bool PineTimeStyle::Refresh() {
|
||||||
char hourStr[3];
|
char hourStr[3];
|
||||||
char minStr[3];
|
char minStr[3];
|
||||||
|
|
||||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
||||||
lv_label_set_text(timeAMPM, ampmChar);
|
lv_label_set_text(timeAMPM, ampmChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display the time as 2 pairs of digits */
|
/* Display the time as 2 pairs of digits */
|
||||||
sprintf(hourStr, "%c%c", hoursChar[0], hoursChar[1]);
|
sprintf(hourStr, "%c%c", hoursChar[0], hoursChar[1]);
|
||||||
|
|
|
@ -5,13 +5,10 @@
|
||||||
|
|
||||||
using namespace Pinetime::Applications::Screens;
|
using namespace Pinetime::Applications::Screens;
|
||||||
|
|
||||||
Steps::Steps(
|
Steps::Steps(Pinetime::Applications::DisplayApp* app,
|
||||||
Pinetime::Applications::DisplayApp *app,
|
Controllers::MotionController& motionController,
|
||||||
Controllers::MotionController& motionController,
|
Controllers::Settings& settingsController)
|
||||||
Controllers::Settings &settingsController)
|
: Screen(app), motionController {motionController}, settingsController {settingsController} {
|
||||||
: Screen(app),
|
|
||||||
motionController{motionController},
|
|
||||||
settingsController{settingsController} {
|
|
||||||
|
|
||||||
stepsArc = lv_arc_create(lv_scr_act(), nullptr);
|
stepsArc = lv_arc_create(lv_scr_act(), nullptr);
|
||||||
|
|
||||||
|
@ -34,12 +31,12 @@ Steps::Steps(
|
||||||
lv_label_set_text_fmt(lSteps, "%li", stepsCount);
|
lv_label_set_text_fmt(lSteps, "%li", stepsCount);
|
||||||
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20);
|
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20);
|
||||||
|
|
||||||
lv_obj_t * lstepsL = lv_label_create(lv_scr_act(), nullptr);
|
lv_obj_t* lstepsL = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(lstepsL, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
lv_obj_set_style_local_text_color(lstepsL, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
||||||
lv_label_set_text_static(lstepsL, "Steps");
|
lv_label_set_text_static(lstepsL, "Steps");
|
||||||
lv_obj_align(lstepsL, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
lv_obj_align(lstepsL, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||||
|
|
||||||
lv_obj_t * lstepsGoal = lv_label_create(lv_scr_act(), nullptr);
|
lv_obj_t* lstepsGoal = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(lstepsGoal, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN);
|
lv_obj_set_style_local_text_color(lstepsGoal, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN);
|
||||||
lv_label_set_text_fmt(lstepsGoal, "Goal\n%lu", settingsController.GetStepsGoal());
|
lv_label_set_text_fmt(lstepsGoal, "Goal\n%lu", settingsController.GetStepsGoal());
|
||||||
lv_label_set_align(lstepsGoal, LV_LABEL_ALIGN_CENTER);
|
lv_label_set_align(lstepsGoal, LV_LABEL_ALIGN_CENTER);
|
||||||
|
|
|
@ -70,11 +70,6 @@ bool SystemInfo::Refresh() {
|
||||||
return running;
|
return running;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SystemInfo::OnButtonPushed() {
|
|
||||||
running = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
return screens.OnTouchEvent(event);
|
return screens.OnTouchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,12 +31,9 @@ namespace Pinetime {
|
||||||
Pinetime::Controllers::MotionController& motionController);
|
Pinetime::Controllers::MotionController& motionController);
|
||||||
~SystemInfo() override;
|
~SystemInfo() override;
|
||||||
bool Refresh() override;
|
bool Refresh() override;
|
||||||
bool OnButtonPushed() override;
|
|
||||||
bool OnTouchEvent(TouchEvents event) override;
|
bool OnTouchEvent(TouchEvents event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool running = true;
|
|
||||||
|
|
||||||
Pinetime::Controllers::DateTime& dateTimeController;
|
Pinetime::Controllers::DateTime& dateTimeController;
|
||||||
Pinetime::Controllers::Battery& batteryController;
|
Pinetime::Controllers::Battery& batteryController;
|
||||||
Pinetime::Controllers::BrightnessController& brightnessController;
|
Pinetime::Controllers::BrightnessController& brightnessController;
|
||||||
|
|
|
@ -27,7 +27,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
|
||||||
batteryController {batteryController},
|
batteryController {batteryController},
|
||||||
dateTimeController {dateTimeController},
|
dateTimeController {dateTimeController},
|
||||||
brightness {brightness},
|
brightness {brightness},
|
||||||
motorController{motorController},
|
motorController {motorController},
|
||||||
settingsController {settingsController} {
|
settingsController {settingsController} {
|
||||||
|
|
||||||
// Time
|
// Time
|
||||||
|
@ -154,10 +154,6 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QuickSettings::Refresh() {
|
bool QuickSettings::Refresh() {
|
||||||
return running;
|
return running;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ namespace Pinetime {
|
||||||
|
|
||||||
bool Refresh() override;
|
bool Refresh() override;
|
||||||
|
|
||||||
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
|
|
||||||
void OnButtonEvent(lv_obj_t* object, lv_event_t event);
|
void OnButtonEvent(lv_obj_t* object, lv_event_t event);
|
||||||
|
|
||||||
void UpdateScreen();
|
void UpdateScreen();
|
||||||
|
|
Loading…
Reference in New Issue