display fix touch init, some formatting

This commit is contained in:
gemu2015 2020-09-11 15:45:21 +02:00
parent 9afa8a5d4f
commit 01ab99f8a1

View File

@ -506,7 +506,7 @@ void DisplayText(void)
} }
} }
break; break;
#endif #endif // USE_SCRIPT_FATFS
case 'h': case 'h':
// hor line to // hor line to
var = atoiv(cp, &temp); var = atoiv(cp, &temp);
@ -696,7 +696,7 @@ void DisplayText(void)
Restore_graph(temp,bbuff); Restore_graph(temp,bbuff);
break; break;
} }
#endif #endif // USE_SCRIPT_FATFS
{ int16_t num,gxp,gyp,gxs,gys,dec,icol; { int16_t num,gxp,gyp,gxs,gys,dec,icol;
float ymin,ymax; float ymin,ymax;
var=atoiv(cp,&num); var=atoiv(cp,&num);
@ -744,7 +744,7 @@ void DisplayText(void)
AddValue(num,temp); AddValue(num,temp);
} }
break; break;
#endif #endif // USE_GRAPH
#ifdef USE_AWATCH #ifdef USE_AWATCH
case 'w': case 'w':
@ -752,7 +752,7 @@ void DisplayText(void)
cp += var; cp += var;
DrawAClock(temp); DrawAClock(temp);
break; break;
#endif #endif // USE_AWATCH
#ifdef USE_TOUCH_BUTTONS #ifdef USE_TOUCH_BUTTONS
case 'b': case 'b':
@ -834,12 +834,13 @@ void DisplayText(void)
buttons[num]->vpower.is_pushbutton=0; buttons[num]->vpower.is_pushbutton=0;
} }
if (dflg) buttons[num]->xdrawButton(buttons[num]->vpower.on_off); if (dflg) buttons[num]->xdrawButton(buttons[num]->vpower.on_off);
buttons[num]->vpower.disable=!dflg;
} }
} }
} }
} }
break; break;
#endif #endif // USE_TOUCH_BUTTONS
default: default:
// unknown escape // unknown escape
Response_P(PSTR("Unknown Escape")); Response_P(PSTR("Unknown Escape"));
@ -1530,8 +1531,8 @@ void CmndDisplayRows(void)
bool jpg2rgb888(const uint8_t *src, size_t src_len, uint8_t * out, jpg_scale_t scale); bool jpg2rgb888(const uint8_t *src, size_t src_len, uint8_t * out, jpg_scale_t scale);
char get_jpeg_size(unsigned char* data, unsigned int data_size, unsigned short *width, unsigned short *height); char get_jpeg_size(unsigned char* data, unsigned int data_size, unsigned short *width, unsigned short *height);
void rgb888_to_565(uint8_t *in, uint16_t *out, uint32_t len); void rgb888_to_565(uint8_t *in, uint16_t *out, uint32_t len);
#endif #endif // JPEG_PICTS
#endif #endif // ESP32
#if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT) #if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)
extern FS *fsp; extern FS *fsp;
@ -1626,7 +1627,7 @@ void Draw_RGB_Bitmap(char *file,uint16_t xp, uint16_t yp) {
#endif // ESP32 #endif // ESP32
} }
} }
#endif #endif // USE_SCRIPT_FATFS
#ifdef USE_AWATCH #ifdef USE_AWATCH
#define MINUTE_REDUCT 4 #define MINUTE_REDUCT 4
@ -1663,7 +1664,7 @@ void DrawAClock(uint16_t rad) {
temp=((float)RtcTime.minute*(pi/30.0)-(pi/2.0)); temp=((float)RtcTime.minute*(pi/30.0)-(pi/2.0));
renderer->writeLine(disp_xpos, disp_ypos,disp_xpos+(frad-MINUTE_REDUCT)*cosf(temp),disp_ypos+(frad-MINUTE_REDUCT)*sinf(temp), fg_color); renderer->writeLine(disp_xpos, disp_ypos,disp_xpos+(frad-MINUTE_REDUCT)*cosf(temp),disp_ypos+(frad-MINUTE_REDUCT)*sinf(temp), fg_color);
} }
#endif #endif // USE_AWATCH
#ifdef USE_GRAPH #ifdef USE_GRAPH
@ -1938,7 +1939,7 @@ void Restore_graph(uint8_t num, char *path) {
fp.close(); fp.close();
RedrawGraph(num,1); RedrawGraph(num,1);
} }
#endif #endif // USE_SCRIPT_FATFS
void RedrawGraph(uint8_t num, uint8_t flags) { void RedrawGraph(uint8_t num, uint8_t flags) {
uint16_t index=num%NUM_GRAPHS; uint16_t index=num%NUM_GRAPHS;
@ -2050,16 +2051,13 @@ void AddValue(uint8_t num,float fval) {
#ifdef USE_FT5206 #ifdef USE_FT5206
#include <FT5206.h>
// touch panel controller // touch panel controller
#undef FT5206_address #undef FT5206_address
#define FT5206_address 0x38 #define FT5206_address 0x38
#include <FT5206.h>
FT5206_Class *touchp; FT5206_Class *touchp;
TP_Point pLoc; TP_Point pLoc;
extern VButton *buttons[];
bool FT5206_found; bool FT5206_found;
bool Touch_Init(TwoWire &i2c) { bool Touch_Init(TwoWire &i2c) {
@ -2088,6 +2086,7 @@ uint32_t Touch_Status(uint32_t sel) {
} }
} }
#ifdef USE_TOUCH_BUTTONS #ifdef USE_TOUCH_BUTTONS
void Touch_MQTT(uint8_t index, const char *cp) { void Touch_MQTT(uint8_t index, const char *cp) {
ResponseTime_P(PSTR(",\"FT5206\":{\"%s%d\":\"%d\"}}"), cp, index+1, buttons[index]->vpower.on_off); ResponseTime_P(PSTR(",\"FT5206\":{\"%s%d\":\"%d\"}}"), cp, index+1, buttons[index]->vpower.on_off);
@ -2184,6 +2183,7 @@ uint8_t vbutt=0;
pLoc.y = 0; pLoc.y = 0;
} }
} }
#endif // USE_TOUCH_BUTTONS #endif // USE_TOUCH_BUTTONS
#endif // USE_FT5206 #endif // USE_FT5206