Skip to content

Commit

Permalink
Finalize top bar icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Apehaenger committed Sep 12, 2023
1 parent 3a68a87 commit e67b961
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 31 deletions.
26 changes: 19 additions & 7 deletions Firmware/CoverUI/YardForce/WYM240128K1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#define LVGL_BUFFER_MULTIPLIER 10
#define LVGL_TIMER_HANDLER_PERIOD_MS 10 // 10ms lv_timer_handler() soft period

#define TOP_STATUS_BAR_GAP_PX 5 // Amount of (gap) pixels between top status-bar icons/symbols

#include "UC1698.h"

#include <Arduino.h>
Expand All @@ -40,7 +42,9 @@ namespace display
lv_disp_drv_t lv_disp_drv; // LVGL driver

// Status Screen Widgets
WidgetLedSymbol *v_led_ros, *v_led_charge;
WidgetLedSymbol *v_led_heartbeat, *v_led_ros,
*v_led_emergency_wheel, *v_led_emergency, *v_led_emergency_stop,
*v_led_charge;
WidgetBar *bar_gps, *bar_bat;
WidgetTextTicker *text_ticker_status;

Expand Down Expand Up @@ -85,15 +89,25 @@ namespace display

static void mainStatusScreen()
{
// Status symbols, from right to left
v_led_charge = new WidgetLedSymbol(FA_SYMBOL_CHARGE, LV_ALIGN_OUT_TOP_RIGHT, (240 - (1 * 14)), 0);
v_led_ros = new WidgetLedSymbol(FA_SYMBOL_ROS, LV_ALIGN_OUT_TOP_RIGHT, (240 - (2 * 14) - 5), 0);
// On the left side of the status bar we do have functional status symbols like heartbeat and ROS
v_led_heartbeat = new WidgetLedSymbol(FA_SYMBOL_HEARTBEAT, LV_ALIGN_TOP_LEFT, 0, 0); // Leftmost
v_led_ros = new WidgetLedSymbol(FA_SYMBOL_ROS, LV_ALIGN_TOP_LEFT, 14 + TOP_STATUS_BAR_GAP_PX, 0);

// In the middle, we do have emergencies
v_led_emergency = new WidgetLedSymbol(FA_SYMBOL_EMERGENCY, LV_ALIGN_TOP_MID, 0, 0); // Centered
v_led_emergency_wheel = new WidgetLedSymbol(FA_SYMBOL_EMERGENCY_WHEEL, LV_ALIGN_TOP_MID, -14 - TOP_STATUS_BAR_GAP_PX - 2, 0); // Left of centered
v_led_emergency_stop = new WidgetLedSymbol(FA_SYMBOL_EMERGENCY_STOP, LV_ALIGN_TOP_MID, 14 + TOP_STATUS_BAR_GAP_PX, 0); // Right of centered

// On the right side, mowing status like, charging, docking, ...
v_led_charge = new WidgetLedSymbol(FA_SYMBOL_CHARGE, LV_ALIGN_OUT_TOP_RIGHT, (240 - (1 * 14)), 0); // Rightmost

// GPS & Battery bars
bar_gps = new WidgetBar(FA_SYMBOL_GPS2 " %d %%", LV_ALIGN_TOP_MID, 0, 30, UC1698_DISPLAY_WIDTH, 21);
bar_bat = new WidgetBar(FA_SYMBOL_BATTERY " %d %%", LV_ALIGN_TOP_MID, 0, 60, UC1698_DISPLAY_WIDTH, 21);

// Mower status text (ticker)
text_ticker_status = new WidgetTextTicker(LV_ALIGN_TOP_MID, 0, 95, UC1698_DISPLAY_WIDTH);
text_ticker_status->set_text("Long text should ticker: Lorem Ipsum Bla bla bla");
text_ticker_status->set_text("Mower status like Idle, Mowing, Emergency, ...");
}

static void anim_x_cb(void *var, int32_t v)
Expand Down Expand Up @@ -160,8 +174,6 @@ namespace display

openmower_anim();
//mainStatusScreen();
// test1();
// testCanvas();

return true;
}
Expand Down
1 change: 1 addition & 0 deletions Firmware/CoverUI/YardForce/WidgetLedSymbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace display
{
label = lv_label_create(lv_scr_act());
lv_label_set_text(label, symbol_str.c_str());
lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_set_style_text_color(lv_scr_act(), lv_color_black(), LV_PART_MAIN);
lv_obj_align(label, align, x_ofs, y_ofs);
}
Expand Down
57 changes: 39 additions & 18 deletions Firmware/CoverUI/YardForce/assets/PerfectPixel_FA_14.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+2022 "•" */
0x6f, 0xf6,

/* U+F06A "" */
0xf, 0xc0, 0x7f, 0x83, 0xff, 0x1f, 0x3e, 0xfc,
0xff, 0xf3, 0xff, 0xcf, 0xff, 0xff, 0xfc, 0xff,
0xf3, 0xf7, 0xcf, 0x8f, 0xfc, 0x1f, 0xe0, 0x3f,
0x0,

/* U+F071 "" */
0x1, 0x80, 0x3, 0xc0, 0x3, 0xc0, 0x7, 0xe0,
0x7, 0xe0, 0xe, 0x70, 0x1e, 0x70, 0x1e, 0x78,
Expand Down Expand Up @@ -398,6 +404,11 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
0xdf, 0xf3, 0xfe, 0x7f, 0xc7, 0xf0, 0x7c, 0x2,
0x0, 0x40, 0x8, 0x0,

/* U+F21E "" */
0x3c, 0xf1, 0xff, 0xef, 0xff, 0xff, 0xff, 0xf3,
0x7d, 0xec, 0xe0, 0xe8, 0xf, 0x3c, 0x1f, 0xe0,
0x3f, 0x0, 0x78, 0x0, 0xc0,

/* U+F240 "" */
0xff, 0xff, 0xbf, 0xff, 0xec, 0x0, 0x1f, 0x7f,
0xf7, 0xdf, 0xfc, 0xf7, 0xff, 0x7c, 0x0, 0x1f,
Expand Down Expand Up @@ -434,6 +445,12 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
0xdf, 0x1e, 0x3c, 0x78, 0xff, 0xf7, 0xff, 0xff,
0xff, 0xff, 0xff, 0xc0,

/* U+F5E1 "" */
0x10, 0x0, 0x6, 0x80, 0x1, 0xef, 0x1, 0xff,
0xf8, 0x3d, 0x8f, 0x1d, 0xc0, 0x4f, 0x5e, 0x18,
0xd3, 0xfe, 0x2f, 0xff, 0x83, 0xff, 0x30, 0xff,
0xc8, 0x18, 0x7e, 0x0, 0x3, 0x0, 0x1, 0xc0,

/* U+F5E7 "" */
0x7f, 0x80, 0x7f, 0x86, 0x63, 0x86, 0x63, 0x8f,
0x61, 0x8f, 0x63, 0x8f, 0x7b, 0x86, 0x77, 0xe6,
Expand Down Expand Up @@ -549,30 +566,34 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 860, .adv_w = 89, .box_w = 6, .box_h = 14, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 871, .adv_w = 126, .box_w = 7, .box_h = 5, .ofs_x = 1, .ofs_y = 3},
{.bitmap_index = 876, .adv_w = 76, .box_w = 4, .box_h = 4, .ofs_x = 1, .ofs_y = 4},
{.bitmap_index = 878, .adv_w = 252, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 906, .adv_w = 140, .box_w = 9, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 922, .adv_w = 252, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 950, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 975, .adv_w = 252, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1003, .adv_w = 168, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1023, .adv_w = 280, .box_w = 18, .box_h = 9, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1044, .adv_w = 280, .box_w = 18, .box_h = 9, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1065, .adv_w = 280, .box_w = 18, .box_h = 9, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1086, .adv_w = 280, .box_w = 18, .box_h = 9, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1107, .adv_w = 280, .box_w = 18, .box_h = 9, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1128, .adv_w = 252, .box_w = 15, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1155, .adv_w = 224, .box_w = 14, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1175, .adv_w = 252, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1203, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -2}
{.bitmap_index = 878, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 903, .adv_w = 252, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 931, .adv_w = 140, .box_w = 9, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 947, .adv_w = 252, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 975, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1000, .adv_w = 252, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1028, .adv_w = 168, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1048, .adv_w = 224, .box_w = 14, .box_h = 12, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 1069, .adv_w = 280, .box_w = 18, .box_h = 9, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1090, .adv_w = 280, .box_w = 18, .box_h = 9, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1111, .adv_w = 280, .box_w = 18, .box_h = 9, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1132, .adv_w = 280, .box_w = 18, .box_h = 9, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1153, .adv_w = 280, .box_w = 18, .box_h = 9, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1174, .adv_w = 252, .box_w = 15, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1201, .adv_w = 224, .box_w = 14, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1221, .adv_w = 280, .box_w = 18, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1253, .adv_w = 252, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1281, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -2}
};

/*---------------------
* CHARACTER MAPPING
*--------------------*/

static const uint16_t unicode_list_2[] = {
0x0, 0xd04f, 0xd0c5, 0xd0c7, 0xd102, 0xd11b, 0xd1c4, 0xd21e,
0xd21f, 0xd220, 0xd221, 0xd222, 0xd5ba, 0xd5bd, 0xd5c5, 0xd79e
0x0, 0xd048, 0xd04f, 0xd0c5, 0xd0c7, 0xd102, 0xd11b, 0xd1c4,
0xd1fc, 0xd21e, 0xd21f, 0xd220, 0xd221, 0xd222, 0xd5ba, 0xd5bd,
0xd5bf, 0xd5c5, 0xd79e
};

/*Collect the unicode lists and glyph_id offsets*/
Expand All @@ -588,7 +609,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] =
},
{
.range_start = 8226, .range_length = 55199, .glyph_id_start = 95,
.unicode_list = unicode_list_2, .glyph_id_ofs_list = NULL, .list_length = 16, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
.unicode_list = unicode_list_2, .glyph_id_ofs_list = NULL, .list_length = 19, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
}
};

Expand Down
28 changes: 22 additions & 6 deletions Firmware/CoverUI/YardForce/lv_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,19 +400,35 @@
/* PerfectPixel font, Size 14, 1 Bpp, Characters:
* !"# %-... Bullet
* 0x20-0x23, 0x25-0x7E, 0x2022
* + FontAwesome location-arrow (GPS), bolt (charge), umbrella (rain), exclamation-triangle (emergency), anchor (home?), plug (docking or charge?)
* 0xF124, 0xF0E7, 0xF0E9, 0xF071, 0xF13D, 0xF1E6
* battery-full, battery 3/4, battery 1/2, battery 1/4, battery-empty
* 0xF240-0xF244
* charging-station (charge), brain (ROS?), sattelite-dish (GPS), car-battery
* 0xf5e7, 0xf5dc, 0xf7c0, 0xf5df
* + FontAwesome5-Solid+Brands+Regular
* location-arrow (GPS),
* bolt (charge),
* umbrella (rain),
* exclamation-triangle (emergency),
* anchor (home?),
* plug (docking or charge?)
* battery-full, battery 3/4, battery 1/2, battery 1/4, battery-empty
* 0xF124, 0xF0E7, 0xF0E9, 0xF071, 0xF13D, 0xF1E6, 0xF240-0xF244,
*
* charging-station (charge),
* brain (ROS?),
* sattelite-dish (GPS),
* car-battery,
* car-crash (Wheel lift Hall1-2),
* heartbeat,
* exclamation-circle (stop pressed)
* 0xf5e7, 0xf5dc, 0xf7c0, 0xf5df, 0xf5e1, 0xf21e, 0xf06a
*/
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(PerfectPixel_FA_14)
#define FA_SYMBOL_GPS1 "\xEF\x9F\x80"
#define FA_SYMBOL_GPS2 "\xEF\x84\xA4"
#define FA_SYMBOL_BATTERY "\xEF\x97\x9F"
#define FA_SYMBOL_CHARGE "\xEF\x87\xA6"
#define FA_SYMBOL_ROS "\xEF\x97\x9C" // Brain
#define FA_SYMBOL_EMERGENCY "\xEF\x81\xB1"
#define FA_SYMBOL_EMERGENCY_WHEEL "\xEF\x97\xA1" // Car-crash
#define FA_SYMBOL_EMERGENCY_STOP "\xEF\x81\xAA" // Exclamation-circle
#define FA_SYMBOL_HEARTBEAT "\xEF\x88\x9E"

/*Always set a default font*/
#define LV_FONT_DEFAULT &PerfectPixel_FA_14
Expand Down

0 comments on commit e67b961

Please sign in to comment.