diff --git a/metesp.ino b/metesp.ino index 8b61d58..40e967f 100644 --- a/metesp.ino +++ b/metesp.ino @@ -32,6 +32,8 @@ static WiFiMulti wifiMulti; static TwoWire I2C = TwoWire(0); +TaskHandle_t task_measure; +TaskHandle_t task_draw; static NTPtime* ntp = new NTPtime(NTP_URL); @@ -44,25 +46,21 @@ static OWM* owm[6] = {new OWM(LOCATION_0, OPENWEATHER_API), static Influx* iflx = new Influx(NULL, owm);//TODO: Add sensor +static TimedFun* tf = new TimedFun(); static bool time_update = false, view_update = true, view_refresh = true; static bool shutdownt = false; static int shutdownc = 0; -TaskHandle_t task_measure; -TaskHandle_t task_draw; - - -static TimedFun* tf = new TimedFun(); - -static const int8_t views_size = 5; +static const int8_t views_size = 6; static DisplayWrapper* views[views_size] = { new MainDisplay(), new WeatherDisplay(owm[0]), new WeatherDisplay(owm[1]), new TempDisplay(sensor), - new AirDisplay(sensor) + new AirDisplay(sensor), + new LightDisplay(sensor), }; @@ -94,13 +92,17 @@ void IRAM_ATTR onSecondTimer() { } void IRAM_ATTR onTouch(int8_t contacts, GTPoint *points) { - if(touch->dev.holding) return; + if(touch->dev.holding){ + Serial.printf("Draging:\n"); + Serial.printf("C0: #0 %d,%d \n", touch->dev.dx, touch->dev.dy); + return; + } Serial.printf("Contacts: %d\n", contacts); for (uint8_t i = 0; i < contacts; i++) { Serial.printf("C%d: #%d %d,%d s:%d\n", i, points[i].id, points[i].x, points[i].y, points[i].a); yield(); } - if(points[0].x < 125) Display::nextView(); + if(points[0].y < 125) Display::nextView(); else Display::prevView(); view_update = true; } diff --git a/src/display/display.cpp b/src/display/display.cpp index c3d46ca..5170daf 100644 --- a/src/display/display.cpp +++ b/src/display/display.cpp @@ -21,8 +21,8 @@ void Display::setup(){ Paint_SetMirroring(MIRROR_HORIZONTAL); Paint_Clear(WHITE); - Paint_DrawIcon(89,54, ICON_LOGO, &FontIcon, BLACK, WHITE); - Paint_DrawString_EN(29, 5, "Helcel", &Font45, WHITE, BLACK); + Paint_DrawIcon(89,36, ICON_LOGO, &FontIcon, BLACK, WHITE); + Paint_DrawString_EN(29, 0, "Helcel", &Font45, WHITE, BLACK); Paint_SelectImage(BlackImage); EPD_2IN13_V2_Display(BlackImage); delay(100); @@ -102,24 +102,56 @@ void WeatherDisplay::drawDisplay() { } void TempDisplay::drawDisplay() { - Paint_DrawIcon(0,Font24.Height, ICON_TEMPERATURE,&FontIcon, BLACK, WHITE); - Paint_DrawString_EN(2,0,"Temp", &Font24, WHITE, BLACK); - Paint_DrawFltUnit(76,0,sensor->heatidx, "C", &Font24, BLACK, WHITE); - Paint_DrawFltUnit(76,36,sensor->temp, "C", &Font24, BLACK, WHITE); - Paint_DrawFltUnit(160,36,sensor->hum, "%", &Font24, BLACK, WHITE); - Paint_DrawFltUnit(76,64,sensor->pres, "hPa", &Font24, BLACK, WHITE); + Paint_DrawIcon(0,8, ICON_TEMPERATURE,&FontIcon, BLACK, WHITE); + Paint_DrawFltUnit(76,0,sensor->temp, "C", &Font24, BLACK, WHITE); + Paint_DrawFltUnit(186,6,sensor->heatidx, "C", &Font12, BLACK, WHITE); + Paint_DrawFltUnit(76,24,sensor->pres, "hPa", &Font24, BLACK, WHITE); + Paint_DrawFltUnit(76,48,sensor->hum, "%", &Font24, BLACK, WHITE); + + Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 4 - Font16.Height,"nominal", &Font16, WHITE, BLACK); } void AirDisplay::drawDisplay() { - Paint_DrawIcon(0,Font24.Height, ICON_POLUTION,&FontIcon, BLACK, WHITE); - Paint_DrawString_EN(2,0,"Air", &Font24, WHITE, BLACK); - Paint_DrawIntUnit(150,10, 69,"", &Font24, BLACK, WHITE); + Paint_DrawIcon(0,8, ICON_POLUTION,&FontIcon, BLACK, WHITE); + + Paint_DrawIntUnit(76,0,sensor->voci, "voci", &Font24, BLACK, WHITE); + + Paint_DrawIntUnit(76,24+12*0,sensor->pmd.pm10_standard, "ug/m3", &Font12, BLACK, WHITE); + Paint_DrawIntUnit(76,24+12*1,sensor->pmd.pm25_standard, "ug/m3", &Font12, BLACK, WHITE); + Paint_DrawIntUnit(76,24+12*2,sensor->pmd.pm100_standard, "ug/m3", &Font12, BLACK, WHITE); + + Paint_DrawIntUnit(186,24+12*0,sensor->pmd.pm10_env, "ug/m3", &Font12, BLACK, WHITE); + Paint_DrawIntUnit(186,24+12*1,sensor->pmd.pm25_env, "ug/m3", &Font12, BLACK, WHITE); + Paint_DrawIntUnit(186,24+12*2,sensor->pmd.pm100_env, "ug/m3", &Font12, BLACK, WHITE); + +// particles_03um, ///< 0.3um Particle Count +// particles_05um, ///< 0.5um Particle Count +// particles_10um, ///< 1.0um Particle Count +// particles_25um, ///< 2.5um Particle Count +// particles_50um, ///< 5.0um Particle Count +// particles_100um; ///< 10.0um Particle Count + + Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 4 - Font16.Height,"nominal", &Font16, WHITE, BLACK); + } + +void LightDisplay::drawDisplay() { + Paint_DrawIcon(0,8, ICON_BULB,&FontIcon, BLACK, WHITE); //TODO BULB + + Paint_DrawFltUnit(76,0,sensor->light_lux, "lux", &Font24, BLACK, WHITE); + Paint_DrawIntUnit(76,24*1,sensor->uvi, "uvi", &Font24, BLACK, WHITE); + Paint_DrawFltUnit(76,24*2,sensor->light, "l", &Font24, BLACK, WHITE); + Paint_DrawIntUnit(76,24*3,sensor->light_vis, "vl", &Font24, BLACK, WHITE); + + Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 4 - Font16.Height,"nominal", &Font16, WHITE, BLACK); +} + + void MainDisplay::drawDisplay() { - Paint_DrawIcon(0,0, ICON_LOGO,&FontIcon, BLACK, WHITE); - Paint_DrawString_EN(60,0,"MAIN", &Font24, WHITE, BLACK); - Paint_DrawIntUnit(0,30, 69,"", &Font24, BLACK, WHITE); + Paint_DrawIcon(89,36, ICON_LOGO, &FontIcon, BLACK, WHITE); + Paint_DrawString_EN(29, 0, "Helcel", &Font45, WHITE, BLACK); + Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 4 - Font16.Height,"WESP-v0.1", &Font16, WHITE, BLACK); } void CustomDisplay::drawDisplay() { diff --git a/src/display/display.h b/src/display/display.h index ba0d3b9..b1d7b90 100644 --- a/src/display/display.h +++ b/src/display/display.h @@ -61,6 +61,14 @@ class AirDisplay: public DisplayWrapper { Sensor* sensor; }; +class LightDisplay: public DisplayWrapper { + public: + LightDisplay(Sensor* s) : sensor(s){} + void drawDisplay(); + private: + Sensor* sensor; +}; + class MainDisplay: public DisplayWrapper { public: void drawDisplay(); diff --git a/src/epd/fonts/fonts.h b/src/epd/fonts/fonts.h index a8d13cc..ed03979 100644 --- a/src/epd/fonts/fonts.h +++ b/src/epd/fonts/fonts.h @@ -77,6 +77,8 @@ typedef enum { ICON_SUNSET, ICON_SUNRISE, + + ICON_BULB } ICON_tpe; diff --git a/src/epd/fonts/icons.cpp b/src/epd/fonts/icons.cpp index 909ace6..ee30965 100644 --- a/src/epd/fonts/icons.cpp +++ b/src/epd/fonts/icons.cpp @@ -1115,6 +1115,80 @@ const uint8_t FontIcon_Table [] = { 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +//BULB +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x7e,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x7,0xff,0xe0,0x0,0x0,0x0, +0x0,0x0,0x0,0x1f,0x81,0xf8,0x0,0x0,0x0, +0x0,0x0,0x0,0x3c,0x0,0x3c,0x0,0x0,0x0, +0x0,0x0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x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + }; sFONT FontIcon = { diff --git a/src/epd/icon.h b/src/epd/icon.h index 5ea5c3f..c9fcd5d 100644 --- a/src/epd/icon.h +++ b/src/epd/icon.h @@ -297,312 +297,312 @@ static unsigned char header_data[] = { 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,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.cpp b/src/touch/gt1151.cpp index d9275d4..b12b5b5 100644 --- a/src/touch/gt1151.cpp +++ b/src/touch/gt1151.cpp @@ -3,8 +3,6 @@ #define GT1151_RESET_PIN 02 #define GT1151_INT_PIN 15 -GT1151_Dev Dev_Now, Dev_Old; -uint8_t GT_Gesture_Mode = 0; volatile uint8_t gtIRQ = 0; void IRAM_ATTR _gt_irq_handler() { @@ -25,12 +23,19 @@ void GT1151::armIRQ() { } void GT1151::onIRQ() { - int16_t contacts = readInput((GTPoint *) dev.points); + GTPoint points[CT_MAX_TOUCH]; + int16_t contacts = readInput((GTPoint *) &points); dev.holding = contacts > 0 && dev.pressing; dev.pressing = contacts > 0; + if(dev.holding){ + dev.dx = points[0].x - dev.points[0].x; + dev.dy = points[0].y - dev.points[0].y; + }else if(dev.pressing){ + memcpy(dev.points,points,sizeof(GTPoint)*CT_MAX_TOUCH); + } if (contacts < 0) return; if (contacts > 0) touchHandler(contacts, (GTPoint *)dev.points); - WriteRegister(GT1151_READ_COORD_ADDR, 0x00); + WriteRegister(GT1151_COORD_ADDR, 0x00); } @@ -38,21 +43,17 @@ int16_t GT1151::readInput(GTPoint* points) { uint8_t* data = static_cast(static_cast(points)); int touch_num; uint8_t regState; - int error = !ReadRegister(GT1151_READ_COORD_ADDR, ®State, 1); - if (!(regState & 0x80)) return -1; + int error = !ReadRegister(GT1151_COORD_ADDR, ®State, 1); + if ((regState & 0x80)==0) return -1; touch_num = regState & 0x0f; if(touch_num > 5) return -1; if (touch_num <= 0) return touch_num; - - error = !ReadRegister(GT1151_READ_POINTS, data, sizeof(GTPoint) * touch_num); + + + error = !ReadRegister(GT1151_COORD_ADDR, data, sizeof(GTPoint) * touch_num); if (error) return -1; - for(int i = 0; i< touch_num; i++) { - points[i].x = lowByte(points[i].x)<<8 | highByte(points[i].x); - points[i].y = lowByte(points[i].y)<<8 | highByte(points[i].y); - points[i].a = lowByte(points[i].a)<<8 | highByte(points[i].a); - } return touch_num; } @@ -60,6 +61,11 @@ int16_t GT1151::readInput(GTPoint* points) { void GT1151::Reset(void){ pinMode(GT1151_INT_PIN, OUTPUT); pinMode(GT1151_INT_PIN, INPUT); + digitalWrite(GT1151_RESET_PIN, HIGH); + delay(100); + digitalWrite(GT1151_RESET_PIN, LOW); + delay(100); + digitalWrite(GT1151_RESET_PIN, HIGH); delay(100); } diff --git a/src/touch/gt1151.h b/src/touch/gt1151.h index 66f3a7f..84e39ea 100644 --- a/src/touch/gt1151.h +++ b/src/touch/gt1151.h @@ -10,29 +10,28 @@ #define CT_MAX_TOUCH 5 +#define GT1151_REG_CMD 0x8040 -#define GT1151_REG_CMD 0x8040 - - -#define GT1151_REG_DATA 0x8140 -#define GT1151_REG_ID 0x8140 - -#define GT1151_READ_COORD_ADDR 0x814E -#define GT1151_READ_POINTS 0x814F +#define GT1151_REG_DATA 0x8140 +#define GT1151_REG_ID 0x8140 +#define GT1151_COORD_ADDR 0x814E +#define GT1151_POINTS_ADDR 0x814F +//121x250 struct GTPoint { - uint8_t id; - uint16_t x; - uint16_t y; - uint16_t a; + uint8_t unused; + uint8_t id; + uint16_t x; + uint16_t y; + uint16_t a; }; typedef struct{ bool holding; bool pressing; GTPoint points[CT_MAX_TOUCH]; - + int16_t dx,dy; }GT1151_Dev;