#include "Arduino.h" #include "EDIPTFT.h" #include "FT18_STW_INIT.h" #include "FT_2018_STW_CAN.h" #ifndef FT18_STW_DISPLAY_h #define FT18_STW_DISPLAY_h #define MOSI 75 #define MISO 74 #define CLK 76 #define disp_cs 42 #define reset 43 #define writeprotect 52 #define POIL_ALARM_THRESH ((uint32_t)(0.1 / 0.0514)) #define POIL_ALARM_TIME 20000 // ms #define TMOT_ALARM_THRESH (40 + 105) #define TMOT_SAFE_VALUE (40 + 200) #define TMOT_ALARM_TIME 20000 // ms #define TOIL_ALARM_THRESH (40 + 150) #define TOIL_ALARM_TIME 10000 // ms #define ENC_DISPLAY_TIME 1000 // ms String pad_left(String orig, int len, char pad_char = ' '); enum DisplayView { VIEW_DRIVER, VIEW_TESTING, VIEW_LAST = VIEW_TESTING }; enum Value { VAL_GEAR, VAL_RPM, VAL_TT_FL, VAL_TT_FR, VAL_TT_RL, VAL_TT_RR, VAL_LAPTIME, VAL_UBATT, VAL_TMOT, VAL_TAIR, VAL_TOIL, VAL_ERR_TYPE, VAL_PFUEL, VAL_PWAT, VAL_POIL, VAL_PBF, VAL_PBR, VAL_SPEED_FL, VAL_SPEED_FR, VAL_SPEED, VAL_BBAL, VAL_FIRST_LEFT_BOX = VAL_LAPTIME, VAL_LAST = VAL_BBAL }; String get_value(Value val); String get_label(Value val); void init_display(void); void update_display(void); void display_trc(void); void display_mode(void); void alarm(String text); bool check_alarms(); bool check_enc_displays(); bool check_display(uint8_t& val_old, uint8_t val_new, bool& active, uint32_t& begin, const String& title); void redraw_view_driver(); void update_view_driver(); void redraw_view_testing(); void update_view_testing(); void redraw_label_testing(int i, uint8_t bg_color); void update_value_testing(int i); class DataBox { public: DataBox(int x1, int y1, int x2, int y2, int text_x, int text_y, int font, int size_x, int size_y, uint8_t justification, bool do_clear); void update_value(String val_new); void update_label(String label_new); void redraw(); virtual void redraw_value(); virtual void redraw_label(); protected: int x1, y1, x2, y2, text_x, text_y, font, size_x, size_y; uint8_t justification; bool do_clear; String value; String label; }; #define TT_COL0 EA_LIGHTBLUE #define TT_COL1 EA_GREEN #define TT_COL2 EA_ORANGE #define TT_COL3 EA_RED #define TT_THRESH1 40 #define TT_THRESH2 60 #define TT_THRESH3 70 class TireTempBox : public DataBox { public: TireTempBox(int x1, int y1, int x2, int y2, int text_x, int text_y, int font, int size_x, int size_y, uint8_t justification); void update_value(int val_new); void redraw_value() override; void redraw_label() override; private: int color; int num_value; }; #endif