Rename define MAX_TOUCH_BUTTONS

This commit is contained in:
Theo Arends 2021-01-20 15:12:41 +01:00
parent 14788a4e74
commit 398e29d7cf
3 changed files with 10 additions and 10 deletions

View File

@ -89,7 +89,7 @@
#define USE_DISPLAY #define USE_DISPLAY
#define USE_DISPLAY_ILI9342 #define USE_DISPLAY_ILI9342
#define USE_TOUCH_BUTTONS #define USE_TOUCH_BUTTONS
#define MAXBUTTONS 16 #define MAX_TOUCH_BUTTONS 16
#define JPEG_PICTS #define JPEG_PICTS
#define USE_FT5206 #define USE_FT5206
#define USE_MPU6886 #define USE_MPU6886

View File

@ -300,7 +300,7 @@ extern FS *ufsp;
#ifdef USE_DISPLAY #ifdef USE_DISPLAY
#ifdef USE_TOUCH_BUTTONS #ifdef USE_TOUCH_BUTTONS
#include <renderer.h> #include <renderer.h>
extern VButton *buttons[MAXBUTTONS]; extern VButton *buttons[MAX_TOUCH_BUTTONS];
#endif #endif
#endif #endif
@ -3044,7 +3044,7 @@ chknext:
if (!strncmp(vname, "tbut[", 5)) { if (!strncmp(vname, "tbut[", 5)) {
GetNumericArgument(vname + 5, OPER_EQU, &fvar, 0); GetNumericArgument(vname + 5, OPER_EQU, &fvar, 0);
uint8_t index = fvar; uint8_t index = fvar;
if (index<1 || index>MAXBUTTONS) index = 1; if (index<1 || index>MAX_TOUCH_BUTTONS) index = 1;
index--; index--;
if (buttons[index]) { if (buttons[index]) {
fvar = buttons[index]->vpower.on_off; fvar = buttons[index]->vpower.on_off;

View File

@ -28,12 +28,12 @@ Renderer *renderer;
enum ColorType { COLOR_BW, COLOR_COLOR }; enum ColorType { COLOR_BW, COLOR_COLOR };
#ifndef MAXBUTTONS #ifndef MAX_TOUCH_BUTTONS
#define MAXBUTTONS 16 #define MAX_TOUCH_BUTTONS 16
#endif #endif
#ifdef USE_TOUCH_BUTTONS #ifdef USE_TOUCH_BUTTONS
VButton *buttons[MAXBUTTONS]; VButton *buttons[MAX_TOUCH_BUTTONS];
#endif #endif
// drawing color is WHITE // drawing color is WHITE
@ -772,7 +772,7 @@ void DisplayText(void)
if (*cp=='d') dis=1; if (*cp=='d') dis=1;
cp++; cp++;
var=atoiv(cp,&num); var=atoiv(cp,&num);
num=num%MAXBUTTONS; num=num%MAX_TOUCH_BUTTONS;
cp+=var; cp+=var;
if (buttons[num]) { if (buttons[num]) {
buttons[num]->vpower.disable=dis; buttons[num]->vpower.disable=dis;
@ -791,7 +791,7 @@ void DisplayText(void)
cp+=var; cp+=var;
cp++; cp++;
uint8_t bflags=num>>8; uint8_t bflags=num>>8;
num=num%MAXBUTTONS; num=num%MAX_TOUCH_BUTTONS;
var=atoiv(cp,&gxp); var=atoiv(cp,&gxp);
cp+=var; cp+=var;
cp++; cp++;
@ -2188,7 +2188,7 @@ uint8_t vbutt=0;
//AddLog_P(LOG_LEVEL_INFO, PSTR("touch %d - %d"), pLoc.x, pLoc.y); //AddLog_P(LOG_LEVEL_INFO, PSTR("touch %d - %d"), pLoc.x, pLoc.y);
// now must compare with defined buttons // now must compare with defined buttons
for (uint8_t count=0; count<MAXBUTTONS; count++) { for (uint8_t count=0; count<MAX_TOUCH_BUTTONS; count++) {
if (buttons[count] && !buttons[count]->vpower.disable) { if (buttons[count] && !buttons[count]->vpower.disable) {
if (buttons[count]->contains(pLoc.x, pLoc.y)) { if (buttons[count]->contains(pLoc.x, pLoc.y)) {
// did hit // did hit
@ -2237,7 +2237,7 @@ uint8_t vbutt=0;
} }
} }
#endif #endif
for (uint8_t count=0; count<MAXBUTTONS; count++) { for (uint8_t count=0; count<MAX_TOUCH_BUTTONS; count++) {
if (buttons[count]) { if (buttons[count]) {
buttons[count]->press(false); buttons[count]->press(false);
if (buttons[count]->justReleased()) { if (buttons[count]->justReleased()) {