2021-06-09 12:10:12 +02:00
|
|
|
#include "Arduino.h"
|
|
|
|
#include "EDIPTFT.h"
|
|
|
|
#include "FT18_STW_INIT.h"
|
|
|
|
#include "FT_2018_STW_CAN.h"
|
|
|
|
#ifndef FT18_STW_DISPLAY_h
|
2022-03-13 18:18:11 +01:00
|
|
|
#define FT18_STW_DISPLAY_h
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
#define MOSI 75
|
|
|
|
#define MISO 74
|
|
|
|
#define CLK 76
|
|
|
|
#define disp_cs 42
|
|
|
|
#define reset 43
|
|
|
|
#define writeprotect 52
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
#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
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-14 14:30:33 +01:00
|
|
|
String pad_left(String orig, int len, char pad_char = ' ');
|
|
|
|
|
2022-03-14 14:06:52 +01:00
|
|
|
enum DisplayView { VIEW_DRIVER, VIEW_TESTING, VIEW_LAST = VIEW_TESTING };
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
enum Value {
|
2022-03-13 19:57:34 +01:00
|
|
|
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,
|
2022-03-16 16:13:50 +01:00
|
|
|
VAL_PFUEL,
|
2022-03-13 19:57:34 +01:00
|
|
|
VAL_PWAT,
|
|
|
|
VAL_POIL,
|
|
|
|
VAL_PBF,
|
|
|
|
VAL_PBR,
|
|
|
|
VAL_SPEED_FL,
|
|
|
|
VAL_SPEED_FR,
|
|
|
|
VAL_SPEED,
|
|
|
|
VAL_FIRST_LEFT_BOX = VAL_LAPTIME,
|
|
|
|
VAL_LAST = VAL_SPEED
|
2022-03-13 18:18:11 +01:00
|
|
|
};
|
|
|
|
String get_value(Value val);
|
|
|
|
String get_label(Value val);
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
void init_display(void);
|
|
|
|
void update_display(void);
|
|
|
|
void display_trc(void);
|
|
|
|
void display_mode(void);
|
|
|
|
void alarm(String text);
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
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);
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-14 14:06:52 +01:00
|
|
|
void redraw_view_driver();
|
|
|
|
void update_view_driver();
|
|
|
|
void redraw_view_testing();
|
|
|
|
void update_view_testing();
|
2022-03-14 14:30:33 +01:00
|
|
|
void redraw_label_testing(int i, uint8_t bg_color);
|
|
|
|
void update_value_testing(int i);
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
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);
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
void update_value(String val_new);
|
|
|
|
void update_label(String label_new);
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
void redraw();
|
|
|
|
virtual void redraw_value();
|
|
|
|
virtual void redraw_label();
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
protected:
|
|
|
|
int x1, y1, x2, y2, text_x, text_y, font, size_x, size_y;
|
|
|
|
uint8_t justification;
|
|
|
|
String value;
|
|
|
|
String label;
|
|
|
|
};
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
#define TT_COL0 EA_LIGHTBLUE
|
|
|
|
#define TT_COL1 EA_GREEN
|
|
|
|
#define TT_COL2 EA_ORANGE
|
|
|
|
#define TT_COL3 EA_RED
|
|
|
|
#define TT_THRESH1 50
|
|
|
|
#define TT_THRESH2 60
|
|
|
|
#define TT_THRESH3 70
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
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);
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
void update_value(int val_new);
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
void redraw_value() override;
|
|
|
|
void redraw_label() override;
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2022-03-13 18:18:11 +01:00
|
|
|
private:
|
|
|
|
int color;
|
|
|
|
int num_value;
|
|
|
|
};
|
2022-03-13 20:30:14 +01:00
|
|
|
|
2021-06-09 12:10:12 +02:00
|
|
|
#endif
|