From cd6b808b2346fc08e2d896b698a60613db203a49 Mon Sep 17 00:00:00 2001 From: Daniel Rieper Date: Sun, 14 Feb 2021 19:27:10 +0100 Subject: [PATCH] 5 Buttons , Build errors --- src/main.cpp | 27 ++++++++++++++++++++++++--- src/settings.h | 41 +++++++++++++++++++++++------------------ src/values.h | 4 ++-- 3 files changed, 49 insertions(+), 23 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5dd2728..2b755ad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -578,6 +578,16 @@ void doButtonActions(void) { case 3: doCmdAction(BUTTON_3_LONG); buttons[i].isPressed = false; + break; + + case 4: + doCmdAction(BUTTON_4_LONG); + buttons[i].isPressed = false; + break; + + case 5: + doCmdAction(BUTTON_5_LONG); + buttons[i].isPressed = false; break; } } else { @@ -601,6 +611,17 @@ void doButtonActions(void) { case 3: doCmdAction(BUTTON_3_SHORT); buttons[i].isPressed = false; + break; + + case 4: + doCmdAction(BUTTON_4_SHORT); + buttons[i].isPressed = false; + break; + + case 5: + doCmdAction(BUTTON_5_SHORT); + buttons[i].isPressed = false; + break; } } } @@ -2511,7 +2532,7 @@ void doRfidCardModifications(const uint32_t mod) { } #endif - doAction(mod); + doCmdAction(mod); } void doCmdAction(const uint32_t mod) { @@ -2903,10 +2924,10 @@ void doCmdAction(const uint32_t mod) { case CMD_NEXTTRACK: trackControlToQueueSender(NEXTTRACK); break; - case CMD_FIRSTRACK: + case CMD_FIRSTTRACK: trackControlToQueueSender(FIRSTTRACK); break; - case CMD_LASTRACK: + case CMD_LASTTRACK: trackControlToQueueSender(LASTTRACK); break; case CMD_VOLUMEINIT: diff --git a/src/settings.h b/src/settings.h index 5c9a34a..975e5dd 100644 --- a/src/settings.h +++ b/src/settings.h @@ -151,25 +151,30 @@ float voltageIndicatorHigh = 4.2; // Upper range for Neopixel- // Button Layout -#define BUTTON_MULTI_01 = TOGGLE_WIFI_STATUS -#define BUTTON_MULTI_02 = ENABLE_FTP_SERVER -#define BUTTON_MULTI_03 = CMD_NOTHING -#define BUTTON_MULTI_12 = CMD_MEASUREBATTERY -#define BUTTON_MULTI_13 = CMD_NOTHING -#define BUTTON_MULTI_23 = CMD_NOTHING - -#define BUTTON_0_SHORT = CMD_NEXTTRACK -#define BUTTON_1_SHORT = CMD_PREVTRACK -#define BUTTON_2_SHORT = CMD_PLAYPAUSE -#define BUTTON_3_SHORT = CMD_MEASUREBATTERY -#define BUTTON_3_LONG = CMD_SLEEPMODE +#define BUTTON_MULTI_01 TOGGLE_WIFI_STATUS +#define BUTTON_MULTI_02 ENABLE_FTP_SERVER +#define BUTTON_MULTI_03 CMD_NOTHING +#define BUTTON_MULTI_12 CMD_MEASUREBATTERY +#define BUTTON_MULTI_13 CMD_NOTHING +#define BUTTON_MULTI_23 CMD_NOTHING + +#define BUTTON_0_SHORT CMD_NEXTTRACK +#define BUTTON_1_SHORT CMD_PREVTRACK +#define BUTTON_2_SHORT CMD_PLAYPAUSE +#define BUTTON_3_SHORT CMD_MEASUREBATTERY +#define BUTTON_3_LONG CMD_SLEEPMODE + +#define BUTTON_4_SHORT CMD_VOLUMEDOWN +#define BUTTON_4_LONG CMD_VOLUMEDOWN +#define BUTTON_5_SHORT CMD_VOLUMEUP +#define BUTTON_5_LONG CMD_VOLUMEUP #ifdef USEROTARY_ENABLE - #define BUTTON_0_LONG = CMD_LASTTRACK - #define BUTTON_1_LONG = CMD_FIRSTTRACK - #define BUTTON_2_LONG = CMD_PLAYPAUSE + #define BUTTON_0_LONG CMD_LASTTRACK + #define BUTTON_1_LONG CMD_FIRSTTRACK + #define BUTTON_2_LONG CMD_PLAYPAUSE #else - #define BUTTON_0_LONG = CMD_VOLUMEDOWN - #define BUTTON_1_LONG = CMD_VOLUMEUP - #define BUTTON_2_LONG = CMD_SLEEPMODE + #define BUTTON_0_LONG CMD_VOLUMEDOWN + #define BUTTON_1_LONG CMD_VOLUMEUP + #define BUTTON_2_LONG CMD_SLEEPMODE #endif diff --git a/src/values.h b/src/values.h index f742961..7e37b20 100644 --- a/src/values.h +++ b/src/values.h @@ -47,9 +47,9 @@ #define CMD_PLAYPAUSE 170 // Admin-Cmd Play/Pause #define CMD_PREVTRACK 171 // Admin-Cmd Prev Track -#define CMD_NEXTTACK 172 // Admin-Cmd Next Track +#define CMD_NEXTTRACK 172 // Admin-Cmd Next Track #define CMD_FIRSTTRACK 173 // Admin-Cmd Prev Track -#define CMD_LASTTACK 174 // Admin-Cmd Next Track +#define CMD_LASTTRACK 174 // Admin-Cmd Next Track #define CMD_VOLUMEINIT 175 // Set Volume to Initial #define CMD_VOLUMEUP 176 // Set Volume up #define CMD_VOLUMEDOWN 177 // Set Volume down