diff --git a/lib/esp-epaper-29-ws-20171230-gemu-1.1/src/epd4in2.cpp b/lib/esp-epaper-29-ws-20171230-gemu-1.1/src/epd4in2.cpp index ee6a038ea..8c8d037c5 100755 --- a/lib/esp-epaper-29-ws-20171230-gemu-1.1/src/epd4in2.cpp +++ b/lib/esp-epaper-29-ws-20171230-gemu-1.1/src/epd4in2.cpp @@ -219,27 +219,27 @@ void Epd42::SetLut(void) { unsigned int count; SendCommand(LUT_FOR_VCOM); //vcom for(count = 0; count < 44; count++) { - SendData(lut_vcom0[count]); + SendData(pgm_read_byte(&lut_vcom0[count])); } SendCommand(LUT_WHITE_TO_WHITE); //ww -- for(count = 0; count < 42; count++) { - SendData(lut_ww[count]); + SendData(pgm_read_byte(&lut_ww[count])); } SendCommand(LUT_BLACK_TO_WHITE); //bw r for(count = 0; count < 42; count++) { - SendData(lut_bw[count]); + SendData(pgm_read_byte(&lut_bw[count])); } SendCommand(LUT_WHITE_TO_BLACK); //wb w for(count = 0; count < 42; count++) { - SendData(lut_wb[count]); + SendData(pgm_read_byte(&lut_wb[count])); } SendCommand(LUT_BLACK_TO_BLACK); //bb b for(count = 0; count < 42; count++) { - SendData(lut_bb[count]); + SendData(pgm_read_byte(&lut_bb[count])); } } @@ -252,27 +252,27 @@ void Epd42::SetLutQuick(void) { unsigned int count; SendCommand(LUT_FOR_VCOM); //vcom for(count = 0; count < 44; count++) { - SendData(lut_vcom0_quick[count]); + SendData(pgm_read_byte(&lut_vcom0_quick[count])); } SendCommand(LUT_WHITE_TO_WHITE); //ww -- for(count = 0; count < 42; count++) { - SendData(lut_ww_quick[count]); + SendData(pgm_read_byte(&lut_ww_quick[count])); } SendCommand(LUT_BLACK_TO_WHITE); //bw r for(count = 0; count < 42; count++) { - SendData(lut_bw_quick[count]); + SendData(pgm_read_byte(&lut_bw_quick[count])); } SendCommand(LUT_WHITE_TO_BLACK); //wb w for(count = 0; count < 42; count++) { - SendData(lut_wb_quick[count]); + SendData(pgm_read_byte(&lut_wb_quick[count])); } SendCommand(LUT_BLACK_TO_BLACK); //bb b for(count = 0; count < 42; count++) { - SendData(lut_bb_quick[count]); + SendData(pgm_read_byte(&lut_bb_quick[count])); } } @@ -387,7 +387,7 @@ void Epd42::Sleep() { SendData(0xA5); } -const unsigned char lut_vcom0[] = +const unsigned char lut_vcom0[] PROGMEM = { 0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x17, 0x17, 0x00, 0x00, 0x02, @@ -398,7 +398,7 @@ const unsigned char lut_vcom0[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -const unsigned char lut_vcom0_quick[] = +const unsigned char lut_vcom0_quick[] PROGMEM = { 0x00, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -411,7 +411,8 @@ const unsigned char lut_vcom0_quick[] = -const unsigned char lut_ww[] ={ +const unsigned char lut_ww[] PROGMEM = +{ 0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, @@ -421,7 +422,8 @@ const unsigned char lut_ww[] ={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -const unsigned char lut_ww_quick[] ={ +const unsigned char lut_ww_quick[] PROGMEM = +{ 0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -432,7 +434,8 @@ const unsigned char lut_ww_quick[] ={ }; -const unsigned char lut_bw[] ={ +const unsigned char lut_bw[] PROGMEM = +{ 0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, @@ -443,7 +446,8 @@ const unsigned char lut_bw[] ={ }; -const unsigned char lut_bw_quick[] ={ +const unsigned char lut_bw_quick[] PROGMEM = +{ 0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -453,7 +457,8 @@ const unsigned char lut_bw_quick[] ={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -const unsigned char lut_bb[] ={ +const unsigned char lut_bb[] PROGMEM = +{ 0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, @@ -463,7 +468,8 @@ const unsigned char lut_bb[] ={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -const unsigned char lut_bb_quick[] ={ +const unsigned char lut_bb_quick[] PROGMEM = +{ 0x50, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -474,7 +480,8 @@ const unsigned char lut_bb_quick[] ={ }; -const unsigned char lut_wb[] ={ +const unsigned char lut_wb[] PROGMEM = +{ 0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, @@ -484,7 +491,8 @@ const unsigned char lut_wb[] ={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -const unsigned char lut_wb_quick[] ={ +const unsigned char lut_wb_quick[] PROGMEM = +{ 0x50, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/sonoff/xdsp_05_epaper_29.ino b/sonoff/xdsp_05_epaper_29.ino index ee99126d0..105aa504b 100644 --- a/sonoff/xdsp_05_epaper_29.ino +++ b/sonoff/xdsp_05_epaper_29.ino @@ -180,7 +180,7 @@ void EpdRefresh29(void) // Every second * Interface \*********************************************************************************************/ -bool Xdsp05(byte function) +bool Xdsp05(uint8_t function) { bool result = false; if (FUNC_DISPLAY_INIT_DRIVER == function) { diff --git a/sonoff/xdsp_06_epaper_42.ino b/sonoff/xdsp_06_epaper_42.ino index ddd1aeb56..2a54227f2 100644 --- a/sonoff/xdsp_06_epaper_42.ino +++ b/sonoff/xdsp_06_epaper_42.ino @@ -17,9 +17,10 @@ along with this program. If not, see . */ + #ifdef USE_SPI #ifdef USE_DISPLAY -#ifdef USE_DISPLAY_EPAPER_42 +#ifdef USE_DISPLAY_E_42 #define XDSP_06 6 @@ -33,11 +34,11 @@ #include #include -//unsigned char image[(EPD_HEIGHT * EPD_WIDTH) / 8]; extern uint8_t *buffer; Epd42 *epd42; + /*********************************************************************************************/ void EpdInitDriver42() @@ -124,15 +125,15 @@ void EpdRefresh42() // Every second #endif // USE_DISPLAY_MODES1TO5 + /*********************************************************************************************\ * Interface \*********************************************************************************************/ -bool Xdsp06(byte function) +bool Xdsp06(uint8_t function) { bool result = false; - //if (spi_flg) { if (FUNC_DISPLAY_INIT_DRIVER == function) { EpdInitDriver42(); } @@ -150,10 +151,10 @@ bool Xdsp06(byte function) #endif // USE_DISPLAY_MODES1TO5 } } - //} return result; } + #endif // USE_DISPLAY_EPAPER42 #endif // USE_DISPLAY #endif // USE_SPI diff --git a/sonoff/xdsp_07_sh1106.ino b/sonoff/xdsp_07_sh1106.ino index 2d59ed8d5..1c45a451d 100644 --- a/sonoff/xdsp_07_sh1106.ino +++ b/sonoff/xdsp_07_sh1106.ino @@ -163,7 +163,7 @@ void SH1106Refresh(void) // Every second * Interface \*********************************************************************************************/ -bool Xdsp07(byte function) +bool Xdsp07(uint8_t function) { bool result = false; diff --git a/sonoff/xdsp_08_ILI9488.ino b/sonoff/xdsp_08_ILI9488.ino index 401a8eadd..51cb0fd4c 100644 --- a/sonoff/xdsp_08_ILI9488.ino +++ b/sonoff/xdsp_08_ILI9488.ino @@ -37,8 +37,8 @@ #include #include -TouchLocation pLoc; -uint8_t ctouch_counter = 0; +TouchLocation ili9488_pLoc; +uint8_t ili9488_ctouch_counter = 0; // currently fixed #define BACKPLANE_PIN 2 @@ -131,34 +131,34 @@ void ILI9488_MQTT(uint8_t count,const char *cp) { // check digitizer hit void FT6236Check() { uint16_t temp; -ctouch_counter++; -if (2 == ctouch_counter) { +ili9488_ctouch_counter++; +if (2 == ili9488_ctouch_counter) { // every 100 ms should be enough - ctouch_counter=0; - if (FT6236readTouchLocation(&pLoc,1)) { + ili9488_ctouch_counter=0; + if (FT6236readTouchLocation(&ili9488_pLoc,1)) { // did find a hit if (renderer) { uint8_t rot=renderer->getRotation(); switch (rot) { case 0: - temp=pLoc.y; - pLoc.y=renderer->height()-pLoc.x; - pLoc.x=temp; + temp=ili9488_pLoc.y; + ili9488_pLoc.y=renderer->height()-ili9488_pLoc.x; + ili9488_pLoc.x=temp; break; case 1: break; case 2: break; case 3: - temp=pLoc.y; - pLoc.y=pLoc.x; - pLoc.x=renderer->width()-temp; + temp=ili9488_pLoc.y; + ili9488_pLoc.y=ili9488_pLoc.x; + ili9488_pLoc.x=renderer->width()-temp; break; } // now must compare with defined buttons for (uint8_t count=0; countcontains(pLoc.x,pLoc.y)) { + if (buttons[count]->contains(ili9488_pLoc.x,ili9488_pLoc.y)) { // did hit buttons[count]->press(true); if (buttons[count]->justPressed()) { @@ -205,8 +205,8 @@ if (2 == ctouch_counter) { } } } - pLoc.x=0; - pLoc.y=0; + ili9488_pLoc.x=0; + ili9488_pLoc.y=0; } } } @@ -215,7 +215,7 @@ if (2 == ctouch_counter) { /*********************************************************************************************\ * Interface \*********************************************************************************************/ -bool Xdsp08(byte function) +bool Xdsp08(uint8_t function) { bool result = false; diff --git a/sonoff/xdsp_09_SSD1351.ino b/sonoff/xdsp_09_SSD1351.ino index 268cee7cd..0a3b69b4e 100644 --- a/sonoff/xdsp_09_SSD1351.ino +++ b/sonoff/xdsp_09_SSD1351.ino @@ -157,7 +157,7 @@ void SSD1351Refresh(void) // Every second /*********************************************************************************************\ * Interface \*********************************************************************************************/ -bool Xdsp09(byte function) +bool Xdsp09(uint8_t function) { bool result = false; diff --git a/sonoff/xdsp_10_RA8876.ino b/sonoff/xdsp_10_RA8876.ino index 8effd5d06..d77ed6c00 100644 --- a/sonoff/xdsp_10_RA8876.ino +++ b/sonoff/xdsp_10_RA8876.ino @@ -36,8 +36,8 @@ #include #include -TouchLocation pLoc; -uint8_t ctouch_counter = 0; +TouchLocation ra8876_pLoc; +uint8_t ra8876_ctouch_counter = 0; #ifdef USE_TOUCH_BUTTONS extern VButton *buttons[]; @@ -117,21 +117,21 @@ void RA8876_MQTT(uint8_t count,const char *cp) { // check digitizer hit void FT5316Check() { uint16_t temp; -ctouch_counter++; -if (2 == ctouch_counter) { +ra8876_ctouch_counter++; +if (2 == ra8876_ctouch_counter) { // every 100 ms should be enough - ctouch_counter=0; + ra8876_ctouch_counter=0; // panel has 800x480 - if (FT6236readTouchLocation(&pLoc,1)) { - pLoc.x=pLoc.x*RA8876_TFTWIDTH/800; - pLoc.y=pLoc.y*RA8876_TFTHEIGHT/480; + if (FT6236readTouchLocation(&ra8876_pLoc,1)) { + ra8876_pLoc.x=ra8876_pLoc.x*RA8876_TFTWIDTH/800; + ra8876_pLoc.y=ra8876_pLoc.y*RA8876_TFTHEIGHT/480; // did find a hit if (renderer) { // rotation not supported - pLoc.x=RA8876_TFTWIDTH-pLoc.x; - pLoc.y=RA8876_TFTHEIGHT-pLoc.y; + ra8876_pLoc.x=RA8876_TFTWIDTH-ra8876_pLoc.x; + ra8876_pLoc.y=RA8876_TFTHEIGHT-ra8876_pLoc.y; /* uint8_t rot=renderer->getRotation(); @@ -159,7 +159,7 @@ if (2 == ctouch_counter) { // now must compare with defined buttons for (uint8_t count=0; countcontains(pLoc.x,pLoc.y)) { + if (buttons[count]->contains(ra8876_pLoc.x,ra8876_pLoc.y)) { // did hit buttons[count]->press(true); if (buttons[count]->justPressed()) { @@ -206,8 +206,8 @@ if (2 == ctouch_counter) { } } } - pLoc.x=0; - pLoc.y=0; + ra8876_pLoc.x=0; + ra8876_pLoc.y=0; } } } @@ -396,7 +396,7 @@ Serial.print("Text test took "); Serial.print(elapsedtime); Serial.println(" ms" /*********************************************************************************************\ * Interface \*********************************************************************************************/ -bool Xdsp10(byte function) +bool Xdsp10(uint8_t function) { bool result = false;