Merge branch 'develop' into upstream-dev
This commit is contained in:
@@ -45,7 +45,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
|
||||
{Symbols::sun, Apps::Brightness},
|
||||
{Symbols::list, Apps::SysInfo},
|
||||
{Symbols::check, Apps::FirmwareValidation},
|
||||
{Symbols::none, Apps::None}
|
||||
{Symbols::heartBeat, Apps::HeartRate}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
|
||||
|
||||
std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
|
||||
std::array<Screens::Tile::Applications, 6> applications {
|
||||
{{Symbols::tachometer, Apps::Gauge},
|
||||
{{Symbols::map, Apps::Navigation},
|
||||
{Symbols::asterisk, Apps::Meter},
|
||||
{Symbols::paintbrush, Apps::Paint},
|
||||
{Symbols::info, Apps::Notifications},
|
||||
|
@@ -3,11 +3,11 @@
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
const char* BatteryIcon::GetBatteryIcon(float batteryPercent) {
|
||||
if(batteryPercent > 90.0f) return Symbols::batteryFull;
|
||||
if(batteryPercent > 75.0f) return Symbols::batteryThreeQuarter;
|
||||
if(batteryPercent > 50.0f) return Symbols::batteryHalf;
|
||||
if(batteryPercent > 25.0f) return Symbols::batteryOneQuarter;
|
||||
const char* BatteryIcon::GetBatteryIcon(int batteryPercent) {
|
||||
if(batteryPercent > 90) return Symbols::batteryFull;
|
||||
if(batteryPercent > 75) return Symbols::batteryThreeQuarter;
|
||||
if(batteryPercent > 50) return Symbols::batteryHalf;
|
||||
if(batteryPercent > 25) return Symbols::batteryOneQuarter;
|
||||
return Symbols::batteryEmpty;
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,7 @@ namespace Pinetime {
|
||||
class BatteryIcon {
|
||||
public:
|
||||
static const char* GetUnknownIcon();
|
||||
static const char* GetBatteryIcon(float batteryPercent);
|
||||
static const char* GetBatteryIcon(int batteryPercent);
|
||||
static const char* GetPlugIcon(bool isCharging);
|
||||
};
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "components/battery/BatteryController.h"
|
||||
#include "components/ble/BleController.h"
|
||||
#include "components/ble/NotificationManager.h"
|
||||
#include "components/heartrate/HeartRateController.h"
|
||||
#include "../DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
@@ -26,9 +27,11 @@ Clock::Clock(DisplayApp* app,
|
||||
Controllers::DateTime& dateTimeController,
|
||||
Controllers::Battery& batteryController,
|
||||
Controllers::Ble& bleController,
|
||||
Controllers::NotificationManager& notificatioManager) : Screen(app), currentDateTime{{}},
|
||||
Controllers::NotificationManager& notificatioManager,
|
||||
Controllers::HeartRateController& heartRateController): Screen(app), currentDateTime{{}},
|
||||
dateTimeController{dateTimeController}, batteryController{batteryController},
|
||||
bleController{bleController}, notificatioManager{notificatioManager} {
|
||||
bleController{bleController}, notificatioManager{notificatioManager},
|
||||
heartRateController{heartRateController} {
|
||||
displayedChar[0] = 0;
|
||||
displayedChar[1] = 0;
|
||||
displayedChar[2] = 0;
|
||||
@@ -171,10 +174,15 @@ bool Clock::Refresh() {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO heartbeat = heartBeatController.GetValue();
|
||||
if(heartbeat.IsUpdated()) {
|
||||
heartbeat = heartRateController.HeartRate();
|
||||
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
|
||||
if(heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
|
||||
char heartbeatBuffer[4];
|
||||
sprintf(heartbeatBuffer, "%d", heartbeat.Get());
|
||||
if(heartbeatRunning.Get())
|
||||
sprintf(heartbeatBuffer, "%d", heartbeat.Get());
|
||||
else
|
||||
sprintf(heartbeatBuffer, "---");
|
||||
|
||||
lv_label_set_text(heartbeatValue, heartbeatBuffer);
|
||||
lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
|
||||
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
||||
|
@@ -12,6 +12,7 @@ namespace Pinetime {
|
||||
class Battery;
|
||||
class Ble;
|
||||
class NotificationManager;
|
||||
class HeartRateController;
|
||||
}
|
||||
|
||||
namespace Applications {
|
||||
@@ -42,7 +43,8 @@ namespace Pinetime {
|
||||
Controllers::DateTime& dateTimeController,
|
||||
Controllers::Battery& batteryController,
|
||||
Controllers::Ble& bleController,
|
||||
Controllers::NotificationManager& notificatioManager);
|
||||
Controllers::NotificationManager& notificatioManager,
|
||||
Controllers::HeartRateController& heartRateController);
|
||||
~Clock() override;
|
||||
|
||||
bool Refresh() override;
|
||||
@@ -62,11 +64,12 @@ namespace Pinetime {
|
||||
Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
|
||||
uint8_t currentDay = 0;
|
||||
|
||||
DirtyValue<float> batteryPercentRemaining {0};
|
||||
DirtyValue<int> batteryPercentRemaining {0};
|
||||
DirtyValue<bool> bleState {false};
|
||||
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime;
|
||||
DirtyValue<uint32_t> stepCount {0};
|
||||
DirtyValue<uint8_t> heartbeat {0};
|
||||
DirtyValue<bool> heartbeatRunning {false};
|
||||
DirtyValue<bool> notificationState {false};
|
||||
|
||||
lv_obj_t* label_time;
|
||||
@@ -86,6 +89,7 @@ namespace Pinetime {
|
||||
Controllers::Battery& batteryController;
|
||||
Controllers::Ble& bleController;
|
||||
Controllers::NotificationManager& notificatioManager;
|
||||
Controllers::HeartRateController& heartRateController;
|
||||
|
||||
bool running = true;
|
||||
|
||||
|
115
src/displayapp/screens/HeartRate.cpp
Normal file
115
src/displayapp/screens/HeartRate.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
#include <libs/lvgl/lvgl.h>
|
||||
#include "HeartRate.h"
|
||||
#include <components/heartrate/HeartRateController.h>
|
||||
|
||||
#include "../DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
extern lv_font_t jetbrains_mono_extrabold_compressed;
|
||||
extern lv_font_t jetbrains_mono_bold_20;
|
||||
|
||||
namespace {
|
||||
const char *ToString(Pinetime::Controllers::HeartRateController::States s) {
|
||||
switch (s) {
|
||||
case Pinetime::Controllers::HeartRateController::States::NotEnoughData:
|
||||
return "Not enough data,\nplease wait...";
|
||||
case Pinetime::Controllers::HeartRateController::States::NoTouch:
|
||||
return "No touch detected";
|
||||
case Pinetime::Controllers::HeartRateController::States::Running:
|
||||
return "Measuring...";
|
||||
case Pinetime::Controllers::HeartRateController::States::Stopped:
|
||||
return "Stopped";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static void btnStartStopEventHandler(lv_obj_t *obj, lv_event_t event) {
|
||||
HeartRate *screen = static_cast<HeartRate *>(obj->user_data);
|
||||
screen->OnStartStopEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::HeartRateController& heartRateController) : Screen(app), heartRateController{heartRateController} {
|
||||
label_bpm = lv_label_create(lv_scr_act(), NULL);
|
||||
|
||||
labelStyle = const_cast<lv_style_t *>(lv_label_get_style(label_bpm, LV_LABEL_STYLE_MAIN));
|
||||
labelStyle->text.font = &jetbrains_mono_bold_20;
|
||||
|
||||
lv_style_copy(&labelBigStyle, labelStyle);
|
||||
labelBigStyle.text.font = &jetbrains_mono_extrabold_compressed;
|
||||
|
||||
lv_label_set_style(label_bpm, LV_LABEL_STYLE_MAIN, labelStyle);
|
||||
|
||||
label_hr = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_style(label_hr, LV_LABEL_STYLE_MAIN, &labelBigStyle);
|
||||
lv_obj_align(label_hr, lv_scr_act(), LV_ALIGN_CENTER, -70, -40);
|
||||
lv_label_set_text(label_hr, "000");
|
||||
|
||||
lv_label_set_text(label_bpm, "Heart rate BPM");
|
||||
lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20);
|
||||
|
||||
|
||||
label_status = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData));
|
||||
lv_label_set_style(label_status, LV_LABEL_STYLE_MAIN, labelStyle);
|
||||
lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
|
||||
btn_startStop = lv_btn_create(lv_scr_act(), NULL);
|
||||
btn_startStop->user_data = this;
|
||||
lv_obj_set_height(btn_startStop, 50);
|
||||
lv_obj_set_event_cb(btn_startStop, btnStartStopEventHandler);
|
||||
lv_obj_align(btn_startStop, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||
|
||||
label_startStop = lv_label_create(btn_startStop, nullptr);
|
||||
UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
|
||||
}
|
||||
|
||||
HeartRate::~HeartRate() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
bool HeartRate::Refresh() {
|
||||
char hr[4];
|
||||
|
||||
auto state = heartRateController.State();
|
||||
switch(state) {
|
||||
case Controllers::HeartRateController::States::NoTouch:
|
||||
case Controllers::HeartRateController::States::NotEnoughData:
|
||||
case Controllers::HeartRateController::States::Stopped:
|
||||
lv_label_set_text(label_hr, "000");
|
||||
break;
|
||||
default:
|
||||
sprintf(hr, "%03d", heartRateController.HeartRate());
|
||||
lv_label_set_text(label_hr, hr);
|
||||
}
|
||||
|
||||
lv_label_set_text(label_status, ToString(state));
|
||||
lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
|
||||
return running;
|
||||
}
|
||||
|
||||
bool HeartRate::OnButtonPushed() {
|
||||
running = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HeartRate::OnStartStopEvent(lv_event_t event) {
|
||||
if (event == LV_EVENT_CLICKED) {
|
||||
if(heartRateController.State() == Controllers::HeartRateController::States::Stopped) {
|
||||
heartRateController.Start();
|
||||
UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
|
||||
}
|
||||
else {
|
||||
heartRateController.Stop();
|
||||
UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HeartRate::UpdateStartStopButton(bool isRunning) {
|
||||
if(isRunning)
|
||||
lv_label_set_text(label_startStop, "Stop");
|
||||
else
|
||||
lv_label_set_text(label_startStop, "Start");
|
||||
}
|
42
src/displayapp/screens/HeartRate.h
Normal file
42
src/displayapp/screens/HeartRate.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
#include "Screen.h"
|
||||
#include <bits/unique_ptr.h>
|
||||
#include <libs/lvgl/src/lv_core/lv_style.h>
|
||||
#include <libs/lvgl/src/lv_core/lv_obj.h>
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Controllers {
|
||||
class HeartRateController;
|
||||
}
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
||||
class HeartRate : public Screen{
|
||||
public:
|
||||
HeartRate(DisplayApp* app, Controllers::HeartRateController& HeartRateController);
|
||||
~HeartRate() override;
|
||||
|
||||
bool Refresh() override;
|
||||
bool OnButtonPushed() override;
|
||||
void OnStartStopEvent(lv_event_t event);
|
||||
|
||||
private:
|
||||
Controllers::HeartRateController& heartRateController;
|
||||
void UpdateStartStopButton(bool isRunning);
|
||||
lv_obj_t* label_hr;
|
||||
lv_obj_t* label_bpm;
|
||||
lv_obj_t* label_status;
|
||||
lv_style_t labelBigStyle;
|
||||
lv_style_t* labelStyle;
|
||||
lv_obj_t* btn_startStop;
|
||||
lv_obj_t* label_startStop;
|
||||
|
||||
bool running = true;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
120
src/displayapp/screens/Navigation.cpp
Normal file
120
src/displayapp/screens/Navigation.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
/* Copyright (C) 2021 Adam Pigg
|
||||
|
||||
This file is part of InfiniTime.
|
||||
|
||||
InfiniTime is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
InfiniTime is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "Navigation.h"
|
||||
#include <cstdint>
|
||||
#include "../DisplayApp.h"
|
||||
#include "components/ble/NavigationService.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
extern lv_font_t jetbrains_mono_extrabold_compressed;
|
||||
extern lv_font_t jetbrains_mono_bold_20;
|
||||
|
||||
/**
|
||||
* Set the pixel array to display by the image
|
||||
* This just calls lv_img_set_src but adds type safety
|
||||
*
|
||||
* @param img pointer to an image object
|
||||
* @param data the image array
|
||||
*/
|
||||
inline void lv_img_set_src_arr(lv_obj_t *img, const lv_img_dsc_t *src_img) {
|
||||
lv_img_set_src(img, src_img);
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigation watchapp
|
||||
*
|
||||
*/
|
||||
Navigation::Navigation(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::NavigationService &nav) : Screen(app), navService(nav) {
|
||||
|
||||
constexpr uint8_t FONT_HEIGHT = 12;
|
||||
constexpr uint8_t LINE_PAD = 15;
|
||||
constexpr int8_t MIDDLE_OFFSET = -25;
|
||||
|
||||
imgFlag = lv_img_create(lv_scr_act(), nullptr);
|
||||
lv_img_set_src_arr(imgFlag, &flag);
|
||||
lv_obj_align(imgFlag, nullptr, LV_ALIGN_IN_TOP_MID, 0, 15);
|
||||
|
||||
txtNarrative = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_long_mode(txtNarrative, LV_LABEL_LONG_SROLL);
|
||||
lv_obj_align(txtNarrative, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 1 * FONT_HEIGHT);
|
||||
lv_label_set_text(txtNarrative, "Narrative");
|
||||
lv_label_set_align(txtNarrative, LV_LABEL_ALIGN_CENTER);
|
||||
lv_label_set_anim_speed(txtNarrative, 15);
|
||||
lv_obj_set_width(txtNarrative, LV_HOR_RES);
|
||||
|
||||
txtManDist = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_long_mode(txtManDist, LV_LABEL_LONG_SROLL);
|
||||
lv_obj_align(txtManDist, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 2 * FONT_HEIGHT + LINE_PAD);
|
||||
lv_label_set_text(txtManDist, "0M");
|
||||
lv_label_set_align(txtManDist, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_set_width(txtManDist, LV_HOR_RES);
|
||||
|
||||
//Route Progress
|
||||
barProgress = lv_bar_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(barProgress, 200, 20);
|
||||
lv_obj_align(barProgress, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||
lv_bar_set_anim_time(barProgress, 500);
|
||||
lv_bar_set_range(barProgress, 0, 100);
|
||||
lv_bar_set_value(barProgress, 0, LV_ANIM_ON);
|
||||
}
|
||||
|
||||
Navigation::~Navigation() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
bool Navigation::Refresh() {
|
||||
|
||||
if (m_flag != navService.getFlag()) {
|
||||
m_flag = navService.getFlag();
|
||||
|
||||
lv_img_set_src_arr(imgFlag, iconForName(m_flag));
|
||||
}
|
||||
|
||||
if (m_narrative != navService.getNarrative()) {
|
||||
m_narrative = navService.getNarrative();
|
||||
lv_label_set_text(txtNarrative, m_narrative.data());
|
||||
}
|
||||
|
||||
if (m_manDist != navService.getManDist()) {
|
||||
m_manDist = navService.getManDist();
|
||||
lv_label_set_text(txtManDist, m_manDist.data());
|
||||
}
|
||||
|
||||
if (m_progress != navService.getProgress()) {
|
||||
m_progress = navService.getProgress();
|
||||
lv_bar_set_value(barProgress, m_progress, LV_ANIM_ON);
|
||||
}
|
||||
|
||||
return running;
|
||||
}
|
||||
|
||||
bool Navigation::OnButtonPushed() {
|
||||
running = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
const lv_img_dsc_t* Navigation::iconForName(std::string icon)
|
||||
{
|
||||
for (auto iter : m_iconMap) {
|
||||
if (iter.first == icon) {
|
||||
return iter.second;
|
||||
}
|
||||
}
|
||||
return &invalid;
|
||||
}
|
238
src/displayapp/screens/Navigation.h
Normal file
238
src/displayapp/screens/Navigation.h
Normal file
@@ -0,0 +1,238 @@
|
||||
/* Copyright (C) 2021 Adam Pigg
|
||||
|
||||
This file is part of InfiniTime.
|
||||
|
||||
InfiniTime is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
InfiniTime is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
#include <string>
|
||||
#include "Screen.h"
|
||||
#include <array>
|
||||
#include <lvgl/src/lv_draw/lv_img_decoder.h>
|
||||
|
||||
#include "displayapp/icons/navigation/arrive-left.c"
|
||||
#include "displayapp/icons/navigation/arrive-right.c"
|
||||
#include "displayapp/icons/navigation/arrive-straight.c"
|
||||
#include "displayapp/icons/navigation/arrive.c"
|
||||
#include "displayapp/icons/navigation/close.c"
|
||||
#include "displayapp/icons/navigation/continue-left.c"
|
||||
#include "displayapp/icons/navigation/continue-right.c"
|
||||
#include "displayapp/icons/navigation/continue-slight-left.c"
|
||||
#include "displayapp/icons/navigation/continue-slight-right.c"
|
||||
#include "displayapp/icons/navigation/continue-straight.c"
|
||||
#include "displayapp/icons/navigation/continue-uturn.c"
|
||||
#include "displayapp/icons/navigation/continue.c"
|
||||
#include "displayapp/icons/navigation/depart-left.c"
|
||||
#include "displayapp/icons/navigation/depart-right.c"
|
||||
#include "displayapp/icons/navigation/depart-straight.c"
|
||||
#include "displayapp/icons/navigation/end-of-road-left.c"
|
||||
#include "displayapp/icons/navigation/end-of-road-right.c"
|
||||
#include "displayapp/icons/navigation/ferry.c"
|
||||
#include "displayapp/icons/navigation/flag.c"
|
||||
#include "displayapp/icons/navigation/fork-left.c"
|
||||
#include "displayapp/icons/navigation/fork-right.c"
|
||||
#include "displayapp/icons/navigation/fork-slight-left.c"
|
||||
#include "displayapp/icons/navigation/fork-slight-right.c"
|
||||
#include "displayapp/icons/navigation/fork-straight.c"
|
||||
#include "displayapp/icons/navigation/invalid.c"
|
||||
#include "displayapp/icons/navigation/invalid-left.c"
|
||||
#include "displayapp/icons/navigation/invalid-right.c"
|
||||
#include "displayapp/icons/navigation/invalid-slight-left.c"
|
||||
#include "displayapp/icons/navigation/invalid-slight-right.c"
|
||||
#include "displayapp/icons/navigation/invalid-straight.c"
|
||||
#include "displayapp/icons/navigation/invalid-uturn.c"
|
||||
#include "displayapp/icons/navigation/merge-left.c"
|
||||
#include "displayapp/icons/navigation/merge-right.c"
|
||||
#include "displayapp/icons/navigation/merge-slight-left.c"
|
||||
#include "displayapp/icons/navigation/merge-slight-right.c"
|
||||
#include "displayapp/icons/navigation/merge-straight.c"
|
||||
#include "displayapp/icons/navigation/new-name-left.c"
|
||||
#include "displayapp/icons/navigation/new-name-right.c"
|
||||
#include "displayapp/icons/navigation/new-name-sharp-left.c"
|
||||
#include "displayapp/icons/navigation/new-name-sharp-right.c"
|
||||
#include "displayapp/icons/navigation/new-name-slight-left.c"
|
||||
#include "displayapp/icons/navigation/new-name-slight-right.c"
|
||||
#include "displayapp/icons/navigation/new-name-straight.c"
|
||||
#include "displayapp/icons/navigation/notification-left.c"
|
||||
#include "displayapp/icons/navigation/notification-right.c"
|
||||
#include "displayapp/icons/navigation/notification-sharp-left.c"
|
||||
#include "displayapp/icons/navigation/notification-sharp-right.c"
|
||||
#include "displayapp/icons/navigation/notification-slight-left.c"
|
||||
#include "displayapp/icons/navigation/notification-slight-right.c"
|
||||
#include "displayapp/icons/navigation/notification-straight.c"
|
||||
#include "displayapp/icons/navigation/off-ramp-left.c"
|
||||
#include "displayapp/icons/navigation/off-ramp-right.c"
|
||||
#include "displayapp/icons/navigation/off-ramp-slight-left.c"
|
||||
#include "displayapp/icons/navigation/off-ramp-slight-right.c"
|
||||
#include "displayapp/icons/navigation/on-ramp-left.c"
|
||||
#include "displayapp/icons/navigation/on-ramp-right.c"
|
||||
#include "displayapp/icons/navigation/on-ramp-sharp-left.c"
|
||||
#include "displayapp/icons/navigation/on-ramp-sharp-right.c"
|
||||
#include "displayapp/icons/navigation/on-ramp-slight-left.c"
|
||||
#include "displayapp/icons/navigation/on-ramp-slight-right.c"
|
||||
#include "displayapp/icons/navigation/on-ramp-straight.c"
|
||||
#include "displayapp/icons/navigation/rotary.c"
|
||||
#include "displayapp/icons/navigation/rotary-left.c"
|
||||
#include "displayapp/icons/navigation/rotary-right.c"
|
||||
#include "displayapp/icons/navigation/rotary-sharp-left.c"
|
||||
#include "displayapp/icons/navigation/rotary-sharp-right.c"
|
||||
#include "displayapp/icons/navigation/rotary-slight-left.c"
|
||||
#include "displayapp/icons/navigation/rotary-slight-right.c"
|
||||
#include "displayapp/icons/navigation/rotary-straight.c"
|
||||
#include "displayapp/icons/navigation/roundabout.c"
|
||||
#include "displayapp/icons/navigation/roundabout-left.c"
|
||||
#include "displayapp/icons/navigation/roundabout-right.c"
|
||||
#include "displayapp/icons/navigation/roundabout-sharp-left.c"
|
||||
#include "displayapp/icons/navigation/roundabout-sharp-right.c"
|
||||
#include "displayapp/icons/navigation/roundabout-slight-left.c"
|
||||
#include "displayapp/icons/navigation/roundabout-slight-right.c"
|
||||
#include "displayapp/icons/navigation/roundabout-straight.c"
|
||||
#include "displayapp/icons/navigation/turn-left.c"
|
||||
#include "displayapp/icons/navigation/turn-right.c"
|
||||
#include "displayapp/icons/navigation/turn-sharp-left.c"
|
||||
#include "displayapp/icons/navigation/turn-sharp-right.c"
|
||||
#include "displayapp/icons/navigation/turn-slight-left.c"
|
||||
#include "displayapp/icons/navigation/turn-slight-right.c"
|
||||
#include "displayapp/icons/navigation/turn-straight.c"
|
||||
#include "displayapp/icons/navigation/updown.c"
|
||||
#include "displayapp/icons/navigation/uturn.c"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Controllers {
|
||||
class NavigationService;
|
||||
}
|
||||
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
class Navigation : public Screen {
|
||||
public:
|
||||
Navigation(DisplayApp *app, Pinetime::Controllers::NavigationService &nav);
|
||||
~Navigation() override;
|
||||
|
||||
bool Refresh() override;
|
||||
bool OnButtonPushed() override;
|
||||
|
||||
private:
|
||||
|
||||
lv_obj_t *imgFlag;
|
||||
lv_obj_t *txtNarrative;
|
||||
lv_obj_t *txtManDist;
|
||||
lv_obj_t *barProgress;
|
||||
|
||||
Pinetime::Controllers::NavigationService &navService;
|
||||
|
||||
std::string m_flag;
|
||||
std::string m_narrative;
|
||||
std::string m_manDist;
|
||||
int m_progress;
|
||||
|
||||
/** Watchapp */
|
||||
bool running = true;
|
||||
|
||||
const lv_img_dsc_t* iconForName(std::string icon);
|
||||
|
||||
std::array<std::pair<std::string, const lv_img_dsc_t*>, 89 > m_iconMap = { {
|
||||
{"arrive-left", &arrive_left},
|
||||
{"arrive-right", &arrive_right},
|
||||
{"arrive-straight", &arrive_straight},
|
||||
{"arrive", &arrive},
|
||||
{"close", &close},
|
||||
{"continue-left", &continue_left},
|
||||
{"continue-right", &continue_right},
|
||||
{"continue-slight-left", &continue_slight_left},
|
||||
{"continue-slight-right", &continue_slight_right},
|
||||
{"continue-straight", &continue_straight},
|
||||
{"continue-uturn", &continue_uturn},
|
||||
{"continue", &continue_icon},
|
||||
{"depart-left", &depart_left},
|
||||
{"depart-right", &depart_right},
|
||||
{"depart-straight", &depart_straight},
|
||||
{"end-of-road-left", &end_of_road_left},
|
||||
{"end-of-road-right", &end_of_road_right},
|
||||
{"ferry", &ferry},
|
||||
{"flag", &flag},
|
||||
{"fork-left", &fork_left},
|
||||
{"fork-right", &fork_right},
|
||||
{"fork-slight-left", &fork_slight_left},
|
||||
{"fork-slight-right", &fork_slight_right},
|
||||
{"fork-straight", &fork_straight},
|
||||
{"invalid", &invalid},
|
||||
{"invalid-left", &invalid_left},
|
||||
{"invalid-right", &invalid_right},
|
||||
{"invalid-slight-left", &invalid_slight_left},
|
||||
{"invalid-slight-right", &invalid_slight_right},
|
||||
{"invalid-straight", &invalid_straight},
|
||||
{"invalid-uturn", &invalid_uturn},
|
||||
{"merge-left", &merge_left},
|
||||
{"merge-right", &merge_right},
|
||||
{"merge-slight-left", &merge_slight_left},
|
||||
{"merge-slight-right", &merge_slight_right},
|
||||
{"merge-straight", &merge_straight},
|
||||
{"new-name-left", &new_name_left},
|
||||
{"new-name-right", &new_name_right},
|
||||
{"new-name-sharp-left", &new_name_sharp_left},
|
||||
{"new-name-sharp-right", &new_name_sharp_right},
|
||||
{"new-name-slight-left", &new_name_slight_left},
|
||||
{"new-name-slight-right", &new_name_slight_right},
|
||||
{"new-name-straight", &new_name_straight},
|
||||
{"notification-left", ¬ification_left},
|
||||
{"notification-right", ¬ification_right},
|
||||
{"notification-sharp-left", ¬ification_sharp_left},
|
||||
{"notification-sharp-right", ¬ification_sharp_right},
|
||||
{"notification-slight-left", ¬ification_slight_left},
|
||||
{"notification-slight-right", ¬ification_slight_right},
|
||||
{"notification-straight", ¬ification_straight},
|
||||
{"off-ramp-left", &off_ramp_left},
|
||||
{"off-ramp-right", &off_ramp_right},
|
||||
{"off-ramp-slight-left", &off_ramp_slight_left},
|
||||
{"off-ramp-slight-right", &off_ramp_slight_right},
|
||||
{"on-ramp-left", &on_ramp_left},
|
||||
{"on-ramp-right", &on_ramp_right},
|
||||
{"on-ramp-sharp-left", &on_ramp_sharp_left},
|
||||
{"on-ramp-sharp-right", &on_ramp_sharp_right},
|
||||
{"on-ramp-slight-left", &on_ramp_slight_left},
|
||||
{"on-ramp-slight-right", &on_ramp_slight_right},
|
||||
{"on-ramp-straight", &on_ramp_straight},
|
||||
{"rotary", &rotary},
|
||||
{"rotary-left", &rotary_left},
|
||||
{"rotary-right", &rotary_right},
|
||||
{"rotary-sharp-left", &rotary_sharp_left},
|
||||
{"rotary-sharp-right", &rotary_sharp_right},
|
||||
{"rotary-slight-left", &rotary_slight_left},
|
||||
{"rotary-slight-right", &rotary_slight_right},
|
||||
{"rotary-straight", &rotary_straight},
|
||||
{"roundabout", &roundabout},
|
||||
{"roundabout-left", &roundabout_left},
|
||||
{"roundabout-right", &roundabout_right},
|
||||
{"roundabout-sharp-left", &roundabout_sharp_left},
|
||||
{"roundabout-sharp-right", &roundabout_sharp_right},
|
||||
{"roundabout-slight-left", &roundabout_slight_left},
|
||||
{"roundabout-slight-right", &roundabout_slight_right},
|
||||
{"roundabout-straight", &roundabout_straight},
|
||||
{"turn-left", &turn_left},
|
||||
{"turn-right", &turn_right},
|
||||
{"turn-sharp-left", &turn_sharp_left},
|
||||
{"turn-sharp-right", &turn_sharp_right},
|
||||
{"turn-slight-left", &turn_slight_left},
|
||||
{"turn-slight-right", &turn_slight_right},
|
||||
{"turn-straight", &turn_straight},
|
||||
{"updown", &updown},
|
||||
{"uturn", &uturn} } };
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -25,6 +25,7 @@ namespace Pinetime {
|
||||
static constexpr const char* asterisk = "\xEF\x81\xA9";
|
||||
static constexpr const char* paintbrush = "\xEF\x87\xBC";
|
||||
static constexpr const char* paddle = "\xEF\x91\x9D";
|
||||
static constexpr const char* map = "\xEF\x96\xa0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user