summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
authorKieran Cawthray <kieranc@gmail.com>2021-11-07 17:49:54 +0100
committerKieran Cawthray <kieranc@gmail.com>2021-11-07 17:49:54 +0100
commit18e3cc7038d0f6c0cebc5d042e0740f968f890db (patch)
tree4fd50ddece4d92c06ea0e16cc06902703a2b6202 /src/displayapp
parent85d494a987e8edfd51fbb0eb6dfa04ea108cbb48 (diff)
parent4a5b5f954f12de1574af8e3efec094bb4bdbb542 (diff)
Merge remote-tracking branch 'upstream/develop' into pts-settings
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/DisplayApp.cpp14
-rw-r--r--src/displayapp/DisplayAppRecovery.h2
-rw-r--r--src/displayapp/Messages.h3
-rw-r--r--src/displayapp/screens/SystemInfo.cpp26
-rw-r--r--src/displayapp/screens/Twos.cpp12
5 files changed, 39 insertions, 18 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index ad9536da..342c3879 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -259,6 +259,20 @@ void DisplayApp::Refresh() {
}
}
break;
+ case Messages::ButtonLongPressed:
+ if (currentApp != Apps::Clock) {
+ LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Down);
+ }
+ break;
+ case Messages::ButtonLongerPressed:
+ // Create reboot app and open it instead
+ LoadApp(Apps::SysInfo, DisplayApp::FullRefreshDirections::Up);
+ break;
+ case Messages::ButtonDoubleClicked:
+ if (currentApp != Apps::Notifications && currentApp != Apps::NotificationsPreview) {
+ LoadApp(Apps::Notifications, DisplayApp::FullRefreshDirections::Down);
+ }
+ break;
case Messages::BleFirmwareUpdateStarted:
LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down);
diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h
index 9f5fb130..72868159 100644
--- a/src/displayapp/DisplayAppRecovery.h
+++ b/src/displayapp/DisplayAppRecovery.h
@@ -10,7 +10,7 @@
#include <date/date.h>
#include <drivers/Watchdog.h>
#include <components/motor/MotorController.h>
-#include <BootErrors.h>
+#include "BootErrors.h"
#include "TouchEvents.h"
#include "Apps.h"
#include "Messages.h"
diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h
index d48b646f..ab0a0608 100644
--- a/src/displayapp/Messages.h
+++ b/src/displayapp/Messages.h
@@ -9,6 +9,9 @@ namespace Pinetime {
UpdateBleConnection,
TouchEvent,
ButtonPushed,
+ ButtonLongPressed,
+ ButtonLongerPressed,
+ ButtonDoubleClicked,
NewNotification,
TimerDone,
BleFirmwareUpdateStarted,
diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp
index 343b72bf..dd223b2f 100644
--- a/src/displayapp/screens/SystemInfo.cpp
+++ b/src/displayapp/screens/SystemInfo.cpp
@@ -209,7 +209,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
static constexpr uint8_t maxTaskCount = 9;
TaskStatus_t tasksStatus[maxTaskCount];
- lv_obj_t* infoTask = lv_table_create(lv_scr_act(), NULL);
+ lv_obj_t* infoTask = lv_table_create(lv_scr_act(), nullptr);
lv_table_set_col_cnt(infoTask, 4);
lv_table_set_row_cnt(infoTask, maxTaskCount + 1);
lv_obj_set_style_local_pad_all(infoTask, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, 0);
@@ -227,35 +227,37 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
auto nb = uxTaskGetSystemState(tasksStatus, maxTaskCount, nullptr);
std::sort(tasksStatus, tasksStatus + nb, sortById);
for (uint8_t i = 0; i < nb && i < maxTaskCount; i++) {
+ char buffer[7] = {0};
- lv_table_set_cell_value(infoTask, i + 1, 0, std::to_string(tasksStatus[i].xTaskNumber).c_str());
- char state[2] = {0};
+ sprintf(buffer, "%lu", tasksStatus[i].xTaskNumber);
+ lv_table_set_cell_value(infoTask, i + 1, 0, buffer);
switch (tasksStatus[i].eCurrentState) {
case eReady:
case eRunning:
- state[0] = 'R';
+ buffer[0] = 'R';
break;
case eBlocked:
- state[0] = 'B';
+ buffer[0] = 'B';
break;
case eSuspended:
- state[0] = 'S';
+ buffer[0] = 'S';
break;
case eDeleted:
- state[0] = 'D';
+ buffer[0] = 'D';
break;
default:
- state[0] = 'I'; // Invalid
+ buffer[0] = 'I'; // Invalid
break;
}
- lv_table_set_cell_value(infoTask, i + 1, 1, state);
+ buffer[1] = '\0';
+ lv_table_set_cell_value(infoTask, i + 1, 1, buffer);
lv_table_set_cell_value(infoTask, i + 1, 2, tasksStatus[i].pcTaskName);
if (tasksStatus[i].usStackHighWaterMark < 20) {
- std::string str1 = std::to_string(tasksStatus[i].usStackHighWaterMark) + " low";
- lv_table_set_cell_value(infoTask, i + 1, 3, str1.c_str());
+ sprintf(buffer, "%d low", tasksStatus[i].usStackHighWaterMark);
} else {
- lv_table_set_cell_value(infoTask, i + 1, 3, std::to_string(tasksStatus[i].usStackHighWaterMark).c_str());
+ sprintf(buffer, "%d", tasksStatus[i].usStackHighWaterMark);
}
+ lv_table_set_cell_value(infoTask, i + 1, 3, buffer);
}
return std::make_unique<Screens::Label>(3, 5, app, infoTask);
}
diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp
index 4201d501..d12ef906 100644
--- a/src/displayapp/screens/Twos.cpp
+++ b/src/displayapp/screens/Twos.cpp
@@ -1,10 +1,10 @@
#include "Twos.h"
-#include <lvgl/lvgl.h>
-#include <string>
-#include <charconv>
#include <array>
-#include <vector>
+#include <cstdio>
+#include <cstdlib>
+#include <lvgl/lvgl.h>
#include <utility>
+#include <vector>
using namespace Pinetime::Applications::Screens;
@@ -265,7 +265,9 @@ void Twos::updateGridDisplay(Tile grid[][4]) {
for (int row = 0; row < 4; row++) {
for (int col = 0; col < 4; col++) {
if (grid[row][col].value) {
- lv_table_set_cell_value(gridDisplay, row, col, (std::to_string(grid[row][col].value)).c_str());
+ char buffer[7];
+ sprintf(buffer, "%d", grid[row][col].value);
+ lv_table_set_cell_value(gridDisplay, row, col, buffer);
} else {
lv_table_set_cell_value(gridDisplay, row, col, "");
}