|
|
@@ -65,10 +65,10 @@ void menuFocus(void)
|
|
|
{
|
|
|
// Пункт "Сбросить счетчики"
|
|
|
if (selectedMenuItem->Select == MCELL_RES) {
|
|
|
- set_raw_counters(0, 0, 0);
|
|
|
+ reset_distance();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// Пункт "Сохранить настройки"
|
|
|
if (selectedMenuItem->Select == MCELL_SAVE) {
|
|
|
settings_save();
|
|
|
@@ -160,6 +160,12 @@ void change_revers(bool dir)
|
|
|
settings.revers = true;
|
|
|
}
|
|
|
|
|
|
+// Сброс дистанции
|
|
|
+void change_reset_distance(bool dir)
|
|
|
+{
|
|
|
+ reset_distance();
|
|
|
+}
|
|
|
+
|
|
|
// -------------------------------------------------------------------------- //
|
|
|
// Экранное меню OLDED.
|
|
|
|
|
|
@@ -181,13 +187,22 @@ static void screen_draw_main(uint8_t sel)
|
|
|
oled_clear(BLACK);
|
|
|
|
|
|
// Скругленная рамка и логотип
|
|
|
- GFX_DrawRoundRectangle(0, 0, 127, 127, 5, 15);
|
|
|
- Paint_DrawString_EN(45, 120, "Fly Electronics", &Font8, 0xf, 0x0);
|
|
|
+ //GFX_DrawRoundRectangle(0, 0, 127, 127, 5, 15);
|
|
|
+ Paint_DrawString_EN(50, 120, "Fly Electronics", &Font8, 0xf, 0x0);
|
|
|
|
|
|
// Total
|
|
|
+ //memset(screen_str_buf, 0, SCREEN_BUF_LEN);
|
|
|
+ //oled_float_right_aligment(distance, 7, screen_str_buf);
|
|
|
+ Paint_DrawString_EN(1, 36, "Distance (m):", &Font12, 0xf, 0x0);
|
|
|
+
|
|
|
memset(screen_str_buf, 0, SCREEN_BUF_LEN);
|
|
|
- sprintf(screen_str_buf, ".2%f", distance);
|
|
|
- Paint_DrawString_EN(10, 52, screen_str_buf, &Font24, 0xf, 0x0);
|
|
|
+ oled_float_right_aligment(distance, 7, screen_str_buf);
|
|
|
+ Paint_DrawString_EN(4, 52, screen_str_buf, &Font24, 0xf, 0x0);
|
|
|
+
|
|
|
+ //sprintf(screen_str_buf, "%.2f", distance);
|
|
|
+ //Paint_DrawString_EN(10, 52, screen_str_buf, &Font24, 0xf, 0x0);
|
|
|
+ //Paint_DrawString_EN(4, 0, "01234567890", &Font24, 0xf, 0x0);
|
|
|
+ //Paint_DrawString_EN(4, 52, "01234567890", &Font24, 0xf, 0x0);
|
|
|
|
|
|
|
|
|
//Paint_DrawString_EN(10, 52, "0.0", &Font24, 0xf, 0x0);
|
|
|
@@ -275,16 +290,19 @@ static void screen_draw_settings(uint8_t sel)
|
|
|
static void cli_draw_main(uint8_t sel)
|
|
|
{
|
|
|
uint32_t raw_forw_turns, raw_back_turns, dir;
|
|
|
+ double distance = get_distance();
|
|
|
|
|
|
get_raw_params(&raw_forw_turns, &raw_back_turns, &dir);
|
|
|
|
|
|
DBG printf("\033c");
|
|
|
DBG printf("~~~ MAIN SCREEN ~~~\r\n\n");
|
|
|
-
|
|
|
+
|
|
|
+ DBG printf("Total (m): %.2f\r\n", distance);
|
|
|
+#if 0
|
|
|
cli_print_int_param((char*)"Turns forward: ", raw_forw_turns, false);
|
|
|
cli_print_int_param((char*)"Turns back : ", raw_back_turns, false);
|
|
|
cli_print_int_param((char*)"Direction : ", dir, false);
|
|
|
-
|
|
|
+#endif
|
|
|
update_flag = true;
|
|
|
}
|
|
|
|
|
|
@@ -310,10 +328,7 @@ static void cli_draw_settings(uint8_t sel)
|
|
|
|
|
|
select = sel == MCELL_RES ? true : false;
|
|
|
cli_print_str_param((char*)"Reset counters", (char*)"", select);
|
|
|
-
|
|
|
- select = sel == MCELL_SAVE ? true : false;
|
|
|
- cli_print_str_param((char*)"Save settings", (char*)"", select);
|
|
|
-
|
|
|
+
|
|
|
//DBG printf("\r\nSelect item: %u\r\n", sel);
|
|
|
}
|
|
|
|