diff --git a/src/main.cpp b/src/main.cpp index c5587c7..caf986b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,16 +10,16 @@ EncButton btnUp(INPUT); -//avr +// avr #define FIS_ENA 5 #define FIS_CLK 6 #define FIS_DATA 7 -//CLK,DATA,ENA pin, forcemode=0/1 -VAGFISWriter fisWriter( FIS_CLK, FIS_DATA, FIS_ENA, 1); +// CLK,DATA,ENA pin, forcemode=0/1 +VAGFISWriter fisWriter(FIS_CLK, FIS_DATA, FIS_ENA, 1); #define ADR_Engine 0x01 -#define ADR_Gears 0x02 +#define ADR_Gears 0x02 #define ADR_ABS_Brakes 0x03 #define ADR_Airbag 0x15 #define ADR_Dashboard 0x17 @@ -27,119 +27,59 @@ VAGFISWriter fisWriter( FIS_CLK, FIS_DATA, FIS_ENA, 1); #define ADR_Central_locking 0x35 int ADR_Engine_Speed = 10400; -int ADR_Dashboard_Speed = 10400; +int ADR_Dashboard_Speed = 10400; NewSoftwareSerial obd(pinKLineRX, pinKLineTX, false); // RX, TX, inverse logic bool logoDash = 0; +const uint8_t PROGMEM quattroLogo[56]{ + 0xff, 0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0xc0, 0xef, 0xec, 0x02, 0x04, 0x1e, 0x0f, 0x9b, 0x80, 0x2f, 0xe8, 0x01, 0x3e, 0xfc, 0x04, 0x01, 0xbf, 0x2f, 0xe9, 0xf9, 0x3a, 0xe5, 0xfc, 0xfc, 0x80, 0x20, 0x08, 0x09, 0x02, 0x05, 0xfc, 0x01, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + const uint8_t PROGMEM AudiLogo[144]{ -0x00,0x7e, 0x03,0xf0,0x0f, 0x80,0x7e, 0x00 -, 0x01,0xff, 0x8f, 0xfc, 0x3f, 0xf1,0xff, 0x80 -, 0x03,0x81,0xdc, 0x07,0xe0,0x3b, 0x81,0xc0 -, 0x06,0x00,0x70,0x03,0xc0,0x0e, 0x00,0x60 -, 0x0c, 0x00,0x70,0x01,0x80,0x0e, 0x00,0x30 -, 0x18,0x00,0x78,0x03,0xc0,0x0e, 0x00,0x18 -, 0x18,0x00,0xd8,0x02,0xc0,0x1b, 0x00,0x18 -, 0x18,0x00,0xd8,0x06,0x40,0x1b, 0x00,0x18 -, 0x10,0x00,0xc8,0x06,0x60,0x1b, 0x00,0x08 -, 0x10,0x00,0xd8,0x06,0x60,0x1b, 0x00,0x08 -, 0x18,0x00,0xd8,0x06,0x40,0x1b, 0x00,0x18 -, 0x18,0x00,0xd8,0x03,0xc0,0x1a, 0x00,0x18 -, 0x18,0x00,0x70,0x03,0xc0,0x0e, 0x00,0x18 -, 0x0c, 0x00,0x70,0x01,0x80,0x0e, 0x00,0x30 -, 0x06,0x00,0x78,0x03,0xc0,0x1e, 0x00,0x60 -, 0x03,0x81,0xdc, 0x0e, 0xf0,0x3b, 0x81,0xc0 -, 0x01,0xff, 0x87,0xfc, 0x3f, 0xe1,0xff, 0x80 -, 0x00,0x3c, 0x01,0xe0,0x07,0x80,0x3c, 0x00 + 0x00, 0x7e, 0x03, 0xf0, 0x0f, 0x80, 0x7e, 0x00, 0x01, 0xff, 0x8f, 0xfc, 0x3f, 0xf1, 0xff, 0x80, 0x03, 0x81, 0xdc, 0x07, 0xe0, 0x3b, 0x81, 0xc0, 0x06, 0x00, 0x70, 0x03, 0xc0, 0x0e, 0x00, 0x60, 0x0c, 0x00, 0x70, 0x01, 0x80, 0x0e, 0x00, 0x30, 0x18, 0x00, 0x78, 0x03, 0xc0, 0x0e, 0x00, 0x18, 0x18, 0x00, 0xd8, 0x02, 0xc0, 0x1b, 0x00, 0x18, 0x18, 0x00, 0xd8, 0x06, 0x40, 0x1b, 0x00, 0x18, 0x10, 0x00, 0xc8, 0x06, 0x60, 0x1b, 0x00, 0x08, 0x10, 0x00, 0xd8, 0x06, 0x60, 0x1b, 0x00, 0x08, 0x18, 0x00, 0xd8, 0x06, 0x40, 0x1b, 0x00, 0x18, 0x18, 0x00, 0xd8, 0x03, 0xc0, 0x1a, 0x00, 0x18, 0x18, 0x00, 0x70, 0x03, 0xc0, 0x0e, 0x00, 0x18, 0x0c, 0x00, 0x70, 0x01, 0x80, 0x0e, 0x00, 0x30, 0x06, 0x00, 0x78, 0x03, 0xc0, 0x1e, 0x00, 0x60, 0x03, 0x81, 0xdc, 0x0e, 0xf0, 0x3b, 0x81, 0xc0, 0x01, 0xff, 0x87, 0xfc, 0x3f, 0xe1, 0xff, 0x80, 0x00, 0x3c, 0x01, 0xe0, 0x07, 0x80, 0x3c, 0x00}; + +const uint8_t PROGMEM AudiLogoMy[272]{ + 0xff, 0x81, 0xfc, 0x0f, 0xf0, 0x3f, 0x81, 0xff, 0xfc, 0x00, 0x70, 0x01, 0x80, 0x0e, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0xfe, 0x07, 0xf8, 0x1f, 0xe0, 0x7f, 0x0f, 0xe3, 0xff, 0x0f, 0xfc, 0x3f, 0xf0, 0xff, 0xc7, 0xc7, 0xff, 0x07, 0xf8, 0x1f, 0xe0, 0xff, 0xe3, 0xcf, 0xfe, 0x23, 0xf8, 0x1f, 0xc4, 0x7f, 0xf3, 0x8f, 0xfe, 0x23, 0xf1, 0x8f, 0xc4, 0x7f, 0xf1, 0x9f, 0xfc, 0x73, 0xf1, 0x8f, 0xce, 0x7f, 0xf1, 0x9f, 0xfc, 0x73, 0xf3, 0xcf, 0xce, 0x3f, 0xf9, 0x9f, 0xfc, 0x71, 0xf3, 0xcf, 0x8e, 0x3f, 0xf9, 0x9f, 0xfc, 0x71, 0xf3, 0xcf, 0x8e, 0x3f, 0xf9, 0x9f, 0xfc, 0x73, 0xf3, 0xcf, 0xce, 0x3f, 0xf9, 0x9f, 0xfc, 0x73, 0xf1, 0x8f, 0xce, 0x3f, 0xf9, 0x8f, 0xfe, 0x63, 0xf1, 0x8f, 0xc6, 0x7f, 0xf1, 0x8f, 0xfe, 0x23, 0xf8, 0x1f, 0xc4, 0x7f, 0xf1, 0xc7, 0xff, 0x07, 0xf8, 0x1f, 0xe0, 0xff, 0xe3, 0xe3, 0xff, 0x0f, 0xfc, 0x3f, 0xf0, 0xff, 0xc7, 0xe0, 0xff, 0x07, 0xf8, 0x1f, 0xe0, 0xff, 0x0f, 0xf8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1f, 0xfc, 0x00, 0x70, 0x01, 0x80, 0x0e, 0x00, 0x3f, 0xff, 0x01, 0xfc, 0x07, 0xe0, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3c, 0x7f, 0xff, 0xff, 0x80, 0x6f, 0xec, 0x02, 0x0c, 0x1c, 0x06, 0x01, 0xbf, 0x2f, 0xe9, 0xf9, 0x3e, 0xfc, 0xe4, 0xfc, 0xbf, 0x2f, 0xc9, 0xf9, 0x3a, 0x65, 0xfc, 0xfc, 0x80, 0x20, 0x08, 0x09, 0x02, 0x05, 0xfc, 0x01, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }; -//22x8 +// 22x8 const uint8_t PROGMEM oilico[24]{ -0x01,0xc0,0x18 -, 0xfa, 0xa0,0xfc -, 0xdf, 0xff, 0x40 -, 0x68,0x04,0xc4 -, 0x28,0x01,0x04 -, 0x38,0x02,0x00 -, 0x18,0x0c, 0x00 -, 0x0f, 0xf8,0x00 -}; + 0x01, 0xc0, 0x18, 0xfa, 0xa0, 0xfc, 0xdf, 0xff, 0x40, 0x68, 0x04, 0xc4, 0x28, 0x01, 0x04, 0x38, 0x02, 0x00, 0x18, 0x0c, 0x00, 0x0f, 0xf8, 0x00}; -//9x10 +// 22x8 +const uint8_t PROGMEM oilicoMy[24]{ + 0x41, 0xc0, 0x00, 0x79, 0xc0, 0x18, 0xcf, 0xf1, 0xf8, 0x7f, 0xff, 0xc0, 0x0c, 0x00, 0x80, 0x0c, 0x01, 0x0c, 0x0f, 0xfe, 0x00, 0x07, 0xfc, 0x00}; + +// 9x10 const uint8_t PROGMEM fuelico[20]{ -0xf8,0x00 -, 0x89,0x00 -, 0x88,0x80 -, 0x89,0x80 -, 0xfc, 0x80 -, 0xfa, 0x80 -, 0xfa, 0x80 -, 0xfa, 0x80 -, 0xfa, 0x80 -, 0xf9,0x00 -}; + 0xf8, 0x00, 0x89, 0x00, 0x88, 0x80, 0x89, 0x80, 0xfc, 0x80, 0xfa, 0x80, 0xfa, 0x80, 0xfa, 0x80, 0xfa, 0x80, 0xf9, 0x00}; -//13x10 +// 13x10 const uint8_t PROGMEM batteryico[20]{ -0x3c, 0xe0 -, 0x65,0x30 -, 0xc0,0x18 -, 0x80,0x08 -, 0x80,0x08 -, 0x98,0x48 -, 0x80,0x48 -, 0x80,0x08 -, 0x80,0x08 -, 0xff, 0xf8 -}; + 0x3c, 0xe0, 0x65, 0x30, 0xc0, 0x18, 0x80, 0x08, 0x80, 0x08, 0x98, 0x48, 0x80, 0x48, 0x80, 0x08, 0x80, 0x08, 0xff, 0xf8}; + +// 13x10 +const uint8_t PROGMEM batteryicoMy[20]{ + 0x30, 0x60, 0xff, 0xf8, 0xc0, 0x38, 0x80, 0x08, 0xb0, 0x68, 0x80, 0x48, 0x80, 0x08, 0x80, 0x08, 0x80, 0x08, 0xff, 0xf8}; -//13x10 +// 13x10 const uint8_t PROGMEM oiltempico[20]{ -0x04,0x00 -, 0x07,0x00 -, 0x04,0x00 -, 0x04,0x00 -, 0x07,0x00 -, 0xc4,0x00 -, 0xb6,0x70 -, 0x61,0x20 -, 0x20,0x48 -, 0x1f, 0x80 -}; + 0x04, 0x00, 0x07, 0x00, 0x04, 0x00, 0x04, 0x00, 0x07, 0x00, 0xc4, 0x00, 0xb6, 0x70, 0x61, 0x20, 0x20, 0x48, 0x1f, 0x80}; +// 13x10 +const uint8_t PROGMEM oiltempicoMy[20]{ + 0x0c, 0x00, 0xec, 0x00, 0xa4, 0x38, 0xde, 0xe0, 0x73, 0xa0, 0x20, 0x40, 0x00, 0x48, 0x00, 0x88, 0x1f, 0x80, 0x1f, 0x00}; -//11x10 +// 11x10 const uint8_t PROGMEM coolanttempico[20]{ -0x04,0x00 -, 0x07,0x80 -, 0x04,0x00 -, 0x07,0x80 -, 0x04,0x00 -, 0x07,0x80 -, 0x44,0x40 -, 0xae, 0xa0 -, 0x00,0x00 -, 0x3f, 0x80 -}; + 0x04, 0x00, 0x07, 0x80, 0x04, 0x00, 0x07, 0x80, 0x04, 0x00, 0x07, 0x80, 0x44, 0x40, 0xae, 0xa0, 0x00, 0x00, 0x3f, 0x80}; +// 11x10 +const uint8_t PROGMEM coolanttempicoMy[20]{ + 0x04, 0x00, 0x07, 0x00, 0x04, 0x00, 0x07, 0x00, 0x04, 0x00, 0x07, 0x00, 0x44, 0x40, 0x3d, 0x80, 0x00, 0x00, 0x7f, 0x80}; -//16x16 +// 16x16 const uint8_t PROGMEM ccicon[32]{ -0x00,0x00 -, 0xc0,0x00 -, 0x68,0x00 -, 0x38,0x00 -, 0x38,0xe0 -, 0x03,0xf8 -, 0x06,0x4c -, 0x0f, 0x4e -, 0x0b, 0x8b -, 0x19,0xe3 -, 0x1c, 0xe7 -, 0x1c, 0xe7 -, 0x18,0x03 -, 0x0e, 0x0e -, 0x0e, 0x0e -, 0x04,0x04 -}; + 0x00, 0x00, 0xc0, 0x00, 0x68, 0x00, 0x38, 0x00, 0x38, 0xe0, 0x03, 0xf8, 0x06, 0x4c, 0x0f, 0x4e, 0x0b, 0x8b, 0x19, 0xe3, 0x1c, 0xe7, 0x1c, 0xe7, 0x18, 0x03, 0x0e, 0x0e, 0x0e, 0x0e, 0x04, 0x04}; uint8_t currAddr = 0; uint8_t blockCounter = 0; @@ -153,9 +93,7 @@ bool fullDash = false; uint8_t currPage = 1; uint8_t currPageOld; -int readVagGroup = 1; - -String readString; +int readVagGroup = 0; int param0; int param1; @@ -173,7 +111,7 @@ int8_t oilTemp = 0; int8_t intakeAirTemp = 0; int8_t oilPressure = 0; float engineLoad = 0; -int engineSpeed = 0; +int engineSpeed = 0; float throttleValve = 0; float supplyVoltage = 0; uint8_t vehicleSpeed = 0; @@ -183,35 +121,33 @@ unsigned long odometer = 0; float injektTime = 0; float MAF = 0; - float Lhour = 0; - float LhourAVGtmp = 0; - float LhourAVG = 0; - float L100Current = 0; - float L100; - - float L100tmp; - int ix = 1; - int countLoop = 1; - - int iy = 1; - float L100Move = 0; - float L100Movetmp = 0; - - float vehicleSpeedAVGtmp; - float vehicleSpeedAVG; - float L100AVG; +float Lhour = 0; +float LhourAVGtmp = 0; +float LhourAVG = 0; +float L100Current = 0; +float L100; + +float L100tmp; +int ix = 1; +int countLoop = 1; + +int iy = 1; +float L100Move = 0; +float L100Movetmp = 0; + +float vehicleSpeedAVGtmp; +float vehicleSpeedAVG; +float L100AVG; // float L100tmp =0; // int ix = 1; bool SaveL100Flag = false; - - - -String floatToString(float v){ - String res; - char buf[16]; - dtostrf(v,4, 2, buf); - res=String(buf); +String floatToString(float v) +{ + String res; + char buf[16]; + dtostrf(v, 4, 2, buf); + res = String(buf); return res; } @@ -683,18 +619,32 @@ bool readSensors(int group){ return true; } -void alarm() +void getECUSensor(int groupNum) { - if (alarmCounter > 10) - return; - // tone(pinBuzzer, 1200); - // delay(100); - // noTone(pinBuzzer); - alarmCounter++; + if (currAddr != ADR_Engine) + { + connect(ADR_Engine, ADR_Engine_Speed); + } + else + { + readSensors(groupNum); + } } +void getDashboardSensor(int groupNum) +{ + if (currAddr != ADR_Dashboard) + { + connect(ADR_Dashboard, ADR_Dashboard_Speed); + } + else + { + readSensors(groupNum); + } +} -void btnInterrupt(){ +void btnInterrupt() +{ btnUp.tickISR(); } @@ -707,11 +657,6 @@ void setup() attachInterrupt(0, btnInterrupt, FALLING); - - - - - Serial.begin(9600); Serial.println(F("SETUP")); fisWriter.begin(); @@ -721,317 +666,197 @@ void setup() void loop() { - //eeprom_write_float(1, 1); - btnUp.tick(); - - // eeprom_write_dword(1,1); - // eeprom_write_float(5,1); - - - if (btnUp.held()){ - fullDash = !fullDash; - countLoop = 1; - fisWriter.reset(); - } - - - - - if(!fullDash){ - if (btnUp.hasClicks(1)){ - currPage++; - if (currPage > 9) currPage = 1; - eeprom_update_byte(0, currPage); - } + // eeprom_write_float(1, 1); + btnUp.tick(); - if (btnUp.hasClicks(2)){ - currPage--; - if (currPage < 1) currPage = 9; - eeprom_update_byte(0, currPage); - } - - if(logoDash == 0){ + if (logoDash == 0) + { logoDash = 1; fisWriter.initFullScreen(); - - fisWriter.GraphicFromArray(0, 0, 64, 88, AudiLogo, 1); + + fisWriter.GraphicFromArray(0, 35, 64, 88, AudiLogo, 1); + delay(5); + fisWriter.GraphicFromArray(0, 55, 64, 88, quattroLogo, 1); delay(5); fisWriter.reset(); - } - switch (currPage) + } + + // eeprom_write_dword(1,1); + // eeprom_write_float(5,1); + + if (btnUp.held()) { - case 1: -// FIS_WRITE_line1="AUDI"; -// FIS_WRITE_line2="QUATTRO"; - fisWriter.sendString("AUDI", "QUATTRO"); - break; - - case 2: - if (currAddr != ADR_Engine) - { - connect(ADR_Engine, ADR_Engine_Speed); - } - else - { - readSensors(4); - } -fisWriter.sendString("COOL:"+ String(coolantTemp), "AIR:"+ String(intakeAirTemp)); -// FIS_WRITE_line1="COOL:"+ String(coolantTemp); -// FIS_WRITE_line2="AIR:"+ String(intakeAirTemp); + fullDash = !fullDash; + countLoop = 1; + fisWriter.reset(); + } - - //fisWriter.sendMsgFS(0,0,0x00,6,"LINE 1"); // 0x00 - standard font, negative, left aligned - //fisWriter.sendMsgFS(0,8,0x01,6, 'coolantTemp'); // 0x01 - standard font, positive, left aligned -// fisWriter.sendMsgFS(0,24,0x05,6, line4); // 0x05 - compressed font, positive, left-aligned -// fisWriter.sendMsgFS(0,16,0x04,6,"LINE 3"); // 0x04 - compressed font, negative, left aligned -// fisWriter.sendMsgFS(0,24,0x05,6, intakeAirTemp); // 0x05 - compressed font, positive, left-aligned -// fisWriter.sendMsgFS(0,32,0x08,6,"LINE 5"); // 0x08 - special characters, negative, left aligned -// fisWriter.sendMsgFS(0,40,0x09,6,"LINE 6"); // 0x09 - special characters, positive, left aligned -// fisWriter.sendMsgFS(0,48,0x20,6,"LINE 7"); // 0x20 - standard font, negative, centered -// fisWriter.sendMsgFS(0,56,0x21,6,"LINE 8"); // 0x21 - standard font, positive, centered -// fisWriter.sendMsgFS(0,64,0x24,6,"LINE 9"); // 0x24 - compressed font, negative, centered -// fisWriter.sendMsgFS(0,72,0x25,13,"1234567891011"); // 0x25 - compressed font, positive, centered -// fisWriter.sendMsgFS(0,80,0x28,13,"1234567891011"); // 0x28 - special characters, positive, centered - - break; - - case 3: - if (currAddr != ADR_Engine) - { - connect(ADR_Engine, ADR_Engine_Speed); - } - else + if (!fullDash) + { + if (btnUp.hasClicks(1)) { - readSensors(115); + currPage++; + if (currPage > 9) + currPage = 1; + eeprom_update_byte(0, currPage); } -fisWriter.sendString("BOOST:", String(turboPress)); -// FIS_WRITE_line1="BOOST:"; -// FIS_WRITE_line2= String(turboPress); - break; - case 4: - if (currAddr != ADR_Engine) - { - connect(ADR_Engine, ADR_Engine_Speed); - } - else - { - readSensors(2); - } -fisWriter.sendString("INJ:"+ String(injektTime), "MAF:"+ String(MAF)); -// FIS_WRITE_line1="INJ:"+ String(injektTime); -// FIS_WRITE_line2="MAF:"+ String(MAF); - break; - case 5: - if (currAddr != ADR_Engine) + if (btnUp.hasClicks(2)) { - connect(ADR_Engine, ADR_Engine_Speed); - } - else - { - readSensors(5); - } -fisWriter.sendString("RPM:"+ String(engineSpeed), "SPD:"+ String(vehicleSpeed)); -// FIS_WRITE_line1="RPM:"+ String(engineSpeed); -// FIS_WRITE_line2="SPD:"+ String(vehicleSpeed); - break; - case 6: - if (currAddr != ADR_Engine) - { - connect(ADR_Engine, ADR_Engine_Speed); - } - else - { - readSensors(20); + currPage--; + if (currPage < 1) + currPage = 9; + eeprom_update_byte(0, currPage); } - fisWriter.sendString("RETARDS:", String(param0)+":"+String(param1)+":"+String(param2)+":"+String(param3)); -// FIS_WRITE_line1="RETARDS:"; -// FIS_WRITE_line2=String(param0)+":"+String(param1)+":"+String(param2)+":"+String(param3); - break; - case 7: - if (currAddr != ADR_Engine) + switch (currPage) { - connect(ADR_Engine, ADR_Engine_Speed); - } - else - { - readSensors(115); - } - if(turboPressCount>6){ + case 1: + fisWriter.sendString("AUDI", "QUATTRO"); + break; + + case 2: + getECUSensor(4); + fisWriter.sendString("COOL:" + String(coolantTemp), "AIR:" + String(intakeAirTemp)); + break; + + case 3: + getECUSensor(115); + fisWriter.sendString("BOOST:", String(turboPress)); + break; + case 4: + getECUSensor(2); + fisWriter.sendString("INJ:" + String(injektTime), "MAF:" + String(MAF)); + break; + case 5: + getECUSensor(5); + fisWriter.sendString("RPM:" + String(engineSpeed), "SPD:" + String(vehicleSpeed)); + break; + case 6: + getECUSensor(20); + fisWriter.sendString("RETARDS:", String(param0) + ":" + String(param1) + ":" + String(param2) + ":" + String(param3)); + break; + + case 7: + getECUSensor(115); + if (turboPressCount > 6) + { turboPressCount = 0; turboPressMax = 0; } - if(turboPress.toFloat()>turboPressMax){ + if (turboPress.toFloat() > turboPressMax) + { turboPressMax = turboPress.toFloat(); turboPressCount = 0; } turboPressCount++; -fisWriter.sendString(String(turboPressMax), String(turboPress)); -// FIS_WRITE_line1=String(turboPressMax); -// FIS_WRITE_line2= String(turboPress); - - break; - case 9: -if (currAddr != ADR_Dashboard) - { - // disconnect(); - connect(ADR_Dashboard, ADR_Dashboard_Speed); - } - else - { - readSensors(2); - //readSensors(50); - } - fisWriter.sendString("FUEL:", String(fuelLevel)); - -// FIS_WRITE_line1="FUEL:"; -// FIS_WRITE_line2=String(fuelLevel); - break; + fisWriter.sendString(String(turboPressMax), String(turboPress)); + break; case 8: - if (currAddr != ADR_Engine) - { - if(SaveL100Flag){ - // eeprom_update_dword(1, ix); - // eeprom_update_float(5,L100tmp); - SaveL100Flag = false; - } - connect(ADR_Engine, ADR_Engine_Speed); - } - else - { - readSensors(2); - readSensors(5); - if(engineSpeed>0){ - Lhour = (float)engineSpeed * (float)injektTime * float(0.0004478); - LhourAVGtmp = LhourAVGtmp+Lhour; - LhourAVG = LhourAVGtmp/ix; - vehicleSpeedAVGtmp = vehicleSpeedAVGtmp+vehicleSpeed; - vehicleSpeedAVG = vehicleSpeedAVGtmp / ix; - L100AVG= (float)LhourAVG * (float)108.0 / (float)vehicleSpeedAVG; - ix++; + if (currAddr != ADR_Engine) + { + if (SaveL100Flag) + { + // eeprom_update_dword(1, ix); + // eeprom_update_float(5,L100tmp); + SaveL100Flag = false; + } + connect(ADR_Engine, ADR_Engine_Speed); } + else + { + readSensors(2); + readSensors(5); + if (engineSpeed > 0) + { + Lhour = (float)engineSpeed * (float)injektTime * float(0.0004478); + LhourAVGtmp = LhourAVGtmp + Lhour; + LhourAVG = LhourAVGtmp / ix; + vehicleSpeedAVGtmp = vehicleSpeedAVGtmp + vehicleSpeed; + vehicleSpeedAVG = vehicleSpeedAVGtmp / ix; + L100AVG = (float)LhourAVG * (float)108.0 / (float)vehicleSpeedAVG; + ix++; + } SaveL100Flag = true; + } + fisWriter.sendString(String(vehicleSpeedAVG) + "K", String(L100AVG) + "L"); + break; + case 9: + getDashboardSensor(2); + fisWriter.sendString("FUEL:", String(fuelLevel)); + break; } - fisWriter.sendString(String(vehicleSpeedAVG)+"K", String(L100AVG)+"L"); -// FIS_WRITE_line1=String(vehicleSpeedAVG)+"K"; -// FIS_WRITE_line2=String(L100AVG)+"L"; - break; - - - case 17: - if (currAddr != ADR_Dashboard) - { - // disconnect(); - connect(ADR_Dashboard, ADR_Dashboard_Speed); - } - else - { - readSensors(2); - //readSensors(50); - } -// FIS_WRITE_line1="FUEL:"; -// FIS_WRITE_line2=String(fuelLevel); - break; - case 18: - if (currAddr != ADR_Dashboard) - { - // disconnect(); - connect(ADR_Dashboard, ADR_Dashboard_Speed); - } - else - { - //readSensors(2); - readSensors(50); - } -// FIS_WRITE_line1="COOL:"; -// FIS_WRITE_line2=String(coolantTemp); - break; } - } else { - if (btnUp.hasClicks(1)){ - readVagGroup++; - } - - if (btnUp.hasClicks(2)){ - readVagGroup--; - } - - if (btnUp.hasClicks(3)){ - readVagGroup = readVagGroup+10; - } - - if (currAddr != ADR_Dashboard) - { - // disconnect(); - connect(ADR_Dashboard, ADR_Dashboard_Speed); - readSensors(1); - readSensors(2); - readSensors(50); - } - else + else + { + if (btnUp.hasClicks(1)) { - // readSensors(readVagGroup); - if(countLoop==20){ - readSensors(1); - readSensors(2); - readSensors(50); - countLoop = 1; - //fisWriter.radioDisplayBlank(); - } else{ - readSensors(1); - } - + readVagGroup++; } + if (btnUp.hasClicks(2)) + { + readVagGroup--; + } - fisWriter.initFullScreen(); - fisWriter.sendStringFS(32,36,0x21, String(vehicleSpeed)+" KM/H"); - fisWriter.sendStringFS(32,50,0x21, String(engineSpeed)+" RPM"); + if (btnUp.hasClicks(3)) + { + readVagGroup = readVagGroup + 10; + } + if (readVagGroup > 0) + { + getECUSensor(readVagGroup); + fisWriter.initFullScreen(); + fisWriter.sendStringFS(5, 3, 0x21, "ECU GROUP:"); + fisWriter.sendStringFS(5, 11, 0x21, String(readVagGroup)); + fisWriter.sendMsgFS(0, 17, 0x05, 13, "fffffffffffff"); + fisWriter.sendMsgFS(0, 18, 0x05, 13, "fffffffffffff"); + fisWriter.sendStringFS(5, 30, 0x21, String(param0)); + fisWriter.sendStringFS(5, 40, 0x21, String(param1)); + fisWriter.sendStringFS(5, 50, 0x21, String(param2)); + fisWriter.sendStringFS(5, 60, 0x21, String(param3)); + // fisWriter.GraphicFromArray(0, 75, 64, 88, oilicoMy, 1); + // fisWriter.GraphicFromArray(20, 75, 64, 88, oilico, 1); + // fisWriter.GraphicFromArray(40, 75, 64, 88, batteryicoMy, 1); + // fisWriter.GraphicFromArray(55, 75, 64, 88, batteryico, 1); + } + else + { - fisWriter.sendMsgFS(0,60,0x05,13, "fffffffffffff"); - fisWriter.sendMsgFS(0,17,0x05,13, "fffffffffffff"); + if (countLoop > 20) + { + getDashboardSensor(1); + getDashboardSensor(2); + getDashboardSensor(50); + countLoop = 1; + } + else + { + getDashboardSensor(1); + } - - fisWriter.sendStringFS(3,0,0x05, "FUEL:"); - fisWriter.sendStringFS(3,9,0x05, " "+String(fuelLevel)+"L"); - fisWriter.sendStringFS(43,0,0x25, " TEMP:"); + fisWriter.initFullScreen(); + fisWriter.sendStringFS(32, 36, 0x21, String(vehicleSpeed) + " KM/H"); + fisWriter.sendStringFS(32, 50, 0x21, String(engineSpeed) + " RPM"); - fisWriter.sendStringFS(43,9,0x25, " "+String(ambientTemperature)+"C"); - fisWriter.sendStringFS(3,71,0x05, "COOL:"); - fisWriter.sendStringFS(3,80,0x05, " "+String(coolantTemp)+"C"); - fisWriter.sendStringFS(43,71,0x25, " OIL:"); - fisWriter.sendStringFS(43,80,0x25, " "+String(oilTemp)+"C"); + fisWriter.sendMsgFS(0, 60, 0x05, 13, "fffffffffffff"); + fisWriter.sendMsgFS(0, 17, 0x05, 13, "fffffffffffff"); -// fisWriter.sendStringFS(5,60,0x21, String(param3)+""); - } + fisWriter.sendStringFS(3, 0, 0x05, "FUEL:"); + fisWriter.sendStringFS(3, 9, 0x05, " " + String(fuelLevel) + "L"); + fisWriter.sendStringFS(43, 0, 0x25, " TEMP:"); + fisWriter.sendStringFS(43, 9, 0x25, " " + String(ambientTemperature) + "C"); + fisWriter.sendStringFS(3, 71, 0x05, "COOL:"); + fisWriter.sendStringFS(3, 80, 0x05, " " + String(coolantTemp) + "C"); + fisWriter.sendStringFS(43, 71, 0x25, " OIL:"); + fisWriter.sendStringFS(43, 80, 0x25, " " + String(oilTemp) + "C"); + } -// -// case 1: -// switch (idx){ -// case 0: vehicleSpeed = v; break; -// case 1: engineSpeed = v; break; -// case 2: oilPressure = v; break; -// } -// break; -// case 2: -// switch (idx){ -// case 0: odometer = v; break; -// case 1: fuelLevel = v; break; -// case 3: ambientTemperature = v; break; -// } -// break; -// case 50: -// switch (idx){ -// case 1: engineSpeed = v; break; -// case 2: oilTemp = v; break; -// case 3: coolantTemp = v; break; -// -// -// - countLoop++; -// fisWriter.initFullScreen(); -// fisWriter.sendStringFS(0,24,0x05, (String)countLoop); // 0x05 - compressed font, positive, left-aligned + // fisWriter.sendStringFS(5,60,0x21, String(param3)+""); + } + countLoop++; + // fisWriter.initFullScreen(); + // fisWriter.sendStringFS(0,24,0x05, (String)countLoop); // 0x05 - compressed font, positive, left-aligned } \ No newline at end of file