diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/.gitignore b/lib/lib_display/Display_Renderer-gemu-1.0/.gitignore similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/.gitignore rename to lib/lib_display/Display_Renderer-gemu-1.0/.gitignore diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/.travis.yml b/lib/lib_display/Display_Renderer-gemu-1.0/.travis.yml similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/.travis.yml rename to lib/lib_display/Display_Renderer-gemu-1.0/.travis.yml diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/Arduino/epd2in9-demo/epd2in9-demo.ino b/lib/lib_display/Display_Renderer-gemu-1.0/Arduino/epd2in9-demo/epd2in9-demo.ino similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/Arduino/epd2in9-demo/epd2in9-demo.ino rename to lib/lib_display/Display_Renderer-gemu-1.0/Arduino/epd2in9-demo/epd2in9-demo.ino diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/Arduino/libraries/readme.txt b/lib/lib_display/Display_Renderer-gemu-1.0/Arduino/libraries/readme.txt similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/Arduino/libraries/readme.txt rename to lib/lib_display/Display_Renderer-gemu-1.0/Arduino/libraries/readme.txt diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/LICENSE b/lib/lib_display/Display_Renderer-gemu-1.0/LICENSE similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/LICENSE rename to lib/lib_display/Display_Renderer-gemu-1.0/LICENSE diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/Makefile b/lib/lib_display/Display_Renderer-gemu-1.0/Makefile similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/Makefile rename to lib/lib_display/Display_Renderer-gemu-1.0/Makefile diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/README.md b/lib/lib_display/Display_Renderer-gemu-1.0/README.md similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/README.md rename to lib/lib_display/Display_Renderer-gemu-1.0/README.md diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/component.mk b/lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/component.mk similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/component.mk rename to lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/component.mk diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/epaper-29-ws.c b/lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/epaper-29-ws.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/epaper-29-ws.c rename to lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/epaper-29-ws.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/epaper-29-ws.h b/lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/epaper-29-ws.h similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/epaper-29-ws.h rename to lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/epaper-29-ws.h diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/epaper_font.c b/lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/epaper_font.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/epaper_font.c rename to lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/epaper_font.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/epaper_fonts.h b/lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/epaper_fonts.h similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/epaper_fonts.h rename to lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/epaper_fonts.h diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/font16.c b/lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/font16.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/font16.c rename to lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/font16.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/font20.c b/lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/font20.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/font20.c rename to lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/font20.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/font8.c b/lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/font8.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/font8.c rename to lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/font8.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/imagedata.cpp b/lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/imagedata.cpp similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/imagedata.cpp rename to lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/imagedata.cpp diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/imagedata.h b/lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/imagedata.h similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/components/epaper-29-ws/imagedata.h rename to lib/lib_display/Display_Renderer-gemu-1.0/components/epaper-29-ws/imagedata.h diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/Doxyfile b/lib/lib_display/Display_Renderer-gemu-1.0/docs/Doxyfile similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/Doxyfile rename to lib/lib_display/Display_Renderer-gemu-1.0/docs/Doxyfile diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/Makefile b/lib/lib_display/Display_Renderer-gemu-1.0/docs/Makefile similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/Makefile rename to lib/lib_display/Display_Renderer-gemu-1.0/docs/Makefile diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/README.md b/lib/lib_display/Display_Renderer-gemu-1.0/docs/README.md similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/README.md rename to lib/lib_display/Display_Renderer-gemu-1.0/docs/README.md diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/conf.py b/lib/lib_display/Display_Renderer-gemu-1.0/docs/conf.py similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/conf.py rename to lib/lib_display/Display_Renderer-gemu-1.0/docs/conf.py diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/gen-dxd.py b/lib/lib_display/Display_Renderer-gemu-1.0/docs/gen-dxd.py similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/gen-dxd.py rename to lib/lib_display/Display_Renderer-gemu-1.0/docs/gen-dxd.py diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/index.rst b/lib/lib_display/Display_Renderer-gemu-1.0/docs/index.rst similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/index.rst rename to lib/lib_display/Display_Renderer-gemu-1.0/docs/index.rst diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/link-roles.py b/lib/lib_display/Display_Renderer-gemu-1.0/docs/link-roles.py similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/link-roles.py rename to lib/lib_display/Display_Renderer-gemu-1.0/docs/link-roles.py diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/repo_util.py b/lib/lib_display/Display_Renderer-gemu-1.0/docs/repo_util.py similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/repo_util.py rename to lib/lib_display/Display_Renderer-gemu-1.0/docs/repo_util.py diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/requirements.txt b/lib/lib_display/Display_Renderer-gemu-1.0/docs/requirements.txt similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/docs/requirements.txt rename to lib/lib_display/Display_Renderer-gemu-1.0/docs/requirements.txt diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/library.properties b/lib/lib_display/Display_Renderer-gemu-1.0/library.properties similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/library.properties rename to lib/lib_display/Display_Renderer-gemu-1.0/library.properties diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/main/README.md b/lib/lib_display/Display_Renderer-gemu-1.0/main/README.md similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/main/README.md rename to lib/lib_display/Display_Renderer-gemu-1.0/main/README.md diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/main/component.mk b/lib/lib_display/Display_Renderer-gemu-1.0/main/component.mk similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/main/component.mk rename to lib/lib_display/Display_Renderer-gemu-1.0/main/component.mk diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/main/esp-epaper-29-ws.c b/lib/lib_display/Display_Renderer-gemu-1.0/main/esp-epaper-29-ws.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/main/esp-epaper-29-ws.c rename to lib/lib_display/Display_Renderer-gemu-1.0/main/esp-epaper-29-ws.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/main/imagedata.c b/lib/lib_display/Display_Renderer-gemu-1.0/main/imagedata.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/main/imagedata.c rename to lib/lib_display/Display_Renderer-gemu-1.0/main/imagedata.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/main/imagedata.h b/lib/lib_display/Display_Renderer-gemu-1.0/main/imagedata.h similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/main/imagedata.h rename to lib/lib_display/Display_Renderer-gemu-1.0/main/imagedata.h diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/pictures/2.9inch_e-Paper_Datasheet.pdf b/lib/lib_display/Display_Renderer-gemu-1.0/pictures/2.9inch_e-Paper_Datasheet.pdf similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/pictures/2.9inch_e-Paper_Datasheet.pdf rename to lib/lib_display/Display_Renderer-gemu-1.0/pictures/2.9inch_e-Paper_Datasheet.pdf diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/pictures/e-paper-and-esp-sample-image.jpg b/lib/lib_display/Display_Renderer-gemu-1.0/pictures/e-paper-and-esp-sample-image.jpg similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/pictures/e-paper-and-esp-sample-image.jpg rename to lib/lib_display/Display_Renderer-gemu-1.0/pictures/e-paper-and-esp-sample-image.jpg diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/pictures/e-paper-and-esp-sample-text.jpg b/lib/lib_display/Display_Renderer-gemu-1.0/pictures/e-paper-and-esp-sample-text.jpg similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/pictures/e-paper-and-esp-sample-text.jpg rename to lib/lib_display/Display_Renderer-gemu-1.0/pictures/e-paper-and-esp-sample-text.jpg diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/pictures/espresif-logo.bmp b/lib/lib_display/Display_Renderer-gemu-1.0/pictures/espresif-logo.bmp similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/pictures/espresif-logo.bmp rename to lib/lib_display/Display_Renderer-gemu-1.0/pictures/espresif-logo.bmp diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/pictures/image-conversion-setup.png b/lib/lib_display/Display_Renderer-gemu-1.0/pictures/image-conversion-setup.png similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/pictures/image-conversion-setup.png rename to lib/lib_display/Display_Renderer-gemu-1.0/pictures/image-conversion-setup.png diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epdif.cpp b/lib/lib_display/Display_Renderer-gemu-1.0/src/epdif.cpp similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epdif.cpp rename to lib/lib_display/Display_Renderer-gemu-1.0/src/epdif.cpp diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epdif.h b/lib/lib_display/Display_Renderer-gemu-1.0/src/epdif.h similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epdif.h rename to lib/lib_display/Display_Renderer-gemu-1.0/src/epdif.h diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epdpaint.cpp b/lib/lib_display/Display_Renderer-gemu-1.0/src/epdpaint.cpp similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epdpaint.cpp rename to lib/lib_display/Display_Renderer-gemu-1.0/src/epdpaint.cpp diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epdpaint.h b/lib/lib_display/Display_Renderer-gemu-1.0/src/epdpaint.h similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epdpaint.h rename to lib/lib_display/Display_Renderer-gemu-1.0/src/epdpaint.h diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/font12.c b/lib/lib_display/Display_Renderer-gemu-1.0/src/font12.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/font12.c rename to lib/lib_display/Display_Renderer-gemu-1.0/src/font12.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/font16.c b/lib/lib_display/Display_Renderer-gemu-1.0/src/font16.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/font16.c rename to lib/lib_display/Display_Renderer-gemu-1.0/src/font16.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/font20.c b/lib/lib_display/Display_Renderer-gemu-1.0/src/font20.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/font20.c rename to lib/lib_display/Display_Renderer-gemu-1.0/src/font20.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/font24.c b/lib/lib_display/Display_Renderer-gemu-1.0/src/font24.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/font24.c rename to lib/lib_display/Display_Renderer-gemu-1.0/src/font24.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/font8.c b/lib/lib_display/Display_Renderer-gemu-1.0/src/font8.c similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/font8.c rename to lib/lib_display/Display_Renderer-gemu-1.0/src/font8.c diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/fonts.h b/lib/lib_display/Display_Renderer-gemu-1.0/src/fonts.h similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/fonts.h rename to lib/lib_display/Display_Renderer-gemu-1.0/src/fonts.h diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/renderer.cpp b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp similarity index 82% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/renderer.cpp rename to lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp index bd3f83c86..31b62f1e2 100644 --- a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/renderer.cpp +++ b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp @@ -531,6 +531,96 @@ void VButton::xdrawButton(bool inverted) { wr_redir=0; } +boolean VButton::didhit(int16_t x, int16_t y) { + return ((x >= spars.xp) && (x < (int16_t) (spars.xp + spars.xs)) && + (y >= spars.yp) && (y < (int16_t) (spars.yp + spars.ys))); +} + +void VButton::SliderInit(Renderer *renderer, uint16_t xp, uint16_t yp, uint16_t xs, uint16_t ys, uint16_t nelem, uint16_t bgcol, uint16_t frcol, uint16_t barcol) { + spars.xp = xp; + spars.yp = yp; + spars.xs = xs; + spars.ys = ys; + spars.nelem = nelem; + spars.bgcol = bgcol; + spars.frcol = frcol; + spars.barcol = barcol; + rend = renderer; + + rend->fillRect(spars.xp, spars.yp, spars.xs, spars.ys, spars.bgcol); + + if (xs < ys) { + float bxs = spars.xs - 6; + float bys = (float)(spars.ys - 6) / (float)nelem; + float bxp = xp + 3; + float byp = yp + 3; + for (uint32_t count = 0; count < spars.nelem; count++) { + rend->fillRect(bxp, byp, bxs, bys - 3, spars.barcol); + rend->drawRect(bxp, byp, bxs, bys - 3, spars.frcol); + byp += bys; + } + } else { + float bys = spars.ys - 6; + float bxs = (float)(spars.xs - 6) / (float)nelem; + float byp = yp + 3; + float bxp = xp + 3; + for (uint32_t count = 0; count < spars.nelem; count++) { + rend->fillRect(bxp, byp, bxs - 3 , bys, spars.barcol); + rend->drawRect(bxp, byp, bxs - 3, bys, spars.frcol); + bxp += bxs; + } + } +} + +uint16_t VButton::UpdateSlider(int16_t x, int16_t y) { + uint16_t elems = spars.nelem + 1; + + if (x < 0) { + x = spars.xp + (-x * spars.xs) / 100; + y = spars.yp + (spars.ys - (-y * spars.ys) / 100); + } + + if (spars.xs < spars.ys) { + uint16_t dy = spars.ys - (y - spars.yp); + uint16_t limit = elems - ((float)dy /(float)spars.ys * elems); + float bxs = spars.xs - 6; + float bys = (float)(spars.ys - 6) / (float)spars.nelem; + float bxp = spars.xp + 3; + float byp = spars.yp + 3; + uint16_t col; + for (uint32_t count = 0; count < spars.nelem; count++) { + if (count >= limit) { + col = spars.barcol; + } else { + col = spars.bgcol; + } + rend->fillRect(bxp, byp, bxs, bys - 3, col); + rend->drawRect(bxp, byp, bxs, bys - 3, spars.frcol); + byp += bys; + } + return 100 - (float(y - spars.yp) / (float)spars.ys) * 100.0; + } else { + uint16_t limit = (x - spars.xp) * elems / spars.xs; + float bys = spars.ys - 6; + float bxs = (float)(spars.xs - 6) / (float)spars.nelem; + float byp = spars.yp + 3; + float bxp = spars.xp + 3; + uint16_t col; + for (uint32_t count = 0; count < spars.nelem; count++) { + if (count < limit) { + col = spars.barcol; + } else { + col = spars.bgcol; + } + rend->fillRect(bxp, byp, bxs - 3, bys, col); + rend->drawRect(bxp, byp, bxs - 3 , bys, spars.frcol); + bxp += bxs; + } + return (float(x - spars.xp) / (float)spars.xs) * 100.0; + } + +} + diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/renderer.h b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h similarity index 82% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/renderer.h rename to lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h index 261363956..b50745686 100644 --- a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/renderer.h +++ b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h @@ -53,7 +53,7 @@ typedef union { uint8_t spare0 : 1; uint8_t spare1 : 1; uint8_t spare2 : 1; - uint8_t spare3 : 1; + uint8_t slider : 1; uint8_t disable : 1; uint8_t on_off : 1; uint8_t is_pushbutton : 1; @@ -61,10 +61,27 @@ typedef union { }; } TButton_State; + +struct Slider { + uint16_t xp; + uint16_t yp; + uint16_t xs; + uint16_t ys; + uint16_t nelem; + uint16_t bgcol; + uint16_t frcol; + uint16_t barcol; +}; + class VButton : public Adafruit_GFX_Button { public: TButton_State vpower; + struct Slider spars; + Renderer *rend; void xdrawButton(bool inverted); + boolean didhit(int16_t x, int16_t y); + uint16_t UpdateSlider(int16_t x, int16_t y); + void SliderInit(Renderer *rend, uint16_t xp, uint16_t yp, uint16_t xs, uint16_t ys, uint16_t nelem, uint16_t bgcol, uint16_t frcol, uint16_t barcol); }; diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epd2in9.cpp b/lib/lib_display/Epaper_29-gemu-1.0/epd2in9.cpp similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epd2in9.cpp rename to lib/lib_display/Epaper_29-gemu-1.0/epd2in9.cpp diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epd2in9.h b/lib/lib_display/Epaper_29-gemu-1.0/epd2in9.h similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epd2in9.h rename to lib/lib_display/Epaper_29-gemu-1.0/epd2in9.h diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epd4in2.cpp b/lib/lib_display/Epaper_42-gemu-1.0/epd4in2.cpp similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epd4in2.cpp rename to lib/lib_display/Epaper_42-gemu-1.0/epd4in2.cpp diff --git a/lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epd4in2.h b/lib/lib_display/Epaper_42-gemu-1.0/epd4in2.h similarity index 100% rename from lib/lib_display/esp-epaper-29-ws-20171230-gemu-1.1/src/epd4in2.h rename to lib/lib_display/Epaper_42-gemu-1.0/epd4in2.h diff --git a/tasmota/xdrv_13_display.ino b/tasmota/xdrv_13_display.ino index a9b9f7d33..817898d56 100755 --- a/tasmota/xdrv_13_display.ino +++ b/tasmota/xdrv_13_display.ino @@ -497,7 +497,7 @@ void DisplayText(void) cp += var; linebuf[fill] = 0; break; -#if (defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)) || defined(USE_UFILESYS) +#ifdef USE_UFILESYS case 'P': { char *ep=strchr(cp,':'); if (ep) { @@ -508,7 +508,7 @@ void DisplayText(void) } } break; -#endif // USE_SCRIPT_FATFS +#endif // USE_UFILESYS case 'h': // hor line to var = atoiv(cp, &temp); @@ -765,17 +765,17 @@ void DisplayText(void) #ifdef USE_TOUCH_BUTTONS case 'b': - { int16_t num,gxp,gyp,gxs,gys,outline,fill,textcolor,textsize; uint8_t dflg=1; - if (*cp=='e' || *cp=='d') { + { int16_t num, gxp, gyp, gxs, gys, outline, fill, textcolor, textsize; uint8_t dflg = 1, sbt = 0; + if (*cp == 'e' || *cp == 'd') { // enable disable - uint8_t dis=0; - if (*cp=='d') dis=1; + uint8_t dis = 0; + if (*cp == 'd') dis = 1; cp++; - var=atoiv(cp,&num); - num=num%MAX_TOUCH_BUTTONS; - cp+=var; + var = atoiv(cp, &num); + num = num % MAX_TOUCH_BUTTONS; + cp += var; if (buttons[num]) { - buttons[num]->vpower.disable=dis; + buttons[num]->vpower.disable = dis; if (!dis) { if (buttons[num]->vpower.is_virtual) buttons[num]->xdrawButton(buttons[num]->vpower.on_off); else buttons[num]->xdrawButton(bitRead(TasmotaGlobal.power,num)); @@ -783,15 +783,33 @@ void DisplayText(void) } break; } - if (*cp=='-') { + if (*cp == '-') { cp++; - dflg=0; + dflg = 0; + } + if (*cp == 's') { + cp++; + sbt = 1; } var=atoiv(cp,&num); cp+=var; - cp++; uint8_t bflags=num>>8; num=num%MAX_TOUCH_BUTTONS; + if (*cp == 's') { + cp++; + var=atoiv(cp,&gxp); + if (buttons[num]) { + // set slider or button + if (buttons[num]->vpower.slider) { + buttons[num]->UpdateSlider(-gxp, -gxp); + } else { + buttons[num]->vpower.on_off = gxp; + buttons[num]->xdrawButton(buttons[num]->vpower.on_off); + } + } + break; + } + cp++; var=atoiv(cp,&gxp); cp+=var; cp++; @@ -818,32 +836,42 @@ void DisplayText(void) cp++; // text itself char bbuff[32]; - cp=get_string(bbuff,sizeof(bbuff),cp); - + if (!sbt) { + // text itself + cp = get_string(bbuff, sizeof(bbuff), cp); + } if (buttons[num]) { delete buttons[num]; } if (renderer) { buttons[num]= new VButton(); if (buttons[num]) { - buttons[num]->initButtonUL(renderer,gxp,gyp,gxs,gys,renderer->GetColorFromIndex(outline),\ - renderer->GetColorFromIndex(fill),renderer->GetColorFromIndex(textcolor),bbuff,textsize); - if (!bflags) { - // power button - if (dflg) buttons[num]->xdrawButton(bitRead(TasmotaGlobal.power,num)); - buttons[num]->vpower.is_virtual=0; - } else { - // virtual button - buttons[num]->vpower.is_virtual=1; - if (bflags==2) { - // push - buttons[num]->vpower.is_pushbutton=1; + if (!sbt) { + buttons[num]->vpower.slider = 0; + buttons[num]->initButtonUL(renderer, gxp, gyp, gxs, gys, renderer->GetColorFromIndex(outline),\ + renderer->GetColorFromIndex(fill), renderer->GetColorFromIndex(textcolor), bbuff, textsize); + if (!bflags) { + // power button + if (dflg) buttons[num]->xdrawButton(bitRead(TasmotaGlobal.power, num)); + buttons[num]->vpower.is_virtual = 0; } else { - // toggle - buttons[num]->vpower.is_pushbutton=0; + // virtual button + buttons[num]->vpower.is_virtual = 1; + if (bflags==2) { + // push + buttons[num]->vpower.is_pushbutton = 1; + } else { + // toggle + buttons[num]->vpower.is_pushbutton = 0; + } + if (dflg) buttons[num]->xdrawButton(buttons[num]->vpower.on_off); + buttons[num]->vpower.disable = !dflg; } - if (dflg) buttons[num]->xdrawButton(buttons[num]->vpower.on_off); - buttons[num]->vpower.disable=!dflg; + } else { + // slider + buttons[num]->vpower.slider = 1; + buttons[num]->SliderInit(renderer, gxp, gyp, gxs, gys, outline, renderer->GetColorFromIndex(fill),\ + renderer->GetColorFromIndex(textcolor), renderer->GetColorFromIndex(textsize)); } } } @@ -1575,7 +1603,7 @@ char get_jpeg_size(unsigned char* data, unsigned int data_size, unsigned short * #endif // JPEG_PICTS #endif // ESP32 -#if (defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)) || defined(USE_UFILESYS) +#ifdef USE_UFILESYS extern FS *ufsp; #define XBUFF_LEN 128 void Draw_RGB_Bitmap(char *file,uint16_t xp, uint16_t yp, bool inverted ) { @@ -1675,7 +1703,7 @@ void Draw_RGB_Bitmap(char *file,uint16_t xp, uint16_t yp, bool inverted ) { #endif // ESP32 } } -#endif // USE_SCRIPT_FATFS +#endif // USE_UFILESYS #ifdef USE_AWATCH #define MINUTE_REDUCT 4 @@ -2188,9 +2216,11 @@ uint8_t vbutt=0; //AddLog(LOG_LEVEL_INFO, PSTR("touch %d - %d"), pLoc.x, pLoc.y); // now must compare with defined buttons - for (uint8_t count=0; countvpower.disable) { - if (buttons[count]->contains(pLoc.x, pLoc.y)) { + for (uint8_t count = 0; count < MAX_TOUCH_BUTTONS; count++) { + if (buttons[count]) { + if (!buttons[count]->vpower.slider) { + if (!buttons[count]->vpower.disable) { + if (buttons[count]->contains(pLoc.x, pLoc.y)) { // did hit buttons[count]->press(true); if (buttons[count]->justPressed()) { @@ -2216,12 +2246,20 @@ uint8_t vbutt=0; Touch_MQTT(count, cp, buttons[count]->vpower.on_off); } } + } + if (!buttons[count]->vpower.is_virtual) { + rbutt++; + } else { + vbutt++; + } } - if (!buttons[count]->vpower.is_virtual) { - rbutt++; - } else { - vbutt++; + } else { + // slider + if (buttons[count]->didhit(pLoc.x, pLoc.y)) { + uint16_t value = buttons[count]->UpdateSlider(pLoc.x, pLoc.y); + Touch_MQTT(count, "SLD", value); } + } } } } @@ -2237,27 +2275,29 @@ uint8_t vbutt=0; } } #endif - for (uint8_t count=0; countpress(false); - if (buttons[count]->justReleased()) { - if (buttons[count]->vpower.is_virtual) { - if (buttons[count]->vpower.is_pushbutton) { - // push button - buttons[count]->vpower.on_off = 0; - Touch_MQTT(count,"PBT", buttons[count]->vpower.on_off); - buttons[count]->xdrawButton(buttons[count]->vpower.on_off); + if (!buttons[count]->vpower.slider) { + buttons[count]->press(false); + if (buttons[count]->justReleased()) { + if (buttons[count]->vpower.is_virtual) { + if (buttons[count]->vpower.is_pushbutton) { + // push button + buttons[count]->vpower.on_off = 0; + Touch_MQTT(count,"PBT", buttons[count]->vpower.on_off); + buttons[count]->xdrawButton(buttons[count]->vpower.on_off); + } } } - } - if (!buttons[count]->vpower.is_virtual) { - // check if power button stage changed - uint8_t pwr = bitRead(TasmotaGlobal.power, rbutt); - uint8_t vpwr = buttons[count]->vpower.on_off; - if (pwr != vpwr) { - Touch_RDW_BUTT(count, pwr); + if (!buttons[count]->vpower.is_virtual) { + // check if power button stage changed + uint8_t pwr = bitRead(TasmotaGlobal.power, rbutt); + uint8_t vpwr = buttons[count]->vpower.on_off; + if (pwr != vpwr) { + Touch_RDW_BUTT(count, pwr); + } + rbutt++; } - rbutt++; } } }