diff --git a/src/gui/font/DIN1451_m_cond_180.c b/src/gui/font/DIN1451_m_cond_180.c index 0efe925..a4343f0 100644 --- a/src/gui/font/DIN1451_m_cond_180.c +++ b/src/gui/font/DIN1451_m_cond_180.c @@ -18,78 +18,6 @@ /*Store the image of the glyphs*/ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { - /* U+20 " " */ - - /* U+2C "," */ - 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xfd, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xfd, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xfd, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xfd, 0xbf, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xfd, 0xbf, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xbf, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xbf, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, - 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xfd, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xfd, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xfd, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xfd, 0xbf, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xfd, 0xbf, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xbf, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6b, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x20, 0xbf, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x0, 0xb, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, 0x0, 0x0, - 0xbf, 0xff, 0xff, 0xff, 0xff, 0xd2, 0x0, 0x0, - 0xb, 0xff, 0xff, 0xff, 0xff, 0x90, 0x0, 0x0, - 0x0, 0xbf, 0xff, 0xff, 0xff, 0x50, 0x0, 0x0, - 0x0, 0xb, 0xff, 0xff, 0xfc, 0x20, 0x0, 0x0, - 0x0, 0x0, 0xbf, 0xff, 0xf9, 0x0, 0x0, 0x0, - 0x0, 0x0, 0xb, 0xff, 0xe5, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0xbf, 0xc1, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0xb, 0x80, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - - /* U+2E "." */ - 0x5e, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, - 0xee, 0x66, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xf7, 0x6f, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x76, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x6f, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x76, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xf7, 0x6f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x76, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xf7, 0x6f, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x76, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x6f, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x76, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xf7, 0x6f, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x76, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xf7, 0x6f, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x76, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, - 0x6f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x76, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xf7, - /* U+30 "0" */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x12, 0x22, 0x10, 0x0, @@ -4335,96 +4263,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x85, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - - /* U+3A ":" */ - 0xce, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, - 0xed, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xef, 0xff, 0xff, 0xff, 0x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0xff, 0xef, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; @@ -4434,39 +4273,29 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, - {.bitmap_index = 0, .adv_w = 539, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 0, .adv_w = 596, .box_w = 17, .box_h = 41, .ofs_x = 10, .ofs_y = -23}, - {.bitmap_index = 349, .adv_w = 622, .box_w = 19, .box_h = 18, .ofs_x = 10, .ofs_y = 0}, - {.bitmap_index = 520, .adv_w = 1097, .box_w = 52, .box_h = 132, .ofs_x = 8, .ofs_y = -1}, - {.bitmap_index = 3952, .adv_w = 1097, .box_w = 34, .box_h = 129, .ofs_x = 12, .ofs_y = 0}, - {.bitmap_index = 6145, .adv_w = 1097, .box_w = 53, .box_h = 130, .ofs_x = 8, .ofs_y = 0}, - {.bitmap_index = 9590, .adv_w = 1097, .box_w = 53, .box_h = 132, .ofs_x = 8, .ofs_y = -1}, - {.bitmap_index = 13088, .adv_w = 1097, .box_w = 59, .box_h = 129, .ofs_x = 5, .ofs_y = 0}, - {.bitmap_index = 16894, .adv_w = 1097, .box_w = 53, .box_h = 130, .ofs_x = 8, .ofs_y = -1}, - {.bitmap_index = 20339, .adv_w = 1097, .box_w = 53, .box_h = 130, .ofs_x = 8, .ofs_y = -1}, - {.bitmap_index = 23784, .adv_w = 1097, .box_w = 55, .box_h = 129, .ofs_x = 7, .ofs_y = 0}, - {.bitmap_index = 27332, .adv_w = 1097, .box_w = 53, .box_h = 132, .ofs_x = 8, .ofs_y = -1}, - {.bitmap_index = 30830, .adv_w = 1097, .box_w = 53, .box_h = 131, .ofs_x = 8, .ofs_y = 0}, - {.bitmap_index = 34302, .adv_w = 697, .box_w = 18, .box_h = 77, .ofs_x = 15, .ofs_y = 0} + {.bitmap_index = 0, .adv_w = 1097, .box_w = 52, .box_h = 132, .ofs_x = 8, .ofs_y = -1}, + {.bitmap_index = 3432, .adv_w = 1097, .box_w = 34, .box_h = 129, .ofs_x = 12, .ofs_y = 0}, + {.bitmap_index = 5625, .adv_w = 1097, .box_w = 53, .box_h = 130, .ofs_x = 8, .ofs_y = 0}, + {.bitmap_index = 9070, .adv_w = 1097, .box_w = 53, .box_h = 132, .ofs_x = 8, .ofs_y = -1}, + {.bitmap_index = 12568, .adv_w = 1097, .box_w = 59, .box_h = 129, .ofs_x = 5, .ofs_y = 0}, + {.bitmap_index = 16374, .adv_w = 1097, .box_w = 53, .box_h = 130, .ofs_x = 8, .ofs_y = -1}, + {.bitmap_index = 19819, .adv_w = 1097, .box_w = 53, .box_h = 130, .ofs_x = 8, .ofs_y = -1}, + {.bitmap_index = 23264, .adv_w = 1097, .box_w = 55, .box_h = 129, .ofs_x = 7, .ofs_y = 0}, + {.bitmap_index = 26812, .adv_w = 1097, .box_w = 53, .box_h = 132, .ofs_x = 8, .ofs_y = -1}, + {.bitmap_index = 30310, .adv_w = 1097, .box_w = 53, .box_h = 131, .ofs_x = 8, .ofs_y = 0} }; /*--------------------- * CHARACTER MAPPING *--------------------*/ -static const uint16_t unicode_list_0[] = { - 0x0, 0xc, 0xe -}; + /*Collect the unicode lists and glyph_id offsets*/ static const lv_font_fmt_txt_cmap_t cmaps[] = { { - .range_start = 32, .range_length = 15, .glyph_id_start = 1, - .unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 3, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY - }, - { - .range_start = 48, .range_length = 11, .glyph_id_start = 4, + .range_start = 48, .range_length = 10, .glyph_id_start = 1, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY } }; @@ -4484,7 +4313,7 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .cmaps = cmaps, .kern_dsc = NULL, .kern_scale = 0, - .cmap_num = 2, + .cmap_num = 1, .bpp = 4, .kern_classes = 0, .bitmap_format = 0 @@ -4499,8 +4328,8 @@ static lv_font_fmt_txt_dsc_t font_dsc = { lv_font_t DIN1451_m_cond_180 = { .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ - .line_height = 154, /*The maximum line height required by the font*/ - .base_line = 23, /*Baseline measured from the bottom of the line*/ + .line_height = 132, /*The maximum line height required by the font*/ + .base_line = 1, /*Baseline measured from the bottom of the line*/ #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif diff --git a/src/gui/mainbar/fulldash_tile/fulldash_tile.cpp b/src/gui/mainbar/fulldash_tile/fulldash_tile.cpp index b200fa5..d44b300 100644 --- a/src/gui/mainbar/fulldash_tile/fulldash_tile.cpp +++ b/src/gui/mainbar/fulldash_tile/fulldash_tile.cpp @@ -29,7 +29,6 @@ #include "hardware/motor.h" //task declarations -lv_task_t *dash_task = nullptr; lv_task_t *time_task = nullptr; // Function declarations @@ -97,8 +96,8 @@ static lv_style_t min_bar_indic_style; //also for avg speed static lv_style_t regen_bar_indic_style; static lv_style_t bar_main_style; //Dashclock objects and styles -static lv_obj_t *dashtime = NULL; -static lv_obj_t *wbatt = NULL; +//static lv_obj_t *dashtime = NULL; +//static lv_obj_t *wbatt = NULL; static lv_obj_t *trip = NULL; static lv_style_t trip_label_style; static lv_style_t dashtime_style; @@ -111,7 +110,6 @@ static lv_style_t alert_style; //Overlay objects and styles static lv_obj_t *overlay_bar = NULL; -//static lv_obj_t *overlay_line = NULL; static lv_obj_t *overlay_label = NULL; static lv_style_t overlay_style; static lv_style_t overlay_label_style; @@ -606,7 +604,7 @@ void fulldash_speed_update(float current_speed, float warn_speed, float tiltback converted_speed = current_speed / 1.6; } char speedstring[4]; - if (converted_speed > 10) + if (converted_speed >= 10) { dtostrf(converted_speed, 2, 0, speedstring); } diff --git a/src/gui/mainbar/fulldash_tile/fulldash_tile.h b/src/gui/mainbar/fulldash_tile/fulldash_tile.h index 22d978b..f1cfd5a 100644 --- a/src/gui/mainbar/fulldash_tile/fulldash_tile.h +++ b/src/gui/mainbar/fulldash_tile/fulldash_tile.h @@ -60,17 +60,14 @@ static lv_color_t watch_bg_colour = lv_color_make(0xAF, 0x00, 0x00); // (Dark Re /*********************************************************** Declare custom fonts, TTF fonts can be converted to C at: https://lvgl.io/tools/fontconverter - All custom fonts reside in the sketch directory + All custom fonts reside in the font directory ***********************************************************/ LV_FONT_DECLARE(DIN1451_m_cond_24); LV_FONT_DECLARE(DIN1451_m_cond_28); LV_FONT_DECLARE(DIN1451_m_cond_36); LV_FONT_DECLARE(DIN1451_m_cond_44); LV_FONT_DECLARE(DIN1451_m_cond_66); -LV_FONT_DECLARE(DIN1451_m_cond_72); -LV_FONT_DECLARE(DIN1451_m_cond_80); LV_FONT_DECLARE(DIN1451_m_cond_120); -LV_FONT_DECLARE(DIN1451_m_cond_150); LV_FONT_DECLARE(DIN1451_m_cond_180); // Text labels diff --git a/src/gui/mainbar/simpledash_tile/simpledash_tile.cpp b/src/gui/mainbar/simpledash_tile/simpledash_tile.cpp index 161751f..4b56523 100644 --- a/src/gui/mainbar/simpledash_tile/simpledash_tile.cpp +++ b/src/gui/mainbar/simpledash_tile/simpledash_tile.cpp @@ -39,10 +39,13 @@ static void sd_overlay_event_cb(lv_obj_t *obj, lv_event_t event); Declare LVGL Dashboard objects and styles */ - LV_IMG_DECLARE(currentalarm_128px); - LV_IMG_DECLARE(battalarm_128px); - LV_IMG_DECLARE(tempalarm_128px); - LV_IMG_DECLARE(fan_40px); +LV_IMG_DECLARE(currentalarm_128px); +LV_IMG_DECLARE(battalarm_128px); +LV_IMG_DECLARE(tempalarm_128px); +LV_IMG_DECLARE(fan_40px); + +LV_FONT_DECLARE(DIN1451_m_cond_36); +LV_FONT_DECLARE(DIN1451_m_cond_180); static lv_obj_t *simpledash_cont = NULL; static lv_style_t *style; @@ -167,24 +170,13 @@ void lv_sd_define_styles_1(void) void lv_sd_speed_arc_1(void) { - float current_speed = wheelctl_get_data(WHEELCTL_SPEED); //Label sd_speed_label = lv_label_create(simpledash_cont, NULL); lv_obj_reset_style_list(sd_speed_label, LV_OBJ_PART_MAIN); lv_obj_add_style(sd_speed_label, LV_LABEL_PART_MAIN, &sd_speed_label_style); - char speedstring[4]; - if (current_speed > 10) - { - dtostrf(current_speed, 2, 0, speedstring); - } - else - { - dtostrf(current_speed, 1, 0, speedstring); - } - lv_label_set_text(sd_speed_label, speedstring); + lv_label_set_text(sd_speed_label, "0"); lv_label_set_align(sd_speed_label, LV_LABEL_ALIGN_CENTER); - lv_obj_align(sd_speed_label, NULL, LV_ALIGN_CENTER, 0, 8); - //mainbar_add_slide_element(sd_speed_label); + lv_obj_align(sd_speed_label, simpledash_cont, LV_ALIGN_CENTER, 0, 0); } void lv_sd_batt_arc_1(void) @@ -284,11 +276,11 @@ void lv_sd_alerts(void) { sd_fan_indic = lv_img_create(simpledash_cont, NULL); lv_obj_reset_style_list(sd_fan_indic, LV_OBJ_PART_MAIN); - lv_obj_set_size(sd_fan_indic, 40, 40); + lv_obj_set_size(sd_fan_indic, 32, 32); lv_obj_add_style(sd_fan_indic, LV_OBJ_PART_MAIN, &sd_alert_style); lv_img_set_src(sd_fan_indic, &fan_40px); lv_obj_set_hidden(sd_fan_indic, true); - lv_obj_align(sd_fan_indic, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0); + lv_obj_align(sd_fan_indic, NULL, LV_ALIGN_IN_TOP_RIGHT, -5, 5); sd_batt_alert = lv_img_create(simpledash_cont, NULL); lv_obj_reset_style_list(sd_batt_alert, LV_OBJ_PART_MAIN); @@ -364,36 +356,21 @@ int sd_value2angle(int arcstart, int arcstop, float minvalue, float maxvalue, fl { int rAngle; int arcdegrees; - if (arcstop < arcstart) - { - arcdegrees = (arcstop + 360) - arcstart; - } - else - { - arcdegrees = arcstop - arcstart; - } - if (reverse) - { - rAngle = arcstop - (arcvalue * arcdegrees / (maxvalue - minvalue)); - } - else - { - rAngle = arcstart + (arcvalue * arcdegrees / (maxvalue - minvalue)); - } - if (rAngle >= 360) - { - rAngle = rAngle - 360; - } - else if (rAngle < 0) - { - rAngle = rAngle + 360; - } + + if (arcstop < arcstart) arcdegrees = (arcstop + 360) - arcstart; + else arcdegrees = arcstop - arcstart; + + if (reverse) rAngle = arcstop - (arcvalue * arcdegrees / (maxvalue - minvalue)); + else rAngle = arcstart + (arcvalue * arcdegrees / (maxvalue - minvalue)); + + if (rAngle >= 360) rAngle = rAngle - 360; + else if (rAngle < 0) rAngle = rAngle + 360; + return rAngle; } void simpledash_speed_update(float current_speed, float warn_speed, float tiltback_speed, float top_speed) { - Serial.println("updating speed"); if (sd_speed_label == NULL) return; if (current_speed >= tiltback_speed) { @@ -407,25 +384,16 @@ void simpledash_speed_update(float current_speed, float warn_speed, float tiltba { lv_style_set_text_color(&sd_speed_label_style, LV_STATE_DEFAULT, sd_speed_fg_clr); } - lv_obj_add_style(sd_speed_label, LV_LABEL_PART_MAIN, &sd_speed_label_style); - char speedstring[4]; - float converted_speed = current_speed; - if (dashboard_get_config(DASHBOARD_IMPDIST)) - { - converted_speed = current_speed / 1.6; - } - if (converted_speed >= 10) - { - dtostrf(converted_speed, 2, 0, speedstring); - } - else - { - dtostrf(converted_speed, 1, 0, speedstring); - } - lv_label_set_text(sd_speed_label, speedstring); + + if (dashboard_get_config(DASHBOARD_IMPDIST)) current_speed = current_speed / 1.6; + + static char sd_speedstring[4]; + dtostrf(current_speed, 2, 0, sd_speedstring); + + lv_label_set_text(sd_speed_label, sd_speedstring); lv_label_set_align(sd_speed_label, LV_LABEL_ALIGN_CENTER); - lv_obj_align(sd_speed_label, NULL, LV_ALIGN_CENTER, 0, 8); + lv_obj_align(sd_speed_label, simpledash_cont, LV_ALIGN_CENTER, 0, 0); } void simpledash_batt_update(float current_battpct, float min_battpct, float max_battpct) @@ -475,7 +443,6 @@ void simpledash_current_update(float current_current, byte maxcurrent, float min if (dashboard_get_config(DASHBOARD_CURRENT)) { - Serial.println("updating current"); if (sd_current_arc == NULL) return; // Set warning and alert colour float amps = current_current; @@ -502,7 +469,6 @@ void simpledash_current_update(float current_current, byte maxcurrent, float min if (dashboard_get_config(DASHBOARD_BARS)) { - Serial.println("updating current bars"); if (sd_current_max_bar == NULL || sd_current_regen_bar == NULL) return; int ang_max = sd_value2angle(sd_current_arc_start, sd_current_arc_end, 0, maxcurrent, max_current, true); int ang_max2 = ang_max + 3; @@ -510,10 +476,6 @@ void simpledash_current_update(float current_current, byte maxcurrent, float min { ang_max2 = ang_max2 - 360; } - if (ang_max2 < 0) - { - ang_max2 = ang_max2 + 360; - } lv_arc_set_angles(sd_current_max_bar, ang_max, ang_max2); int ang_regen = sd_value2angle(sd_current_arc_start, sd_current_arc_end, 0, maxcurrent, min_current, true); @@ -522,14 +484,8 @@ void simpledash_current_update(float current_current, byte maxcurrent, float min { ang_regen2 = ang_regen2 - 360; } - if (ang_regen2 < 0) - { - ang_regen2 = ang_regen2 + 360; - } lv_arc_set_angles(sd_current_regen_bar, ang_regen, ang_regen2); - Serial.println("current bars updated"); } - Serial.println("current updated"); } } @@ -541,14 +497,12 @@ void simpledash_overlay_update() lv_style_set_bg_opa(&sd_overlay_style, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_add_style(sd_overlay_bar, LV_OBJ_PART_MAIN, &sd_overlay_style); lv_obj_set_hidden(sd_overlay_label, true); - Serial.println("overlay disabled"); } else { lv_style_set_bg_opa(&sd_overlay_style, LV_STATE_DEFAULT, LV_OPA_30); lv_obj_add_style(sd_overlay_bar, LV_OBJ_PART_MAIN, &sd_overlay_style); lv_obj_set_hidden(sd_overlay_label, false); - Serial.println("overlay enabled"); } } @@ -569,7 +523,6 @@ void simpledash_activate_cb(void) lv_task_ready(overlay_task); simpledash_active = true; wheelctl_update_values(); - Serial.println("overlay task created"); } } @@ -578,7 +531,6 @@ void simpledash_hibernate_cb(void) if (simpledash_active && overlay_task != nullptr) { lv_task_del(overlay_task); simpledash_active = false; - Serial.println("overlay task deleted"); } } diff --git a/src/gui/mainbar/simpledash_tile/simpledash_tile.h b/src/gui/mainbar/simpledash_tile/simpledash_tile.h index 1e7df64..f72443a 100644 --- a/src/gui/mainbar/simpledash_tile/simpledash_tile.h +++ b/src/gui/mainbar/simpledash_tile/simpledash_tile.h @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifndef _SIMPLEDASH_TILE_H #define _SIMPLEDASH_TILE_H @@ -29,60 +30,44 @@ is a warning or critical state **********************************************/ // Gauge colours -static lv_color_t sd_current_bg_clr = lv_color_make(0x25, 0x25, 0x25); //Current gauge arc background (default = dark gray) -static lv_color_t sd_current_fg_clr = lv_color_make(0xff, 0xff, 0xff); //Current gauge arc background (default = white) -static lv_color_t sd_speed_bg_clr = lv_color_make(0x05, 0x2a, 0x05); //Speed gauge arc background (default = dark green) -static lv_color_t sd_speed_fg_clr = lv_color_make(0x00, 0xfa, 0x0f); //Speed gauge indicator color (default = green) -static lv_color_t sd_batt_bg_clr = lv_color_make(0x05, 0x2a, 0x05); //Battery gauge arc background (default = dark green) - -// change default bg col for batt arc MJR 14-OCT-2020 -- could not get this to compile, reverted to original CJO 18-10 -//static lv_color_t batt_light_bg_clr = ( fulldash ? lv_color_make(0x05, 0x4a, 0x15) : lv_color_make(0xff, 0x00, 0x00) ); // green or red +static lv_color_t sd_current_bg_clr = lv_color_make(0x25, 0x25, 0x25); //Current gauge arc background (default = dark gray) +static lv_color_t sd_current_fg_clr = lv_color_make(0xff, 0xff, 0xff); //Current gauge arc background (default = white) +static lv_color_t sd_speed_bg_clr = lv_color_make(0x05, 0x2a, 0x05); //Speed gauge arc background (default = dark green) +static lv_color_t sd_speed_fg_clr = lv_color_make(0x00, 0xfa, 0x0f); //Speed gauge indicator color (default = green) +static lv_color_t sd_batt_bg_clr = lv_color_make(0x05, 0x2a, 0x05); //Battery gauge arc background (default = dark green) static lv_color_t sd_batt_light_bg_clr = lv_color_make(0x05, 0x4a, 0x15); //Battery gauge arc background (default = dark green) - -static lv_color_t sd_batt_fg_clr = lv_color_make(0x00, 0xfa, 0x0f); //Battery gauge indicator color (default = green) -static lv_color_t sd_temp_bg_clr = lv_color_make(0x05, 0x05, 0x3a); //Temperature gauge arc background (dark blue) -static lv_color_t sd_temp_fg_clr = lv_color_make(0x2a, 0x1f, 0xff); //Temperature gauge indicator color (light blue) +static lv_color_t sd_batt_fg_clr = lv_color_make(0x00, 0xfa, 0x0f); //Battery gauge indicator color (default = green) +static lv_color_t sd_temp_bg_clr = lv_color_make(0x05, 0x05, 0x3a); //Temperature gauge arc background (dark blue) +static lv_color_t sd_temp_fg_clr = lv_color_make(0x2a, 0x1f, 0xff); //Temperature gauge indicator color (light blue) static lv_color_t sd_arc_warning_colour = lv_color_make(0x3a, 0x3a, 0x05); //Colour for warnings (Dark yellow) -static lv_color_t sd_arc_crit_colour = lv_color_make(0x3a, 0x05, 0x05); //Colour for critical states (Dark red) +static lv_color_t sd_arc_crit_colour = lv_color_make(0x3a, 0x05, 0x05); //Colour for critical states (Dark red) //Misc colours static lv_color_t sd_ride_mode_clr = lv_color_make(0xFF, 0x00, 0xFF); //The H M S ride mode indicator (Magenta) static lv_color_t sd_max_bar_clr = lv_color_make(0xFF, 0x00, 0xFF); // (Magenta) static lv_color_t sd_min_bar_clr = lv_color_make(0x2a, 0x1f, 0xff); // (light blue) static lv_color_t sd_regen_bar_clr = lv_color_make(0x00, 0xfa, 0x0f); // (green) -static lv_color_t sd_watch_info_colour = lv_color_make(0xe0, 0xe0, 0xe0); //Watch battery level and time (Gray) static lv_color_t sd_warning_colour = lv_color_make(0xff, 0xff, 0x00); //Colour for warnings (Yellow) static lv_color_t sd_crit_colour = lv_color_make(0xff, 0x00, 0x00); //Colour for critical states (RED) -//Disconnected time display colour -static lv_color_t sd_watch_colour = lv_color_make(0xFF, 0x00, 0x00); // (Red) -static lv_color_t sd_watch_bg_colour = lv_color_make(0xAF, 0x00, 0x00); // (Dark Red) - -/*********************************************************** - Declare custom fonts, TTF fonts can be converted to C at: - https://lvgl.io/tools/fontconverter - All custom fonts reside in the sketch directory - ***********************************************************/ -LV_FONT_DECLARE(DIN1451_m_cond_24); -LV_FONT_DECLARE(DIN1451_m_cond_28); -LV_FONT_DECLARE(DIN1451_m_cond_36); -LV_FONT_DECLARE(DIN1451_m_cond_44); -LV_FONT_DECLARE(DIN1451_m_cond_66); -LV_FONT_DECLARE(DIN1451_m_cond_72); -LV_FONT_DECLARE(DIN1451_m_cond_80); -LV_FONT_DECLARE(DIN1451_m_cond_120); -LV_FONT_DECLARE(DIN1451_m_cond_150); -LV_FONT_DECLARE(DIN1451_m_cond_180); - -// Text labels - -// Bitmaps //Functions +/** +* @brief Setup all widgets on the simple dash +*/ void simpledash_tile_setup(void); +/** +* @brief Get the tile number of the simpe dash +*/ uint32_t simpledash_get_tile (void); +/** +* @brief reload the simpledash tile +*/ void simpledash_tile_reload ( void ); - /** * @brief update speed arc and label +* @param current_speed current speed as reported by the wheel +* @param warn_speed the speed when the last speed alarm is triggered (alarm3) +* @param tiltback_speed The speed when the wheels tiltback feature is activated +* @param top_speed highest speed attained during the session */ void simpledash_speed_update(float current_speed, float warn_speed, float tiltback_speed, float top_speed); /**