From 49be7f117a24fb408528be3c15387c57231827fe Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Fri, 17 Jan 2025 18:00:32 +0100 Subject: [PATCH] Modify pad detectionfor OBP60 Light --- lib/obp60task/OBP60Keypad.h | 45 +++++++++++++++++------------- lib/obp60task/platformio.ini | 18 ++++++------ lib/obp60task/platformio.ini.light | 2 +- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/lib/obp60task/OBP60Keypad.h b/lib/obp60task/OBP60Keypad.h index 7ad6f9b..54935be 100644 --- a/lib/obp60task/OBP60Keypad.h +++ b/lib/obp60task/OBP60Keypad.h @@ -181,6 +181,29 @@ long starttime = 0; // Start time point for pressed key #endif #ifdef HARDWARE_LIGHT + int readSensorpads(){ + // Read key code + if(digitalRead(UP) == LOW){ + keycode = 10; // Left swipe + } + else if(digitalRead(DOWN) == LOW){ + keycode = 9; // Right swipe + } + else if(digitalRead(CONF) == LOW){ + keycode = 3; // Key 3 + } + else if(digitalRead(MENUE) == LOW){ + keycode = 1; // Key 1 + } + else if(digitalRead(EXIT) == LOW){ + keycode = 2; // Key 2 + } + else{ + keycode = 0; // No key activ + } + return keycode; + } + // Keypad functions for OBP60 clone (thSensitivity is inactiv) int readKeypad(uint thSensitivity) { pinMode(UP, INPUT); @@ -189,25 +212,8 @@ long starttime = 0; // Start time point for pressed key pinMode(MENUE, INPUT); pinMode(EXIT, INPUT); - // Read key code - if(digitalRead(UP) == LOW){ - keycode = 10; // Left swipe - } - else if(digitalRead(DOWN) == LOW){ - keycode = 9; // Right swipe - } - else if(digitalRead(CONF) == LOW){ - keycode = 3; // Key 3 - } - else if(digitalRead(MENUE) == LOW){ - keycode = 1; // Key 1 - } - else if(digitalRead(EXIT) == LOW){ - keycode = 2; // Key 2 - } - else{ - keycode = 0; // No key activ - } + // Raed pad values + readSensorpads(); // Detect key if (keycode > 0 ){ @@ -220,6 +226,7 @@ long starttime = 0; // Start time point for pressed key keystatus = keycode; // Copy keycode keycodeold = keycode; + while(readSensorpads() > 0){} // Wait for pad lesease delay(keydelay); } } diff --git a/lib/obp60task/platformio.ini b/lib/obp60task/platformio.ini index 4010a82..6d6ae65 100644 --- a/lib/obp60task/platformio.ini +++ b/lib/obp60task/platformio.ini @@ -9,10 +9,10 @@ board_build.variants_dir = variants #board = obp60_s3_n8 #ESP32-S3 N8, 8MB flash, no PSRAM #board = obp60_s3_n16 #ESP32-S3 N16,16MB flash, no PSRAM, zero series #board = obp60_s3_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM -board = obp60_s3_n16r8 #ESP32-S3 N16R8, 16MB flash, 8MB PSRAM, production series -#board = obp60_s3_light_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM, OBP60 clone -#board_build.partitions = default_8MB.csv #ESP32-S3 N8, 8MB flash -board_build.partitions = default_16MB.csv #ESP32-S3 N16, 16MB flash +#board = obp60_s3_n16r8 #ESP32-S3 N16R8, 16MB flash, 8MB PSRAM, production series +board = obp60_s3_light_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM, OBP60 clone +board_build.partitions = default_8MB.csv #ESP32-S3 N8, 8MB flash +#board_build.partitions = default_16MB.csv #ESP32-S3 N16, 16MB flash framework = arduino lib_deps = ${basedeps.lib_deps} @@ -40,22 +40,22 @@ lib_deps = build_flags= #https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL # -D ARDUINO_USB_MODE=1 #0=OTG (to implement other external devices), 1=CDC (is a serial device) -# -D ARDUINO_USB_CDC_ON_BOOT=1 #0=JTAG, 1=CDC (serial device) + -D ARDUINO_USB_CDC_ON_BOOT=0 #Serial output via RX/TX # -D CORE_DEBUG_LEVEL=1 #Debug level for CPU core via CDC (seral device) # -D TIME=$UNIX_TIME #Set PC time for RTC (only settable via VSC) -D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib -D BOARD_OBP60S3 #Board OBP60 V2.1 with ESP32S3 # -D HARDWARE_V20 #OBP60 hardware revision V2.0 - -D HARDWARE_V21 #OBP60 hardware revision V2.1 -# -D HARDWARE_LIGHT #OBP60 hardware clone +# -D HARDWARE_V21 #OBP60 hardware revision V2.1 + -D HARDWARE_LIGHT #OBP60 hardware clone # -D DISPLAY_GDEW042T2 #old E-Ink display from Waveshare, R10 0.47 ohm -D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm # -D DISPLAY_GYE042A87 #alternativ E-Ink display from Genyo Optical, R10 2.2 ohm # -D DISPLAY_SE0420NQ04 #alternativ E-Ink display from SID Technology, R10 2.2 ohm ${env.build_flags} #CONFIG_ESP_TASK_WDT_TIMEOUT_S = 10 #Task Watchdog timeout period (seconds) [1...60] 5 default -upload_port = /dev/ttyACM0 #OBP60 original -#upload_port = /dev/ttyUSB0 #OBP60 clone +#upload_port = /dev/ttyACM0 #OBP60 original +upload_port = /dev/ttyUSB0 #OBP60 clone upload_protocol = esptool #firmware upload via USB OTG seriell, by first upload need to set the ESP32-S3 in the upload mode with shortcut GND to Pin27 upload_speed = 230400 monitor_speed = 115200 diff --git a/lib/obp60task/platformio.ini.light b/lib/obp60task/platformio.ini.light index d11edcf..6d6ae65 100644 --- a/lib/obp60task/platformio.ini.light +++ b/lib/obp60task/platformio.ini.light @@ -40,7 +40,7 @@ lib_deps = build_flags= #https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL # -D ARDUINO_USB_MODE=1 #0=OTG (to implement other external devices), 1=CDC (is a serial device) -# -D ARDUINO_USB_CDC_ON_BOOT=1 #0=JTAG, 1=CDC (serial device) + -D ARDUINO_USB_CDC_ON_BOOT=0 #Serial output via RX/TX # -D CORE_DEBUG_LEVEL=1 #Debug level for CPU core via CDC (seral device) # -D TIME=$UNIX_TIME #Set PC time for RTC (only settable via VSC) -D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib