ow-dash-cube/Core/Inc/dashboard.h
Clément Grennerat 7db4d2cc6c v1.0
2025-09-17 21:30:07 +02:00

62 lines
1.9 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __DASHBOARD_H
#define __DASHBOARD_H
#include "LCD_driver.h"
#define COLOR_PRIMARY 0xfd01
#define COLOR_SECONDARY 0x667f
#define COLOR_SUCCESS 0x3766
#define COLOR_ERROR 0xf226
#define COLOR_FG 0xFFFF
#define COLOR_BG 0x0000
#define COLOR_OFF 0x0000
#define FAULT_CODE_MAX 27
void run_dashboard_loop();
void init();
// refresh_slow = 0 if it should not refresh the low-refresh rate information.
// refresh_mid = 0 if it should not refresh the mid-refresh rate information.
void update_values(uint8_t refresh_slow, uint8_t refresh_mid);
void update_adc();
void draw_init();
// Displays the battery voltage and percent, with the trip and life distances
// Input voltage from COMM_GET_VALUES, scale 10
// battery percent (level) from COMM_GET_VALUES_SETUP, scale 100
// trip distance from COMM_GET_VALUES_SETUP, scale 100
// life distance (odometer) from COMM_GET_VALUES_SETUP
void draw_battery(int16_t voltage, int32_t percent, int32_t trip_dist, uint32_t life_dist);
// Displays the power bars at the top
// Duty from COMM_GET_VALUES, scale 1000
void draw_power_bars(int16_t duty, uint8_t regen);
// Displays the huge speed counter with avg and max values.
// Speed from COMM_GET_VALUES_SETUP, scale 1000
void draw_speed(int32_t speed, uint8_t fault_code);
// Displays Current, Duty, Watts
// Current from COMM_GET_VALUES, scale 100
// Duty from COMM_GET_VALUES, scale 1000
// Input voltage from COMM_GET_VALUES, scale 10
void draw_power(int32_t amps, int16_t duty, int16_t voltage);
// Displays the two ADS voltages
//2 voltages from reFloat - COMM_CUSTOM_APP_DATA, scale 10, adcx_en are booleans.
void draw_adc(int32_t adc1_scaled, int32_t adc2_scaled, uint8_t adc1_en, uint8_t adc2_en);
// Displays the controller and motor temperatures
// 2 temperatures from COMM_GET_VALUES_SETUP, scale 10
void draw_temps(int16_t temp_fet, int16_t temp_motor);
#endif