Compare commits

...

4 commits

Author SHA1 Message Date
tgc-dk d8545bf831
Merge 42bcd56545 into a2356f2f4a 2024-10-06 18:56:14 +00:00
Reinhold Gschweicher 42bcd56545 Revert "Decrease heapsize to make room for the new icon"
This reverts commit 8f3b7b1f41.
2024-10-06 20:54:34 +02:00
Reinhold Gschweicher 2a8e953cb6 Remove new font, draw with lvgl 2024-10-06 20:17:58 +02:00
Reinhold Gschweicher 0954e3b2b0 PopupMessage: draw lock with lvgl, hard code size 2024-10-06 20:13:52 +02:00
8 changed files with 38 additions and 39 deletions

View file

@ -62,7 +62,7 @@
#define configTICK_RATE_HZ 1024 #define configTICK_RATE_HZ 1024
#define configMAX_PRIORITIES (3) #define configMAX_PRIORITIES (3)
#define configMINIMAL_STACK_SIZE (120) #define configMINIMAL_STACK_SIZE (120)
#define configTOTAL_HEAP_SIZE (1024 * 35) #define configTOTAL_HEAP_SIZE (1024 * 40)
#define configMAX_TASK_NAME_LEN (4) #define configMAX_TASK_NAME_LEN (4)
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1 #define configIDLE_SHOULD_YIELD 1

View file

@ -30,7 +30,6 @@
#include "displayapp/screens/Weather.h" #include "displayapp/screens/Weather.h"
#include "displayapp/screens/PassKey.h" #include "displayapp/screens/PassKey.h"
#include "displayapp/screens/Error.h" #include "displayapp/screens/Error.h"
#include "displayapp/screens/Symbols.h"
#include "drivers/Cst816s.h" #include "drivers/Cst816s.h"
#include "drivers/St7789.h" #include "drivers/St7789.h"
@ -102,7 +101,6 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
spiNorFlash {spiNorFlash}, spiNorFlash {spiNorFlash},
lvgl {lcd, filesystem}, lvgl {lcd, filesystem},
timer(this, TimerCallback), timer(this, TimerCallback),
popupMessage {Screens::Symbols::lock, 90, 90},
controllers {batteryController, controllers {batteryController,
bleController, bleController,
dateTimeController, dateTimeController,

View file

@ -1,5 +1,5 @@
set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20 set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20
jetbrains_mono_extrabold_compressed lv_font_sys_48 lv_font_sys_80 jetbrains_mono_extrabold_compressed lv_font_sys_48
open_sans_light fontawesome_weathericons) open_sans_light fontawesome_weathericons)
find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED
HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin") HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin")

View file

@ -64,16 +64,6 @@
"bpp": 1, "bpp": 1,
"size": 48 "size": 48
}, },
"lv_font_sys_80": {
"sources": [
{
"file": "material-design-icons/MaterialIcons-Regular.ttf",
"range": "0xe897"
}
],
"bpp": 1,
"size": 80
},
"fontawesome_weathericons": { "fontawesome_weathericons": {
"sources": [ "sources": [
{ {

View file

@ -64,9 +64,6 @@ namespace Pinetime {
static constexpr const char* flashlight = "\xEF\x80\x8B"; static constexpr const char* flashlight = "\xEF\x80\x8B";
static constexpr const char* paintbrushLg = "\xEE\x90\x8A"; static constexpr const char* paintbrushLg = "\xEE\x90\x8A";
// wake-up screenlock icon, from material icons
static constexpr const char* lock = "\xEE\xA2\x97";
} }
} }
} }

View file

@ -1,21 +1,40 @@
#include "displayapp/widgets/PopupMessage.h" #include "displayapp/widgets/PopupMessage.h"
#include "displayapp/InfiniTimeTheme.h"
#include <libraries/log/nrf_log.h> #include <libraries/log/nrf_log.h>
using namespace Pinetime::Applications::Widgets; using namespace Pinetime::Applications::Widgets;
PopupMessage::PopupMessage(const char* msg, int16_t h, int16_t w) : message {msg}, height {h}, width {w} { PopupMessage::PopupMessage() {
} }
void PopupMessage::Create() { void PopupMessage::Create() {
btnPopup = lv_btn_create(lv_scr_act(), nullptr); popup = lv_obj_create(lv_scr_act(), nullptr);
btnPopup->user_data = this; lv_obj_set_size(popup, 90, 90);
lv_obj_set_size(btnPopup, height, width); lv_obj_align(popup, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
lv_obj_align(btnPopup, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_local_bg_color(popup, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, Colors::bg);
lv_obj_set_style_local_bg_opa(btnPopup, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_60); lv_obj_set_style_local_bg_opa(popup, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_60);
lv_obj_set_style_local_text_font(btnPopup, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_80); lv_obj_t* lockBody = lv_obj_create(popup, nullptr);
lv_obj_t* lblMessage = lv_label_create(btnPopup, nullptr); lv_obj_set_size(lockBody, 55, 50);
lv_label_set_text_static(lblMessage, message); lv_obj_align(lockBody, popup, LV_ALIGN_CENTER, 0, 10);
lv_obj_set_hidden(btnPopup, isHidden);
lv_obj_set_style_local_bg_color(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_bg_opa(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0);
lv_obj_set_style_local_border_color(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_border_width(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 22);
lv_obj_set_style_local_border_side(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL);
lv_obj_set_style_local_border_opa(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100);
lv_obj_t* lockTop = lv_obj_create(popup, nullptr);
lv_obj_set_size(lockTop, 30, 35);
lv_obj_align(lockTop, popup, LV_ALIGN_CENTER, 0, -20);
lv_obj_set_style_local_bg_color(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_bg_opa(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0);
lv_obj_set_style_local_border_color(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_border_width(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 6);
lv_obj_set_style_local_border_side(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL);
lv_obj_set_style_local_border_opa(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100);
lv_obj_set_hidden(popup, isHidden);
} }
void PopupMessage::SetHidden(bool hidden) { void PopupMessage::SetHidden(bool hidden) {
@ -24,11 +43,11 @@ void PopupMessage::SetHidden(bool hidden) {
} }
isHidden = hidden; isHidden = hidden;
// create/delete on demand // create/delete on demand
if (btnPopup == nullptr && !isHidden) { if (popup == nullptr && !isHidden) {
Create(); Create();
} else if (btnPopup != nullptr) { } else if (popup != nullptr) {
lv_obj_del(btnPopup); lv_obj_del(popup);
btnPopup = nullptr; popup = nullptr;
} }
} }

View file

@ -6,18 +6,14 @@ namespace Pinetime {
namespace Widgets { namespace Widgets {
class PopupMessage { class PopupMessage {
public: public:
// The caller owns the message string, it is not copied. PopupMessage();
PopupMessage(const char* msg, int16_t h, int16_t w);
void Create(); void Create();
void SetHidden(bool hidden); void SetHidden(bool hidden);
bool IsHidden(); bool IsHidden();
private: private:
const char* message; lv_obj_t* popup = nullptr;
lv_obj_t* btnPopup = nullptr;
bool isHidden = true; bool isHidden = true;
int16_t height;
int16_t width;
}; };
} }
} }

View file

@ -419,8 +419,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
LV_FONT_DECLARE(jetbrains_mono_76) \ LV_FONT_DECLARE(jetbrains_mono_76) \
LV_FONT_DECLARE(open_sans_light) \ LV_FONT_DECLARE(open_sans_light) \
LV_FONT_DECLARE(fontawesome_weathericons) \ LV_FONT_DECLARE(fontawesome_weathericons) \
LV_FONT_DECLARE(lv_font_sys_48) \ LV_FONT_DECLARE(lv_font_sys_48)
LV_FONT_DECLARE(lv_font_sys_80)
/* Enable it if you have fonts with a lot of characters. /* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp * The limit depends on the font size, font face and bpp