begin placing elements, add skip BT check

This commit is contained in:
Sem van der Hoeven
2024-11-12 23:34:56 +01:00
parent 21c166aadf
commit 2f325e3254
2 changed files with 40 additions and 50 deletions

View File

@@ -21,6 +21,7 @@ Program to create a car monitor display using:
#include "bars.h"
#define DEBUG 1
#define SKIP_BT_CHECK 1
// #define RTT_MR 0x400E1A30U
#define MS(x) x * 1000
@@ -49,6 +50,18 @@ Program to create a car monitor display using:
#define COLOR_ORANGE 255, 96, 33
/****************************************/
/* x and y positions for several gauges */
/****************************************/
/* box that holds temperature gauges */
#define TEMP_BOX_PADDING 5
#define TEMP_BOX_X_START 300
#define TEMP_BOX_Y_START TEMP_BOX_PADDING
#define TEMP_BOX_CONTENT_WIDTH 180 // witdth of the box to calculate the content in it
#define TEMP_BOX_WIDTH TEMP_BOX_CONTENT_WIDTH - TEMP_BOX_PADDING // width of the box to draw the outline
#define TEMP_BOX_HEIGHT 200 - TEMP_BOX_PADDING
#define TEMP_BOX_COLOR VGA_GRAY
enum DeviceLabel
{
DEV_CPU = 0,
@@ -315,6 +328,11 @@ void on_main_enter()
#endif
Timer0.attachInterrupt(query_slow_obd2_values);
Timer0.start(MS(5000));
// draw section for temps
display.setColor(TEMP_BOX_COLOR);
display.drawRect(TEMP_BOX_X_START, TEMP_BOX_Y_START, TEMP_BOX_X_START + TEMP_BOX_WIDTH, TEMP_BOX_Y_START + TEMP_BOX_HEIGHT);
display.setColor(VGA_AQUA);
}
@@ -539,8 +557,6 @@ void setup()
statemachine_register_state(&init_state, STATE_INIT);
statemachine_register_state(&main_state, STATE_CAR_INFO);
// TODO remove
// statemachine_register_state(&main_state, 0);
statemachine_init();
display.clrScr();
@@ -568,6 +584,10 @@ void setup()
Serial.println(elm327.elm327->connected);
#endif
#if (SKIP_BT_CHECK == 1)
update_percent(10);
#endif
display.clrScr();
display.setFont(OCR_A_Extended_M);
@@ -575,32 +595,5 @@ void setup()
void loop()
{
bar_draw_horizontal(0, 0, 200, 10, bar_1_x, 100, VGA_AQUA, 1, &display);
bar_draw_horizontal(0, 20, 200, 11, bar_2_x, 100, VGA_FUCHSIA, 0, &display);
bar_draw_vertical(0, 50, 20, 100, bar_3_y, 100, VGA_BLUE, 1, &display);
bar_1_x++;
if (bar_1_x > 100)
{
bar_1_x = 0;
bar_clear_part_horizontal(0,0,200,10,bar_1_x,100,VGA_BLACK,0,&display);
}
bar_2_x++;
if (bar_2_x > 100)
{
bar_2_x = 10;
bar_clear_part_horizontal(0,20,200,11,bar_2_x,100,VGA_BLACK,1,&display);
}
bar_3_y++;
if (bar_3_y > 100)
{
bar_3_y = 50;
bar_clear_part_vertical(0,50,20,100,bar_3_y,100,VGA_BLACK,0,&display);
}
delay(50);
// statemachine_loop();
statemachine_loop();
}