From 1d3742e14f09316a1d795527713eb8f9742f0ffb Mon Sep 17 00:00:00 2001 From: Joaquim Date: Sun, 4 Apr 2021 03:08:51 +0100 Subject: Big UI and navigation Rewrite new navigation add some color to the apps redesign menus new settings menu new quick settings code clean up size reduction by converting navigation images to font and more... --- src/displayapp/screens/Notifications.cpp | 48 +++++++++++++------------------- 1 file changed, 20 insertions(+), 28 deletions(-) (limited to 'src/displayapp/screens/Notifications.cpp') diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index c903ed0f..ea6adc64 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -18,21 +18,21 @@ Notifications::Notifications(DisplayApp *app, if(notification.valid) { currentId = notification.id; currentItem = std::make_unique("\nNotification", - notification.message.data(), - notification.index, - notification.category, - notificationManager.NbNotifications(), - mode, - alertNotificationService); + notification.message.data(), + notification.index, + notification.category, + notificationManager.NbNotifications(), + mode, + alertNotificationService); validDisplay = true; } else { currentItem = std::make_unique("\nNotification", - "No notification to display", - 0, - notification.category, - notificationManager.NbNotifications(), - Modes::Preview, - alertNotificationService); + "No notification to display", + 0, + notification.category, + notificationManager.NbNotifications(), + Modes::Preview, + alertNotificationService); } if(mode == Modes::Preview) { @@ -62,11 +62,6 @@ bool Notifications::Refresh() { timeoutLinePoints[1].x = pos; lv_line_set_points(timeoutLine, timeoutLinePoints, 2); - - if (!running) { - // Start clock app when exiting this one - app->StartApp(Apps::Clock); - } } return running; @@ -74,7 +69,7 @@ bool Notifications::Refresh() { bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { switch (event) { - case Pinetime::Applications::TouchEvents::SwipeUp: { + case Pinetime::Applications::TouchEvents::SwipeDown: { Controllers::NotificationManager::Notification previousNotification; if(validDisplay) previousNotification = notificationManager.GetPrevious(currentId); @@ -86,7 +81,7 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { validDisplay = true; currentId = previousNotification.id; currentItem.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up); + app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); currentItem = std::make_unique("\nNotification", previousNotification.message.data(), previousNotification.index, @@ -96,19 +91,22 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { alertNotificationService); } return true; - case Pinetime::Applications::TouchEvents::SwipeDown: { + case Pinetime::Applications::TouchEvents::SwipeUp: { Controllers::NotificationManager::Notification nextNotification; if(validDisplay) nextNotification = notificationManager.GetNext(currentId); else nextNotification = notificationManager.GetLastNotification(); - if (!nextNotification.valid) return true; + if (!nextNotification.valid) { + running = false; + return false; + } validDisplay = true; currentId = nextNotification.id; currentItem.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); + app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up); currentItem = std::make_unique("\nNotification", nextNotification.message.data(), nextNotification.index, @@ -127,12 +125,6 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } } - -bool Notifications::OnButtonPushed() { - running = false; - return true; -} - namespace { static void AcceptIncomingCallEventHandler(lv_obj_t* obj, lv_event_t event) { auto* item = static_cast(obj->user_data); -- cgit v1.2.3-70-g09d2 From 03de1c67393fcb99b5987514be6f470349c57c0f Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 4 Apr 2021 12:10:47 +0200 Subject: Add support for notification title. The notification buffer must contain the title and the message separated by a '\0' character. If the buffer does not contain any \0, the whole buffer is considered to be the message of the notification. A default title will be displayed in the notification app. --- src/components/ble/AlertNotificationClient.cpp | 1 + src/components/ble/AlertNotificationService.cpp | 1 + src/components/ble/MusicService.cpp | 1 - src/components/ble/NavigationService.cpp | 1 - src/components/ble/NotificationManager.cpp | 16 ++++++++++++++++ src/components/ble/NotificationManager.h | 4 ++++ src/displayapp/screens/Notifications.cpp | 15 ++++++++------- 7 files changed, 30 insertions(+), 9 deletions(-) (limited to 'src/displayapp/screens/Notifications.cpp') diff --git a/src/components/ble/AlertNotificationClient.cpp b/src/components/ble/AlertNotificationClient.cpp index e7a18626..cfb3272d 100644 --- a/src/components/ble/AlertNotificationClient.cpp +++ b/src/components/ble/AlertNotificationClient.cpp @@ -165,6 +165,7 @@ void AlertNotificationClient::OnNotification(ble_gap_event *event) { NotificationManager::Notification notif; os_mbuf_copydata(event->notify_rx.om, headerSize, messageSize - 1, notif.message.data()); notif.message[messageSize - 1] = '\0'; + notif.size = messageSize; notif.category = Pinetime::Controllers::NotificationManager::Categories::SimpleAlert; notificationManager.Push(std::move(notif)); diff --git a/src/components/ble/AlertNotificationService.cpp b/src/components/ble/AlertNotificationService.cpp index 0639119c..c3187c1d 100644 --- a/src/components/ble/AlertNotificationService.cpp +++ b/src/components/ble/AlertNotificationService.cpp @@ -75,6 +75,7 @@ int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle os_mbuf_copydata(ctxt->om, headerSize, messageSize-1, notif.message.data()); os_mbuf_copydata(ctxt->om, 0, 1, &category); notif.message[messageSize-1] = '\0'; + notif.size = messageSize; // TODO convert all ANS categories to NotificationController categories switch(category) { diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp index bd6e27fb..e37e3831 100644 --- a/src/components/ble/MusicService.cpp +++ b/src/components/ble/MusicService.cpp @@ -191,7 +191,6 @@ int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_ data[notifSize] = '\0'; os_mbuf_copydata(ctxt->om, 0, notifSize, data); char *s = (char *) &data[0]; - NRF_LOG_INFO("DATA : %s", s); if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msArtistCharUuid) == 0) { artistName = s; } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msTrackCharUuid) == 0) { diff --git a/src/components/ble/NavigationService.cpp b/src/components/ble/NavigationService.cpp index 3c1fd162..545c44da 100644 --- a/src/components/ble/NavigationService.cpp +++ b/src/components/ble/NavigationService.cpp @@ -101,7 +101,6 @@ int Pinetime::Controllers::NavigationService::OnCommand(uint16_t conn_handle, ui data[notifSize] = '\0'; os_mbuf_copydata(ctxt->om, 0, notifSize, data); char *s = (char *) &data[0]; - NRF_LOG_INFO("DATA : %s", s); if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &navFlagCharUuid) == 0) { m_flag = s; } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &navNarrativeCharUuid) == 0) { diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp index 36abf026..88e83b92 100644 --- a/src/components/ble/NotificationManager.cpp +++ b/src/components/ble/NotificationManager.cpp @@ -87,3 +87,19 @@ size_t NotificationManager::NbNotifications() const { return std::count_if(notifications.begin(), notifications.end(), [](const Notification& n){ return n.valid;}); } +const char* NotificationManager::Notification::Message() const { + const char* itField = std::find(message.begin(), message.begin()+size-1, '\0'); + if(itField != message.begin()+size-1) { + const char* ptr = (itField)+1; + return ptr; + } + return const_cast(message.data()); +} + +const char* NotificationManager::Notification::Title() const { + const char * itField = std::find(message.begin(), message.begin()+size-1, '\0'); + if(itField != message.begin()+size-1) { + return message.data(); + } + return {}; +} diff --git a/src/components/ble/NotificationManager.h b/src/components/ble/NotificationManager.h index 075a9a45..486bba15 100644 --- a/src/components/ble/NotificationManager.h +++ b/src/components/ble/NotificationManager.h @@ -17,8 +17,12 @@ namespace Pinetime { Id id; bool valid = false; uint8_t index; + uint8_t size; std::array message; Categories category = Categories::Unknown; + + const char* Message() const; + const char* Title() const; }; Notification::Id nextId {0}; diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index c903ed0f..457d1e06 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -17,8 +17,8 @@ Notifications::Notifications(DisplayApp *app, auto notification = notificationManager.GetLastNotification(); if(notification.valid) { currentId = notification.id; - currentItem = std::make_unique("\nNotification", - notification.message.data(), + currentItem = std::make_unique(notification.Title(), + notification.Message(), notification.index, notification.category, notificationManager.NbNotifications(), @@ -87,8 +87,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { currentId = previousNotification.id; currentItem.reset(nullptr); app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up); - currentItem = std::make_unique("\nNotification", - previousNotification.message.data(), + currentItem = std::make_unique(previousNotification.Title(), + previousNotification.Message(), previousNotification.index, previousNotification.category, notificationManager.NbNotifications(), @@ -109,8 +109,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { currentId = nextNotification.id; currentItem.reset(nullptr); app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); - currentItem = std::make_unique("\nNotification", - nextNotification.message.data(), + currentItem = std::make_unique(nextNotification.Title(), + nextNotification.Message(), nextNotification.index, nextNotification.category, notificationManager.NbNotifications(), @@ -178,8 +178,9 @@ namespace { lv_obj_t* alert_type = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x888888)); + if(title == nullptr) title = "Notification"; lv_label_set_text(alert_type, title); - lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, -4); + lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16); ///////// switch(category) { -- cgit v1.2.3-70-g09d2 From 1b71a10bebb63a1b93583d20d657d7accb6b3ddf Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 4 Apr 2021 13:42:22 +0200 Subject: Notification app : disable swipe when the app is in 'preview' mode. In this mode, only the new notification should be displayed, there is no point to allow navigating to past notifications. Works as a workaround for the crash that occurs when you swipe the notification app in preview mode (https://github.com/JF002/InfiniTime/issues/250). --- src/displayapp/screens/Notifications.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/displayapp/screens/Notifications.cpp') diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 457d1e06..5600c0ec 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -73,6 +73,8 @@ bool Notifications::Refresh() { } bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + if(mode != Modes::Normal) return true; + switch (event) { case Pinetime::Applications::TouchEvents::SwipeUp: { Controllers::NotificationManager::Notification previousNotification; -- cgit v1.2.3-70-g09d2 From bb7531e2085cee056161c528d84884d5a75c5e6e Mon Sep 17 00:00:00 2001 From: Joaquim Date: Sun, 4 Apr 2021 13:51:22 +0100 Subject: double tap wakeup error fix battery nonblocking read --- src/components/battery/BatteryController.cpp | 74 +++++++++++++++++++++------- src/components/battery/BatteryController.h | 47 ++++-------------- src/displayapp/screens/InfiniPaint.cpp | 2 + src/displayapp/screens/Notifications.cpp | 5 +- src/drivers/TwiMaster.cpp | 7 ++- src/libs/lv_conf.h | 2 +- src/systemtask/SystemTask.cpp | 20 ++++---- 7 files changed, 89 insertions(+), 68 deletions(-) (limited to 'src/displayapp/screens/Notifications.cpp') diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp index aaa245e4..50f95c99 100644 --- a/src/components/battery/BatteryController.cpp +++ b/src/components/battery/BatteryController.cpp @@ -1,16 +1,38 @@ #include "BatteryController.h" #include +#include #include #include +#include using namespace Pinetime::Controllers; +#define SAMPLES_IN_BUFFER 1 +static nrf_saadc_value_t m_buffer_pool[2][SAMPLES_IN_BUFFER]; + +static float voltage = 0.0f; +static int percentRemaining = -1; + void Battery::Init() { nrf_gpio_cfg_input(chargingPin, (nrf_gpio_pin_pull_t)GPIO_PIN_CNF_PULL_Pullup); nrf_gpio_cfg_input(powerPresentPin, (nrf_gpio_pin_pull_t)GPIO_PIN_CNF_PULL_Pullup); +} + +void Battery::Update() { + isCharging = !nrf_gpio_pin_read(chargingPin); + isPowerPresent = !nrf_gpio_pin_read(powerPresentPin); + + // Non blocking read + SaadcInit(); + nrfx_saadc_sample(); + +} + +void Battery::SaadcInit() { nrfx_saadc_config_t adcConfig = NRFX_SAADC_DEFAULT_CONFIG; - nrfx_saadc_init(&adcConfig, SaadcEventHandler); + APP_ERROR_CHECK(nrfx_saadc_init(&adcConfig, SaadcEventHandler)); + nrf_saadc_channel_config_t adcChannelConfig = { .resistor_p = NRF_SAADC_RESISTOR_DISABLED, .resistor_n = NRF_SAADC_RESISTOR_DISABLED, @@ -18,32 +40,50 @@ void Battery::Init() { .reference = NRF_SAADC_REFERENCE_INTERNAL, .acq_time = NRF_SAADC_ACQTIME_3US, .mode = NRF_SAADC_MODE_SINGLE_ENDED, - .burst = NRF_SAADC_BURST_DISABLED, + .burst = NRF_SAADC_BURST_ENABLED, .pin_p = batteryVoltageAdcInput, .pin_n = NRF_SAADC_INPUT_DISABLED }; - nrfx_saadc_channel_init(0, &adcChannelConfig); + APP_ERROR_CHECK(nrfx_saadc_channel_init(0, &adcChannelConfig)); + APP_ERROR_CHECK(nrfx_saadc_buffer_convert(m_buffer_pool[0],SAMPLES_IN_BUFFER)); + APP_ERROR_CHECK(nrfx_saadc_buffer_convert(m_buffer_pool[1],SAMPLES_IN_BUFFER)); + } -void Battery::Update() { - isCharging = !nrf_gpio_pin_read(chargingPin); - isPowerPresent = !nrf_gpio_pin_read(powerPresentPin); +void Battery::SaadcEventHandler(nrfx_saadc_evt_t const * p_event) { + int avg_sample = 0; + int i = 0; + + const float battery_max = 4.18; //maximum voltage of battery ( max charging voltage is 4.21 ) + const float battery_min = 3.20; //minimum voltage of battery before shutdown ( depends on the battery ) - nrf_saadc_value_t value = 0; - nrfx_saadc_sample_convert(0, &value); + if (p_event->type == NRFX_SAADC_EVT_DONE) { + + APP_ERROR_CHECK(nrfx_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER)); - // see https://forum.pine64.org/showthread.php?tid=8147 - voltage = (value * 2.0f) / (1024/3.0f); - int percentRemaining = ((voltage - 3.55f)*100.0f)*3.9f; - percentRemaining = std::max(percentRemaining, 0); - percentRemaining = std::min(percentRemaining, 100); + for (i = 0; i < SAMPLES_IN_BUFFER; i++) { + avg_sample += p_event->data.done.p_buffer[i]; // take N samples in a row + } + avg_sample /= i; // average all the samples out - percentRemainingBuffer.insert(percentRemaining); + voltage = (static_cast(avg_sample) * 2.04f) / (1024 / 3.0f); + voltage = roundf(voltage * 100) / 100; -// NRF_LOG_INFO("BATTERY " NRF_LOG_FLOAT_MARKER " %% - " NRF_LOG_FLOAT_MARKER " v", NRF_LOG_FLOAT(percentRemaining), NRF_LOG_FLOAT(voltage)); -// NRF_LOG_INFO("POWER Charging : %d - Power : %d", isCharging, isPowerPresent); + percentRemaining = static_cast(((voltage - battery_min) / (battery_max - battery_min)) * 100); + + percentRemaining = std::max(percentRemaining, 0); + percentRemaining = std::min(percentRemaining, 100); + + nrfx_saadc_uninit(); + + } } -void Battery::SaadcEventHandler(nrfx_saadc_evt_t const * event) { +int Battery::PercentRemaining() { + return percentRemaining; +} + +float Battery::Voltage() { + return voltage; } \ No newline at end of file diff --git a/src/components/battery/BatteryController.h b/src/components/battery/BatteryController.h index 86250a57..9bc942c9 100644 --- a/src/components/battery/BatteryController.h +++ b/src/components/battery/BatteryController.h @@ -6,44 +6,16 @@ namespace Pinetime { namespace Controllers { - /** A simple circular buffer that can be used to average - out the sensor values. The total capacity of the CircBuffer - is given as the template parameter N. - */ - template - class CircBuffer { - public: - CircBuffer() : arr{}, sz{}, cap{N}, head{} {} - /** - insert member function overwrites the next data to the current - HEAD and moves the HEAD to the newly inserted value. - */ - void insert(const int num) { - head %= cap; - arr[head++] = num; - if (sz != cap) { - sz++; - } - } - - int GetAverage() const { - int sum = std::accumulate(arr.begin(), arr.end(), 0); - return (sum / sz); - } - - private: - std::array arr; /**< internal array used to store the values*/ - uint8_t sz; /**< The current size of the array.*/ - uint8_t cap; /**< Total capacity of the CircBuffer.*/ - uint8_t head; /**< The current head of the CircBuffer*/ - }; class Battery { public: + void Init(); void Update(); - int PercentRemaining() const { return percentRemainingBuffer.GetAverage(); } - float Voltage() const { return voltage; } + + int PercentRemaining(); + float Voltage(); + bool IsCharging() const { return isCharging; } bool IsPowerPresent() const { return isPowerPresent; } @@ -51,12 +23,13 @@ namespace Pinetime { static constexpr uint32_t chargingPin = 12; static constexpr uint32_t powerPresentPin = 19; static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7; - static constexpr uint8_t percentRemainingSamples = 10; - static void SaadcEventHandler(nrfx_saadc_evt_t const * p_event); - CircBuffer percentRemainingBuffer {}; - float voltage = 0.0f; + bool isCharging = false; bool isPowerPresent = false; + + static void SaadcEventHandler(nrfx_saadc_evt_t const * p_event); + void SaadcInit(); + }; } } \ No newline at end of file diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp index b2f0fdfe..b6a7e3e4 100644 --- a/src/displayapp/screens/InfiniPaint.cpp +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -56,6 +56,8 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { std::fill(b, b + bufferSize, selectColor); color++; return true; + default: + return true; } return true; } diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index ea6adc64..1a8fca9c 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -117,7 +117,7 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } return true; case Pinetime::Applications::TouchEvents::LongTap: { - notificationManager.ToggleVibrations(); + //notificationManager.ToggleVibrations(); return true; } default: @@ -214,6 +214,7 @@ namespace { lv_obj_set_size(bt_accept, (LV_HOR_RES / 3) - 5, 80); label_accept = lv_label_create(bt_accept, nullptr); lv_label_set_text(label_accept, Symbols::phone); + lv_obj_set_style_local_bg_color(bt_accept, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); bt_reject = lv_btn_create(callBtnContainer, nullptr); bt_reject->user_data = this; @@ -221,6 +222,7 @@ namespace { lv_obj_set_size(bt_reject, (LV_HOR_RES / 3) - 5, 80); label_reject = lv_label_create(bt_reject, nullptr); lv_label_set_text(label_reject, Symbols::phoneSlash); + lv_obj_set_style_local_bg_color(bt_reject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); bt_mute = lv_btn_create(callBtnContainer, nullptr); bt_mute->user_data = this; @@ -228,6 +230,7 @@ namespace { lv_obj_set_size(bt_mute, (LV_HOR_RES / 3) - 5, 80); label_mute = lv_label_create(bt_mute, nullptr); lv_label_set_text(label_mute, Symbols::volumMute); + lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); } break; } diff --git a/src/drivers/TwiMaster.cpp b/src/drivers/TwiMaster.cpp index 6a063ecf..d5898b5e 100644 --- a/src/drivers/TwiMaster.cpp +++ b/src/drivers/TwiMaster.cpp @@ -10,6 +10,7 @@ using namespace Pinetime::Drivers; TwiMaster::TwiMaster(const Modules module, const Parameters& params) : module{module}, params{params} { mutex = xSemaphoreCreateBinary(); + ASSERT(mutex != NULL); } void TwiMaster::Init() { @@ -61,9 +62,11 @@ void TwiMaster::Init() { } TwiMaster::ErrorCodes TwiMaster::Read(uint8_t deviceAddress, uint8_t registerAddress, uint8_t *data, size_t size) { - xSemaphoreTake(mutex, portMAX_DELAY); + // this is causing an error when came from sleep + //xSemaphoreTake(mutex, portMAX_DELAY); + auto ret = ReadWithRetry(deviceAddress, registerAddress, data, size); - xSemaphoreGive(mutex); + //xSemaphoreGive(mutex); return ret; } diff --git a/src/libs/lv_conf.h b/src/libs/lv_conf.h index 0d1304a5..b2c45ab1 100644 --- a/src/libs/lv_conf.h +++ b/src/libs/lv_conf.h @@ -74,7 +74,7 @@ typedef int16_t lv_coord_t; #define LV_MEM_CUSTOM 0 #if LV_MEM_CUSTOM == 0 /* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ -#define LV_MEM_SIZE (12U * 1024U) +#define LV_MEM_SIZE (14U * 1024U) /* Complier prefix for a big array declaration */ #define LV_MEM_ATTR diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 236c313a..2aa071dc 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -148,8 +148,12 @@ void SystemTask::Work() { break; case Messages::GoToRunning: spi.Wakeup(); - //twiMaster.Wakeup(); - //touchPanel.Wakeup(); + + // Double Tap needs the touch screen to be in normal mode + if ( settingsController.getWakeUpMode() != Pinetime::Controllers::Settings::WakeUpMode::DoubleTap ) { + twiMaster.Wakeup(); + touchPanel.Wakeup(); + } nimbleController.StartAdvertising(); xTimerStart(idleTimer, 0); @@ -212,14 +216,10 @@ void SystemTask::Work() { // Double Tap needs the touch screen to be in normal mode if ( settingsController.getWakeUpMode() != Pinetime::Controllers::Settings::WakeUpMode::DoubleTap ) { - //touchPanel.Sleep(); + touchPanel.Sleep(); + twiMaster.Sleep(); } - // No Wake uo mode, we can put the twi to sleep - if ( settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None ) { - //twiMaster.Sleep(); - } - isSleeping = true; isGoingToSleep = false; break; @@ -281,10 +281,10 @@ void SystemTask::OnTouchEvent() { GoToRunning(); } else if( settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap ) { // error - /*auto info = touchPanel.GetTouchInfo(); + auto info = touchPanel.GetTouchInfo(); if( info.isTouch and info.gesture == Pinetime::Drivers::Cst816S::Gestures::DoubleTap ) { GoToRunning(); - }*/ + } } } } -- cgit v1.2.3-70-g09d2 From 57b4c3f0edc6acfa31bd2160abdcd6091920ba63 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Fri, 9 Apr 2021 20:50:09 +0200 Subject: Fix display of empty notification. --- src/displayapp/screens/Notifications.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/displayapp/screens/Notifications.cpp') diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 2fac6acb..33cebe86 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -26,7 +26,7 @@ Notifications::Notifications(DisplayApp *app, alertNotificationService); validDisplay = true; } else { - currentItem = std::make_unique("\nNotification", + currentItem = std::make_unique("Notification", "No notification to display", 0, notification.category, -- cgit v1.2.3-70-g09d2