clean: remove build date, config button indicator and all associated config menu logic
This commit is contained in:
parent
c8affde099
commit
6342a0ecfc
1 changed files with 4 additions and 39 deletions
|
|
@ -120,9 +120,6 @@ const uint32_t SLEEP_DURATION = 180 * 1000000; //180 sec
|
|||
String line[12] = { "", "", "", "", "", "", "", "", "", "", "", "" }; //buffer for each line in terminal function
|
||||
bool dim = false; //back light dim flag
|
||||
const uint8_t LIGHT_LEVEL = 40; //backlight control by light level Higher = darker light
|
||||
long holdtime = 0; //hold time for button pressed check
|
||||
const String compile_date = __DATE__ " - " __TIME__; //get built date and time
|
||||
bool press = false; // button press flag
|
||||
String serial_no = ""; //keep serial no.
|
||||
|
||||
|
||||
|
|
@ -228,8 +225,6 @@ void setup() {
|
|||
Serial.printf("Flash Size %d, Flash Speed %d\n", ESP.getFlashChipSize(), ESP.getFlashChipSpeed());
|
||||
Serial.println(F("\n---------------------------------------\n"));
|
||||
Serial.println(F("<< Va&Cob OBDII Gauge >>"));
|
||||
Serial.print(F("by Ratthanin W. BUILD -> "));
|
||||
Serial.println(compile_date);
|
||||
|
||||
|
||||
|
||||
|
|
@ -266,11 +261,6 @@ void setup() {
|
|||
tft.setTextColor(TFT_WHITE);
|
||||
tft.drawString("OBDII GAUGE", 10, 5, 2);
|
||||
ledcWrite(backlightChannel, 255); //full bright
|
||||
tft.setTextColor(TFT_WHITE, TFT_RED);
|
||||
tft.drawRightString(" Config button ->", 319, 26, 2);
|
||||
String txt = " BUILD : " + compile_date;
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLUE);
|
||||
tft.drawString(txt, 0, 26, 2);
|
||||
|
||||
// checkGenuine();//check guniune
|
||||
//init variable
|
||||
|
|
@ -310,17 +300,6 @@ recent_client_addr : {0x00,0x00,0x00,0x00,0x00,0x00} array of bytes[6]
|
|||
while (!foundOBD2) { //not success try scan and connect another OBD2
|
||||
scanBTdevice();
|
||||
autoDim(); //auto backlight handle
|
||||
|
||||
if (digitalRead(SELECTOR_PIN) == LOW) { //button pressed
|
||||
if (!press) {
|
||||
press = true; //set flag
|
||||
holdtime = millis(); //set timer
|
||||
} else if (holdtime - millis() > 500) { //press once and longer
|
||||
configMenu(); //open config menu
|
||||
press = false; //reset flag
|
||||
} //else if holdtimer > 30000
|
||||
delay(200); //delay avoid bounce
|
||||
}
|
||||
}
|
||||
|
||||
//Initialize ELM327
|
||||
|
|
@ -358,13 +337,11 @@ recent_client_addr : {0x00,0x00,0x00,0x00,0x00,0x00} array of bytes[6]
|
|||
void loop() {
|
||||
updateBacklightFade(); // non-blocking smooth backlight fade handler
|
||||
|
||||
// SCAN TOUCHSCREEN & BUTTON
|
||||
// SCAN TOUCHSCREEN
|
||||
// - Single click on a quadrant: toggles between clock (arc) and number
|
||||
// - Double click on a quadrant: puts that instrument in full screen (or exits full screen)
|
||||
// - Long press (> 1.2s): opens configuration menu
|
||||
uint16_t touchX = 0, touchY = 0;
|
||||
bool isTouched = getTouch(&touchX, &touchY);
|
||||
bool btnPressed = (digitalRead(SELECTOR_PIN) == LOW);
|
||||
|
||||
static bool isTouching = false;
|
||||
static uint32_t touchStartTime = 0;
|
||||
|
|
@ -372,31 +349,19 @@ void loop() {
|
|||
static uint8_t clickCount = 0;
|
||||
static uint32_t firstClickTime = 0;
|
||||
static int8_t clickQuadrant = -1;
|
||||
static bool longPressHandled = false;
|
||||
|
||||
if (isTouched || btnPressed) {
|
||||
if (isTouched) {
|
||||
if (!isTouching) {
|
||||
isTouching = true;
|
||||
touchStartTime = millis();
|
||||
lastTouchX = touchX;
|
||||
lastTouchY = touchY;
|
||||
longPressHandled = false;
|
||||
} else if (!longPressHandled && (millis() - touchStartTime > 1200)) {
|
||||
// Long press (> 1.2s): Open Config Menu!
|
||||
longPressHandled = true;
|
||||
clickCount = 0;
|
||||
ledcWriteTone(buzzerChannel, 3500);
|
||||
delay(40);
|
||||
ledcWriteTone(buzzerChannel, 0);
|
||||
configMenu();
|
||||
if (foundOBD2) initScreen();
|
||||
isTouching = false;
|
||||
}
|
||||
} else {
|
||||
// Touch / button released
|
||||
// Touch released
|
||||
if (isTouching) {
|
||||
isTouching = false;
|
||||
if (!longPressHandled && (millis() - touchStartTime >= 30)) {
|
||||
if (millis() - touchStartTime >= 30) {
|
||||
// Valid tap detected! Determine quadrant
|
||||
int quad = (lastTouchX < 160) ? ((lastTouchY < 120) ? 0 : 2) : ((lastTouchY < 120) ? 1 : 3);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue