diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/ble/MotionService.cpp | 2 | ||||
-rw-r--r-- | src/components/ble/MotionService.h | 2 | ||||
-rw-r--r-- | src/displayapp/DisplayAppRecovery.h | 2 | ||||
-rw-r--r-- | src/displayapp/screens/SystemInfo.cpp | 26 | ||||
-rw-r--r-- | src/displayapp/screens/Twos.cpp | 12 |
5 files changed, 24 insertions, 20 deletions
diff --git a/src/components/ble/MotionService.cpp b/src/components/ble/MotionService.cpp index e305021a..b4786ab5 100644 --- a/src/components/ble/MotionService.cpp +++ b/src/components/ble/MotionService.cpp @@ -80,7 +80,7 @@ int MotionService::OnStepCountRequested(uint16_t connectionHandle, uint16_t attr return 0; } -void MotionService::OnNewStepCountValue(uint8_t stepCount) { +void MotionService::OnNewStepCountValue(uint32_t stepCount) { if(!stepCountNoficationEnabled) return; uint32_t buffer = stepCount; diff --git a/src/components/ble/MotionService.h b/src/components/ble/MotionService.h index 75ad5182..1b4ac0a3 100644 --- a/src/components/ble/MotionService.h +++ b/src/components/ble/MotionService.h @@ -17,7 +17,7 @@ namespace Pinetime { MotionService(Pinetime::System::SystemTask& system, Controllers::MotionController& motionController); void Init(); int OnStepCountRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context); - void OnNewStepCountValue(uint8_t stepCount); + void OnNewStepCountValue(uint32_t stepCount); void OnNewMotionValues(int16_t x, int16_t y, int16_t z); void SubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle); 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/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, ""); } |