Files
OBD2-car-display/due_obd2/defines.h
Sem van der Hoeven 48933e2bab Show first bars of data
2025-04-03 00:22:07 +02:00

68 lines
3.1 KiB
C

#ifndef DEFINES_H
#define DEFINES_H
#define DEBUG 1
#define SKIP_BT_CHECK 1
// #define RTT_MR 0x400E1A30U
#define MS(x) x * 1000
#define S(x) MS(x) * 1000
#define OBD2_SLOW_VALUES_QUERY_INTERVAL_MS 5000
#define INIT_TEXT_WIDTH 15
#define INIT_PERCENTAGE_WIDTH 4
#define FLAG_INIT_UPDATE_TEXT_POS 0x01
#define FLAG_INIT_CLEAR_POS 0x02
#define FLAG_INIT_UPDATE_PERCENT_POS 0x03
#define FLAG_DEVICE_LABEL_UPDATE_POS 0x04
#define FLAG_DEVICE_LABEL_SHOULD_UPDATE_POS 0x05 /* 0 if label should be updated, 1 if valyue should be updated */
#define FLAG_DEVICE_LABEL_UPDATE_KB_POS 0x06 /* count KB up */
#define FLAG_INIT_ELM327_DONE_POS 0x07 /* elm327 done initializing */
#define LOGO_MIN_STEP 20
#define LOGO_MAX_POS_Y 124
#define FLAG_LOGO_UPDATE 0x00
#define LOGO_TEXT_WIDTH 16
#define RAM_AMOUNT_KB 96
#define RAM_AMOUNT_B 98304
#define RAM_TEXT_WIDTH 9
#define DEV_LABEL_LENGTH 10
#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 210 - TEMP_BOX_PADDING
#define TEMP_BOX_COLOR VGA_GRAY
#define TEMP_BOX_BAR_AMOUNT 4 // amount of bars to display in the temperature box
#define TEMP_BOX_BAR_PADDING 2
#define TEMP_BOX_BAR_HEIGHT (((TEMP_BOX_HEIGHT) / ((TEMP_BOX_BAR_AMOUNT) * 2)) - TEMP_BOX_BAR_PADDING)
#define TEMP_BOX_BAR_WIDTH TEMP_BOX_CONTENT_WIDTH - (TEMP_BOX_BAR_PADDING * 4)
#define TEMP_BOX_COOLANT_POS 0
#define TEMP_BOX_INTAKE_AIR_POS 1
#define TEMP_BOX_AMBIENT_AIR_POS 2
#define TEMP_BOX_OIL_POS 3
#define TEMP_BOX_CONTENT_X_START TEMP_BOX_X_START + TEMP_BOX_BAR_PADDING
#define TEMP_BOX_COOLANT_TEXT_Y_START TEMP_BOX_Y_START + TEMP_BOX_BAR_PADDING + (2 * TEMP_BOX_COOLANT_POS * TEMP_BOX_BAR_HEIGHT)
#define TEMP_BOX_COOLANT_BAR_Y_START TEMP_BOX_Y_START + TEMP_BOX_BAR_PADDING + ((2 * TEMP_BOX_COOLANT_POS * TEMP_BOX_BAR_HEIGHT) + TEMP_BOX_BAR_HEIGHT)
#define TEMP_BOX_INTAKE_AIR_TEXT_Y_START TEMP_BOX_Y_START + TEMP_BOX_BAR_PADDING + (2 * TEMP_BOX_INTAKE_AIR_POS * TEMP_BOX_BAR_HEIGHT) + 2
#define TEMP_BOX_INTAKE_AIR_BAR_Y_START TEMP_BOX_Y_START + TEMP_BOX_BAR_PADDING + (2 * (TEMP_BOX_INTAKE_AIR_POS * TEMP_BOX_BAR_HEIGHT) + TEMP_BOX_BAR_HEIGHT)
#define TEMP_BOX_AMBIENT_AIR_TEXT_Y_START TEMP_BOX_Y_START + TEMP_BOX_BAR_PADDING + (2 * TEMP_BOX_AMBIENT_AIR_POS * TEMP_BOX_BAR_HEIGHT) + 2
#define TEMP_BOX_AMBIENT_AIR_BAR_Y_START TEMP_BOX_Y_START + TEMP_BOX_BAR_PADDING + ((2 * TEMP_BOX_AMBIENT_AIR_POS * TEMP_BOX_BAR_HEIGHT) + TEMP_BOX_BAR_HEIGHT)
#define TEMP_BOX_OIL_TEXT_Y_START TEMP_BOX_Y_START + TEMP_BOX_BAR_PADDING + (2 * TEMP_BOX_OIL_POS * TEMP_BOX_BAR_HEIGHT) + 2
#define TEMP_BOX_OIL_BAR_Y_START TEMP_BOX_Y_START + TEMP_BOX_BAR_PADDING + ((2 * TEMP_BOX_OIL_POS * TEMP_BOX_BAR_HEIGHT) + TEMP_BOX_BAR_HEIGHT)
#endif // !DEFINES_H