Add files via upload

This commit is contained in:
BM Devs 2017-04-07 02:58:35 -04:00 committed by GitHub
parent d7c05fdafa
commit 811c4614f1
7 changed files with 1049 additions and 0 deletions

View File

@ -0,0 +1,83 @@
//#####################################################
//#####################################################
//#####################################################
/*
* THIS IS THE BM DEVS DATALOGGER
*
* THIS WORKS BY DATALOGGING ECTUNE ISR V3 PROTOCOL ON
* THE ARDUINO SERIAL PORT. THIS WORKS WITH 2X BUTTONS
* NAVIGATION ONLY. IT ONLY WORKS FOR THE 20X04 LCD
*
* ####################################################
* ALL CREDITS GOES TO :
* -Bouletmarc (BM Devs)
* -Majidi
* -Thatguy
*/
//#####################################################
//#####################################################
//#####################################################
//Load Modules
#include "Wire.h"
#include <LiquidCrystal_I2C.h>
#include <stdio.h>
#include <avr/pgmspace.h>
#include <EEPROM.h>
//Set Inputs
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
const int TopButton = 9;
const int BottomButton = 8;
//Screen Settings
const int ScreenMaxIndex = 35; //Maximum datalogs values
int ScreenCurrentIndex = 0;
int ScreenIndex[8]; //Display Index for 8x values
bool ScreenOption = false;
//Options Vars
const String VersionStr = "V2.0.0";
int Timeout = 200;
int Injectors_Size = 240;
int mBarSeaLevel = 1013;
byte TrannyType = 5;
byte O2Input = 0;
byte MapValue = 0;
byte UseCelcius = 1;
byte UseKMH = 1;
bool EcuConnected = false;
//#####################################################
void setup() {
//Initialize Screen Indexes
for (int i=0; i<8; i++) ScreenIndex[i] = i;
//Initialize Buttons Pinout
pinMode(TopButton,INPUT_PULLUP);
pinMode(BottomButton,INPUT_PULLUP);
//Start LCD Display
lcd.begin(20, 4);
StartScreen();
lcd.clear();
//Initialize Connection/Optinos
Connect();
LoadOptions();
}
//#####################################################
void loop() {
delay(Timeout);
//Screens Loop
if (!ScreenOption) {
if (!EcuConnected) SetJ12Screen();
if (EcuConnected) Display();
}
else DisplayOptions();
}

View File

@ -0,0 +1,77 @@
//Buttons Vars
#define ON 1
#define OFF 0
volatile int buttonTop = 0;
volatile int buttonBottom = 0;
volatile int buttonDual = 0;
unsigned long last_interrupt_time=0;
int debouncing = 50;
//Apply Buttons
void GetButtonStates() {
if (buttonTop == ON) ApplyTop();
if (buttonBottom == ON) ApplyBottom();
if (buttonDual == ON) ApplyDual();
}
void ApplyTop() {
//Increase Index
ScreenIndex[ScreenCurrentIndex]++;
//Check If the Index is not already been in use
for (int i=0; i<8; i++)
if (i != ScreenCurrentIndex)
if(ScreenIndex[ScreenCurrentIndex] == ScreenIndex[i])
ScreenIndex[ScreenCurrentIndex]++;
if(ScreenIndex[ScreenCurrentIndex] > ScreenMaxIndex) ScreenIndex[ScreenCurrentIndex] = 1;
buttonTop=OFF;
}
void ApplyBottom() {
//Switch to the next lines
ScreenCurrentIndex++;
if(ScreenIndex[ScreenCurrentIndex] > (8 - 1)) ScreenCurrentIndex = 0;
buttonBottom=OFF;
}
void ApplyDual() {
if (ScreenOption) ScreenOption = false;
else ScreenOption = true;
}
//###########################################################################################################
//###########################################################################################################
//###########################################################################################################
//Get States
void GetButtonTopState() {
if (digitalRead(TopButton) == LOW) {
if (!EcuConnected)
EcuConnected = true;
else {
unsigned long interrupt_time = millis();
if (buttonTop == OFF && (interrupt_time - last_interrupt_time > debouncing)) {
delay(30);
if (digitalRead(BottomButton) == LOW) buttonDual = ON;
else buttonTop=ON;
last_interrupt_time = interrupt_time;
}
}
}
}
void GetButtonBottomState() {
if (digitalRead(BottomButton) == LOW) {
if (!EcuConnected)
EcuConnected = true;
else {
unsigned long interrupt_time = millis();
if (buttonBottom == OFF && (interrupt_time - last_interrupt_time > debouncing)) {
delay(30);
if (digitalRead(TopButton) == LOW) buttonDual = ON;
else buttonBottom=ON;
last_interrupt_time = interrupt_time;
}
}
}
}

View File

@ -0,0 +1,594 @@
bool J12_Cut = true;
const int Array_Size = 52;
byte Datalog_Bytes[Array_Size];
byte GB[10] = {0x46, 0x00, 0x67, 0x00, 0x8E, 0x00, 0xB8, 0x00, 0x52, 0xDE};
void Connect() {
Serial.begin(38400);
}
/*void Disconnect() {
Serial.end();
}*/
bool GetJ12Cut() {
J12_Cut = true;
Serial.write((byte) 171);
if ((int) Serial.read() != 205) J12_Cut = false;
return J12_Cut;
}
void GetData(){
while(Serial.available())
for (int i = 0; i < Array_Size; i++)
Datalog_Bytes[i] = Serial.read();
Serial.flush();
Serial.write(" ");
}
void SetTranny(int ThisTranny) {
TrannyType = ThisTranny;
if (ThisTranny == 0) {
GB[0] = 0x46;
GB[1] = 0x00;
GB[2] = 0x67;
GB[3] = 0x00;
GB[4] = 0x8E;
GB[5] = 0x00;
GB[6] = 0xB8;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB[10] = {0x46, 0x00, 0x67, 0x00, 0x8E, 0x00, 0xB8, 0x00, 0x52, 0xDE};
} else if (ThisTranny == 1) {
GB[0] = 0x42;
GB[1] = 0x00;
GB[2] = 0x5D;
GB[3] = 0x00;
GB[4] = 0x87;
GB[5] = 0x00;
GB[6] = 0xB6;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB = {0x42, 0x00, 0x5D, 0x00, 0x87, 0x00, 0xB6, 0x00, 0x52, 0xDE};
} else if (ThisTranny == 2) {
GB[0] = 0x46;
GB[1] = 0x00;
GB[2] = 0x64;
GB[3] = 0x00;
GB[4] = 0x91;
GB[5] = 0x00;
GB[6] = 0xB8;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB = {0x46, 0x00, 0x64, 0x00, 0x91, 0x00, 0xB8, 0x00, 0x52, 0xDE};
} else if (ThisTranny == 3) {
GB[0] = 0x48;
GB[1] = 0x00;
GB[2] = 0x71;
GB[3] = 0x00;
GB[4] = 0xAA;
GB[5] = 0x00;
GB[6] = 0xE3;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB = {0x48, 0x00, 0x71, 0x00, 0xAA, 0x00, 0xE3, 0x00, 0x52, 0xDE};
} else if (ThisTranny == 4) {
GB[0] = 0x46;
GB[1] = 0x00;
GB[2] = 0x6E;
GB[3] = 0x00;
GB[4] = 0x9A;
GB[5] = 0x00;
GB[6] = 0xC4;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB = {0x46, 0x00, 0x6E, 0x00, 0x9A, 0x00, 0xC4, 0x00, 0x52, 0xDE};
} else if (ThisTranny == 5) {
GB[0] = 0x48;
GB[1] = 0x00;
GB[2] = 0x71;
GB[3] = 0x00;
GB[4] = 0xB2;
GB[5] = 0x00;
GB[6] = 0xD6;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB = {0x48, 0x00, 0x71, 0x00, 0xB2, 0x00, 0xD6, 0x00, 0x52, 0xDE};
} else if (ThisTranny == 6) {
GB[0] = 0x47;
GB[1] = 0x00;
GB[2] = 0x6E;
GB[3] = 0x00;
GB[4] = 0x9E;
GB[5] = 0x00;
GB[6] = 0xC3;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB = {0x47, 0x00, 0x6E, 0x00, 0x9E, 0x00, 0xC3, 0x00, 0x52, 0xDE};
} else if (ThisTranny == 7) {
GB[0] = 0x47;
GB[1] = 0x00;
GB[2] = 0x6E;
GB[3] = 0x00;
GB[4] = 0x9E;
GB[5] = 0x00;
GB[6] = 0xC9;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB = {0x47, 0x00, 0x6E, 0x00, 0x9E, 0x00, 0xC9, 0x00, 0x52, 0xDE};
} else if (ThisTranny == 8) {
GB[0] = 0x4A;
GB[1] = 0x00;
GB[2] = 0x7B;
GB[3] = 0x00;
GB[4] = 0xAF;
GB[5] = 0x00;
GB[6] = 0xE0;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB = {0x4A, 0x00, 0x7B, 0x00, 0xAF, 0x00, 0xE0, 0x00, 0x52, 0xDE};
} else if (ThisTranny == 9) {
GB[0] = 0x4B;
GB[1] = 0x00;
GB[2] = 0x7D;
GB[3] = 0x00;
GB[4] = 0xBC;
GB[5] = 0x00;
GB[6] = 0xED;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB = {0x4B, 0x00, 0x7D, 0x00, 0xBC, 0x00, 0xED, 0x00, 0x52, 0xDE};
} else if (ThisTranny > 9) {
GB[0] = 0x46;
GB[1] = 0x00;
GB[2] = 0x67;
GB[3] = 0x00;
GB[4] = 0x8E;
GB[5] = 0x00;
GB[6] = 0xB8;
GB[7] = 0x00;
GB[8] = 0x52;
GB[9] = 0xDE;
//GB = {0x46, 0x00, 0x67, 0x00, 0x8E, 0x00, 0xB8, 0x00, 0x52, 0xDE};
TrannyType = 0;
}
}
long Long2Bytes(byte ThisByte1, byte ThisByte2) {
return (long) ((long) ThisByte2 * 256 + (long) ThisByte1);
}
float GetTemperature(byte ThisByte) {
float ThisTemp = (float) ThisByte / 51;
ThisTemp = (0.1423*pow(ThisTemp,6)) - (2.4938*pow(ThisTemp,5)) + (17.837*pow(ThisTemp,4)) - (68.698*pow(ThisTemp,3)) + (154.69*pow(ThisTemp,2)) - (232.75*ThisTemp) + 284.24;
ThisTemp = ((ThisTemp - 32)*5)/9;
if (UseCelcius == 0)
ThisTemp = ThisTemp * 1.8 + 32.0;
return ThisTemp;
/*if (UseCelcius)
return round(double_Temperature[(int) ThisByte]);
return round(GetTemperatureF(double_Temperature[(int) ThisByte]));*/
}
double GetVolt(byte ThisByte) {
return round(((double) ThisByte * 0.0196078438311815) * 100) / 100;
}
float GetDuration(int ThisInt) {
return (float) ThisInt * 3.20000004768372 / 1000.0;
}
byte GetActivated(byte ThisByte, int ThisPos, bool Reversed) {
int bitArray[8];
for (int i=0; i < 8; ++i ) {
bitArray[i] = ThisByte & 1;
ThisByte = ThisByte >> 1;
}
if (Reversed)
return bitArray[ThisPos] ? (byte) 0 : (byte) 1;
return bitArray[ThisPos] ? (byte) 1 : (byte) 0;
}
float GetInstantConsumption(){
float hundredkm = ((60 / GetVss()) * 100) / 60; //minutes needed to travel 100km
float fuelc = (hundredkm * ((Injectors_Size / 100) * GetDuty())) / 1000;
return constrain(fuelc, 0.0001, 50.0);
}
float GetDuty(){
return ((float) GetRpm() * (float) GetInj()) / 1200;
}
float GetValueHG(int ThisInt) {
return (float) round(((double) ThisInt * 0.02952999) * 10) / 10;
}
unsigned int GetEct(){
return GetTemperature(Datalog_Bytes[0]);
}
unsigned int GetIat(){
return GetTemperature(Datalog_Bytes[1]);
}
float GetO2(){
if (O2Input == 0) return round((float) GetVolt(Datalog_Bytes[2]) * 100) / 100;//O2Byte = Datalog_Bytes[2];
if (O2Input == 1) return round((float) GetVolt(Datalog_Bytes[24]) * 100) / 100;//O2Byte = Datalog_Bytes[24];
if (O2Input == 2) return round((float) GetVolt(Datalog_Bytes[44]) * 100) / 100;//O2Byte = Datalog_Bytes[44]; //byte_25
if (O2Input == 3) return round((float) GetVolt(Datalog_Bytes[45]) * 100) / 100;//O2Byte = Datalog_Bytes[45];
//return round((float) GetVolt(O2Byte) * 100) / 100;
//return ((2 * (float) O2Byte[2]) + 10) / 10f;
}
unsigned int GetBaro(){
return (int) round((double) ((int) Datalog_Bytes[3] / 2 + 24) * 7.221 - 59.0);
}
float GetMap(){
int ThisInt = (int) Datalog_Bytes[4];
//if (MapValue == 0) return ((float) ThisInt * 2041) / 255; //(1764/255) * (float) ThisInt;
if (MapValue == 0) return 6.9176 * (float) ThisInt;
else if (MapValue == 1) return (float) (ThisInt / 1000);
else if (MapValue == 2) return (float) round(-((double) GetValueHG(mBarSeaLevel) + (double) GetValueHG(ThisInt)) * 10) / 10;
else if (MapValue == 3) return GetValueHG(ThisInt);
else if (MapValue == 4) return (float) round(((double) (ThisInt - mBarSeaLevel) * 0.0145037695765495) * 100) / 100; //GetValuePSI(ThisInt);
else if (MapValue == 5) return (float) round((double) ThisInt * 0.1); //GetValueKPa(ThisInt);
else return 0;
//float mapRaw = Datalog_Bytes[4];
//return (1764/255)*mapRaw;
}
unsigned int GetTps(){
return (int) round(((double) Datalog_Bytes[5] - 25.0) / 2.04);
//return constrain((0.4716 * Datalog_Bytes[5]) - 11.3184, 0, 100);
}
unsigned int GetRpm(){
//return (int) (1875000/Long2Bytes(Datalog_Bytes[6], Datalog_Bytes[7]));
return (int) (1851562/Long2Bytes(Datalog_Bytes[6], Datalog_Bytes[7]));
}
bool GetIgnCut(){
return (bool) GetActivated(Datalog_Bytes[8], 2, false);
}
bool GetVTSM(){
return (bool) GetActivated(Datalog_Bytes[8], 3, false);
}
bool GetFuelCut1(){
return (bool) GetActivated(Datalog_Bytes[8], 4, false);
}
bool GetFuelCut2(){
return (bool) GetActivated(Datalog_Bytes[8], 5, false);
}
unsigned int GetVss(){
if (UseKMH == 1)
return (int) Datalog_Bytes[16];
return (int) round((float) Datalog_Bytes[16] / 1.6f);
}
double GetInjFV() {
return round(((double) Long2Bytes(Datalog_Bytes[17], Datalog_Bytes[18]) / 4.0) * 100) / 100;
}
float GetInjectorDuty() {
return (float) ((double) GetRpm() * (double) GetDuration(Long2Bytes(Datalog_Bytes[17], Datalog_Bytes[18])) / 1200.0);
}
float GetInj(){
return (float) (Long2Bytes(Datalog_Bytes[17], Datalog_Bytes[18]) / 352);
}
unsigned int GetIgn(){
return (0.25 * Datalog_Bytes[19]) - 6;
}
bool GetVTP(){
return (bool) GetActivated(Datalog_Bytes[21], 3, false);
}
bool GetFanCtrl(){
return (bool) GetActivated(Datalog_Bytes[22], 4, false);
}
bool GetAtlCtrl(){
return (bool) GetActivated(Datalog_Bytes[22], 5, false);
}
bool GetMIL(){
return (bool) GetActivated(Datalog_Bytes[23], 5, false);
}
float GetBattery(){
return (26.0 * Datalog_Bytes[25]) / 270.0;
}
bool GetInputFTL(){
return (bool) GetActivated(Datalog_Bytes[38], 0, false);
}
bool GetInputFTS(){
return (bool) GetActivated(Datalog_Bytes[38], 1, false);
}
bool GetInputEBC(){
return (bool) GetActivated(Datalog_Bytes[38], 2, false);
}
bool GetInputBST(){
return (bool) GetActivated(Datalog_Bytes[38], 7, false);
}
bool GetOutputFTL(){
return (bool) GetActivated(Datalog_Bytes[39], 0, false);
}
bool GetOutputAntilag(){
return (bool) GetActivated(Datalog_Bytes[39], 1, false);
}
bool GetOutputFTS(){
return (bool) GetActivated(Datalog_Bytes[39], 2, false);
}
bool GetOutputBoostCut(){
return (bool) GetActivated(Datalog_Bytes[39], 3, false);
}
bool GetOutputEBC(){
return (bool) GetActivated(Datalog_Bytes[39], 4, false);
}
bool GetOutput2ndMap(){
return (bool) GetActivated(Datalog_Bytes[39], 5, false);
}
bool GetOutputFanCtrl(){
return (bool) GetActivated(Datalog_Bytes[39], 6, false);
}
bool GetOutputBST(){
return (bool) GetActivated(Datalog_Bytes[39], 7, false);
}
bool GetLeanProtect(){
return (bool) GetActivated(Datalog_Bytes[43], 7, false);
}
double GetIACVDuty(){
return ((double) ((float) Long2Bytes(Datalog_Bytes[49], Datalog_Bytes[50]) / 32768) * 100.0 - 100.0);
}
double GetMapVolt(){
return GetVolt(Datalog_Bytes[4]);
}
double GetTPSVolt(){
return GetVolt(Datalog_Bytes[5]);
}
double GetInjDuration(){
return round(((double) GetDuration((int) Long2Bytes(Datalog_Bytes[17], Datalog_Bytes[18]))) * 100) / 100;
}
unsigned int GetGear(){
if (GetVss() == 0)
return 0;
long ThisRatio = (long) (GetVss() * 256) * (long) GetRpm() / (long) 256;
byte Gear = 0;
for (int i = 0; i < 4; i++) {
int ThisIndex = i * 2;
if (ThisRatio >= GB[ThisIndex]) Gear = i + 1;
else break;
}
return Gear;
}
//################################################################################################################################
//################################################################################################################################
//################################################################################################################################
//REMOVED UNUSED DISPLAY
/*int GetIgnTable(){
return (0.25 * Datalog_Bytes[20]) - 6;
}
bool GetParkN(){
return (bool) GetActivated(Datalog_Bytes[21], 0, false);
}
bool GetBKSW(){
return (bool) GetActivated(Datalog_Bytes[21], 1, false);
}
bool GetACC(){
return (bool) GetActivated(Datalog_Bytes[21], 2, false);
}
bool GetStart(){
return (bool) GetActivated(Datalog_Bytes[21], 4, false);
}
bool GetSCC(){
return (bool) GetActivated(Datalog_Bytes[21], 5, false);
}
bool GetVTSFeedBack(){
return (bool) GetActivated(Datalog_Bytes[21], 6, false);
}
bool GetPSP(){
return (bool) GetActivated(Datalog_Bytes[21], 7, false);
}
bool GetFuelPump(){
return (bool) GetActivated(Datalog_Bytes[22], 0, false);
}
bool GetIAB(){
return (bool) GetActivated(Datalog_Bytes[22], 2, false);
}
bool GetPurge(){
return (bool) GetActivated(Datalog_Bytes[22], 6, false);
}
bool GetAC(){
return (bool) GetActivated(Datalog_Bytes[22], 7, false);
}
bool GetO2Heater(){
return (bool) GetActivated(Datalog_Bytes[23], 6, false);
}
bool GetVTS(){
return (bool) GetActivated(Datalog_Bytes[23], 7, false);
}
double GetELDVolt(){
return GetVolt(Datalog_Bytes[24]);
}
bool GetATShift1(){
return (bool) GetActivated(Datalog_Bytes[8], 6, false);
}
bool GetATShift2(){
return (bool) GetActivated(Datalog_Bytes[8], 7, false);
}
double GetECTFC(){
return GetFC(Datalog_Bytes[26], 128);
}
long GetO2Short(){
return (long) GetFC(Long2Bytes(Datalog_Bytes[27], Datalog_Bytes[28]), 32768);
}
long GetO2Long(){
return (long) GetFC(Long2Bytes(Datalog_Bytes[29], Datalog_Bytes[30]), 32768);
}
long GetIATFC(){
return (long) GetFC(Long2Bytes(Datalog_Bytes[31], Datalog_Bytes[32]), 32768);
}
double GetVEFC(){
return GetFC(Datalog_Bytes[33], 128);
}
float GetIATIC(){
return GetIC(Datalog_Bytes[34]);
}
float GetECTIC(){
return GetIC(Datalog_Bytes[35]);
}
float GetGEARIC(){
return GetIC(Datalog_Bytes[36]);
}
bool GetInputEBCHi(){
return (bool) GetActivated(Datalog_Bytes[38], 3, false);
}
bool GetInputGPO1(){
return (bool) GetActivated(Datalog_Bytes[38], 4, false);
}
bool GetInputGPO2(){
return (bool) GetActivated(Datalog_Bytes[38], 5, false);
}
bool GetInputGPO3(){
return (bool) GetActivated(Datalog_Bytes[38], 6, false);
}
double GetEBCBaseDuty(){
return GetEBC(Datalog_Bytes[40]);
}
double GetEBCDuty(){
return GetEBC(Datalog_Bytes[41]);
}
bool GetOutputGPO1(){
return (bool) GetActivated(Datalog_Bytes[43], 0, false);
}
bool GetOutputGPO2(){
return (bool) GetActivated(Datalog_Bytes[43], 1, false);
}
bool GetOutputGPO3(){
return (bool) GetActivated(Datalog_Bytes[43], 2, false);
}
bool GetOutputBSTStage2(){
return (bool) GetActivated(Datalog_Bytes[43], 3, false);
}
bool GetOutputBSTStage3(){
return (bool) GetActivated(Datalog_Bytes[43], 4, false);
}
bool GetOutputBSTStage4(){
return (bool) GetActivated(Datalog_Bytes[43], 5, false);
}
bool GetPostFuel(){
return (bool) GetActivated(Datalog_Bytes[8], 0, false);
}
bool GetSCCChecker(){
return (bool) GetActivated(Datalog_Bytes[8], 1, false);
}
float GetIC(byte ThisByte) {
if ((int) ThisByte == 128)
return 0.0f;
if ((int) ThisByte < 128)
return (float) (128 - (int) ThisByte) * -0.25f;
return (float) ((int) ThisByte - 128) * 0.25f;
}
double GetFC(long ThisByte, long ThisLong) {
double num = (double) ThisByte / (double) ThisLong;
//if (CorrectionUnits == "multi")
return round((num) * 100) / 100;
//return round(num * 100.0 - 100.0);
}
double GetEBC(byte ThisByte) {
double num = (double) ThisByte / 2.0;
if (num > 100.0)
num = 100.0;
return round((num * 10)) / 10;
}*/

View File

@ -0,0 +1,129 @@
void Display() {
GetData();
GetButtonTopState();
GetButtonBottomState();
GetButtonStates();
execScreen();
}
void execScreen(){
//Running 8x Loop for 20x04 Display
for (int i=0; i<8; i++) {
//Get Text Index
int ThisScreenIndex = ScreenIndex[i];
//Set Text
String Text = "";
if (ThisScreenIndex == 0) Text += "RPM:" + String(GetRpm());
if (ThisScreenIndex == 1) Text += "ECT:" + String(GetEct()) + "C";
if (ThisScreenIndex == 2) Text += "IAT:" + String(GetIat()) + "C";
if (ThisScreenIndex == 3) Text += "TPS:" + String(GetTps()) + "%";
if (ThisScreenIndex == 4) Text += "O2:" + String(GetO2());
if (ThisScreenIndex == 5) Text += "IGN:" + String(GetIgn());
if (ThisScreenIndex == 6) Text += "INJ:" + String(GetInj()) + "ms";
if (ThisScreenIndex == 7) Text += "FUEL:" + String(GetInstantConsumption()) + "L";
if (ThisScreenIndex == 8) Text += "DTY:" + String(GetInjectorDuty());
if (ThisScreenIndex == 9) Text += "MAP:" + String(GetMap());
if (ThisScreenIndex == 10) Text += "VSS:" + String(GetVss()) + "kmh";
if (ThisScreenIndex == 11) Text += "Gear:" + String(GetGear());
if (ThisScreenIndex == 12) Text += "BATT:" + String(GetBattery());
if (ThisScreenIndex == 13) Text += "VTSM:" + String(GetVTSM());
if (ThisScreenIndex == 14) Text += "ICUT:" + String(GetIgnCut());
if (ThisScreenIndex == 15) Text += "FCUT:" + String(GetFuelCut1());
if (ThisScreenIndex == 16) Text += "FCUT2:" + String(GetFuelCut2());
if (ThisScreenIndex == 17) Text += "INJFV:" + String(GetInjFV());
if (ThisScreenIndex == 18) Text += "INJD:" + String(GetInjDuration());
if (ThisScreenIndex == 19) Text += "VTP:" + String(GetVTP());
if (ThisScreenIndex == 20) Text += "FCTRL:" + String(GetFanCtrl());
if (ThisScreenIndex == 21) Text += "ACTRL:" + String(GetAtlCtrl());
if (ThisScreenIndex == 22) Text += "MIL:" + String(GetMIL());
if (ThisScreenIndex == 23) Text += "FTLI:" + String(GetInputFTL());
if (ThisScreenIndex == 24) Text += "FTSI:" + String(GetInputFTS());
if (ThisScreenIndex == 25) Text += "EBCI:" + String(GetInputEBC());
if (ThisScreenIndex == 26) Text += "BSTI:" + String(GetInputBST());
if (ThisScreenIndex == 27) Text += "FTLO:" + String(GetOutputFTL());
if (ThisScreenIndex == 28) Text += "ATLG:" + String(GetOutputAntilag());
if (ThisScreenIndex == 29) Text += "FTSO:" + String(GetOutputFTS());
if (ThisScreenIndex == 30) Text += "BSTCT:" + String(GetOutputBoostCut());
if (ThisScreenIndex == 31) Text += "EBCO:" + String(GetOutputEBC());
if (ThisScreenIndex == 32) Text += "2MAP:" + String(GetOutput2ndMap());
if (ThisScreenIndex == 33) Text += "FCTRLO:" + String(GetOutputFanCtrl());
if (ThisScreenIndex == 34) Text += "BSTO:" + String(GetOutputBST());
if (ThisScreenIndex == 35) Text += "IACV:" + String(GetIACVDuty());
//POSSIBLE USELESS DATALOGS
//if (ThisScreenIndex == 00) Text += " BARO:" + String(GetBaro());
//if (ThisScreenIndex == 00) Text += " PSTF:" + String(GetPostFuel());
//if (ThisScreenIndex == 00) Text += " SCC.C:" + String(GetSCCChecker());
//if (ThisScreenIndex == 00) Text += " ATSF1:" + String(GetATShift1());
//if (ThisScreenIndex == 00) Text += " ATSF2:" + String(GetATShift2());
//if (ThisScreenIndex == 00) Text += " IGNT:" + String(GetIgnTable());
//if (ThisScreenIndex == 00) Text += " PARK:" + String(GetParkN());
//if (ThisScreenIndex == 00) Text += " BKSW:" + String(GetBKSW());
//if (ThisScreenIndex == 00) Text += " ACC:" + String(GetACC());
//if (ThisScreenIndex == 00) Text += " STRT:" + String(GetStart());
//if (ThisScreenIndex == 00) Text += " SCC:" + String(GetSCC());
//if (ThisScreenIndex == 00) Text += " VTSFB:" + String(GetVTSFeedBack());
//if (ThisScreenIndex == 00) Text += " PSP:" + String(GetPSP());
//if (ThisScreenIndex == 00) Text += " FPMP:" + String(GetFuelPump());
//if (ThisScreenIndex == 00) Text += " IAB:" + String(GetIAB());
//if (ThisScreenIndex == 00) Text += " PURGE:" + String(GetPurge());
//if (ThisScreenIndex == 00) Text += " AC:" + String(GetAC());
//if (ThisScreenIndex == 00) Text += " O2H:" + String(GetO2Heater());
//if (ThisScreenIndex == 00) Text += " VTS:" + String(GetVTS());
//if (ThisScreenIndex == 00) Text += " ELDV:" + String(GetELDVolt()) + "v";
//if (ThisScreenIndex == 00) Text += " ECTFC:" + String(GetECTFC());
//if (ThisScreenIndex == 00) Text += " O2S:" + String(GetO2Short());
//if (ThisScreenIndex == 00) Text += " O2L:" + String(GetO2Long());
//if (ThisScreenIndex == 00) Text += " IATFC:" + String(GetIATFC());
//if (ThisScreenIndex == 00) Text += " VEFC:" + String(GetVEFC());
//if (ThisScreenIndex == 00) Text += " IATIC:" + String(GetIATIC());
//if (ThisScreenIndex == 00) Text += " ECTIC:" + String(GetECTIC());
//if (ThisScreenIndex == 00) Text += " GEARIC:" + String(GetGEARIC());
//if (ThisScreenIndex == 00) Text += " EBCHi:" + String(GetInputEBCHi());
//if (ThisScreenIndex == 00) Text += " GPO1I:" + String(GetInputGPO1());
//if (ThisScreenIndex == 00) Text += " GPO2I:" + String(GetInputGPO2());
//if (ThisScreenIndex == 00) Text += " GPO3I:" + String(GetInputGPO3());
//if (ThisScreenIndex == 00) Text += " EBCBDTY:" + String(GetEBCBaseDuty());
//if (ThisScreenIndex == 00) Text += " EBCDTY:" + String(GetEBCDuty());
//if (ThisScreenIndex == 00) Text += " GPO1O:" + String(GetOutputGPO1());
//if (ThisScreenIndex == 00) Text += " GPO2O:" + String(GetOutputGPO2());
//if (ThisScreenIndex == 00) Text += " GPO3O:" + String(GetOutputGPO3());
//if (ThisScreenIndex == 00) Text += " BSTS2:" + String(GetOutputBSTStage2());
//if (ThisScreenIndex == 00) Text += " BSTS3:" + String(GetOutputBSTStage3());
//if (ThisScreenIndex == 00) Text += " BSTS4:" + String(GetOutputBSTStage4());
//if (ThisScreenIndex == 00) Text += " LEAN:" + String(GetLeanProtect());
//Reset Invalid Char Over Text Lenght
int ResetLenght = 10 - Text.length();
for (int i2=0; i2<ResetLenght; i2++) Text += " ";
//Offset the text (to show 2x value wide rather than only one)
int Offset = 0;
int Lines = i;
if (i == 1) {
Lines = 0;
Offset = 10;
}
if (i == 2) Lines = 1;
if (i == 3) {
Lines = 1;
Offset = 10;
}
if (i == 4) Lines = 2;
if (i == 5) {
Lines = 2;
Offset = 10;
}
if (i == 6) Lines = 3;
if (i == 7) {
Lines = 3;
Offset = 10;
}
//Print Text
lcd.setCursor(Offset, Lines);
lcd.print(Text);
}
}

View File

@ -0,0 +1,16 @@
void SetJ12Screen() {
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print(" NOT CONNECTED");
lcd.setCursor(0,2);
lcd.print(" IS J12 INPLACE?");
lcd.setCursor(0,3);
lcd.print(" ");
//Get States
EcuConnected = GetJ12Cut();
GetButtonTopState();
GetButtonBottomState();
}

View File

@ -0,0 +1,131 @@
// TRANNY TYPES REFERENCES :
//0 = 'Y21/Y80/S80'
//1 = 'ITR S80 JDM 98-01'
//2 = 'ITR S80 USDM 97-01 '
//3 = 'Z6/Y8'
//4 = 'GSR'
//5 = 'LS/RS/GS/SE'
//6 = 'H22 JDM'
//7 = 'H22 USDM/H23 JDM'
//8 = 'H23 USDM'
//9 = 'D16Y7'
// O2 REFERENCES
// o2Input, eldInput, egrInput, b6Input
//MAPS REFERENCES :
// mBar, Bar, inHgG, inHg, psi, kPa (type it with specifics caps)
void DisplayOptions() {
for (int i=0; i<8; i++) {
String Text = "";
if (i == 0) Text += " INJ:" + String(Injectors_Size);
if (i == 1) Text += " TRANNY:" + String(GetTrannyStr());
if (i == 2) Text += " O2IN:" + String(GetO2Str());
if (i == 3) Text += " MAP:" + String(GetMapStr());
if (i == 4) Text += " TEMP:" + String(GetTempCelcius());
if (i == 5) Text += " SPEED:" + String(GetKMH());
if (i == 6) Text += " T/O:" + String(Timeout) + "ms";
if (i == 7) Text += " SLVL:" + String(mBarSeaLevel);
}
String T1 = " YOU WILL NOT";
String T2 = " FIND YOUR";
String T3 = " BEER AND TITTIES";
String T4 = " ERROR HERE !";
lcd.clear();
lcd.setCursor(0,0);
lcd.print(T1);
lcd.setCursor(0,1);
lcd.print(T2);
lcd.setCursor(0,2);
lcd.print(T3);
lcd.setCursor(0,3);
lcd.print(T4);
}
String GetTrannyStr() {
String Str = "";
if (TrannyType == 0) Str = "Y21/80";
if (TrannyType == 1) Str = "S80J";
if (TrannyType == 2) Str = "S80U";
if (TrannyType == 3) Str = "Z6/Y8";
if (TrannyType == 4) Str = "GSR";
if (TrannyType == 5) Str = "RS";
if (TrannyType == 6) Str = "H22J";
if (TrannyType == 7) Str = "H23U";
if (TrannyType == 8) Str = "H22U";
if (TrannyType == 9) Str = "Y7";
return Str;
}
String GetO2Str() {
String Str = "";
if (O2Input == 0) Str = "O2";
if (O2Input == 1) Str = "ELD";
if (O2Input == 2) Str = "EGR";
if (O2Input == 3) Str = "B6";
}
String GetMapStr() {
String Str = "";
if (MapValue == 0) Str = "mBar";
if (MapValue == 1) Str = "Bar";
if (MapValue == 2) Str = "inHgG";
if (MapValue == 3) Str = "inHg";
if (MapValue == 4) Str = "psi";
if (MapValue == 5) Str = "kPa";
}
String GetTempCelcius() {
String Str = "";
if (UseCelcius == 1) Str = "CEL";
if (UseCelcius == 0) Str = "FAR";
}
String GetKMH() {
String Str = "";
if (UseKMH == 1) Str = "KMH";
if (UseKMH == 0) Str = "MPH";
}
void SaveOptions() {
for (int i=0; i < 9; i++) {
int Addr = i * 10;
if (i == 0) EEPROM.put(Addr, Timeout);
if (i == 1) EEPROM.put(Addr, Injectors_Size);
if (i == 2) EEPROM.put(Addr, mBarSeaLevel);
if (i == 3) EEPROM.put(Addr, TrannyType);
if (i == 4) EEPROM.put(Addr, O2Input);
if (i == 5) EEPROM.put(Addr, MapValue);
if (i == 6) EEPROM.put(Addr, UseCelcius);
if (i == 7) EEPROM.put(Addr, UseKMH);
if (i == 8) EEPROM.put(Addr, ScreenIndex);
//Write 3 at the last location to tell data ever get saved
EEPROM.write(1023, 3);
}
}
void LoadOptions() {
if (EEPROM.read(1023) == 3) {
for (int i=0; i < 9; i++) {
int Addr = i * 10;
if (i == 0) EEPROM.get(Addr, Timeout);
if (i == 1) EEPROM.get(Addr, Injectors_Size);
if (i == 2) EEPROM.get(Addr, mBarSeaLevel);
if (i == 3) EEPROM.get(Addr, TrannyType);
if (i == 4) EEPROM.get(Addr, O2Input);
if (i == 5) EEPROM.get(Addr, MapValue);
if (i == 6) EEPROM.get(Addr, UseCelcius);
if (i == 7) EEPROM.get(Addr, UseKMH);
if (i == 8) EEPROM.get(Addr, ScreenIndex);
}
}
else
SaveOptions();
}

View File

@ -0,0 +1,19 @@
void StartScreen(){
String T1 = " BM Devs";
String T2 = " Datalogger";
String T3 = " " + VersionStr;
String T4 = " eCtune ISR V3";
lcd.clear();
lcd.setCursor(0,0);
lcd.print(T1);
delay(1000);
lcd.setCursor(0,1);
lcd.print(T2);
delay(1000);
lcd.setCursor(0,2);
lcd.print(T3);
lcd.setCursor(0,3);
lcd.print(T4);
delay(2000);
}