Merge pull request #26 from facelesstech/main

Fixed the double presses in the menu when using the card computer keyboard
This commit is contained in:
Noah Axon 2023-12-19 21:59:15 -06:00 committed by GitHub
commit 0c0dfe195d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 14 deletions

View File

@ -2,9 +2,9 @@
// github.com/n0xa | IG: @4x0nn
// -=-=-=-=-=-=- Uncomment the platform you're building for -=-=-=-=-=-=-
#define STICK_C_PLUS
//#define STICK_C_PLUS
//#define STICK_C
//#define CARDPUTER
#define CARDPUTER
// -=-=- Uncommenting more than one at a time will result in errors -=-=-
String buildver="2.0.2";
@ -149,14 +149,6 @@ void switcher_button_proc() {
}
}
#if defined(KB)
void check_kb(){
M5Cardputer.update();
if (M5Cardputer.Keyboard.isChange()) {
delay(100);
}
}
#endif
// Tap the power button from pretty much anywhere to get to the main menu
void check_menu_press() {
#if defined(AXP)
@ -174,14 +166,14 @@ void check_menu_press() {
bool check_next_press(){
#if defined(KB)
M5Cardputer.update();
if (M5Cardputer.Keyboard.isKeyPressed(';')){
// hack to handle the up arrow
cursor = cursor - 2;
check_kb();
return true;
}
M5Cardputer.update();
if (M5Cardputer.Keyboard.isKeyPressed(KEY_TAB) || M5Cardputer.Keyboard.isKeyPressed('.')){
check_kb();
return true;
}
#else
@ -194,6 +186,7 @@ bool check_next_press(){
bool check_select_press(){
#if defined(KB)
M5Cardputer.update();
if (M5Cardputer.Keyboard.isKeyPressed(KEY_ENTER) || M5Cardputer.Keyboard.isKeyPressed('/')){
return true;
@ -664,7 +657,6 @@ void sendAllCodes() {
}
#endif
#if defined(KB)
check_kb();
#endif
if (check_select_press()){
Serial.println("endingearly");
@ -1597,7 +1589,6 @@ void loop() {
screen_dim_proc();
#endif
#if defined(CARDPUTER)
check_kb();
#endif
check_menu_press();