First Commit
This commit is contained in:
parent
951530f48d
commit
b9646f27de
|
@ -0,0 +1,223 @@
|
|||
//################################################################################
|
||||
//################################################################################
|
||||
//#### ####
|
||||
//#### BM-DUINO V1.1 ####
|
||||
//#### ####
|
||||
//#### THIS IS A HONDA OBD1 DATALOGGER TO BE USED WITH A 3.2" TFT SCREEN ####
|
||||
//#### ####
|
||||
//#### MADE BY BOULETMARC ####
|
||||
//#### ####
|
||||
//#### CURRENT FEATURES : ####
|
||||
//#### -CN2 Datalogger ####
|
||||
//#### -Tables Board ####
|
||||
//#### -Display Board ####
|
||||
//#### -BeeM*R Rev Limiter ####
|
||||
//#### -Customize Menu ####
|
||||
//#### ####
|
||||
//################################################################################
|
||||
//################################################################################
|
||||
//#include <SD.h> ###
|
||||
//#include <SdFat.h>
|
||||
//#include <SdStream.h> ###
|
||||
//#include <SPI.h>
|
||||
#include <UTFT.h>
|
||||
#include <ITDB02_Touch.h>
|
||||
#include <EEPROM.h>
|
||||
|
||||
//SdFat sd;
|
||||
|
||||
//int SD_CHIP_SELECT = 53; // SD chip select pin
|
||||
//ArduinoOutStream cout(Serial);
|
||||
|
||||
// Set the parameters to the correct one for your TFT Scren
|
||||
UTFT myGLCD(SSD1289, 38, 39, 40, 41);
|
||||
ITDB02_Touch myTouch(6, 5, 4, 3, 2);
|
||||
|
||||
//Set the Relays Pin & Settings used to trigger the BeeM*R
|
||||
int RelayPin = 50;
|
||||
int RelayPin2 = 46;
|
||||
float RelayActivaionTime = 10;
|
||||
|
||||
//Set SD Cards Folder and FileName
|
||||
String SDFolder = "BM-Duino";
|
||||
String LOG = "LOG.txt";
|
||||
String MENU_Settings = "MENU_Settings.txt"; //Used for colors
|
||||
String OBD_Settings = "OBD_Settings.txt"; //Used for Dataloging Memory Offsets, InjSize, etc
|
||||
String OBD_Tables = "OBD_Tables.txt";
|
||||
String OBD_BEEMR_Settings = "OBD_BeeMR.txt";
|
||||
|
||||
//Check if Display_Rpm changed get the rpm enought fast to not trigger the relay more than 1 time at high rpm.
|
||||
//Record Values -
|
||||
//Suggest AFR -
|
||||
//Dont pop BeeM*R Selection while not enabled -
|
||||
//Tell if AFR are Lean or Rich + Color -
|
||||
//Temperature Coloring -
|
||||
|
||||
//fix graphics board -
|
||||
//fix beemr slection for rpm input -DONE ?
|
||||
//add fuel pump delay -NEED TO WORK WITH RELAY TO CONTROL 2 INPUT
|
||||
//added relay activation time -DONE
|
||||
|
||||
//#####################################################################
|
||||
//### DONT EDIT ANYTHING BELLOW THIS LINE ###
|
||||
//#####################################################################
|
||||
// Make Menu Variables
|
||||
int lcd_menu = 0;
|
||||
int Display_Rpm = 0;
|
||||
int Display_Vss = 0;
|
||||
int Display_IAT = 0;
|
||||
int Display_ECT = 0;
|
||||
float Display_AFR = 0;
|
||||
float Display_inHg = 0; //inHg
|
||||
int Display_MAP = 0; //mBar
|
||||
float Display_BATT = 0;
|
||||
float Display_TPS = 0;
|
||||
float Display_IGN = 0;
|
||||
float Display_O2 = 0;
|
||||
float Display_CONSO = 0;
|
||||
bool Display_VTEC = 0;
|
||||
//float Display_Altitude = 0;
|
||||
|
||||
// Make Internal Variables
|
||||
bool displayMillis = true;
|
||||
long LastMillis = 0; // used for last millis counter
|
||||
long previousMillis = 0; // used for last Touch update
|
||||
long interval = 500; // interval to enable back touch input (milliseconds)
|
||||
bool TouchSomething = false;
|
||||
bool readyopen = false; //Used to see if its ready to run trought all menus (finished start loading)
|
||||
bool UseFareneith = false;
|
||||
//int OBDTestValue = 1; //Used to check if the OBD are currently plugged and Running
|
||||
//int Display_Mode = 0; // 0=6displays | 1=single displays
|
||||
int TempValue1 = 0;
|
||||
int TempValue2 = 0;
|
||||
int TempValue3 = 0;
|
||||
int TempValue4 = 0;
|
||||
int TempValue5 = 0;
|
||||
int CurrentSelection = 0; //1=vss | 2=limiter | 3=launch | 4=limitertime | 5=launchtime | 6=limitercut | 7=launchcut | MOARSS
|
||||
|
||||
//Make Programming Variables (Tables Graphic Board)
|
||||
int Prog_BoardType = 0; //1=Table 2=Graphic
|
||||
int Prog_BoardMode = 0; //Used to get selection menu variables (logging vars or x&y vars)
|
||||
int Prog_Rows = 20;
|
||||
int Prog_Cols = 10;
|
||||
int Prog_XMin = 114;
|
||||
int Prog_XMax = 1035;
|
||||
bool Prog_XFloat = false;
|
||||
int Prog_YMin = 0;
|
||||
int Prog_YMax = 9000;
|
||||
bool Prog_YFloat = false;
|
||||
int Prog_X_ID = 1; //0=RPM | 1=mBar | 2=SPEED | 4=IAT | 5=ECT | 6=TPS
|
||||
int Prog_Y_ID = 0; //0=RPM | 1=mBar | 2=SPEED | 4=IAT | 5=ECT | 6=TPS
|
||||
int Prog_Log_Value = 2; //0=IAT | 1=ECT | 2=AFR | 3=BATT | 4=TPS | 5=IGN | 6=O2 | 7=CONSO | 8=SPEED
|
||||
bool Prog_LogFloatVal = false; //Log Float Value ? otherwise Log Integer
|
||||
int Prog_LastX = 0; //used to get the last graphics posx
|
||||
int Prog_LastY = 0; //used to get the last graphics posy
|
||||
long Prog_NextUpdate = 0; //used for the next graphic menu update
|
||||
|
||||
// Make BeeM*R Variables
|
||||
int BeeMRMode = 0; //Mode0 = Datalogging Input ||| Mode1 = Ignition Control Module Input
|
||||
bool BeeMREnabled = false;
|
||||
bool BeeMRLaunchEnabled = true;
|
||||
int BeeMRRevRPM = 8800;
|
||||
int BeeMRLaunchRPM = 3500;
|
||||
int BeeMRRevCutRPM = 400;
|
||||
int BeeMRLaunchCutRPM = 200;
|
||||
int BeeMRRevCutTime = 400;
|
||||
int BeeMRLaunchCutTime = 200;
|
||||
int BeeMRLaunchVSS = 8;
|
||||
bool BeeMRLanching = false; //is currently in the launch control state
|
||||
bool BeeMRRevLimiting = false; //is currently in the rev limiter state
|
||||
|
||||
// Texts Color Vars
|
||||
int Txt1_R = 0;
|
||||
int Txt1_G = 140;
|
||||
int Txt1_B = 0;
|
||||
int Txt2_R = 0;
|
||||
int Txt2_G = 140;
|
||||
int Txt2_B = 0;
|
||||
int Txt3_R = 0;
|
||||
int Txt3_G = 140;
|
||||
int Txt3_B = 0;
|
||||
|
||||
// Border Colors Vars
|
||||
int Col_Border_R = 0;
|
||||
int Col_Border_G = 255;
|
||||
int Col_Border_B = 0;
|
||||
|
||||
// File Vars
|
||||
//SdFile LoadedFile;
|
||||
String CurrentStringCheck = "";
|
||||
String CurrentLineCheck = "";
|
||||
|
||||
// Fonts Vars
|
||||
extern uint8_t SmallFont[];
|
||||
extern uint8_t BigFont[];
|
||||
extern uint8_t SevenSegNumFont[];
|
||||
//##################################################################################
|
||||
|
||||
void setup() {
|
||||
//Init SD Card
|
||||
/*Serial.begin(9600);
|
||||
bool mysd = 0;
|
||||
while (!mysd) {
|
||||
if (!sd.begin(SD_CHIP_SELECT, SPI_FULL_SPEED)) {
|
||||
Serial.println(F("Card failed, or not present"));
|
||||
Serial.println(F("Retrying...."));
|
||||
} else {
|
||||
mysd = 1;
|
||||
Serial.println(F("Card initialised."));
|
||||
}
|
||||
}*/
|
||||
|
||||
//Init DataLogger
|
||||
Serial3.begin(38400);
|
||||
|
||||
//Initialize and Clear LCD
|
||||
myGLCD.InitLCD(LANDSCAPE);
|
||||
myGLCD.clrScr();
|
||||
|
||||
//Initialize and Set Precision of Touch Screen
|
||||
myTouch.InitTouch(LANDSCAPE);
|
||||
//myTouch.setPrecision(PREC_MEDIUM);
|
||||
myTouch.setPrecision(PREC_HI);
|
||||
|
||||
//Init Relays
|
||||
pinMode(RelayPin, OUTPUT);
|
||||
pinMode(RelayPin2, OUTPUT);
|
||||
|
||||
/*CheckForFiles(LOG);
|
||||
CheckForFiles(MENU_Settings);
|
||||
CheckForFiles(OBD_Settings);
|
||||
CheckForFiles(OBD_Tables);
|
||||
CheckForFiles(OBD_BEEMR_Settings);*/
|
||||
|
||||
//Start Menu
|
||||
PopStartMenu();
|
||||
|
||||
//Update EEPROM Read
|
||||
/*delay(10);
|
||||
if(EEPROM.read(0)>3){ //This takes care of the possible bug if the EEPROM has a non state value already stored
|
||||
EEPROM.write(0,0); //update number to last display state value
|
||||
}
|
||||
displayState=EEPROM.read(0);*/
|
||||
|
||||
GetData();
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void loop() {
|
||||
//Get ECU Data
|
||||
GetData();
|
||||
|
||||
//Check Data to Enable/Disable Running state of BeeM*R
|
||||
if (BeeMREnabled) {
|
||||
CheckForBeeMR();
|
||||
}
|
||||
|
||||
//Refresh Menus
|
||||
MenuLoop();
|
||||
|
||||
//Check For Inputing
|
||||
CheckForInput();
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
//Set Your Injector Size. Default : 240cc
|
||||
int injsize = 240;
|
||||
|
||||
//Set the Datalogging Addresse to the correct one for your ECU (these addresse are for Crome >= 1.4, Work with P30 bin)
|
||||
byte ADDR_RPMLOW = 0x10;
|
||||
byte ADDR_RPMHIGH = 0x11;
|
||||
byte ADDR_LOCAM = 0x12;
|
||||
byte ADDR_HICAM = 0x13;
|
||||
byte ADDR_MAP = 0x14;
|
||||
byte ADDR_TPS = 0x15;
|
||||
//byte ADDR_COL = 0x16;
|
||||
byte ADDR_INJLOW = 0x17;
|
||||
byte ADDR_INJHIGH = 0x18;
|
||||
byte ADDR_IGN = 0x19;
|
||||
//byte ADDR_KNOCK = 0x1A;
|
||||
byte ADDR_IAT = 0x1B;
|
||||
byte ADDR_VSS = 0x1C;
|
||||
byte ADDR_ECT = 0x1D;
|
||||
//byte ADDR_BARO = 0x1E;
|
||||
byte ADDR_BATT = 0x1F;
|
||||
byte ADDR_O2 = 0x20;
|
||||
byte ADDR_VTEC = 0x22;
|
||||
|
||||
unsigned int ecuTimeout = 5000;
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void GetData(){
|
||||
//Get RPM&Speed Raw Values
|
||||
float speedRaw=ecuRead(ADDR_VSS);
|
||||
unsigned int rpmLowRaw=ecuRead(ADDR_RPMLOW);
|
||||
unsigned int rpmHighRaw=ecuRead(ADDR_RPMHIGH);
|
||||
int RPM = 1851562/((rpmHighRaw * 256) + rpmLowRaw);
|
||||
|
||||
//Reset Rpm Display
|
||||
if (RPM < 0) {
|
||||
RPM = 0;
|
||||
} else if (RPM > 9999) {
|
||||
RPM = 9999;
|
||||
}
|
||||
|
||||
//Set RPM & Speed Display
|
||||
Display_Rpm = RPM;
|
||||
//Display_Rpm = .92*Display_Rpm+.08*RPM; //Simple IIR filter to smooth out the digital rpm read out
|
||||
//Display_Vss = .4*speedRaw; //MPH
|
||||
Display_Vss = speedRaw; //KMH
|
||||
|
||||
//Get&Set All Others Displays
|
||||
if (lcd_menu == 3 | lcd_menu == 10) {
|
||||
float ECTTempRaw=ecuRead(ADDR_ECT);
|
||||
float IATRaw=ecuRead(ADDR_IAT);
|
||||
int o2Raw=ecuRead(ADDR_O2);
|
||||
float mapRaw=ecuRead(ADDR_MAP);
|
||||
float tpsRaw=ecuRead(ADDR_TPS);
|
||||
unsigned int lowInjRaw=ecuRead(ADDR_INJLOW);
|
||||
unsigned int highInjRaw=ecuRead(ADDR_INJHIGH);
|
||||
unsigned int ignRaw=ecuRead(ADDR_IGN);
|
||||
float batteryRaw = ecuRead(ADDR_BATT);
|
||||
int vtecRaw=ecuRead(ADDR_VTEC);
|
||||
|
||||
//Set Between Values
|
||||
float altitudeOffset = -10.87*(float(EEPROM.read(2))*5/256)+30.48;
|
||||
float Fake_inHg = -10.87*(float(mapRaw)*5/256)+30.48;
|
||||
Fake_inHg = Fake_inHg-altitudeOffset; //now inHg is guage Vac and no longer absolute vac
|
||||
tpsRaw = (0.4716 * tpsRaw) - 11.3184;
|
||||
|
||||
//Get Vtec
|
||||
bool VtecActive = false;
|
||||
if (vtecRaw == 67) {
|
||||
VtecActive = true;
|
||||
}
|
||||
|
||||
Display_ECT = calcTemp(ECTTempRaw, UseFareneith);
|
||||
Display_IAT = calcTemp(IATRaw, UseFareneith);
|
||||
Display_AFR = (2*o2Raw) + 10;
|
||||
//Display_AFR = (float(o2Raw)*5/256)*2+9.6; //AFR o2 for zietronix widebands
|
||||
Display_inHg = constrain(Fake_inHg,0,50);
|
||||
Display_MAP = (1764/255)*mapRaw; //mBar
|
||||
Display_BATT = (26.0 * batteryRaw) / 270.0;
|
||||
Display_TPS = constrain(tpsRaw, 0, 100);
|
||||
Display_IGN = (0.25 * ignRaw) - 6;
|
||||
Display_O2 = o2Raw;
|
||||
Display_CONSO = constrain(calcConso(), 0.0001, 50.0);
|
||||
Display_VTEC = VtecActive;
|
||||
|
||||
if(Display_Rpm<30){ //28 is the rpm that it displays when engine is off
|
||||
EEPROM.write(2,mapRaw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
byte ecuRead(byte ecuAddress) {
|
||||
Serial3.write(ecuAddress);
|
||||
unsigned int time=0;
|
||||
while(Serial3.available() == 0 && time < ecuTimeout) time+=1;
|
||||
if (time >= ecuTimeout) return 0x00;
|
||||
else return Serial3.read();
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
float calcConso() {
|
||||
unsigned int lowInjRaw=ecuRead(ADDR_INJLOW);
|
||||
unsigned int highInjRaw=ecuRead(ADDR_INJHIGH);
|
||||
|
||||
float injValue = ((highInjRaw * 256) + lowInjRaw) / 352;
|
||||
float dutyCycle = (Display_Rpm * injValue) / 1200;
|
||||
float hundredkm = ((60 / Display_Vss) * 100) / 60; //minutes needed to travel 100km
|
||||
return (hundredkm * ((injsize / 100) * dutyCycle)) / 1000;
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
float calcTemp(int raw, bool Far) {
|
||||
if (Far) {
|
||||
//Fareneith
|
||||
if(raw>45)
|
||||
return -.8334*float(raw) + 194.25;
|
||||
else if(raw<=45)
|
||||
return -2.3529*float(raw) + 263.0;
|
||||
} else {
|
||||
//Celcius
|
||||
raw = raw / 51;
|
||||
raw = (0.1423*pow(raw,6)) - (2.4938*pow(raw,5)) + (17.837*pow(raw,4)) - (68.698*pow(raw,3)) + (154.69*pow(raw,2)) - (232.75*raw) + 284.24;
|
||||
return ((raw - 32)*5)/9;
|
||||
}
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void CheckForBeeMR(){
|
||||
//Enable Launch
|
||||
if (BeeMRLaunchEnabled && BeeMRLanching == false && Display_Rpm >= BeeMRLaunchRPM && Display_Vss <= BeeMRLaunchVSS) {
|
||||
BeeMRLanching = true;
|
||||
digitalWrite(RelayPin, HIGH);
|
||||
digitalWrite(RelayPin2, HIGH);
|
||||
if (BeeMRMode == 0) {
|
||||
//Reload Menu
|
||||
if (lcd_menu == 5) {
|
||||
PopBeeMRRPM();
|
||||
}
|
||||
//1st Wait (Relay Activation Time)
|
||||
delay(RelayActivaionTime);
|
||||
//Disable By Time
|
||||
delay(BeeMRLaunchCutTime);
|
||||
BeeMRLanching = false;
|
||||
digitalWrite(RelayPin, LOW);
|
||||
digitalWrite(RelayPin2, LOW);
|
||||
//2rd Wait (Relay Activation Time)
|
||||
delay(RelayActivaionTime);
|
||||
}
|
||||
}
|
||||
|
||||
//Enable Limiter
|
||||
if (BeeMRRevLimiting == false && Display_Rpm >= BeeMRRevRPM) {
|
||||
if ((BeeMRLaunchEnabled && Display_Vss > BeeMRLaunchVSS) | BeeMRLaunchEnabled == false) {
|
||||
BeeMRRevLimiting = true;
|
||||
digitalWrite(RelayPin, HIGH);
|
||||
digitalWrite(RelayPin2, HIGH);
|
||||
if (BeeMRMode == 0) {
|
||||
//Reload Menu
|
||||
if (lcd_menu == 5) {
|
||||
PopBeeMRRPM();
|
||||
}
|
||||
//Disable By Time
|
||||
delay(BeeMRRevCutTime);
|
||||
BeeMRRevLimiting = false;
|
||||
digitalWrite(RelayPin, LOW);
|
||||
digitalWrite(RelayPin2, LOW);
|
||||
Display_Rpm -= 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Disable By Rpm
|
||||
if (BeeMRMode == 1) {
|
||||
if (BeeMRLanching && Display_Rpm <= BeeMRLaunchRPM - BeeMRLaunchCutRPM) {
|
||||
BeeMRLanching = false;
|
||||
digitalWrite(RelayPin, LOW);
|
||||
digitalWrite(RelayPin2, LOW);
|
||||
}
|
||||
if (BeeMRRevLimiting && Display_Rpm <= BeeMRRevRPM - BeeMRRevCutRPM) {
|
||||
BeeMRRevLimiting = false;
|
||||
digitalWrite(RelayPin, LOW);
|
||||
digitalWrite(RelayPin2, LOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//####################################################################################################################################################################
|
||||
//####################################################################################################################################################################
|
|
@ -0,0 +1,480 @@
|
|||
void CheckForInput() {
|
||||
unsigned long currentMillis = millis();
|
||||
if(currentMillis - previousMillis > interval) {
|
||||
TouchSomething = false;
|
||||
}
|
||||
|
||||
while (myTouch.dataAvailable() == true && TouchSomething == false) {
|
||||
myTouch.read();
|
||||
long x = myTouch.getX();
|
||||
long y = myTouch.getY();
|
||||
|
||||
if ((x!=-1) and (y!=-1)){
|
||||
//lcd_menu = 1 MainMenu
|
||||
//lcd_menu = 2 Programming
|
||||
//lcd_menu = 3 Display
|
||||
//lcd_menu = 4 Customize
|
||||
//lcd_menu = 5 BeeM*R
|
||||
//lcd_menu = 6 SelectionMenu (for Rpm, time, etc) #USED FOR BEEM*R VARIABLES
|
||||
//lcd_menu = 7 Board SelectionMenu (for X,Y Tables Values, etc)
|
||||
//lcd_menu = 8 SelectionMenu (for Rpm, time, etc) #USED FOR DATALOGGER BOARDS
|
||||
//lcd_menu = 9 SelectionMenu (for Log, X&Y, Str) #USED FOR DATALOGGER BOARDS
|
||||
//lcd_menu = 10 Boards Diplays
|
||||
//lcd_menu = 11 Load Presets
|
||||
//#################### START MENU #####################
|
||||
//Change From Start Menu to Main
|
||||
if (lcd_menu == 0 && readyopen) {
|
||||
lcd_menu = 1;
|
||||
PopMainMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
//################### MAIN MENU #####################
|
||||
if (lcd_menu == 1) {
|
||||
//Change From Main To Display
|
||||
if (x > 40 && x < 280 && y > 50 && y < 80 && TouchSomething == false) {
|
||||
lcd_menu = 3;
|
||||
PopDisplayMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Change From Main To Programming
|
||||
if (x > 40 && x < 280 && y > 90 && y < 120 && TouchSomething == false) {
|
||||
lcd_menu = 2;
|
||||
PopProgrammingMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Change From Main To BeeM*R
|
||||
if (x > 40 && x < 280 && y > 130 && y < 160 && TouchSomething == false) {
|
||||
lcd_menu = 5;
|
||||
PopBeeMRMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
}
|
||||
//################## BACK BUTTON ####################
|
||||
if (x > 0 && x < 44 && y > 220 && y <= 239 && lcd_menu >= 2 && lcd_menu != 6 && TouchSomething == false) {
|
||||
if (lcd_menu != 7) {
|
||||
//Go to Main Menu
|
||||
lcd_menu = 1;
|
||||
PopMainMenu();
|
||||
} else {
|
||||
//Got to Datalogger
|
||||
lcd_menu = 2;
|
||||
PopProgrammingMenu();
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//################ DATALOGGER MODE SELECTION ##################
|
||||
if (lcd_menu == 2) {
|
||||
//Pop Tables Selection
|
||||
if (x > 15 && x < 230 && y > 70 && y <= 100 && TouchSomething == false) {
|
||||
lcd_menu = 7;
|
||||
Prog_BoardType = 1;
|
||||
PopProgSelectionMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop Graphics Selection
|
||||
if (x > 15 && x < 230 && y > 150 && y <= 180 && TouchSomething == false) {
|
||||
lcd_menu = 7;
|
||||
Prog_BoardType = 2;
|
||||
PopProgSelectionMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
}
|
||||
//################ DATALOGGER SELECTION ##################
|
||||
if (lcd_menu == 7) {
|
||||
//Pop Rows Selection
|
||||
if (x > 16 && x < 158 && y >= 52 && y <= 68 && TouchSomething == false) {
|
||||
lcd_menu = 8;
|
||||
if (Prog_BoardType == 1) {
|
||||
CurrentSelection = 10;
|
||||
PopIntSelectionMenu(Prog_Rows);
|
||||
} else {
|
||||
CurrentSelection = 14;
|
||||
PopIntSelectionMenu(Prog_YMin);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop Cols Selection
|
||||
if (x > 16 && x < 158 && y >= 74 && y <= 90 && TouchSomething == false) {
|
||||
lcd_menu = 8;
|
||||
if (Prog_BoardType == 1) {
|
||||
CurrentSelection = 11;
|
||||
PopIntSelectionMenu(Prog_Cols);
|
||||
} else {
|
||||
CurrentSelection = 15;
|
||||
PopIntSelectionMenu(Prog_YMax);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop Log Selection
|
||||
if (x > 162 && x < 304 && y >= 52 && y <= 68 && TouchSomething == false) {
|
||||
CurrentSelection = 16;
|
||||
lcd_menu = 9;
|
||||
Prog_BoardMode = 1;
|
||||
PopStringSelectionMenu(Prog_Log_Value);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop Board Display Menu
|
||||
if (x > 16 && x < 158 && y >= 186 && y <= 214 && TouchSomething == false) {
|
||||
lcd_menu = 10;
|
||||
PopBoardDisplayMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
//TABLES BOARD SELECTION ONLY HERE
|
||||
if (Prog_BoardType == 1) {
|
||||
//Pop XMin Selection
|
||||
if (x > 16 && x < 158 && y >= 96 && y <= 112 && TouchSomething == false) {
|
||||
CurrentSelection = 12;
|
||||
lcd_menu = 8;
|
||||
PopIntSelectionMenu(Prog_XMin);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop XMax Selection
|
||||
if (x > 16 && x < 158 && y >= 116 && y <= 134 && TouchSomething == false) {
|
||||
CurrentSelection = 13;
|
||||
lcd_menu = 8;
|
||||
PopIntSelectionMenu(Prog_XMax);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop YMin Selection
|
||||
if (x > 16 && x < 158 && y >= 140 && y <= 156 && TouchSomething == false) {
|
||||
CurrentSelection = 14;
|
||||
lcd_menu = 8;
|
||||
PopIntSelectionMenu(Prog_YMin);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop YMax Selection
|
||||
if (x > 16 && x < 158 && y >= 162 && y <= 178 && TouchSomething == false) {
|
||||
CurrentSelection = 15;
|
||||
lcd_menu = 8;
|
||||
PopIntSelectionMenu(Prog_YMax);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop X Selection
|
||||
if (x > 162 && x < 304 && y >= 74 && y <= 90 && TouchSomething == false) {
|
||||
CurrentSelection = 17;
|
||||
lcd_menu = 9;
|
||||
Prog_BoardMode = 0;
|
||||
PopStringSelectionMenu(Prog_X_ID);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop Y Selection
|
||||
if (x > 162 && x < 304 && y >= 96 && y <= 112 && TouchSomething == false) {
|
||||
CurrentSelection = 18;
|
||||
lcd_menu = 9;
|
||||
Prog_BoardMode = 0;
|
||||
PopStringSelectionMenu(Prog_Y_ID);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop Load Preset Menu
|
||||
if (x > 162 && x < 304 && y >= 220 && y <= 239 && TouchSomething == false) {
|
||||
lcd_menu = 11;
|
||||
PopPresetSelectionMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//################ PRESET SELECTION ##################
|
||||
if (lcd_menu == 11) {
|
||||
//Select#1
|
||||
if (x > 60 && x < 260 && y >= 120 && y <= 142 && TouchSomething == false) {
|
||||
lcd_menu = 7;
|
||||
SetPreset(1);
|
||||
PopProgSelectionMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select#2
|
||||
if (x > 60 && x < 260 && y >= 144 && y <= 164 && TouchSomething == false) {
|
||||
lcd_menu = 7;
|
||||
SetPreset(2);
|
||||
PopProgSelectionMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select#3
|
||||
if (x > 60 && x < 260 && y >= 166 && y <= 187 && TouchSomething == false) {
|
||||
lcd_menu = 7;
|
||||
SetPreset(3);
|
||||
PopProgSelectionMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select#4
|
||||
if (x > 60 && x < 260 && y >= 189 && y <= 210 && TouchSomething == false) {
|
||||
lcd_menu = 7;
|
||||
SetPreset(4);
|
||||
PopProgSelectionMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
}
|
||||
//################ BeeM*R OPTIONS ##################
|
||||
//Disable or Enable Launch Control
|
||||
if (lcd_menu == 5) {
|
||||
//Disable or Enable BeeM*R
|
||||
if (x > 12 && x < 80 && y > 56 && y <= 70 && TouchSomething == false) {
|
||||
if (BeeMREnabled) {
|
||||
BeeMREnabled = false;
|
||||
} else {
|
||||
BeeMREnabled = true;
|
||||
}
|
||||
PopBeeMRMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
if (BeeMREnabled) {
|
||||
//Disable or Enable Launch Control
|
||||
if (x > 12 && x < 145 && y > 76 && y <= 90 && TouchSomething == false) {
|
||||
if (BeeMRLaunchEnabled) {
|
||||
BeeMRLaunchEnabled = false;
|
||||
} else {
|
||||
BeeMRLaunchEnabled = true;
|
||||
}
|
||||
PopBeeMRMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Change BeeM*R Mode
|
||||
if (x > 110 && x < 308 && y > 56 && y <= 70 && TouchSomething == false) {
|
||||
if (BeeMRMode == 0) {
|
||||
BeeMRMode = 1;
|
||||
} else {
|
||||
BeeMRMode = 0;
|
||||
}
|
||||
PopBeeMRMenu();
|
||||
TouchSomething = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//################ BeeM*R SELECTION ##################
|
||||
if (lcd_menu == 5 && BeeMREnabled) {
|
||||
//Pop Vss Selection
|
||||
if (x > 149 && x < 308 && y > 76 && y <= 90 && BeeMRLaunchEnabled && TouchSomething == false) {
|
||||
CurrentSelection = 1;
|
||||
lcd_menu = 6;
|
||||
PopIntSelectionMenu(BeeMRLaunchVSS);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop Limiter Selection
|
||||
if (x > 12 && x < 160 && y > 102 && y <= 116 && TouchSomething == false) {
|
||||
CurrentSelection = 2;
|
||||
lcd_menu = 6;
|
||||
PopIntSelectionMenu(BeeMRRevRPM);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop Launch Selection
|
||||
if (x > 164 && x < 308 && y > 102 && y <= 116 && BeeMRLaunchEnabled && TouchSomething == false) {
|
||||
CurrentSelection = 3;
|
||||
lcd_menu = 6;
|
||||
PopIntSelectionMenu(BeeMRLaunchRPM);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//BEEMR MODE0 AND MODE1 OPTIONS
|
||||
if (BeeMRMode == 0) {
|
||||
//Pop Limiter Time Selection
|
||||
if (x > 12 && x < 218 && y > 120 && y <= 134 && TouchSomething == false) {
|
||||
CurrentSelection = 4;
|
||||
lcd_menu = 6;
|
||||
PopIntSelectionMenu(BeeMRRevCutTime);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop Launch Time Selection
|
||||
if (x > 12 && x < 210 && y > 138 && y <= 152 && BeeMRLaunchEnabled && TouchSomething == false) {
|
||||
CurrentSelection = 5;
|
||||
lcd_menu = 6;
|
||||
PopIntSelectionMenu(BeeMRLaunchCutTime);
|
||||
TouchSomething = true;
|
||||
}
|
||||
} else if (BeeMRMode == 1) {
|
||||
//Pop Limiter Cut Selection
|
||||
if (x > 12 && x < 220 && y > 120 && y <= 134 && TouchSomething == false) {
|
||||
CurrentSelection = 6;
|
||||
lcd_menu = 6;
|
||||
PopIntSelectionMenu(BeeMRRevCutRPM);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Pop Launch Cut Selection
|
||||
if (x > 12 && x < 212 && y > 138 && y <= 152 && BeeMRLaunchEnabled && TouchSomething == false) {
|
||||
CurrentSelection = 7;
|
||||
lcd_menu = 6;
|
||||
PopIntSelectionMenu(BeeMRLaunchCutRPM);
|
||||
TouchSomething = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//################ SELECTION MENU ##################
|
||||
if (lcd_menu == 6 | lcd_menu == 8 | lcd_menu == 9) {
|
||||
//Select #1
|
||||
if (x > 60 && x < 126 && y > 120 && y <= 142) {
|
||||
if (lcd_menu != 9) {
|
||||
TempValue1 = (TempValue1 * 10) + 1;
|
||||
SelectionMenuValText(TempValue1);
|
||||
} else {
|
||||
TempValue1 = 0;
|
||||
StringSelectionMenuValText(TempValue1);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select #2
|
||||
if (x > 129 && x < 192 && y > 120 && y <= 142) {
|
||||
if (lcd_menu != 9) {
|
||||
TempValue1 = (TempValue1 * 10) + 2;
|
||||
SelectionMenuValText(TempValue1);
|
||||
} else {
|
||||
TempValue1 = 1;
|
||||
StringSelectionMenuValText(TempValue1);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select #3
|
||||
if (x > 194 && x < 260 && y > 120 && y <= 142) {
|
||||
if (lcd_menu != 9) {
|
||||
TempValue1 = (TempValue1 * 10) + 3;
|
||||
SelectionMenuValText(TempValue1);
|
||||
} else {
|
||||
TempValue1 = 2;
|
||||
StringSelectionMenuValText(TempValue1);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select #4
|
||||
if (x > 60 && x < 126 && y > 144 && y <= 164) {
|
||||
if (lcd_menu != 9) {
|
||||
TempValue1 = (TempValue1 * 10) + 4;
|
||||
SelectionMenuValText(TempValue1);
|
||||
} else {
|
||||
TempValue1 = 3;
|
||||
StringSelectionMenuValText(TempValue1);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select #5
|
||||
if (x > 129 && x < 192 && y > 144 && y <= 164) {
|
||||
if (lcd_menu != 9) {
|
||||
TempValue1 = (TempValue1 * 10) + 5;
|
||||
SelectionMenuValText(TempValue1);
|
||||
} else {
|
||||
TempValue1 = 4;
|
||||
StringSelectionMenuValText(TempValue1);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select #6
|
||||
if (x > 194 && x < 260 && y > 144 && y <= 164) {
|
||||
if (lcd_menu != 9) {
|
||||
TempValue1 = (TempValue1 * 10) + 6;
|
||||
SelectionMenuValText(TempValue1);
|
||||
} else {
|
||||
TempValue1 = 5;
|
||||
StringSelectionMenuValText(TempValue1);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//DONT SELECT #7 to #0 while in certain string Menu (datalogger X&Y menu)
|
||||
if (CurrentSelection != 17 && CurrentSelection != 18) {
|
||||
//Select #7
|
||||
if (x > 60 && x < 126 && y > 166 && y <= 187) {
|
||||
if (lcd_menu != 9) {
|
||||
TempValue1 = (TempValue1 * 10) + 7;
|
||||
SelectionMenuValText(TempValue1);
|
||||
} else {
|
||||
TempValue1 = 6;
|
||||
StringSelectionMenuValText(TempValue1);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select #8
|
||||
if (x > 129 && x < 192 && y > 166 && y <= 187) {
|
||||
if (lcd_menu != 9) {
|
||||
TempValue1 = (TempValue1 * 10) + 8;
|
||||
SelectionMenuValText(TempValue1);
|
||||
} else {
|
||||
TempValue1 = 7;
|
||||
StringSelectionMenuValText(TempValue1);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select #9
|
||||
if (x > 194 && x < 260 && y > 166 && y <= 187) {
|
||||
if (lcd_menu != 9) {
|
||||
TempValue1 = (TempValue1 * 10) + 9;
|
||||
SelectionMenuValText(TempValue1);
|
||||
} else {
|
||||
TempValue1 = 8;
|
||||
StringSelectionMenuValText(TempValue1);
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select #0
|
||||
if (x > 129 && x < 192 && y > 189 && y <= 210) {
|
||||
TempValue1 = (TempValue1 * 10);
|
||||
SelectionMenuValText(TempValue1);
|
||||
TouchSomething = true;
|
||||
}
|
||||
//Select <--
|
||||
if (x > 194 && x < 260 && y > 189 && y <= 210) {
|
||||
TempValue1 = 0;
|
||||
SelectionMenuValText(TempValue1);
|
||||
TouchSomething = true;
|
||||
}
|
||||
}
|
||||
//Select OK
|
||||
if (x > 60 && x < 126 && y > 189 && y <= 210) {
|
||||
//Set BeeM*R Menu Value
|
||||
if (lcd_menu == 6) {
|
||||
if (CurrentSelection == 1) {
|
||||
BeeMRLaunchVSS = TempValue1;
|
||||
} else if (CurrentSelection == 2) {
|
||||
BeeMRRevRPM = TempValue1;
|
||||
} else if (CurrentSelection == 3) {
|
||||
BeeMRLaunchRPM = TempValue1;
|
||||
} else if (CurrentSelection == 4) {
|
||||
BeeMRRevCutTime = TempValue1;
|
||||
} else if (CurrentSelection == 5) {
|
||||
BeeMRLaunchCutTime = TempValue1;
|
||||
} else if (CurrentSelection == 6) {
|
||||
BeeMRRevCutRPM = TempValue1;
|
||||
} else if (CurrentSelection == 7) {
|
||||
BeeMRLaunchCutRPM = TempValue1;
|
||||
}
|
||||
//Return Back to BeeM*R Menu
|
||||
lcd_menu = 5;
|
||||
PopBeeMRMenu();
|
||||
}
|
||||
//Set Datalogger Int Menu Value
|
||||
if (lcd_menu == 8) {
|
||||
if (CurrentSelection == 10) {
|
||||
Prog_Rows = TempValue1;
|
||||
} else if (CurrentSelection == 11) {
|
||||
Prog_Cols = TempValue1;
|
||||
} else if (CurrentSelection == 12) {
|
||||
Prog_XMin = TempValue1;
|
||||
} else if (CurrentSelection == 13) {
|
||||
Prog_XMax = TempValue1;
|
||||
} else if (CurrentSelection == 14) {
|
||||
Prog_YMin = TempValue1;
|
||||
} else if (CurrentSelection == 15) {
|
||||
Prog_YMax = TempValue1;
|
||||
}
|
||||
//Return Back to Board Menu
|
||||
lcd_menu = 7;
|
||||
PopProgSelectionMenu();
|
||||
}
|
||||
//Set Datalogger String Menu Value
|
||||
if (lcd_menu == 9) {
|
||||
if (CurrentSelection == 16) {
|
||||
Prog_Log_Value = TempValue1;
|
||||
} else if (CurrentSelection == 17) {
|
||||
Prog_X_ID = TempValue1;
|
||||
} else if (CurrentSelection == 18) {
|
||||
Prog_Y_ID = TempValue1;
|
||||
}
|
||||
//Return Back to Board Menu
|
||||
lcd_menu = 7;
|
||||
PopProgSelectionMenu();
|
||||
}
|
||||
TouchSomething = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Set Timer for Touch Something
|
||||
if (TouchSomething) {
|
||||
previousMillis = currentMillis;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,313 @@
|
|||
//##################################################################################
|
||||
|
||||
void ClearArea(int StartX, int StartY, int EndX, int EndY) {
|
||||
myGLCD.setColor(0, 0, 0);
|
||||
myGLCD.fillRect(StartX, StartY, EndX, EndY);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
String ConvertProgIntToString(int Value, int Mode) {
|
||||
//MODE0 X&Y VALUE |||| 0=RPM | 1=mBar | 2=SPEED | 3=IAT | 4=ECT | 5=TPS
|
||||
//MODE1 LOG VALUE |||| 0=IAT | 1=ECT | 2=AFR | 3=BATT | 4=TPS | 5=IGN | 6=O2 | 7=CONSO | 8=SPEED
|
||||
if (Mode == 0) {
|
||||
if (Value == 0) {
|
||||
return "RPM";
|
||||
} else if (Value == 1) {
|
||||
return "mBar";
|
||||
} else if (Value == 2) {
|
||||
return "KM/H";
|
||||
} else if (Value == 3) {
|
||||
return "IAT";
|
||||
} else if (Value == 4) {
|
||||
return "ECT";
|
||||
} else if (Value == 5) {
|
||||
return "TPS";
|
||||
}
|
||||
} else if (Mode == 1) {
|
||||
if (Value == 0) {
|
||||
return "IAT";
|
||||
} else if (Value == 1) {
|
||||
return "ECT";
|
||||
} else if (Value == 2) {
|
||||
return "AFR";
|
||||
} else if (Value == 3) {
|
||||
return "BATT";
|
||||
} else if (Value == 4) {
|
||||
return "TPS";
|
||||
} else if (Value == 5) {
|
||||
return "IGN";
|
||||
} else if (Value == 6) {
|
||||
return "O2";
|
||||
} else if (Value == 7) {
|
||||
return "CONS.";
|
||||
} else if (Value == 8) {
|
||||
return "KM/H";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void SetPreset(int Preset) {
|
||||
//Prog_X_ID = 1; //0=RPM | 1=mBar | 2=SPEED | 3=IAT | 4=ECT | 5=TPS
|
||||
//Prog_Y_ID = 0; //0=RPM | 1=mBar | 2=SPEED | 3=IAT | 4=ECT | 5=TPS
|
||||
//Prog_Log_Value = 2; //0=IAT | 1=ECT | 2=AFR | 3=BATT | 4=TPS | 5=IGN | 6=O2 | 7=CONSO | 8=SPEED
|
||||
|
||||
if (Preset == 1) {
|
||||
//Set Preset #1
|
||||
Prog_Rows = 20;
|
||||
Prog_Cols = 10;
|
||||
Prog_XMin = 114;
|
||||
Prog_XMax = 1035;
|
||||
Prog_YMin = 0;
|
||||
Prog_YMax = 9000;
|
||||
Prog_X_ID = 1;
|
||||
Prog_Y_ID = 0;
|
||||
Prog_Log_Value = 2;
|
||||
} else if (Preset == 2) {
|
||||
//Set Preset #2
|
||||
Prog_Rows = 20;
|
||||
Prog_Cols = 10;
|
||||
Prog_XMin = 114;
|
||||
Prog_XMax = 1035;
|
||||
Prog_YMin = 0;
|
||||
Prog_YMax = 9000;
|
||||
Prog_X_ID = 1;
|
||||
Prog_Y_ID = 0;
|
||||
Prog_Log_Value = 5;
|
||||
} else if (Preset == 3) {
|
||||
//Set Preset #3
|
||||
Prog_Rows = 20;
|
||||
Prog_Cols = 10;
|
||||
Prog_XMin = 114;
|
||||
Prog_XMax = 1035;
|
||||
Prog_YMin = 0;
|
||||
Prog_YMax = 9000;
|
||||
Prog_X_ID = 1;
|
||||
Prog_Y_ID = 0;
|
||||
Prog_Log_Value = 7;
|
||||
} else if (Preset == 4) {
|
||||
//Set Preset #4
|
||||
Prog_Rows = 20;
|
||||
Prog_Cols = 10;
|
||||
Prog_XMin = 40;
|
||||
Prog_XMax = 140;
|
||||
Prog_YMin = -40;
|
||||
Prog_YMax = 40;
|
||||
Prog_X_ID = 4;
|
||||
Prog_Y_ID = 3;
|
||||
Prog_Log_Value = 5;
|
||||
}
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
float GetBoardValue(int Mode) {
|
||||
//Mode1 = Log | Mode2 = XVal | Mode3 = YVal
|
||||
|
||||
//Set Log Value
|
||||
if (Mode == 1) {
|
||||
if (Prog_Log_Value == 0) {
|
||||
return Display_IAT;
|
||||
} else if (Prog_Log_Value == 1) {
|
||||
return Display_ECT;
|
||||
} else if (Prog_Log_Value == 2) {
|
||||
return Display_AFR;
|
||||
} else if (Prog_Log_Value == 3) {
|
||||
return Display_BATT;
|
||||
} else if (Prog_Log_Value == 4) {
|
||||
return Display_TPS;
|
||||
} else if (Prog_Log_Value == 5) {
|
||||
return Display_IGN;
|
||||
} else if (Prog_Log_Value == 6) {
|
||||
return Display_O2;
|
||||
} else if (Prog_Log_Value == 7) {
|
||||
return Display_CONSO;
|
||||
} else if (Prog_Log_Value == 8) {
|
||||
return Display_Vss;
|
||||
}
|
||||
}
|
||||
|
||||
//Set X Value
|
||||
if (Mode == 2) {
|
||||
if (Prog_X_ID == 0) {
|
||||
return Display_Rpm;
|
||||
} else if (Prog_X_ID == 1) {
|
||||
return Display_MAP;
|
||||
} else if (Prog_X_ID == 2) {
|
||||
return Display_Vss;
|
||||
} else if (Prog_X_ID == 3) {
|
||||
return Display_IAT;
|
||||
} else if (Prog_X_ID == 4) {
|
||||
return Display_ECT;
|
||||
} else if (Prog_X_ID == 5) {
|
||||
return Display_TPS;
|
||||
}
|
||||
}
|
||||
|
||||
//Set Y Value
|
||||
if (Mode == 3) {
|
||||
if (Prog_Y_ID == 0) {
|
||||
return Display_Rpm;
|
||||
} else if (Prog_Y_ID == 1) {
|
||||
return Display_MAP;
|
||||
} else if (Prog_Y_ID == 2) {
|
||||
return Display_Vss;
|
||||
} else if (Prog_Y_ID == 3) {
|
||||
return Display_IAT;
|
||||
} else if (Prog_Y_ID == 4) {
|
||||
return Display_ECT;
|
||||
} else if (Prog_Y_ID == 5) {
|
||||
return Display_TPS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//####################################################################
|
||||
|
||||
void PopIntSelectionMenu(int Current) {
|
||||
//Set Keypad Background
|
||||
myGLCD.setColor(55, 55, 55);
|
||||
myGLCD.fillRect(60, 120, 260, 210);
|
||||
|
||||
//Set Keypad Rect
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(60, 120, 260, 210);
|
||||
|
||||
//Hori Line
|
||||
myGLCD.drawLine(60, 143, 260, 143);
|
||||
myGLCD.drawLine(60, 165, 260, 165);
|
||||
myGLCD.drawLine(60, 188, 260, 188);
|
||||
|
||||
//Verti Line
|
||||
myGLCD.drawLine(127, 120, 127, 210);
|
||||
myGLCD.drawLine(193, 120, 193, 210);
|
||||
|
||||
//Set Text
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.print("1", 86, 124);
|
||||
myGLCD.print("2", 154, 124);
|
||||
myGLCD.print("3", 220, 124);
|
||||
myGLCD.print("4", 86, 147);
|
||||
myGLCD.print("5", 154, 147);
|
||||
myGLCD.print("6", 220, 147);
|
||||
myGLCD.print("7", 86, 169);
|
||||
myGLCD.print("8", 154, 169);
|
||||
myGLCD.print("9", 220, 169);
|
||||
myGLCD.print("OK", 77, 192);
|
||||
myGLCD.print("0", 154, 192);
|
||||
myGLCD.print("<--", 202, 192);
|
||||
|
||||
//Set Temp Value
|
||||
TempValue1 = Current;
|
||||
|
||||
//Set Value Text
|
||||
SelectionMenuValText(Current);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void SelectionMenuValText(int Current) {
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.setColor(55, 55, 55);
|
||||
myGLCD.fillRect(100, 70, 220, 102);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(100, 70, 220, 102);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.printNumI(Current, CENTER, 80);
|
||||
}
|
||||
|
||||
//####################################################################################################################################################################
|
||||
//####################################################################################################################################################################
|
||||
|
||||
void PopStringSelectionMenu(int Current) {
|
||||
//Set Keypad Background
|
||||
myGLCD.setColor(55, 55, 55);
|
||||
myGLCD.fillRect(60, 120, 260, 210);
|
||||
|
||||
//Set Keypad Rect
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(60, 120, 260, 210);
|
||||
|
||||
//Hori Line
|
||||
myGLCD.drawLine(60, 143, 260, 143);
|
||||
myGLCD.drawLine(60, 165, 260, 165);
|
||||
myGLCD.drawLine(60, 188, 260, 188);
|
||||
|
||||
//Verti Line
|
||||
myGLCD.drawLine(127, 120, 127, 210);
|
||||
myGLCD.drawLine(193, 120, 193, 210);
|
||||
|
||||
//Set Text
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
|
||||
//MODE0 X&Y VALUE |||| 0=RPM | 1=mBar | 2=SPEED | 3=IAT | 4=ECT | 5=TPS
|
||||
//MODE1 LOG VALUE |||| 0=IAT | 1=ECT | 2=AFR | 3=BATT | 4=TPS | 5=IGN | 6=O2 | 7=CONSO | 8=SPEED
|
||||
if (Prog_BoardMode == 0) {
|
||||
myGLCD.print("RPM", 80, 126);
|
||||
myGLCD.print("mBar", 144, 126);
|
||||
myGLCD.print("KM/H", 210, 126);
|
||||
myGLCD.print("IAT", 80, 149);
|
||||
myGLCD.print("ECT", 146, 149);
|
||||
myGLCD.print("TPS", 214, 149);
|
||||
} else if (Prog_BoardMode == 1) {
|
||||
myGLCD.print("IAT", 80, 126);
|
||||
myGLCD.print("ECT", 146, 126);
|
||||
myGLCD.print("AFR", 214, 126);
|
||||
myGLCD.print("BATT", 74, 149);
|
||||
myGLCD.print("TPS", 146, 149);
|
||||
myGLCD.print("IGN", 214, 149);
|
||||
myGLCD.print("O2", 82, 171);
|
||||
myGLCD.print("CONS.", 138, 171);
|
||||
myGLCD.print("KM/H", 210, 171);
|
||||
}
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.print("OK", 77, 192);
|
||||
|
||||
//Set Temp Value
|
||||
TempValue1 = Current;
|
||||
|
||||
//Set Value Text
|
||||
StringSelectionMenuValText(Current);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void StringSelectionMenuValText(int Current) {
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.setColor(55, 55, 55);
|
||||
myGLCD.fillRect(100, 70, 220, 102);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(100, 70, 220, 102);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.print(ConvertProgIntToString(Current, Prog_BoardMode), CENTER, 80);
|
||||
}
|
||||
|
||||
//####################################################################################################################################################################
|
||||
//####################################################################################################################################################################
|
||||
|
||||
void PopPresetSelectionMenu() {
|
||||
//Set Keypad Background
|
||||
myGLCD.setColor(55, 55, 55);
|
||||
myGLCD.fillRect(60, 120, 260, 210);
|
||||
|
||||
//Set Keypad Rect
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(60, 120, 260, 210);
|
||||
|
||||
//Hori Line
|
||||
myGLCD.drawLine(60, 143, 260, 143);
|
||||
myGLCD.drawLine(60, 165, 260, 165);
|
||||
myGLCD.drawLine(60, 188, 260, 188);
|
||||
|
||||
//Set Text
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.print("1. RPM vs mBar --> AFR", 70, 126);
|
||||
myGLCD.print("2. RPM vs mBar --> IGN", 70, 149);
|
||||
myGLCD.print("3. RPM vs mBar --> CONS", 66, 171);
|
||||
myGLCD.print("4. IAT vs ECT --> AFR", 74, 192);
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
//Upload each part of menu that need to upload with a loop (rapid refresh)
|
||||
void MenuLoop() {
|
||||
|
||||
if (lcd_menu == 3) {
|
||||
//Display Menu
|
||||
PopDisplayRPM();
|
||||
PopDisplayVSS();
|
||||
PopDisplayIAT();
|
||||
PopDisplayECT();
|
||||
PopDisplayAFR();
|
||||
PopDisplayinHg();
|
||||
PopDisplayMAP();
|
||||
PopDisplayBATT();
|
||||
PopDisplayTPS();
|
||||
PopDisplayIGN();
|
||||
PopDisplayO2();
|
||||
PopDisplayCONSO();
|
||||
PopDisplayVTEC();
|
||||
} else if (lcd_menu == 5) {
|
||||
//BeeR Menu
|
||||
PopBeeMRRPM();
|
||||
} else if (lcd_menu == 10 && Prog_BoardType == 1){
|
||||
//Table Menu
|
||||
PopBoardDisplayTable();
|
||||
} else if (lcd_menu == 10 && Prog_BoardType == 2){
|
||||
//Graphic Menu
|
||||
PopBoardDisplayGraphic();
|
||||
}
|
||||
|
||||
//Display millis
|
||||
if (displayMillis) {
|
||||
PopDisplayMillis();
|
||||
}
|
||||
}
|
||||
|
||||
//####################################################################################################################################################################
|
||||
//####################################################################################################################################################################
|
||||
|
||||
void PopDisplayMillis() {
|
||||
ClearArea(290, 0, 319, 14);
|
||||
|
||||
long FPS = 1000/(millis() - LastMillis);
|
||||
|
||||
if (FPS >= 1000) {
|
||||
FPS = 999;
|
||||
}
|
||||
|
||||
//Set millis Text
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.print(String(FPS), 292, 2);
|
||||
|
||||
//Set Last millis
|
||||
LastMillis = millis();
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
//##################################################################################
|
||||
|
||||
void PopBeeMRMenu() {
|
||||
//Clear
|
||||
myGLCD.clrScr();
|
||||
|
||||
//Set Itinial Values
|
||||
myGLCD.setBackColor(0, 0, 0);
|
||||
|
||||
//Title
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.print("BeeM*R Rev Limiter", CENTER, 24);
|
||||
|
||||
//Enabled#Disabled
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(12, 56, 80, 70);
|
||||
if (BeeMREnabled) {
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("ENABLED", 16, 58);
|
||||
} else {
|
||||
myGLCD.setColor(255, 0, 0);
|
||||
myGLCD.print("DISABLED", 16, 58);
|
||||
}
|
||||
|
||||
if (BeeMREnabled) {
|
||||
//Mode
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(110, 56, 308, 70);
|
||||
myGLCD.print("Mode :", 114, 58);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
if (BeeMRMode == 0) {
|
||||
myGLCD.print("Datalogging Input", 170, 58);
|
||||
} else {
|
||||
myGLCD.print("ICM Wire Input", 170, 58);
|
||||
}
|
||||
|
||||
//Launch
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(12, 76, 145, 90);
|
||||
myGLCD.print("Launch :", 16, 78);
|
||||
if (BeeMRLaunchEnabled) {
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("ENABLED", 81, 78);
|
||||
} else {
|
||||
myGLCD.setColor(255, 0, 0);
|
||||
myGLCD.print("DISABLED", 81, 78);
|
||||
}
|
||||
|
||||
//VSS Speed
|
||||
if (BeeMRLaunchEnabled) {
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(149, 76, 308, 90);
|
||||
myGLCD.print("Max VSS Speed :", 155, 78);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.printNumI(BeeMRLaunchVSS, 284, 78);
|
||||
}
|
||||
|
||||
//Separator Line
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.drawLine(0, 96, 319, 96);
|
||||
|
||||
//Limiter RPM
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(12, 102, 160, 116);
|
||||
myGLCD.print("Limiter RPM :", 16, 104);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.printNumI(BeeMRRevRPM, 126, 104);
|
||||
|
||||
//Launch RPM
|
||||
if (BeeMRLaunchEnabled) {
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(164, 102, 308, 116);
|
||||
myGLCD.print("Launch RPM :", 168, 104);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.printNumI(BeeMRLaunchRPM, 272, 104);
|
||||
}
|
||||
|
||||
//Check For Input Mode
|
||||
if (BeeMRMode == 0) {
|
||||
//Limiter Time
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(12, 120, 218, 134);
|
||||
myGLCD.print("Limiter Cut Time :", 16, 122);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.printNumI(BeeMRRevCutTime, 166, 122);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.print("ms", 200, 122);
|
||||
|
||||
//Launch Time
|
||||
if (BeeMRLaunchEnabled) {
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(12, 138, 210, 152);
|
||||
myGLCD.print("Launch Cut Time :", 16, 140);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.printNumI(BeeMRLaunchCutTime, 156, 140);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.print("ms", 192, 140);
|
||||
}
|
||||
} else {
|
||||
//Limiter Cut
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(12, 120, 220, 134);
|
||||
myGLCD.print("Limiter Cut RPM :", 16, 122);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.printNumI(BeeMRRevCutRPM, 162, 122);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.print("rpm", 196, 122);
|
||||
|
||||
//Launch Cut
|
||||
if (BeeMRLaunchEnabled) {
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(12, 138, 212, 152);
|
||||
myGLCD.print("Launch Cut RPM :", 16, 140);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.printNumI(BeeMRLaunchCutRPM, 152, 140);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.print("rpm", 188, 140);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Add Rpm Text
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.print("RPM", 16, 176);
|
||||
|
||||
if (BeeMREnabled) {
|
||||
//Add Bottom Infos Text
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.print("Launch VSS", 50, 224);
|
||||
if (BeeMRLaunchEnabled) {
|
||||
myGLCD.print("Launch", 160, 224);
|
||||
}
|
||||
myGLCD.print("Limiter", 238, 224);
|
||||
}
|
||||
|
||||
//Back Button
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.drawRect(0, 220, 44, 239);
|
||||
myGLCD.print("BACK", 6, 224);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopBeeMRRPM() {
|
||||
ClearArea(74, 176, 180, 196);
|
||||
|
||||
//Set
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.printNumI(Display_Rpm, 76, 176);
|
||||
|
||||
if (BeeMREnabled) {
|
||||
BeeMRGetBottomInfos();
|
||||
}
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void BeeMRGetBottomInfos() {
|
||||
//Get VSS States
|
||||
if (Display_Vss <= BeeMRLaunchVSS) {
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.fillCircle(144, 228, 8);
|
||||
} else {
|
||||
myGLCD.setColor(255, 0, 0);
|
||||
myGLCD.fillCircle(144, 228, 8);
|
||||
}
|
||||
|
||||
//Get Launch States
|
||||
if (BeeMRLaunchEnabled) {
|
||||
if (BeeMRLanching) {
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.fillCircle(222, 228, 8);
|
||||
} else {
|
||||
myGLCD.setColor(255, 0, 0);
|
||||
myGLCD.fillCircle(222, 228, 8);
|
||||
}
|
||||
}
|
||||
|
||||
//Get Rev Limiting States
|
||||
if (BeeMRRevLimiting) {
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.fillCircle(308, 228, 8);
|
||||
} else {
|
||||
myGLCD.setColor(255, 0, 0);
|
||||
myGLCD.fillCircle(306, 228, 8);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
void PopDisplayMenu() {
|
||||
myGLCD.clrScr();
|
||||
|
||||
//Title
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("DISPLAY", CENTER, 18);
|
||||
|
||||
//Set RPM
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.print("RPM", 16, 66);
|
||||
|
||||
//Set Speed
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("SPEED", 176, 66);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("Km/h", 280, 66);
|
||||
|
||||
//Set IAT
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("IAT", 16, 86);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("C", 124, 86);
|
||||
|
||||
//Set ECT
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("ECT", 176, 86);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("C", 280, 86);
|
||||
|
||||
//Set AFR
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("AFR", 16, 106);
|
||||
|
||||
//Set inHg
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("inHg", 176, 106);
|
||||
|
||||
//Set MAP
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("MAP", 16, 126);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("mBar", 124, 126);
|
||||
|
||||
//Set BATT
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("BATT", 176, 126);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("V", 280, 126);
|
||||
|
||||
//Set TPS
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("TPS", 16, 146);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("%", 124, 146);
|
||||
|
||||
//Set IGN
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("IGN.", 176, 146);
|
||||
|
||||
//Set O2
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("O2", 16, 166);
|
||||
|
||||
//Set Conso
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("CONS.", 176, 166);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("L/H", 280, 166);
|
||||
|
||||
//Set VTEC
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("VTEC", 16, 186);
|
||||
|
||||
//Lines
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawLine(0, 62, 319, 62);
|
||||
myGLCD.drawLine(0, 200, 319, 200);
|
||||
myGLCD.drawLine(160, 62, 160, 200);
|
||||
|
||||
//Back Button
|
||||
myGLCD.drawRect(0, 220, 44, 239);
|
||||
myGLCD.print("BACK", 6, 224);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayRPM() {
|
||||
ClearArea(68, 64, 122, 78);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.printNumI(Display_Rpm, 70, 66);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayVSS() {
|
||||
ClearArea(229, 64, 262, 78);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.printNumI(Display_Vss, 231, 66);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayIAT() {
|
||||
ClearArea(68, 84, 122, 98);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print(String(Display_IAT), 70, 86);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayECT() {
|
||||
ClearArea(229, 84, 262, 98);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.printNumI(Display_ECT, 231, 86);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayAFR() {
|
||||
ClearArea(68, 104, 122, 118);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print(String(Display_AFR), 70, 106);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayinHg() {
|
||||
ClearArea(229, 104, 277, 118);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print(String(Display_inHg), 231, 106);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayMAP() {
|
||||
ClearArea(68, 124, 122, 138);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print(String(Display_MAP), 70, 126);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayBATT() {
|
||||
ClearArea(229, 124, 277, 138);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print(String(Display_BATT), 231, 126);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayTPS() {
|
||||
ClearArea(68, 144, 122, 158);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print(String(Display_TPS), 70, 146);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayIGN() {
|
||||
ClearArea(229, 144, 277, 158);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print(String(Display_IGN), 231, 146);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayO2() {
|
||||
ClearArea(68, 164, 122, 178);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print(String(Display_O2), 70, 166);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayCONSO() {
|
||||
ClearArea(229, 164, 277, 178);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print(String(Display_CONSO), 231, 166);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopDisplayVTEC() {
|
||||
ClearArea(68, 184, 122, 198);
|
||||
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
if (Display_VTEC) {
|
||||
myGLCD.print("ON", 70, 166);
|
||||
} else {
|
||||
myGLCD.print("OFF", 70, 186);
|
||||
}
|
||||
}
|
||||
|
||||
//####################################################################################################################################################################
|
||||
//####################################################################################################################################################################
|
|
@ -0,0 +1,69 @@
|
|||
void PopBoardDisplayGraphic() {
|
||||
//Reset Board
|
||||
if (millis() >= Prog_NextUpdate) {
|
||||
ClearArea(14, 20, 314, 220);
|
||||
|
||||
//Set Line
|
||||
myGLCD.setColor(55, 55, 55);
|
||||
myGLCD.drawLine(14, 120, 314, 120);
|
||||
myGLCD.drawLine(164, 20, 164, 220);
|
||||
|
||||
//Draw Background Rect
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(14, 20, 314, 220);
|
||||
|
||||
//Set Invalid LastPos
|
||||
Prog_LastX = 0;
|
||||
Prog_LastY = 0;
|
||||
|
||||
Prog_NextUpdate = millis() + 30000;
|
||||
}
|
||||
|
||||
//Set Values
|
||||
float LogFloat = GetBoardValue(1);
|
||||
Prog_LogFloatVal = false;
|
||||
|
||||
//Set Log Float
|
||||
if (Prog_Log_Value >= 2 && Prog_Log_Value <= 7) {
|
||||
Prog_LogFloatVal = true;
|
||||
}
|
||||
|
||||
//Get PosX
|
||||
long CurrMillis = Prog_NextUpdate - millis();
|
||||
int PosX = ((-CurrMillis * 300) / 30000) - 198;
|
||||
|
||||
//Get PosY
|
||||
float RangeF = float(Prog_YMax - Prog_YMin);
|
||||
long FakePos = FakePos = ((LogFloat - Prog_YMin) / RangeF) * 200;
|
||||
int PosY = 220 - int(FakePos);
|
||||
|
||||
//Reset Unavailable PosX
|
||||
if (PosX == 14) {
|
||||
PosX = 15;
|
||||
} else if (PosX == 314) {
|
||||
PosX = 313;
|
||||
}
|
||||
|
||||
//Reset Unavailable PosY
|
||||
if (PosY <= 20) {
|
||||
PosY = 21;
|
||||
} else if (PosY >= 220) {
|
||||
PosY = 219;
|
||||
}
|
||||
|
||||
//Check available LastPos
|
||||
if (Prog_LastX == 0) {
|
||||
Prog_LastX = PosX;
|
||||
}
|
||||
if (Prog_LastY == 0) {
|
||||
Prog_LastY = PosY;
|
||||
}
|
||||
|
||||
//Draw Line
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.drawLine(Prog_LastX, Prog_LastY, PosX, PosY);
|
||||
|
||||
//Set Last Pos
|
||||
Prog_LastX = PosX;
|
||||
Prog_LastY = PosY;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
void PopMainMenu() {
|
||||
//Clear
|
||||
myGLCD.clrScr();
|
||||
|
||||
//Set Itinial Values
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.setBackColor(0, 0, 0);
|
||||
|
||||
//Title
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("MAIN MENU", CENTER, 18);
|
||||
|
||||
//Set Display Rect
|
||||
myGLCD.drawRect(40, 50, 280, 80);
|
||||
myGLCD.drawRect(40, 90, 280, 120);
|
||||
myGLCD.drawRect(40, 130, 280, 160);
|
||||
myGLCD.drawRect(40, 170, 280, 200);
|
||||
|
||||
//Set Options
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("Displays", CENTER, 57);
|
||||
myGLCD.print("Datalogger", CENTER, 97);
|
||||
myGLCD.print("BeeM*R", CENTER, 137);
|
||||
myGLCD.print("Customize", CENTER, 177);
|
||||
|
||||
String VERSION = SetVersionInfos();
|
||||
|
||||
//Set Bottom Desc
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.print("BM-Duino " + VERSION, 8, 228);
|
||||
myGLCD.print("By Bouletmarc", 210, 228);
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
void PopStartMenu() {
|
||||
//Clear
|
||||
myGLCD.clrScr();
|
||||
|
||||
//Set Version & Update Infos
|
||||
String VERSION = SetVersionInfos();
|
||||
String UPDT_NOTES1 = SetUpdateInfos("Note1");
|
||||
String UPDT_NOTES2 = SetUpdateInfos("Note2");
|
||||
String UPDT_NOTES3 = SetUpdateInfos("Note3");
|
||||
String UPDT_NOTES4 = SetUpdateInfos("Note4");
|
||||
String UPDT_NOTES5 = SetUpdateInfos("Note5");
|
||||
|
||||
//Set Itinial Values
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.setBackColor(0, 0, 0);
|
||||
|
||||
//Title
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.print("BM-DUINO", CENTER, 24);
|
||||
|
||||
//Version
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.print(VERSION, CENTER, 40);
|
||||
|
||||
//Desc
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.print("This is a Honda OBD1 Datalogger.", CENTER, 82);
|
||||
myGLCD.print("It Read Rx&Tx Data of the CN2 Port.", CENTER, 94);
|
||||
|
||||
//Update Notes
|
||||
myGLCD.print(" UPDATES NOTES :", LEFT, 156);
|
||||
myGLCD.print(UPDT_NOTES1, LEFT, 168);
|
||||
myGLCD.print(UPDT_NOTES2, LEFT, 180);
|
||||
myGLCD.print(UPDT_NOTES3, LEFT, 192);
|
||||
myGLCD.print(UPDT_NOTES4, LEFT, 204);
|
||||
myGLCD.print(UPDT_NOTES5, LEFT, 216);
|
||||
myGLCD.drawRect(8, 154, 312, 232);
|
||||
|
||||
delay(1000);
|
||||
|
||||
//Set Loading Rect
|
||||
myGLCD.drawRect(79, 118, 241, 128);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
|
||||
//Animate Loading
|
||||
delay(150);
|
||||
myGLCD.fillRect(80, 119, 96, 127);
|
||||
delay(150);
|
||||
myGLCD.fillRect(80, 119, 112, 127);
|
||||
delay(150);
|
||||
myGLCD.fillRect(80, 119, 128, 127);
|
||||
delay(150);
|
||||
myGLCD.fillRect(80, 119, 144, 127);
|
||||
delay(150);
|
||||
myGLCD.fillRect(80, 119, 160, 127);
|
||||
delay(150);
|
||||
myGLCD.fillRect(80, 119, 176, 127);
|
||||
delay(150);
|
||||
myGLCD.fillRect(80, 119, 192, 127);
|
||||
delay(150);
|
||||
myGLCD.fillRect(80, 119, 208, 127);
|
||||
delay(150);
|
||||
myGLCD.fillRect(80, 119, 224, 127);
|
||||
delay(150);
|
||||
myGLCD.fillRect(80, 119, 240, 127);
|
||||
|
||||
//Tap Anywhere
|
||||
myGLCD.print("- TAP ANYWHERE TO START -", CENTER, 135);
|
||||
|
||||
readyopen = true;
|
||||
}
|
|
@ -0,0 +1,231 @@
|
|||
//##################################################################################
|
||||
|
||||
void PopProgrammingMenu() {
|
||||
//Clear
|
||||
myGLCD.clrScr();
|
||||
|
||||
//Set Itinial Values
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.setBackColor(0, 0, 0);
|
||||
|
||||
//Title
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("DATALOGGER", CENTER, 18);
|
||||
|
||||
//Set Display Rect
|
||||
myGLCD.drawRect(15, 70, 230, 100);
|
||||
myGLCD.drawRect(15, 150, 230, 180);
|
||||
|
||||
//Set Options
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
myGLCD.print("TABLES BOARD", 27, 77);
|
||||
myGLCD.print("GRAPHIC BOARD", 19, 157);
|
||||
|
||||
//Draw Table Boards
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(250, 60, 300, 110);
|
||||
|
||||
myGLCD.drawLine(250, 70, 300, 70);
|
||||
myGLCD.drawLine(250, 80, 300, 80);
|
||||
myGLCD.drawLine(250, 90, 300, 90);
|
||||
myGLCD.drawLine(250, 100, 300, 100);
|
||||
|
||||
myGLCD.drawLine(260, 60, 260, 110);
|
||||
myGLCD.drawLine(270, 60, 270, 110);
|
||||
myGLCD.drawLine(280, 60, 280, 110);
|
||||
myGLCD.drawLine(290, 60, 290, 110);
|
||||
|
||||
//Draw Graphics Boards
|
||||
myGLCD.setColor(55, 55, 55);
|
||||
myGLCD.drawLine(250, 160, 300, 160);
|
||||
myGLCD.drawLine(275, 130, 275, 190);
|
||||
myGLCD.setColor(0, 0, 255);
|
||||
myGLCD.drawLine(250, 185, 255, 180);
|
||||
myGLCD.drawLine(255, 180, 260, 170);
|
||||
myGLCD.drawLine(260, 170, 265, 150);
|
||||
myGLCD.drawLine(265, 150, 270, 135);
|
||||
myGLCD.drawLine(270, 135, 275, 155);
|
||||
myGLCD.drawLine(275, 155, 280, 160);
|
||||
myGLCD.drawLine(280, 160, 285, 150);
|
||||
myGLCD.drawLine(285, 150, 290, 175);
|
||||
myGLCD.drawLine(290, 175, 295, 185);
|
||||
myGLCD.drawLine(295, 185, 300, 189);
|
||||
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(250, 130, 300, 190);
|
||||
|
||||
//Back Button
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.drawRect(0, 220, 44, 239);
|
||||
myGLCD.print("BACK", 6, 224);
|
||||
}
|
||||
|
||||
//##################################################################################
|
||||
|
||||
void PopProgSelectionMenu() {
|
||||
//Clear
|
||||
myGLCD.clrScr();
|
||||
|
||||
//Title
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("SET BOARD SETTINGS", CENTER, 18);
|
||||
|
||||
//Reset Variables (Board#2 Graphics)
|
||||
if (Prog_BoardType == 2) {
|
||||
Prog_XMin = 0;
|
||||
Prog_XMax = 30;
|
||||
}
|
||||
|
||||
//Set Display Rect
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(16, 52, 158, 68);
|
||||
myGLCD.drawRect(16, 74, 158, 90);
|
||||
if (Prog_BoardType == 1) {
|
||||
myGLCD.drawRect(16, 96, 158, 112);
|
||||
myGLCD.drawRect(16, 116, 158, 134);
|
||||
myGLCD.drawRect(16, 140, 158, 156);
|
||||
myGLCD.drawRect(16, 162, 158, 178);
|
||||
}
|
||||
myGLCD.drawRect(162, 52, 304, 68);
|
||||
if (Prog_BoardType == 1) {
|
||||
myGLCD.drawRect(162, 74, 304, 90);
|
||||
myGLCD.drawRect(162, 96, 304, 112);
|
||||
myGLCD.drawRect(162, 220, 304, 239);
|
||||
}
|
||||
|
||||
//Set Options
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
if (Prog_BoardType == 1) {
|
||||
myGLCD.print("Rows", 18, 54);
|
||||
myGLCD.print("Cols", 18, 76);
|
||||
myGLCD.print("XMin", 18, 98);
|
||||
myGLCD.print("XMax", 18, 120);
|
||||
myGLCD.print("YMin", 18, 142);
|
||||
myGLCD.print("YMax", 18, 164);
|
||||
} else {
|
||||
myGLCD.print("YMin", 18, 54);
|
||||
myGLCD.print("YMax", 18, 76);
|
||||
}
|
||||
|
||||
myGLCD.print("Log", 164, 54);
|
||||
if (Prog_BoardType == 1) {
|
||||
myGLCD.print("X", 164, 76);
|
||||
myGLCD.print("Y", 164, 98);
|
||||
myGLCD.print("LOAD PRESET", 190, 224);
|
||||
}
|
||||
|
||||
//Set Open
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(16, 186, 158, 214);
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.print("OPEN", 50, 192);
|
||||
|
||||
//Set Board
|
||||
myGLCD.setColor(55, 55, 55);
|
||||
myGLCD.drawLine(220, 160, 300, 160);
|
||||
myGLCD.drawLine(260, 120, 260, 200);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(220, 120, 300, 200);
|
||||
|
||||
//Set Text
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
if (Prog_BoardType == 1) {
|
||||
myGLCD.printNumI(Prog_Rows, 72, 54);
|
||||
myGLCD.printNumI(Prog_Cols, 72, 76);
|
||||
myGLCD.printNumI(Prog_XMin, 72, 98);
|
||||
myGLCD.printNumI(Prog_XMax, 72, 120);
|
||||
myGLCD.printNumI(Prog_YMin, 72, 142);
|
||||
myGLCD.printNumI(Prog_YMax, 72, 164);
|
||||
} else {
|
||||
myGLCD.printNumI(Prog_YMin, 72, 54);
|
||||
myGLCD.printNumI(Prog_YMax, 72, 76);
|
||||
}
|
||||
myGLCD.print(ConvertProgIntToString(Prog_Log_Value, 1), 214, 54);
|
||||
if (Prog_BoardType == 1) {
|
||||
myGLCD.print(ConvertProgIntToString(Prog_X_ID, 0), 214, 76);
|
||||
myGLCD.print(ConvertProgIntToString(Prog_Y_ID, 0), 214, 98);
|
||||
}
|
||||
|
||||
//Set Board Text
|
||||
if (Prog_BoardType == 1) {
|
||||
myGLCD.print(ConvertProgIntToString(Prog_X_ID, 0), 246, 204);
|
||||
myGLCD.print(ConvertProgIntToString(Prog_Y_ID, 0), 206, 173, -90);
|
||||
myGLCD.print(ConvertProgIntToString(Prog_Log_Value, 1) + "=?", 165, 200);
|
||||
} else {
|
||||
myGLCD.print("Time", 246, 204);
|
||||
myGLCD.print(ConvertProgIntToString(Prog_Log_Value, 1), 206, 173, -90);
|
||||
}
|
||||
|
||||
//Back Button
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.drawRect(0, 220, 44, 239);
|
||||
myGLCD.print("BACK", 6, 224);
|
||||
}
|
||||
|
||||
//####################################################################################################################################################################
|
||||
//####################################################################################################################################################################
|
||||
|
||||
void PopBoardDisplayMenu() {
|
||||
//Clear
|
||||
myGLCD.clrScr();
|
||||
|
||||
//Reset Variables
|
||||
Prog_NextUpdate = 0;
|
||||
|
||||
//Title
|
||||
myGLCD.setFont(BigFont);
|
||||
myGLCD.setColor(0, 140, 0);
|
||||
myGLCD.print("BOARD DISPLAY", CENTER, 4);
|
||||
|
||||
//Set X&Y Name
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.setColor(0, 255, 0);
|
||||
if (Prog_BoardType == 1) {
|
||||
myGLCD.print(ConvertProgIntToString(Prog_X_ID, 0), CENTER, 224);
|
||||
myGLCD.print(ConvertProgIntToString(Prog_Y_ID, 0), 0, 130, -90);
|
||||
} else {
|
||||
myGLCD.print("Time (sec)", CENTER, 224);
|
||||
myGLCD.print(ConvertProgIntToString(Prog_Log_Value, 1), 0, 130, -90);
|
||||
}
|
||||
|
||||
//Set Min and Max Text
|
||||
myGLCD.setColor(255, 255, 0);
|
||||
myGLCD.printNumI(Prog_YMin, 0, 210);
|
||||
myGLCD.printNumI(Prog_YMax, 0, 10);
|
||||
myGLCD.printNumI(Prog_XMin, 46, 224);
|
||||
myGLCD.printNumI(Prog_XMax, 282, 224);
|
||||
|
||||
int XPos = 14;
|
||||
int YPos = 20;
|
||||
//Size X = 300
|
||||
//Size Y = 200
|
||||
|
||||
//Set Middle Lines
|
||||
if (Prog_BoardType == 1) {
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
for (int i=1; i <= Prog_Rows-1; i++){
|
||||
int RowYpos = ((200 / Prog_Rows) * i) + YPos;
|
||||
myGLCD.drawLine(14, RowYpos, 314, RowYpos);
|
||||
}
|
||||
for (int i=1; i <= Prog_Cols-1; i++){
|
||||
int ColXpos = ((300 / Prog_Cols) * i) + XPos;
|
||||
myGLCD.drawLine(ColXpos, 20, ColXpos, 220);
|
||||
}
|
||||
}
|
||||
|
||||
//Draw Background Rect
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.drawRect(14, 20, 314, 220);
|
||||
|
||||
//Back Button
|
||||
myGLCD.setFont(SmallFont);
|
||||
myGLCD.drawRect(0, 220, 44, 239);
|
||||
myGLCD.print("BACK", 6, 224);
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
void PopBoardDisplayTable() {
|
||||
//Set Values
|
||||
int CurrRows = 0;
|
||||
int CurrCols = 0;
|
||||
float LogFloat = GetBoardValue(1);
|
||||
float XValFloat = GetBoardValue(2);
|
||||
float YValFloat = GetBoardValue(3);
|
||||
Prog_LogFloatVal = false;
|
||||
Prog_XFloat = false;
|
||||
Prog_YFloat = false;
|
||||
|
||||
//Set Log Float
|
||||
if (Prog_Log_Value >= 2 && Prog_Log_Value <= 7) {
|
||||
Prog_LogFloatVal = true;
|
||||
}
|
||||
|
||||
//Set X Float
|
||||
if (Prog_Log_Value == 5) {
|
||||
Prog_XFloat = true;
|
||||
}
|
||||
|
||||
//Set Y Float
|
||||
if (Prog_Log_Value == 5) {
|
||||
YValFloat = Display_TPS;
|
||||
Prog_YFloat = true;
|
||||
}
|
||||
|
||||
//Get Rows Area
|
||||
for (int i=0; i <= Prog_Rows-1; i++){
|
||||
float Range = float(Prog_YMax - Prog_YMin);
|
||||
float Add = (Range/(Prog_Rows -1));
|
||||
float CurrVal = Prog_YMin + (Add * i);
|
||||
float MinVal = 0;
|
||||
float MaxVal = 0;
|
||||
//Set Min Val
|
||||
if (i == 0) {
|
||||
MinVal = -9999;
|
||||
} else {
|
||||
float LastVal = Prog_YMin + (Add * (i-1));
|
||||
MinVal = LastVal + ((CurrVal - LastVal)/2);
|
||||
}
|
||||
//Set Max Val
|
||||
if (i == Prog_Rows-1) {
|
||||
MaxVal = 9999;
|
||||
} else {
|
||||
float NextVal = Prog_YMin + (Add * (i+1));
|
||||
MaxVal = CurrVal + ((NextVal - CurrVal)/2);
|
||||
}
|
||||
//Set Current Rows
|
||||
if (YValFloat > MinVal && YValFloat <= MaxVal) {
|
||||
CurrRows = Prog_Rows - (i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
//Get Cols Area
|
||||
for (int i=0; i <= Prog_Cols-1; i++){
|
||||
float Range = float(Prog_XMax - Prog_XMin);
|
||||
float Add = (Range/(Prog_Cols -1));
|
||||
float CurrVal = Prog_XMin + (Add * i);
|
||||
float MinVal = 0;
|
||||
float MaxVal = 0;
|
||||
//Set Min Val
|
||||
if (i == 0) {
|
||||
MinVal = -9999;
|
||||
} else {
|
||||
float LastVal = Prog_XMin + (Add * (i-1));
|
||||
MinVal = LastVal + ((CurrVal - LastVal)/2);
|
||||
}
|
||||
//Set Max Val
|
||||
if (i == Prog_Cols-1) {
|
||||
MaxVal = 9999;
|
||||
} else {
|
||||
float NextVal = Prog_XMin + (Add * (i+1));
|
||||
MaxVal = CurrVal + ((NextVal - CurrVal)/2);
|
||||
}
|
||||
//Set Current Cols
|
||||
if (XValFloat > MinVal && XValFloat <= MaxVal) {
|
||||
CurrCols = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
//Set the Value
|
||||
int XPos = 14;
|
||||
int YPos = 20;
|
||||
int TextXpos = (((300 / Prog_Cols) * CurrCols) + XPos) - 29;
|
||||
int TextYpos = (((200 / Prog_Rows) * CurrRows) + YPos);
|
||||
myGLCD.setColor(0, 0, 0);
|
||||
myGLCD.fillRect(TextXpos, TextYpos, TextXpos + 30, TextYpos + 9);
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
myGLCD.setFont(SmallFont);
|
||||
if (Prog_LogFloatVal) {
|
||||
int Rounded = round(LogFloat * 10);
|
||||
String RoundedStr = String(Rounded);
|
||||
String UnRounded = String(round(Rounded / 10));
|
||||
String LastNumber = RoundedStr.substring(RoundedStr.length() - 1, RoundedStr.length());
|
||||
String EndStr = UnRounded + "." + LastNumber;
|
||||
myGLCD.print(EndStr, TextXpos, TextYpos);
|
||||
} else {
|
||||
myGLCD.print(String(int(ceil(LogFloat))), TextXpos, TextYpos);
|
||||
}
|
||||
|
||||
//Set Middle Lines
|
||||
if (Prog_BoardType == 1) {
|
||||
myGLCD.setColor(255, 255, 255);
|
||||
for (int i=1; i <= Prog_Rows-1; i++){
|
||||
int RowYpos = ((200 / Prog_Rows) * i) + YPos;
|
||||
myGLCD.drawLine(14, RowYpos, 314, RowYpos);
|
||||
}
|
||||
for (int i=1; i <= Prog_Cols-1; i++){
|
||||
int ColXpos = ((300 / Prog_Cols) * i) + XPos;
|
||||
myGLCD.drawLine(ColXpos, 20, ColXpos, 220);
|
||||
}
|
||||
}
|
||||
|
||||
//Draw Background Rect
|
||||
myGLCD.drawRect(14, 20, 314, 220);
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
//#################################################################
|
||||
//#################################################################
|
||||
//#################################################################
|
||||
//File Writer (set string values to a certain file)
|
||||
/*
|
||||
void SetFileValues(String FileName, String FileVal) {
|
||||
//Load File
|
||||
LoadFileQuick(FileName);
|
||||
|
||||
//Write File
|
||||
LoadedFile.print(FileVal);
|
||||
|
||||
//Close File
|
||||
CloseFile();
|
||||
}
|
||||
|
||||
//#################################################################
|
||||
//#################################################################
|
||||
//#################################################################
|
||||
//File Loading Manager (also Close)
|
||||
|
||||
void LoadFileQuick(String FileName) {
|
||||
LoadedFile.open(FileName, O_RDWR | O_CREAT | O_AT_END);
|
||||
//LoadedFile.open(SDFolder + "/" + FileName, O_RDWR);
|
||||
}
|
||||
|
||||
void LoadFile(String FileName) {
|
||||
//Set File
|
||||
LoadedFile.open(SDFolder + "/" + FileName, O_RDWR);
|
||||
|
||||
//Set Internal Vars
|
||||
int LinesNumber = GetLinesNumber();
|
||||
CurrentStringCheck = LoadedFile.readString();
|
||||
|
||||
//Lines Loop
|
||||
for (int i=1; i <= LinesNumber; i++){
|
||||
//Get Line String
|
||||
CurrentLineCheck = GetLineFromString(CurrentStringCheck);
|
||||
|
||||
//Set Removal Line for Later
|
||||
String Removal = CurrentLineCheck;
|
||||
|
||||
//Get Separator Distance
|
||||
int DistanceSeparator = GetSeparatorDistance(CurrentLineCheck);
|
||||
|
||||
if (DistanceSeparator >= 2) {
|
||||
String StringName = GetStringName(CurrentLineCheck, DistanceSeparator);
|
||||
String StringVal = GetStringVal(CurrentLineCheck);
|
||||
|
||||
//Set Valuse
|
||||
SetLoadingValues(StringName, StringVal);
|
||||
|
||||
//Remove Current Line
|
||||
int RemoveInt = Removal.length();
|
||||
CurrentStringCheck = CurrentStringCheck.substring(1, RemoveInt + 2);
|
||||
} else {
|
||||
//Send Error
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Close (Finished to load, no more needed)
|
||||
LoadedFile.close();
|
||||
}
|
||||
|
||||
void CloseFile() {
|
||||
LoadedFile.close();
|
||||
}
|
||||
|
||||
//#################################################################
|
||||
//#################################################################
|
||||
//#################################################################
|
||||
//Files String Loading Functions
|
||||
|
||||
int GetLinesNumber () {
|
||||
String ThisString = LoadedFile.readString();
|
||||
int StringLength = ThisString.length();
|
||||
int LineNumber = 1;
|
||||
for (int CharInt=1; CharInt <= StringLength; CharInt++){
|
||||
//Get Char
|
||||
char CurrentChar = ThisString.charAt(CharInt);
|
||||
//Separator Found
|
||||
if (CurrentChar == '\n') {
|
||||
LineNumber ++;
|
||||
}
|
||||
}
|
||||
|
||||
return LineNumber;
|
||||
}
|
||||
|
||||
int GetNewLineDistance (String ThisString) {
|
||||
int LineLength = ThisString.length();
|
||||
for (int CharInt=1; CharInt <= LineLength; CharInt++){
|
||||
//Get Char
|
||||
char CurrentChar = ThisString.charAt(CharInt);
|
||||
//Separator Found
|
||||
if (CurrentChar == '\n') {
|
||||
return CharInt;
|
||||
}
|
||||
//no newline found
|
||||
if (CharInt == LineLength && CurrentChar != '\n') {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int GetSeparatorDistance (String ThisString) {
|
||||
int LineLength = ThisString.length();
|
||||
for (int CharInt=1; CharInt <= LineLength; CharInt++){
|
||||
//Get Char
|
||||
String CurrentChar = (String)ThisString.charAt(CharInt);
|
||||
//Separator Found
|
||||
if (CurrentChar == ";") {
|
||||
return CharInt;
|
||||
}
|
||||
//Line Error Format, no separator found
|
||||
if (CharInt == LineLength && CurrentChar != ";") {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String GetLineFromString (String ThisString) {
|
||||
//Get Distance From NewLine
|
||||
char CurrentLineChar;
|
||||
int DistanceNewline = GetNewLineDistance(ThisString);
|
||||
|
||||
//Set Line Char
|
||||
if (DistanceNewline != 0) {
|
||||
for (int CharInt=1; CharInt < DistanceNewline; CharInt++){
|
||||
CurrentLineChar += CurrentStringCheck.charAt(CharInt);
|
||||
}
|
||||
} else {
|
||||
for (int CharInt=1; CharInt <= CurrentStringCheck.length(); CharInt++){
|
||||
CurrentLineChar += CurrentStringCheck.charAt(CharInt);
|
||||
}
|
||||
}
|
||||
|
||||
return (String)CurrentLineChar;
|
||||
}
|
||||
|
||||
String GetStringName (String ThisString, int DistanceSeparator) {
|
||||
char CurrentLineChar;
|
||||
|
||||
//Set Line Char
|
||||
for (int CharInt=1; CharInt < DistanceSeparator; CharInt++){
|
||||
CurrentLineChar += CurrentStringCheck.charAt(CharInt);
|
||||
}
|
||||
|
||||
String ThisName = (String)CurrentLineChar;
|
||||
|
||||
//Remove This Result for next String Check
|
||||
CurrentLineCheck = CurrentLineCheck.substring(1, DistanceSeparator + 1);
|
||||
|
||||
return ThisName;
|
||||
}
|
||||
|
||||
String GetStringVal (String ThisString) {
|
||||
char CurrentLineChar;
|
||||
int LineLength = ThisString.length();
|
||||
|
||||
//Set Line Char
|
||||
for (int CharInt=1; CharInt <= LineLength; CharInt++){
|
||||
CurrentLineChar += CurrentStringCheck.charAt(CharInt);
|
||||
}
|
||||
|
||||
return (String)CurrentLineChar;
|
||||
}
|
||||
|
||||
//#################################################################
|
||||
//#################################################################
|
||||
//#################################################################
|
||||
//Check Load Or Make File
|
||||
|
||||
void CheckForFiles(String FileName) {
|
||||
if(sd.exists(FileName)) {
|
||||
LoadFile(FileName);
|
||||
} else {
|
||||
MakeFile(FileName);
|
||||
}
|
||||
}
|
||||
|
||||
void MakeFile(String FileName) {
|
||||
//Load File
|
||||
LoadFileQuick(FileName);
|
||||
|
||||
//Set Initial Values (Write File)
|
||||
if (FileName == "LOG.txt") {
|
||||
LoadedFile.print("");
|
||||
} else if (FileName == "MENU_Settings.txt") {
|
||||
LoadedFile.print("");
|
||||
} else if (FileName == "OBD_Settings.txt") {
|
||||
LoadedFile.print("");
|
||||
} else if (FileName == "OBD_Tables.txt") {
|
||||
LoadedFile.print("");
|
||||
} else if (FileName == "OBD_BeeMR.txt") {
|
||||
LoadedFile.print("");
|
||||
}// else if (FileName == ".txt") {
|
||||
// LoadedFile.print("");
|
||||
//}
|
||||
|
||||
//Close File
|
||||
CloseFile();
|
||||
}
|
||||
|
||||
//#################################################################
|
||||
//#################################################################
|
||||
//#################################################################
|
||||
|
||||
void SetLoadingValues(String StringName, String StringVal) {
|
||||
if (StringName = "") {
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -0,0 +1,25 @@
|
|||
// Set Update Notes
|
||||
String VERSION = "v1.2.2";
|
||||
String UPDT_NOTES1 = " -Dual Relays Output";
|
||||
String UPDT_NOTES2 = " -More Outputs";
|
||||
String UPDT_NOTES3 = " -Better Inputting";
|
||||
String UPDT_NOTES4 = " -Better BeeMR";
|
||||
String UPDT_NOTES5 = " -Faster Start Menu";
|
||||
|
||||
String SetVersionInfos() {
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
String SetUpdateInfos(String Current) {
|
||||
if (Current == "Note1") {
|
||||
return UPDT_NOTES1;
|
||||
} else if (Current == "Note2") {
|
||||
return UPDT_NOTES2;
|
||||
} else if (Current == "Note3") {
|
||||
return UPDT_NOTES3;
|
||||
} else if (Current == "Note4") {
|
||||
return UPDT_NOTES4;
|
||||
} else if (Current == "Note5") {
|
||||
return UPDT_NOTES5;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue