mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-15 23:13:07 +01:00
More work on system page
This commit is contained in:
@@ -60,7 +60,7 @@ void initKeys(CommonData &commonData) {
|
||||
|
||||
#ifdef HARDWARE_V21
|
||||
// Keypad functions for original OBP60 hardware
|
||||
int readKeypad(uint thSensitivity) {
|
||||
int readKeypad(GwLog* logger, uint thSensitivity) {
|
||||
|
||||
// Touch sensor values
|
||||
// 35000 - Not touched
|
||||
@@ -110,14 +110,14 @@ void initKeys(CommonData &commonData) {
|
||||
keypad[6] = 0;
|
||||
}
|
||||
// Nothing touched
|
||||
if(keypad[1] == 0 && keypad[2] == 0 && keypad[3] == 0 && keypad[4] == 0 && keypad[5] == 0 && keypad[6] == 0){
|
||||
/* if(keypad[1] == 0 && keypad[2] == 0 && keypad[3] == 0 && keypad[4] == 0 && keypad[5] == 0 && keypad[6] == 0){
|
||||
keypad[0] = 1;
|
||||
}
|
||||
else{
|
||||
keypad[0] = 0;
|
||||
}
|
||||
} */
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
for (int i = 1; i <= 6; i++) {
|
||||
if(i > 0){
|
||||
// Convert keypad to keycode
|
||||
if(keypad[i] == 1){
|
||||
@@ -141,15 +141,17 @@ void initKeys(CommonData &commonData) {
|
||||
}
|
||||
// Detect a very short keynumber (10ms)
|
||||
if (millis() > starttime + 10 && keycode == keycodeold && keylock == true) {
|
||||
logger->logDebug(GwLog::LOG,"Very short 20ms key touch: %d", keycode);
|
||||
|
||||
// Process only valid keys
|
||||
if(keycode == 1 || keycode == 6){
|
||||
//if(keycode == 1 || keycode == 6){
|
||||
keycode2 = keycode;
|
||||
}
|
||||
// Clear by unvalid keys
|
||||
else{
|
||||
keycode2 = 0;
|
||||
keycodeold2 = 0;
|
||||
}
|
||||
//}
|
||||
// Clear by invalid keys
|
||||
//else{
|
||||
// keycode2 = 0;
|
||||
// keycodeold2 = 0;
|
||||
//}
|
||||
}
|
||||
// Timeout for very short pressed key
|
||||
if(millis() > starttime + 200){
|
||||
@@ -157,6 +159,7 @@ void initKeys(CommonData &commonData) {
|
||||
}
|
||||
// Detect a short keynumber (200ms)
|
||||
if (keyoff == false && millis() > starttime + 200 && keycode == keycodeold && keylock == true) {
|
||||
logger->logDebug(GwLog::LOG,"Short 200ms key touch: %d", keycode);
|
||||
keystatus = keycode;
|
||||
keycode = 0;
|
||||
keycodeold = 0;
|
||||
@@ -170,11 +173,17 @@ void initKeys(CommonData &commonData) {
|
||||
|
||||
// System page with key 5 and 4 in fast series
|
||||
if (keycode2 == 5 && keycodeold2 == 4) {
|
||||
logger->logDebug(GwLog::LOG,"Keycode for system page");
|
||||
keycode = 0;
|
||||
keycodeold = 0;
|
||||
keycode2 = 0;
|
||||
keycodeold2 = 0;
|
||||
keystatus = 12;
|
||||
buzzer(TONE4, 50);
|
||||
delay(30);
|
||||
buzzer(TONE4, 50);
|
||||
delay(30);
|
||||
buzzer(TONE4, 50);
|
||||
}
|
||||
|
||||
// Key lock with key 1 and 6 or 6 and 1 in fast series
|
||||
@@ -252,7 +261,7 @@ void initKeys(CommonData &commonData) {
|
||||
}
|
||||
|
||||
// Keypad functions for OBP60 clone (thSensitivity is inactiv)
|
||||
int readKeypad(uint thSensitivity) {
|
||||
int readKeypad(GwLog* logger, uint thSensitivity) {
|
||||
pinMode(UP, INPUT);
|
||||
pinMode(DOWN, INPUT);
|
||||
pinMode(CONF, INPUT);
|
||||
|
||||
Reference in New Issue
Block a user