From 98bbbf01091518235560f86672b1f196db28e47c Mon Sep 17 00:00:00 2001
From: Sebastian Nieto
Date: Mon, 7 Sep 2026 21:45:07 -0300
Subject: [PATCH] Eliminar show pids, cpu temp, dtcs, auto off, about y
firmware update con recursos asociados
---
sketch/obd2_gauge/config.h | 1112 ++--
sketch/obd2_gauge/elm327.h | 99 -
sketch/obd2_gauge/firmware_update.h | 326 --
sketch/obd2_gauge/image.h | 8094 ++++-----------------------
sketch/obd2_gauge/meter.h | 43 -
sketch/obd2_gauge/music.h | 126 -
sketch/obd2_gauge/nes_audio.cpp | 710 ---
sketch/obd2_gauge/nes_audio.h | 187 -
sketch/obd2_gauge/obd2_gauge.ino | 68 +-
9 files changed, 1503 insertions(+), 9262 deletions(-)
delete mode 100644 sketch/obd2_gauge/elm327.h
delete mode 100644 sketch/obd2_gauge/firmware_update.h
delete mode 100644 sketch/obd2_gauge/music.h
delete mode 100644 sketch/obd2_gauge/nes_audio.cpp
delete mode 100644 sketch/obd2_gauge/nes_audio.h
diff --git a/sketch/obd2_gauge/config.h b/sketch/obd2_gauge/config.h
index cc22e14..5118ba8 100644
--- a/sketch/obd2_gauge/config.h
+++ b/sketch/obd2_gauge/config.h
@@ -1,800 +1,312 @@
-/* "config.h"
-this header file is for configuration menu
-*/
-//freeRTOS multi tasking
-#include
-#include
-#include
-
-#include "music.h" //songs data
-#include "nes_audio.h" //nes audio player
-#include "firmware_update.h" //firmware updater function
-#include "elm327.h"// read VIN function
-
-#define mypic_filename "/mypic.jpg"//mypic file
-#define FORMAT_SPIFFS_IF_FAILED true//format if no spiffs
-
-
-Cartridge player(BUZZER_PIN);//not specified 4 pin , use 1 pin at buzzer pin
-
-//configuration menu
-const String menuList[8] = {
- "Show pid/s & CPU Temp",//toggle show system
- "Load my pic 320x240 px",//load user own pic
- "Update firmware",//update new firmware
- "Warning setting",//setting warning parameter (warning data, offset temp)
- "DTCs",//dtc engine
- "Auto-off",//auto turn off
- "About",//about
- "Exit"
- };
-const uint8_t maxMenu = array_length(menuList);//length of menu list
-
-//menu list for warning setting (CPU offset + 4 PIDs)
-const String parameterList[5][2] = {
- {"CPU Temp ("+String(tempOverheat)+"`c), offset"," `c "},
- {"- Refrigerante (ECT)"," `c "},
- {"- Revoluciones (RPM)"," rpm "},
- {"- Voltaje Bateria / PCM"," V "},
- {"- Velocidad (SPEED)"," km/h"}
- };
-
-//increasement and decreasement of each PID
-const int pidWarnStep[5] = {1, 1, 100, 1, 5};
-
-//Sprites
-TFT_eSprite car = TFT_eSprite(&tft);
-TFT_eSprite bk = TFT_eSprite(&tft);
-TFT_eSprite pole = TFT_eSprite(&tft);
-TFT_eSprite fence = TFT_eSprite(&tft);
-
-//------ NES Audio play on Task0
-TaskHandle_t TaskHandle0 = NULL;//create taskhandle0
-
-void TaskPlayMusic(void *pvParameters) {
- esp_task_wdt_init(62, false);//62 sec wd timer / disable wd
- while(1) {
- // player.frame_counter_cb(danceLight);//cal back fucntion (not use)
- player.play_nes(song , true, 0.25); //play nes music, loop, volume 0.25,
-
- }
-}
-//----------------------------
-void animation() {//start field effect
-//sprite variable
-#define BK_HEIGHT 80
-#define BK_WIDTH 235
- uint8_t cur_x = 68;
- uint8_t cur_y = 10;
- uint8_t dash_x = 20;
- int16_t tag_x = 235;
- int16_t fence_x = 0;
- uint8_t ani_speed = 2;
-
-//create spirtes
- bk.createSprite(BK_WIDTH,BK_HEIGHT);
-
- car.createSprite(CAR_WIDTH,CAR_HEIGHT);//image size 114x50
- car.setSwapBytes(true);
- car.pushImage(0,0,CAR_WIDTH,CAR_HEIGHT,futurecar);//image size 114x50
-
- pole.createSprite(POLE_WIDTH,POLE_HEIGHT);
- pole.setSwapBytes(true);
- pole.pushImage(0,0,POLE_WIDTH,POLE_HEIGHT,pole1);
-
- fence.createSprite(FENCE_WIDTH,FENCE_HEIGHT);
- fence.setSwapBytes(true);
- fence.pushImage(0,0,FENCE_WIDTH,FENCE_HEIGHT,fence1);
-//-------------------------------
- tft.fillScreen(TFT_BLACK);//clear screen
-//draw QRCode
- tft.drawBitmap(0, 159, qrcode, QRCODE_WIDTH, QRCODE_HEIGHT, TFT_WHITE);
-//draw text
- tft.setTextColor(TFT_WHITE);
- tft.drawString(">MAP/ENG LOAD/ECT/EOT/TFT/ENG SPD/PCM Volt",0,40,2);
- tft.drawString(">Warning, Automatic Dim/OnOff/O็verheat Shutdown",0,60,2);
- tft.drawString(">Read DTC Code & Clear MIL Status",0,80,2);
- tft.drawString("* FW-\"VaandCobOBD2Gauge.bin\" * Image-\"mypic.jpg\"",0,100,2);
- tft.drawString("* Facebook : www.facebook.com/vaandcob",0,120,2);
- tft.setTextColor(TFT_YELLOW);
- tft.drawString(" [ Manual ] ----------------[ Press button to exit ]",0,140,2);
- tft.setTextColor(TFT_CYAN);
- String txt = "[ "+serial_no+" ] BUILD : "+compile_date;
- tft.drawString(txt,0,0,2);
- //get VIN
- getPID("ATE0");//force echo off
- txt = "VIN : " + getVIN(getPID("0902"));
- tft.setTextColor(TFT_GREENYELLOW);
- tft.drawString(txt,0,20,2);
-
- bk.setTextColor(TFT_BLACK,TFT_ORANGE);
-//loop draw Animation
- while (digitalRead(SELECTOR_PIN) == HIGH && !isScreenPressed()) {//exit if press button or touch
-
- //draw road
- bk.fillSprite(0x4228);//draw road
- bk.fillRect(0,0,235,16,TFT_LIGHTGREY);
- bk.fillRect(0,16,235,3,0x8430);
-
- //draw dash line
- for(int16_t i = 0; i < 5; i++) {
- //speed //space //posY //length
- // bk.drawFastHLine(dash_x +(40 * i), 20,10,TFT_WHITE);//far end dash line
- bk.drawFastHLine((dash_x-20)*1.5+(60 * i),45,15,TFT_WHITE);//middle dash line
- // bk.drawFastHLine((dash_x-40)*2.0+(80 * i),79,20,TFT_WHITE);//nearest dash line
- }
- dash_x = dash_x - ani_speed;
- if (dash_x <= 0 ) dash_x = 40;
-
- //draw traffic
- tag_x = tag_x - ani_speed;
- if (tag_x <= -80) tag_x = 235;
- //bk.setTextColor(random(0xffff));
- bk.drawString("< Thank You >",tag_x,0,2);//draw billboard
-
- //draw car
- int8_t move = random(-1,2);
- cur_x = cur_x + move;
- move = random(-1,2);
- cur_y = cur_y + move;
- if (cur_x > 235-CAR_WIDTH) cur_x = 235-CAR_WIDTH;
- if (cur_x < 1) cur_x = 1;
- if (cur_y < 1) cur_y = 1;
- if (cur_y > 79-CAR_HEIGHT) cur_y = 79-CAR_HEIGHT;
- car.pushToSprite(&bk,cur_x,cur_y,TFT_BLACK);//put car into bk, white color as transparent
-
- //draw fence
- for(int i=0;i<8;i++)//7 sprites
- fence.pushToSprite(&bk,fence_x*2+(FENCE_WIDTH*i),80-FENCE_HEIGHT,TFT_BLACK);
- fence_x = fence_x - ani_speed;
- if (fence_x <= -FENCE_WIDTH + ani_speed) fence_x = 0;//loop back
-
- //draw pole
- pole.pushToSprite(&bk,tag_x*2,80-POLE_HEIGHT,TFT_BLACK);//draw bush
-
- //show background sprite
- bk.pushSprite(85,159);
- //led blinking effect
- digitalWrite(LED_RED_PIN, random(0,2));
- digitalWrite(LED_GREEN_PIN, random(0,2));
- digitalWrite(LED_BLUE_PIN, random(0,2));
- checkCPUTemp();
- autoDim();
- }
- //remove sprites
- car.deleteSprite();
- bk.deleteSprite();
- pole.deleteSprite();
- fence.deleteSprite();
-}//task star field
-
-/*------------------*/
-//highlight and change warning each menu
-void setWarning(int8_t index, int8_t change) {
- for (uint8_t i = 0;i max) tempOffset = max;
- }
- String result = String(tempOffset);
- switch (result.length()) {
- case 1: result = " " + result; break;
- case 2: result = " " + result; break;
- case 3: result = " " + result; break;
- }//switch
- tft.drawRightString(result,285,57+(index*16),2);//cpu offset
- } else {//other pid
-
- int min = pidConfig[index-1][4].toInt();//get min
- int max = pidConfig[index-1][5].toInt();//get max
- if (change == -1) {//decrease
- warningValue[index-1] = String(warningValue[index-1].toInt() - pidWarnStep[index]);
- if (warningValue[index-1].toInt() < min) warningValue[index-1] = String(min);
- }
- if (change == 1) {//increase
- warningValue[index-1] = String(warningValue[index-1].toInt() + pidWarnStep[index]);
- if (warningValue[index-1].toInt() > max) warningValue[index-1] = String(max);
- }
- String result = warningValue[index-1];
- switch (result.length()) {
- case 1: result = " " + result; break;
- case 2: result = " " + result; break;
- case 3: result = " " + result; break;
- }//switch
- tft.drawRightString(result,285,57+(index*16),2);//pid warning value
- } //if i = 0
- delay(300);//touch screen delay
-}
- /*--------------------*/
-void loadMyPic() {
- if(!SD.begin()) {//sdcard not attach
- tft.pushImage(129,44,60,60,sdcard);//show sdcard icon
- Serial.println(F("Micro SD Card not mounted!"));
- tft.setTextColor(TFT_WHITE,TFT_RED);
- tft.drawCentreString("Please insert Micro SD Card",159,120,4);
- } else {//sd card attached
- Serial.println(F("Micro SD Card..OK"));
- uint8_t cardType = SD.cardType();
- if (cardType == CARD_NONE) {//bad card
- Serial.println(F("Micro SD Card Error!"));
- tft.setTextColor(TFT_WHITE,TFT_RED);
- tft.drawCentreString("Micro SD Card Error!",159,120,4);
-
- } else {//good sd card attached
- if (!SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED)) {
- Serial.println(F("Error: SPIFFS failed!"));
- tft.setTextColor(TFT_WHITE,TFT_RED);
- tft.drawCentreString("Error: SPIFFS failed!",159,120,4);
-
- } else {
- tft.setTextColor(TFT_BLACK,TFT_GREEN);
- tft.drawCentreString("Copying...\"mypic.jpg\"",159,120,4);
- Serial.println(F("Deleting...\"mypic.jpg\""));
- SPIFFS.remove(mypic_filename);//remove old file first
- File sourceFile = SD.open(mypic_filename);
- if (sourceFile) {//found file
-
- File destFile = SPIFFS.open(mypic_filename, FILE_WRITE);
- Serial.println(F("Copying...\"mypic.jpg\""));
- tft.setTextColor(TFT_BLACK,TFT_GREEN);
- static uint8_t buf[512];
- while(sourceFile.read( buf, 512) ) {
- destFile.write( buf, 512 );//copy file from sdcard to spiffs
- }
- sourceFile.close();
- destFile.close();
- //load mypic.jpg from spiffs to show on screen
- show_spiffs_jpeg_image(mypic_filename, 0, 0);
-
- } else {
- Serial.println(F("\"mypic.jpg\" not found!"));
- tft.pushImage(130,44,60,60,nofile);//show fileicon
- tft.setTextColor(TFT_WHITE,TFT_RED);
- tft.drawCentreString("\"mypic.jpg\" not found!",159,120,4);
- }//if sourcefile
- }//if SPIFFS.begin
- }//else sccard errror
- }//else sdcard attach
- SD.end();
- SPIFFS.end();
- beep();
-}//loadmypic
-/*----------------*/
-
-void listMenu(uint8_t choice) {
- //draw icon
- if (showsystem) tft.pushImage(0,35,25,25,switchon);//switchon image
- else tft.pushImage(0,35,25,25,switchoff);//switchon image
- tft.pushImage(0,65,25,25,image);//image
- tft.pushImage(0,95,25,25,cpu);//firmware
- tft.pushImage(0,125,25,25,warning);//parameter
- tft.pushImage(0,155,25,25,engine);//engine
- tft.pushImage(159,155,25,25,autooff);//off
- tft.pushImage(0,185,25,25,about);//about
- tft.pushImage(159,185,25,25,quit);//exit
- for (uint8_t i=0;i= 30 && ty < 60) touchedOpt = 0;
- else if (ty >= 60 && ty < 90) touchedOpt = 1;
- else if (ty >= 90 && ty < 120) touchedOpt = 2;
- else if (ty >= 120 && ty < 150) touchedOpt = 3;
- else if (ty >= 150 && ty < 180) touchedOpt = (tx < 160) ? 4 : 5;
- else if (ty >= 180 && ty < 215) touchedOpt = (tx < 160) ? 6 : 7;
-
- if (touchedOpt >= 0) {
- select = touchedOpt;
- listMenu(select);
- clickSound();
- while (isScreenPressed()) {
- delay(10);
- yield();
- }
- delay(120);
- executeSelect = select;
- }
- } else if (digitalRead(SELECTOR_PIN) == LOW) {
- if (!pressed) {
- pressed = true;
- holdtimer = millis();
- } else if (millis() - holdtimer > 1500) {
- executeSelect = select;
- pressed = false;
- }
- } else {
- if (pressed) {
- if (millis() - holdtimer >= 40 && millis() - holdtimer <= 1500) {
- select++;
- if (select == maxMenu) select = 0;
- listMenu(select);
- clickSound();
- }
- pressed = false;
- delay(150);
- }
- }
-
- if (executeSelect >= 0) {
- select = executeSelect;
-//---------- TOGGLE SHOW SYSTEM STATUS -----------
- if (select == 0) {
- beepbeep();
- showsystem = !showsystem;//toggle
- tft.setTextColor(TFT_WHITE,TFT_BLUE);
- if (showsystem) tft.pushImage(0,35,25,25,switchon);//switchon image
- else tft.pushImage(0,35,25,25,switchoff);//switchon image
-
- }
-//--------- LOAD MY PIC -----------
- if (select == 1) {
- clickSound();
- tft.fillRect(0,30,320,239,TFT_BLACK);
- loadMyPic();//load pic from sdcard to spiffs
- tft.setTextColor(TFT_BLACK,TFT_WHITE);
- tft.drawCentreString("[- Tap screen or press button to exit -]",159,215,4);
- delay(400);
- while (digitalRead(SELECTOR_PIN) == HIGH && !isScreenPressed()) {
- //wait for button press or tap to exit
- checkCPUTemp();
- autoDim();
- yield();
- }//while
- while (isScreenPressed()) { delay(10); yield(); }
- clickSound();
- tft.fillScreen(TFT_BLACK);//clear screen
- tft.fillRectVGradient(0, 0, 320, 26, TFT_ORANGE, 0xfc00);
- tft.setTextColor(TFT_BLACK);
- tft.drawCentreString("[--- Configuration Menu ---]",159,0,4);
- listMenu(select);
- }
-
-//--------- UPDATE FIRMWARE -----------
- if (select == 2) {
- clickSound();
- tft.fillRect(0,30,320,239,TFT_BLACK);
- tft.pushImage(56,44,60,60,sdcard);//show sdcard icon
- tft.pushImage(203,44,60,60,wifi);//show wifi icon
- tft.setTextColor(TFT_CYAN,TFT_BLACK);
- tft.drawCentreString("Touch an icon to choose",159,125,4);
- tft.drawCentreString("firmware update method.",159,155,4);
- tft.setTextColor(TFT_BLACK,TFT_WHITE);
- tft.drawCentreString("[- Tap bottom to exit -]",159,215,4);
- delay(500);
- while (digitalRead(SELECTOR_PIN) == HIGH) {//wait for button press to exit
- autoDim();
- checkCPUTemp();
- //touching
- uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
- bool touched = getTouch(&t_x, &t_y);
- if (touched) {
- if ((t_y > 44) && (t_y < 104)) {
- if ((t_x >= 56) && (t_x < 116)) {
- clickSound();
- updateFirmwareSD();//update by sd card
- }
- if ((t_x >= 203) && (t_x < 263)) {
- clickSound();
- updateFirmwareWIFI();//update by wifi
- break;
- }
- } else if (t_y > 180) {
- break; // Tap exit
- }
- }
- delay(200);//touch screen delay
- yield();
- }//while
- while (isScreenPressed()) { delay(10); yield(); }
-
- tft.fillRect(0,30,320,210,TFT_BLACK);
- listMenu(select);
- }
-
-//------------ WARNING SETTING -----------
- if (select == 3) {
- int8_t warningMenuIndex = 0;//index for warning setting
- int8_t inc_dec = 0;//-1=decrease,0=no change, 1=increase
- clickSound();
- tft.fillRect(0,30,320,210,TFT_BLACK);
- tft.setTextColor(TFT_WHITE,TFT_BLACK);
- tft.drawCentreString("[ Warning Parameter Setting]",159,30,2);
- tft.drawFastHLine(0,50,320,TFT_RED);
- tft.setTextColor(TFT_WHITE,TFT_RED);
- tft.drawCentreString("[- Tap here or Press button to Save & Exit -]",159,190,2);
- for (uint8_t i = 0;i<5;i++) //draw buttons
- tft.fillRoundRect(i*64,211,60,30,5,TFT_NAVY);
- tft.setTextColor(TFT_WHITE);
- tft.drawCentreString("DEFAULT",31,217,2);//reset
- tft.drawCentreString("^ PREV",95,217,2);//prev
- tft.drawCentreString("NEXT v",159,217,2);//next
- tft.drawCentreString("-",223,206,6);//-
- tft.fillRect(286,219,3,16,TFT_WHITE);//+
- tft.fillRect(280,225,16,3,TFT_WHITE);//+
- setWarning(warningMenuIndex,inc_dec);//list menu first
- delay(500);
- while (digitalRead(SELECTOR_PIN) == HIGH) {//wait for button press to exit
- autoDim();
- checkCPUTemp();
- String status = "";
- if (foundOBD2) {//temperature read not working if not connect to bluetooh or
- status = " " +String(tempRead,1)+"`c";
- } else {
- status = "--.-`c";
- }
- tft.setTextColor(TFT_YELLOW,TFT_BLACK);
- tft.drawRightString(status.c_str(),319,30,2); //show cpu temp on top-right corner
- //touching
- uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
- bool touched = getTouch(&t_x, &t_y);
- if (touched && (t_y < 50 || (t_y >= 180 && t_y < 210))) break; // Touch top header or prompt to exit
- if (touched && (t_y >= 55 && t_y < 180)) {
- int8_t row = (t_y - 58) / 16;
- if (row >= 0 && row <= maxpidIndex) {
- warningMenuIndex = row;
- setWarning(warningMenuIndex, 0);
- clickSound();
- delay(150);
- }
- }
- if (touched && (t_y > 211)) {
- clickSound();
- #ifdef SERIAL_DEBUG
- Serial.printf("%d - %d\n",t_x,t_y);
- #endif
- if (t_x < 64) {//DEFAULT
- tempOffset = factoryTempOffset;//load default
- //read default warning value
- for (uint8_t i=0;i < maxpidIndex; i++) warningValue[i] = pidConfig[i][8];
- }
- if ((t_x >= 64) && (t_x <128)) warningMenuIndex--;//prev
- if ((t_x >= 128) && (t_x <192)) warningMenuIndex++;//next
- if ((t_x >= 192) && (t_x <256)) inc_dec = -1;//decrease
- if ((t_x >= 256) && (t_x <320)) inc_dec = 1;//increase
- if (warningMenuIndex == maxpidIndex+1) warningMenuIndex = 0;
- if (warningMenuIndex < 0) warningMenuIndex = maxpidIndex;
-
- setWarning(warningMenuIndex,inc_dec);//update list
- inc_dec = 0;//reset
-
- }//if touched
- }//while
- //exit and save warning data to preference
- pref.putInt("tempOffset",tempOffset);//save tempoffset
- for (uint8_t i=0;i < maxpidIndex; i++) {//save all pid
- pref.putString(pidConfig[i][0].c_str(),warningValue[i]);
- }
- tft.setTextColor(TFT_BLACK,TFT_GREEN);
- tft.drawCentreString("Parameters Saved.",159,120,4);
- beep();
- delay(1000);
- tft.fillRect(0,30,320,210,TFT_BLACK);
- listMenu(select);
- }
-
-//--------------- DTC -----------
- if (select == 4) {//https://www.elmelectronics.com/wp-content/uploads/2016/07/ELM327DS.pdf
-
- clickSound();
- tft.fillRect(0,30,320,239,TFT_BLACK);
- tft.pushImage(0,28,25,25,engine);//about
- tft.setTextColor(TFT_YELLOW,TFT_BLACK);
- tft.drawString("Diagnostic Trouble Codes",30,28,4);
- delay(500);
- getPID("ATE0");//force echo off
- //#1 get number of DTC & MIL status
- //getAB2("41 01 86 0E 88 88 41 01 81 0C 00 00 ","41","01");//(A = 80+1,80h=MIL ON,no of dtc = A-80h)
- uint8_t error_cnt = 0;
- uint8_t no_of_dtc = 0;
- A = 0xFF;//supoose error read A
- while ((A == 0xFF) && (error_cnt <3) ) {//if A == 0xFF repeat reading again (A must be 0x80+) try 3 times
- Serial.print(F("MIL Status 0101->"));
- getAB2(getPID("0101"),"41","01");//try read MIL status
- //Terminal(String(A).c_str(),0,88,320,125);
- error_cnt++;
- delay(100);
- }
-#ifdef TEST_DTC
-A = 0x86;
-#endif
-
- if (A == 0xFF) {//Error reading MIL status
- Serial.println(F("Error Reading MIL Status!"));
- tft.setTextColor(TFT_WHITE,TFT_RED);
- tft.drawCentreString("* Error Reading MIL Status! *",159,120,4);
- tft.setTextColor(TFT_LIGHTGREY,TFT_BLACK);
- tft.drawCentreString("[ Please try again ]",159,148,4);
- tft.setTextColor(TFT_BLACK,TFT_WHITE);
- tft.drawCentreString("[- Press button to exit -]",159,215,4);
- beep();
- } else {
- if (A == 0x00) {//41 01 00 = Mil is OFF No DTC
- tft.setTextColor(TFT_GREEN,TFT_BLACK);
- tft.drawCentreString("MIL is OFF - No DTC",159,120,4);
- tft.setTextColor(TFT_BLACK,TFT_WHITE);
- tft.drawCentreString("[- Press button to exit -]",159,215,4);
- } else if (A >= 0x80) {//41 01 8x if A =>80h then MIL status ON else skip to NO MIL below
- Serial.print(F("A = "));Serial.println(A,HEX);
- // #2 get Raw Diagnostic Troulbe Code from ELM327
- //(for 1 dtc)43 06 00 7D
- //(more than 1 dtc) 00E 0: 43 06 00 7D C6 93 1: 01 08 C6 0F 02 E9 02 e: E0 CC CC CC CC CC CC 43 01 C4 01
- uint8_t error_cnt = 0;
- String dtcRead = "";
-
- //check first header 43 or 00
- while ((dtcRead.substring(0,2) != "43") && (dtcRead.substring(0,2) != "00") && (error_cnt < 5)) {
- Serial.print(F("Read DTC 03->"));
- dtcRead = getPID("03");//try read DTC code
-#ifdef TEST_DTC
-dtcRead = "00E 0: 43 06 00 7D C6 93 1: 01 08 C6 0F 02 E9 02 2: E0 CC CC CC CC CC CC 43 01 C4 01";
-#endif
- //Terminal(dtcRead,0,88,320,125);
- error_cnt++;
- delay(100);
- }
- if (error_cnt >= 10) {//exist by error counter
- Serial.println(F("Error Reading DTCs!"));
- tft.setTextColor(TFT_WHITE,TFT_RED);
- tft.drawCentreString("* Error Reading DTCs! *",159,120,4);
- tft.setTextColor(TFT_LIGHTGREY,TFT_BLACK);
- tft.drawCentreString("[ Please try again ]",159,148,4);
- tft.setTextColor(TFT_BLACK,TFT_WHITE);
- tft.drawCentreString("[- Press button to exit -]",159,215,4);
- beep();
- } else {
- //#3 Interpret get the real DTC code 5 digits
- //(for 1 dtc)43 06 00 7D
- // 00E 0: <43 06> /00 7D /C6 93 /1: /01 08 /C6 0F /02 E9 /02 2: E0 /CC CC /CC CC /CC CC /<43 01>/C4 01
- beepbeep();
- int byteCount = 0;//keep number of data byte
- String hexcode[128];//4x16
- uint8_t StringCount = 0;
- dtcRead.trim();
- while (dtcRead.length() > 0) {//split to hex byte
- int index = dtcRead.indexOf(' ');
- String getByte = dtcRead.substring(0, index);//get first byte
- if (getByte.indexOf(':') == -1 ) {//no :
- if (getByte.length() >= 3) {
- byteCount = strtol(getByte.c_str(), NULL, 16);//get byte count = 14 byte
- Serial.print(byteCount);
- Serial.print(" = ");
- } else {//skip ':' byte
- hexcode[StringCount++] = getByte;//copy strings from 0 to space to hexcode
- Serial.print(getByte + ",");
- if (StringCount == byteCount) break;//stop when byte count reach, ignore the rest
- //4306007DC6930108C60F02E902E0 = 14 byte
- }
- }
- dtcRead = dtcRead.substring(index + 1);//copy the rest behind space to elm_rs
- }//while
-
- Serial.println(); //debug split hex byte
-
- //interpret DTC 007D=P007D C693=U0693 0108=P0108 C60F=U060F 02E9=P02E9 02E0=P02E0
- String dtcList[16] = {};//to keep all DTC in list
- no_of_dtc = 0;
- for (uint8_t index = 0;index < StringCount; index++) {
- if (hexcode[index] == "43") {//check if first nibble is 43
- index = index + 2;//skip 2 byte to next pid
- }
- String dtc_1 = hexcode[index];//C6
- uint8_t code = strtol(dtc_1.substring(0,1).c_str(),0,16);//0x0C compare with dtcMap table
- dtc_1 = dtcMap[code]+dtc_1.substring(1);//U0+6 = U06 change prefix,remove 1st char get the rest
- index++;
- String dtc_2 = hexcode[index];//0F
- dtcList[no_of_dtc] = dtc_1+dtc_2;//U060F
- Serial.print(dtcList[no_of_dtc] + ",");//got real DTC code here
- no_of_dtc++;//keep real no of dtc in no_of_dtc
- }//for
- tft.setTextColor(TFT_RED,TFT_BLACK);
- String txt = "MIL is ON - No of DTCs = "+String(no_of_dtc);
- tft.drawCentreString(txt,159,58,4);
- tft.drawFastHLine(0,85,320,TFT_WHITE);
- Serial.printf("\nNo of DTCs = %d\n",no_of_dtc);
-
- //#4 List all DTC on screen
- tft.setTextColor(TFT_WHITE,TFT_BLACK);
- for (uint8_t i=0;i0x80
- }//else if error_ent>5
-
- while (digitalRead(SELECTOR_PIN) == HIGH) { //wait for button press to exit
- checkCPUTemp();
- autoDim();
- uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
- bool touched = getTouch(&t_x, &t_y);
- if (touched) {
- if (no_of_dtc != 0 && (t_y > 215) && (t_x < 127)) {//touch clear MIL button
- clickSound();
- BTSerial.print("04\r");//clear MIL 04->7F 04 78 7F 04 78
- tft.setTextColor(TFT_BLACK,TFT_GREEN);
- tft.drawCentreString("* Successful Clear MIL *",159,120,4);
- Serial.println(F("* Successful Clear MIL *"));
- beepbeep();
- delay(3000);
- break;
- } else if (t_y > 200 || no_of_dtc == 0) {
- break; // Touch exit
- }
- }
- yield();
- }//while button exit
- while (isScreenPressed()) { delay(10); yield(); }
- tft.fillRect(0,28,320,239,TFT_BLACK);
- listMenu(select);
- }//select = 4
-//---------- Auto OFF Voltage -----------
- if (select == 5) {
- clickSound();
- tft.fillRect(0,30,320,210,TFT_BLACK);
- tft.pushImage(0,30,25,25,autooff);//about
- tft.setTextColor(TFT_WHITE,TFT_BLACK);
- tft.drawString("Gauge Auto-off Setting",40,30,4);
- tft.setTextColor(TFT_WHITE,TFT_BLACK);
- tft.drawString("Set detection PCM voltage to turn off gauge.",10,65,2);
- tft.drawString("If gauge turn off while the engnine is running",10,85,2);
- tft.drawString("Please lower down the voltage",10,105,2);
- tft.drawString("Volt",220,135,4);
- tft.setTextColor(TFT_BLACK,TFT_WHITE);
- tft.drawCentreString("[- Tap here or Press button to exit -]",159,180,4);
- for (uint8_t i = 0;i<5;i++) //draw buttons
- tft.fillRoundRect(i*64,211,60,30,5,TFT_NAVY);
- tft.setTextColor(TFT_WHITE);
- tft.drawCentreString("DEFAULT",31,217,2);//reset
- tft.drawCentreString("-",223,206,6);//-
- tft.fillRect(286,219,3,16,TFT_WHITE);//+
- tft.fillRect(280,225,16,3,TFT_WHITE);//+
- tft.setTextColor(TFT_YELLOW,TFT_BLACK);
- String result = String(ecu_off_volt, 1);
- tft.drawCentreString(result.c_str(),159,135,4);
- delay(500);
- while (digitalRead(SELECTOR_PIN) == HIGH) {//wait for button press to exit
- checkCPUTemp();
- autoDim();
- uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
- bool touched = getTouch(&t_x, &t_y);
- if (touched && (t_y < 50 || (t_y >= 165 && t_y < 210))) break; // Touch top or prompt to exit
- if (touched && (t_y > 211)) {
- clickSound();
- #ifdef SERIAL_DEBUG
- Serial.printf("%d - %d\n",t_x,t_y);
- #endif
- if (t_x < 64) {//DEFAULT
- ecu_off_volt = factoryECUOff;
- }
-
- if ((t_x >= 192) && (t_x <256)) {//decrease
- ecu_off_volt = ecu_off_volt - 0.1;
- if (ecu_off_volt <= 11.0) ecu_off_volt = 11.0;
- }
- if ((t_x >= 256) && (t_x <320)) {//increase
- ecu_off_volt = ecu_off_volt + 0.1;
- if (ecu_off_volt >= 15.0) ecu_off_volt = 15.0;
- }
- String result = String(ecu_off_volt, 1);
- tft.drawCentreString(result.c_str(),159,135,4);
- delay(300);//touch screen delay
- }//if touched
- yield();
- }//while
- while (isScreenPressed()) { delay(10); yield(); }
- //exit and save warning data to preference
- pref.putFloat("ecu_off_volt",ecu_off_volt);//save ecu_off_volt
-
- tft.setTextColor(TFT_BLACK,TFT_GREEN);
- tft.drawCentreString("Parameters Saved.",159,120,4);
- beep();
- delay(1000);
- tft.fillRect(0,30,320,210,TFT_BLACK);
- listMenu(select);
- }//select = 5
-
-//---------------------ABOUT-----------
- if (select == 6) {
- clickSound();
- delay(500);
- xTaskCreatePinnedToCore(
- &TaskPlayMusic
- , "play music in core 0" // A name just for humans
- , 4096// This stack size can be checked & adjusted by reading the Stack Highwater
- , NULL// no variable passting to task
- , 3 //Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
- , &TaskHandle0
- , 0);//core0
- animation();//play star field animation
- vTaskDelete(TaskHandle0);//stop animation and text animation
- pinMode(BUZZER_PIN,OUTPUT);//set pin mode again unless speaker stop working
- ledcAttachPin(BUZZER_PIN, buzzerChannel);//reattach buzzer pin
- clickSound();
- while (isScreenPressed()) { delay(10); yield(); }
- tft.fillScreen(TFT_BLACK);//clear screen
- tft.fillRectVGradient(0, 0, 320, 26, TFT_ORANGE, 0xfc00);
- tft.setTextColor(TFT_BLACK);
- tft.drawCentreString("[--- Configuration Menu ---]",159,0,4);
- listMenu(select);
- }//if (select ==6)
-//---------------------EXIT-----------
- if (select == 7) {
- clickSound();
- if (showsystem != currentFlag) {//save to eeprom only when flag changed
- pref.putBool("showsystem", showsystem);//save to NVR
- }
- break;//exist main config menu loop while
- }//select = 7
- pressed = false;
- prompt = true;//to trig reading elm again
- } //if (executeSelect >= 0)
- delay(40);
- } //while (true)
- tft.fillScreen(TFT_BLACK);//clear screen
-}//configMenu
+/* "config.h"
+Configuration menu for OBD2 Gauge
+*/
+#include
+#include
+#include
+
+#define mypic_filename "/mypic.jpg"
+#define FORMAT_SPIFFS_IF_FAILED true
+
+/*------------ SOUND EFFECTS ----------*/
+void beepbeep() {
+ ledcWriteTone(buzzerChannel, 2000);
+ delay(50);
+ ledcWriteTone(buzzerChannel, 0);
+ delay(50);
+ ledcWriteTone(buzzerChannel, 2000);
+ delay(50);
+ ledcWriteTone(buzzerChannel, 0);
+}
+
+void beep() {
+ ledcWriteTone(buzzerChannel, 2000);
+ delay(500);
+ ledcWriteTone(buzzerChannel, 0);
+}
+
+void clickSound() {
+ ledcWriteTone(buzzerChannel, 5000);
+ delay(5);
+ ledcWriteTone(buzzerChannel, 0);
+}
+
+// Configuration menu list
+const String menuList[3] = {
+ "Warning setting", // 0
+ "Load my pic 320x240 px", // 1
+ "Exit" // 2
+};
+const uint8_t maxMenu = 3;
+
+// Menu list for warning setting (4 vehicle gauges)
+const String parameterList[4][2] = {
+ {"- Refrigerante (ECT)", " `c "},
+ {"- Revoluciones (RPM)", " rpm "},
+ {"- Voltaje Bateria", " V "},
+ {"- Velocidad (SPEED)", " km/h"}
+};
+
+// Increments/decrements for each PID warning setting
+const int pidWarnStep[4] = {1, 100, 1, 5};
+
+// Highlight and change warning for each gauge
+void setWarning(int8_t index, int8_t change) {
+ for (uint8_t i = 0; i < 4; i++) {
+ tft.setTextColor(TFT_WHITE, TFT_BLACK);
+ tft.drawString(parameterList[i][0], 10, 60 + (i * 30), 4);
+ tft.drawRightString(parameterList[i][1], 310, 60 + (i * 30), 4);
+ String result = warningValue[i];
+ tft.drawRightString(result.c_str(), 230, 60 + (i * 30), 4);
+ }
+
+ if (index >= 0 && index < 4) {
+ int min = pidConfig[index][4].toInt();
+ int max = pidConfig[index][5].toInt();
+ int val = warningValue[index].toInt();
+ if (change == -1) {
+ val -= pidWarnStep[index];
+ if (val < min) val = min;
+ } else if (change == 1) {
+ val += pidWarnStep[index];
+ if (val > max) val = max;
+ }
+ warningValue[index] = String(val);
+
+ tft.setTextColor(TFT_BLACK, TFT_YELLOW); // highlight selected item
+ tft.drawString(parameterList[index][0], 10, 60 + (index * 30), 4);
+ tft.drawRightString(parameterList[index][1], 310, 60 + (index * 30), 4);
+ tft.drawRightString(warningValue[index].c_str(), 230, 60 + (index * 30), 4);
+ }
+ delay(150);
+}
+
+void loadMyPic() {
+ if (!SD.begin()) {
+ tft.pushImage(129, 44, 60, 60, sdcard);
+ Serial.println(F("Micro SD Card not mounted!"));
+ tft.setTextColor(TFT_WHITE, TFT_RED);
+ tft.drawCentreString("Please insert Micro SD Card", 159, 120, 4);
+ } else {
+ Serial.println(F("Micro SD Card..OK"));
+ uint8_t cardType = SD.cardType();
+ if (cardType == CARD_NONE) {
+ Serial.println(F("Micro SD Card Error!"));
+ tft.setTextColor(TFT_WHITE, TFT_RED);
+ tft.drawCentreString("Micro SD Card Error!", 159, 120, 4);
+ } else {
+ if (!SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED)) {
+ Serial.println(F("Error: SPIFFS failed!"));
+ tft.setTextColor(TFT_WHITE, TFT_RED);
+ tft.drawCentreString("Error: SPIFFS failed!", 159, 120, 4);
+ } else {
+ File sourceFile = SD.open(mypic_filename);
+ if (sourceFile) {
+ File destFile = SPIFFS.open(mypic_filename, FILE_WRITE);
+ Serial.println(F("Copying...\"mypic.jpg\""));
+ tft.setTextColor(TFT_BLACK, TFT_GREEN);
+ static uint8_t buf[512];
+ while (sourceFile.read(buf, 512)) {
+ destFile.write(buf, 512);
+ }
+ sourceFile.close();
+ destFile.close();
+ show_spiffs_jpeg_image(mypic_filename, 0, 0);
+ } else {
+ Serial.println(F("\"mypic.jpg\" not found!"));
+ tft.pushImage(130, 44, 60, 60, nofile);
+ tft.setTextColor(TFT_WHITE, TFT_RED);
+ tft.drawCentreString("\"mypic.jpg\" not found!", 159, 120, 4);
+ }
+ }
+ }
+ }
+ SD.end();
+ SPIFFS.end();
+ beep();
+}
+
+void listMenu(uint8_t choice) {
+ tft.fillRect(0, 30, 320, 180, TFT_BLACK);
+ tft.pushImage(15, 45, 25, 25, warning); // Warning setting icon
+ tft.pushImage(15, 95, 25, 25, image); // Load my pic icon
+ tft.pushImage(15, 145, 25, 25, quit); // Exit icon
+
+ for (uint8_t i = 0; i < maxMenu; i++) {
+ if (choice == i) {
+ tft.setTextColor(TFT_WHITE, TFT_BLUE);
+ } else {
+ tft.setTextColor(TFT_WHITE, TFT_BLACK);
+ }
+ tft.drawString(menuList[i], 50, 45 + 50 * i, 4);
+ }
+ tft.setTextColor(TFT_YELLOW, TFT_BLACK);
+ tft.drawCentreString("Tap option to select or use Button", 160, 215, 2);
+}
+
+void configMenu() {
+ uint8_t select = 0;
+ bool pressed = false;
+ long holdtimer = 0;
+ beep();
+ tft.fillScreen(TFT_BLACK);
+ tft.fillRectVGradient(0, 0, 320, 26, TFT_ORANGE, 0xfc00);
+ tft.setTextColor(TFT_BLACK);
+ tft.drawCentreString("[--- Configuration Menu ---]", 159, 0, 4);
+ listMenu(select);
+ delay(400);
+
+ while (true) {
+ autoDim();
+
+ int8_t executeSelect = -1;
+ uint16_t tx = 0, ty = 0;
+
+ if (getTouch(&tx, &ty)) {
+ int8_t touchedOpt = -1;
+ if (ty >= 35 && ty < 85) touchedOpt = 0;
+ else if (ty >= 85 && ty < 135) touchedOpt = 1;
+ else if (ty >= 135 && ty < 195) touchedOpt = 2;
+
+ if (touchedOpt >= 0) {
+ select = touchedOpt;
+ listMenu(select);
+ clickSound();
+ while (isScreenPressed()) {
+ delay(10);
+ yield();
+ }
+ delay(100);
+ executeSelect = select;
+ }
+ } else if (digitalRead(SELECTOR_PIN) == LOW) {
+ if (!pressed) {
+ pressed = true;
+ holdtimer = millis();
+ } else if (millis() - holdtimer > 1200) {
+ executeSelect = select;
+ pressed = false;
+ }
+ } else {
+ if (pressed) {
+ if (millis() - holdtimer >= 40 && millis() - holdtimer <= 1200) {
+ select++;
+ if (select >= maxMenu) select = 0;
+ listMenu(select);
+ clickSound();
+ }
+ pressed = false;
+ delay(150);
+ }
+ }
+
+ if (executeSelect >= 0) {
+ select = executeSelect;
+
+ // Option 0: Warning setting
+ if (select == 0) {
+ clickSound();
+ tft.fillRect(0, 30, 320, 210, TFT_BLACK);
+ int8_t warningMenuIndex = 0;
+ int8_t inc_dec = 0;
+ tft.setTextColor(TFT_WHITE, TFT_BLACK);
+ tft.drawCentreString("Warning Setting", 159, 32, 4);
+
+ for (uint8_t i = 0; i < 5; i++) {
+ tft.fillRoundRect(i * 64, 211, 60, 30, 5, TFT_NAVY);
+ }
+ tft.setTextColor(TFT_WHITE);
+ tft.drawCentreString("DEFAULT", 31, 217, 2);
+ tft.drawCentreString("^ PREV", 95, 217, 2);
+ tft.drawCentreString("NEXT v", 159, 217, 2);
+ tft.drawCentreString("-", 223, 206, 6);
+ tft.fillRect(286, 219, 3, 16, TFT_WHITE);
+ tft.fillRect(280, 225, 16, 3, TFT_WHITE);
+
+ setWarning(warningMenuIndex, inc_dec);
+ delay(400);
+
+ while (digitalRead(SELECTOR_PIN) == HIGH) {
+ autoDim();
+ uint16_t t_x = 0, t_y = 0;
+ bool touched = getTouch(&t_x, &t_y);
+ if (touched && (t_y < 50 || (t_y >= 180 && t_y < 210))) break;
+ if (touched && (t_y >= 55 && t_y < 180)) {
+ int8_t row = (t_y - 60) / 30;
+ if (row >= 0 && row < 4) {
+ warningMenuIndex = row;
+ setWarning(warningMenuIndex, 0);
+ clickSound();
+ delay(150);
+ }
+ }
+ if (touched && (t_y > 211)) {
+ clickSound();
+ if (t_x < 64) { // DEFAULT
+ for (uint8_t i = 0; i < 4; i++) {
+ warningValue[i] = pidConfig[i][8];
+ }
+ }
+ if ((t_x >= 64) && (t_x < 128)) warningMenuIndex--;
+ if ((t_x >= 128) && (t_x < 192)) warningMenuIndex++;
+ if ((t_x >= 192) && (t_x < 256)) inc_dec = -1;
+ if ((t_x >= 256) && (t_x < 320)) inc_dec = 1;
+ if (warningMenuIndex >= 4) warningMenuIndex = 0;
+ if (warningMenuIndex < 0) warningMenuIndex = 3;
+
+ setWarning(warningMenuIndex, inc_dec);
+ inc_dec = 0;
+ }
+ yield();
+ }
+ while (isScreenPressed()) { delay(10); yield(); }
+
+ // Save warning values
+ for (uint8_t i = 0; i < 4; i++) {
+ pref.putString(pidConfig[i][0].c_str(), warningValue[i]);
+ }
+ tft.setTextColor(TFT_BLACK, TFT_GREEN);
+ tft.drawCentreString("Parameters Saved.", 159, 120, 4);
+ beep();
+ delay(1000);
+ tft.fillScreen(TFT_BLACK);
+ tft.fillRectVGradient(0, 0, 320, 26, TFT_ORANGE, 0xfc00);
+ tft.setTextColor(TFT_BLACK);
+ tft.drawCentreString("[--- Configuration Menu ---]", 159, 0, 4);
+ listMenu(select);
+ }
+
+ // Option 1: Load my pic
+ else if (select == 1) {
+ clickSound();
+ tft.fillRect(0, 30, 320, 239, TFT_BLACK);
+ loadMyPic();
+ tft.setTextColor(TFT_BLACK, TFT_WHITE);
+ tft.drawCentreString("[- Tap screen or press button to exit -]", 159, 215, 4);
+ delay(400);
+ while (digitalRead(SELECTOR_PIN) == HIGH && !isScreenPressed()) {
+ autoDim();
+ yield();
+ }
+ while (isScreenPressed()) { delay(10); yield(); }
+ clickSound();
+ tft.fillScreen(TFT_BLACK);
+ tft.fillRectVGradient(0, 0, 320, 26, TFT_ORANGE, 0xfc00);
+ tft.setTextColor(TFT_BLACK);
+ tft.drawCentreString("[--- Configuration Menu ---]", 159, 0, 4);
+ listMenu(select);
+ }
+
+ // Option 2: Exit
+ else if (select == 2) {
+ clickSound();
+ break;
+ }
+
+ pressed = false;
+ prompt = true;
+ }
+ delay(30);
+ }
+ tft.fillScreen(TFT_BLACK);
+}
diff --git a/sketch/obd2_gauge/elm327.h b/sketch/obd2_gauge/elm327.h
deleted file mode 100644
index 10305e5..0000000
--- a/sketch/obd2_gauge/elm327.h
+++ /dev/null
@@ -1,99 +0,0 @@
-//elm327 interpreter
-
-//DTC prefex code mapping
-const String dtcMap[16] = {"P0","P1","P2","P3","C0","C1","C2","C3","B0","B1","B2","B3","U0","U1","U2","U3"};
-
-//get A B from response return in global A B variable
-void getAB2(String elm_rsp,String mode,String para) { //41 05 2A 3C 01>
- elm_rsp.trim();
- String hexcode[16];
- uint8_t StringCount = 0;
- while (elm_rsp.length() > 0) {//keep reading each char
- int index = elm_rsp.indexOf(' ');//check space
- if (index == -1) // No space found
- { //only data without space is now in hexcode {41,05,aa,bb}
- hexcode[StringCount++] = elm_rsp; //last byte
- //for (index=0;index0) {//clear rx buffer
- BTSerial.read();
- }
- String bt_response = "";
- BTSerial.print(pid+"\r");//get no of dtc
- delay(500);//wait for response
- while (BTSerial.available()>0) {//reading Bluetooth
- char incomingChar = BTSerial.read();
- //check CR/NL
- if (incomingChar == '>') {
- Serial.println(bt_response);
- BTSerial.flush();
- } else {
- bt_response.concat(incomingChar);//keep elm327 respond
- }
- } //while BTSerial
- return bt_response;
-}
-/*------------------*/
-/* VIN reading
-String resp = "014
-0: 49 02 01 4D 50 42
-1: 41 4D 46 30 36 30 4E
-2: 58 34 33 37 30 39 33 "; */
-//convert ascii code to Charactor
-const char asciiTable[0x60]= " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}`";
-char HextoChar(uint8_t asciiCode) {
- if ((asciiCode > 0x20) && (asciiCode < 0x80)) {
- return(asciiTable[asciiCode-32]);
- }
- else return '\0';//null-terminator
-}
-//----------------------------
-//function get VIN Serial.println(getVIN(getPID(0902)));
-String getVIN(String elm_rsp) {
- String VIN = "";
- uint8_t byteCount = 0;
- elm_rsp.trim();
- while (elm_rsp.length() > 0) {//keep reading each char
- int index = elm_rsp.indexOf(' ');//check space
- String getByte = elm_rsp.substring(0, index);//get first byte
- if (index == -1) {//no space found
- byte ascii = strtol(getByte.c_str(), NULL, 16);//read ascii
- VIN.concat(HextoChar(ascii));//last char
- //check correct VIN
- if (VIN.length() == byteCount) {
- VIN = VIN.substring(3);//remove first 3 string
- Serial.println("VIN: " + VIN);
- return VIN;//return VIN number
- } else {
- return "Cannot read VIN";
- }
-
- } else {//found space
- if (getByte.indexOf(':') == -1 ) {
- if (getByte.length() >= 3) {
- byteCount = strtol(getByte.c_str(), NULL, 16);//get byte count
- } else {//skip ':' byte
- byte ascii = strtol(getByte.c_str(), NULL, 16);//read ascii
- VIN.concat(HextoChar(ascii));//convert to hex charactor
- }
- }
- elm_rsp = elm_rsp.substring(index + 1);//copy the rest behind space to elm_rsp.
- }//else
- } //while
- return "Cannot read VIN";
-}//getVIN
-//----------------------------
-
diff --git a/sketch/obd2_gauge/firmware_update.h b/sketch/obd2_gauge/firmware_update.h
deleted file mode 100644
index 7898913..0000000
--- a/sketch/obd2_gauge/firmware_update.h
+++ /dev/null
@@ -1,326 +0,0 @@
-//Firmware updater library
-#include //ota partition boot option
-#include // main updater
-#include // File System
-#include // SD Card ESP32
-#include //safe file
-
-//Wifi updater
-#include //wifi
-#include
-
-const char* ssid = "Va&Cob OBD2 Gauge";
-const char* password = "12345678";//default password
-IPAddress local_IP(192, 168, 4,1);
-IPAddress gateway(192, 168, 4, 1);
-IPAddress subnet(255, 255, 255, 0);
-WebServer server(80);
-
-#define firmware_filename "/VaAndCobOBD2Gauge.bin"//firmware file
-
-
-/*------------ SOUND EFFECT ----------*/
- void beepbeep() { //2 shot beep
- ledcWriteTone(buzzerChannel,2000);
- delay(50);
- ledcWriteTone(buzzerChannel,0);
- delay(50);
- ledcWriteTone(buzzerChannel,2000);
- delay(50);
- ledcWriteTone(buzzerChannel,0);
- }
- void beep() {
- ledcWriteTone(buzzerChannel,2000);
- delay(500);
- ledcWriteTone(buzzerChannel,0);
- }
- void clickSound() {
- ledcWriteTone(buzzerChannel,5000);
- delay(5);
- ledcWriteTone(buzzerChannel,0);
- }
- /*-----------------------------*/
-//html update file
-static const char uploadIndex[] PROGMEM =
-R"(
-
-
-
-
-
-
-Please choose file 'vaandcobobd2gauge.bin'
-
-
-
-
0%
-
-
-
-