#include //#include "SmartDelay.h" #include "Adafruit_GFX.h" #include #include #include #include #include #include #include /// FOR ESP32 HTTP FOTA UPDATE /// #include /// FOR ESP32 HTTP FOTA UPDATE /// uint8_t icon_index = 0; uint8_t static weather_icons[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xdf, 0x07, 0xdf, 0x07, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00 , 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x07, 0xdf, 0x07, 0xdf, 0x07, 0xff, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00 , 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0xff, 0xe0, 0x00, 0x20, 0x00, 0x00, 0x07, 0xdf, 0x07, 0xdf, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xdf, 0x07, 0xdf, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xdf, 0x07, 0xff, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x07, 0xff, 0x00, 0x20, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xdf, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xdf, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xdf, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0x07, 0xdf, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xdf, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xdf, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xdf, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0x07, 0xdf, 0x07, 0xff, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // Data wire is plugged into port 2 on the Arduino #define ONE_WIRE_BUS 4 DeviceAddress insideThermometer = { 0x28, 0xFF, 0xE4, 0xE5, 0x85, 0x16, 0x04, 0x35 }; // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire); ///-------------- WiFiClient client; /// FOR ESP32 HTTP FOTA UPDATE /// const char* fwUrlBase = "http://xxx/.fota/"; /// put your server URL where the *.bin & *.version files are saved in your http ( Apache? ) server const int FW_VERSION = 2019081901 ; /// year_month_day_counternumber 2019 is the year, 08 is the month, 19 is the day 01 is the in day release #define Version "0.5" /// sketch version /// bool HTTP_OTA = false; /// we control this boolean variable through V26 switch that is in push button mode void checkForUpdates() { uint8_t mac[6]; char macAddr[14]; WiFi.macAddress( mac ); sprintf(macAddr, "%02X%02X%02X%02X%02X%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); /// capital letters at MAC address String fwURL = String( fwUrlBase ); fwURL.concat( macAddr ); String fwVersionURL = fwURL; fwVersionURL.concat( ".version" ); Serial.println( "Checking for firmware updates." ); Serial.print( "MAC address: " ); Serial.println( macAddr ); Serial.print( "Firmware version URL: " ); Serial.println( fwVersionURL ); HTTPClient httpClient; httpClient.begin( client, fwVersionURL ); int httpCode = httpClient.GET(); if ( httpCode == 200 ) { String newFWVersion = httpClient.getString(); Serial.print( "Current firmware version: " ); Serial.println( FW_VERSION ); Serial.print( "Available firmware version: " ); Serial.println( newFWVersion ); int newVersion = newFWVersion.toInt(); if ( newVersion > FW_VERSION ) { Serial.println( "Preparing to update" ); // Blynk.virtualWrite(V14, "\nPreparing to update"); String fwImageURL = fwURL; fwImageURL.concat( ".bin" ); t_httpUpdate_return ret = httpUpdate.update( client, fwImageURL ); /// FOR ESP32 HTTP FOTA switch (ret) { case HTTP_UPDATE_FAILED: Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s", httpUpdate.getLastError(), httpUpdate.getLastErrorString().c_str()); /// FOR ESP32 char currentString[64]; sprintf(currentString, "\nHTTP_UPDATE_FAILD Error (%d): %s\n", httpUpdate.getLastError(), httpUpdate.getLastErrorString().c_str()); /// FOR ESP32 break; case HTTP_UPDATE_NO_UPDATES: Serial.println("HTTP_UPDATE_NO_UPDATES"); break; } } else { Serial.println( "Already on latest version" ); } } else { Serial.print( "Firmware version check failed, got HTTP response code " ); Serial.println( httpCode ); char currentString[64]; sprintf(currentString, "\nFirmware version check failed, got HTTP response code : %d\n", httpCode); } httpClient.end(); } /// End of main function that performs HTTP OTA /// const long gmtOffset_sec = 10800; #define SEALEVELPRESSURE_HPA (1013.25) float Temperature = 0; float Pressure = 0; float Altitude = 0; float Humidity = 0; boolean fl_pressure = 0; float temperatureIn = 0; float lastIn = 0; unsigned status; //SmartDelay l4(5000000UL); // blink 5000ms time_t t; static time_t last_t; struct tm *tm; static const char* const wd[7] = {"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat"}; static const char* const wd_rus[7] = {"Вск", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"}; Adafruit_BME280 bme; // I2C unsigned selected; //DS18B20 ds(4); #include #define P_LAT 16 #define P_A 19 #define P_B 23 #define P_C 18 #define P_D 5 #define P_E 15 #define P_OE 17 hw_timer_t * timer = NULL; portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED; // This defines the 'on' time of the display is us. The larger this number, // the brighter the display. If too large the ESP will crash uint8_t display_draw_time = 10; //10-50 is usually fine PxMATRIX matrix(64, 32, P_LAT, P_OE, P_A, P_B, P_C, P_D); uint16_t myRED = matrix.color565(255, 0, 0); uint16_t myGREEN = matrix.color565(0, 255, 0); uint16_t myBLUE = matrix.color565(0, 0, 255); uint16_t myWHITE = matrix.color565(255, 255, 255); uint16_t myYELLOW = matrix.color565(255, 255, 0); uint16_t myCYAN = matrix.color565(0, 255, 255); uint16_t myMAGENTA = matrix.color565(255, 0, 255); uint16_t myBLACK = matrix.color565(0, 0, 0); #define CAYENNE_PRINT Serial #include CAYENNE_IN(1) { //CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString()); //Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message"); int currentValue = getValue.asInt(); } // WiFi network info. char ssid[] = "ssid"; char wifiPassword[] = "pass"; // Cayenne authentication info. This should be obtained from the Cayenne Dashboard. char username[] = "username"; char password[] = "password"; char clientID[] = "clientID"; #define TZ (9*60*60) /*JST*/ #ifdef ESP32 void IRAM_ATTR display_updater() { // Increment the counter and set the time of ISR portENTER_CRITICAL_ISR(&timerMux); matrix.display(display_draw_time); portEXIT_CRITICAL_ISR(&timerMux); } //void IRAM_ATTR resetModule() { // ets_printf("reboot\n"); // esp_restart(); //} #endif void display_update_enable(bool is_enable) { #ifdef ESP32 if (is_enable) { timer = timerBegin(0, 80, true); timerAttachInterrupt(timer, &display_updater, true); timerAlarmWrite(timer, 2000, true); timerAlarmEnable(timer); } else { timerDetachInterrupt(timer); timerAlarmDisable(timer); } #endif } void printValues() { // CAYENNE_OUT_DEFAULT() Temperature = bme.readTemperature(); Pressure = bme.readPressure() / 100.0F * 0.750062; Altitude = bme.readAltitude(SEALEVELPRESSURE_HPA); Humidity = bme.readHumidity(); sensors.requestTemperatures(); // Send the command to get temperatures temperatureIn = sensors.getTempC(insideThermometer); Serial.print("Temperature in= "); Serial.println(temperatureIn); if (temperatureIn > -127) { lastIn = temperatureIn; } else { temperatureIn = lastIn; } Cayenne.celsiusWrite(1, temperatureIn); Cayenne.celsiusWrite(2, Temperature); Cayenne.virtualWrite(3, round(Pressure)); Cayenne.virtualWrite(4, round(Humidity)); Serial.print("Temperature out= "); Serial.print(Temperature); Serial.println(" *C"); Serial.print("Temperature in= "); Serial.print(temperatureIn); Serial.println(" *C"); Serial.print("Pressure = "); Serial.print(Pressure); Serial.println(" hPa"); Serial.print("Approx. Altitude = "); Serial.print(Altitude); Serial.println(" m"); Serial.print("Humidity = "); Serial.print(Humidity); Serial.println(" %"); Serial.println(); } void setup() { // put your setup code here, to run once: Serial.begin(115200); matrix.begin(16); Serial.print("Attempting to connect to Network named: "); Serial.println(ssid); // print the network name (SSID); status = bme.begin(); if (!status) { Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!"); Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(), 16); Serial.print(" ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n"); Serial.print(" ID of 0x56-0x58 represents a BMP 280,\n"); Serial.print(" ID of 0x60 represents a BME 280.\n"); Serial.print(" ID of 0x61 represents a BME 680.\n"); while (1); } // WiFi.begin(ssid, pass); Cayenne.begin(username, password, clientID, ssid, wifiPassword); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(1000); } Serial.println(""); IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); sensors.begin(); // timer_rest = timerBegin(0, 80, true); //timer 0, div 80 // timerAttachInterrupt(timer, &resetModule, true); //attach callback // timerAlarmWrite(timer, wdtTimeout * 1000, false); //set time in us // timerAlarmEnable(timer); //enable interrupt configTime(gmtOffset_sec, 0, "pool.ntp.org", "pool.ntp.org"); // enable NTP // firstRun(); matrix.setFastUpdate(true); matrix.clearDisplay(); display_update_enable(true); } union single_double { uint8_t two[2]; uint16_t one; } this_single_double; // This draws the weather icons void draw_weather_icon (uint8_t icon, uint8_t x1, uint8_t y1) { if (icon > 10) icon = 10; for (int yy = 0; yy < 10; yy++) { for (int xx = 0; xx < 10; xx++) { uint16_t byte_pos = (xx + icon * 10) * 2 + yy * 220; this_single_double.two[1] = weather_icons[byte_pos]; this_single_double.two[0] = weather_icons[byte_pos + 1]; matrix.drawPixel(x1 + xx, y1 + yy, this_single_double.one); } } } // This draws the weather icons void draw_weather_icon1 (uint8_t icon, uint8_t x1, uint8_t y1) { if (icon > 10) icon = 10; for (int yy = 0; yy < 9; yy++) { for (int xx = 0; xx < 9; xx++) { uint16_t byte_pos = (xx + icon * 10) * 2 + yy * 220; this_single_double.two[1] = weather_icons[byte_pos]; this_single_double.two[0] = weather_icons[byte_pos + 1]; matrix.drawPixel(x1 + xx, y1 + yy, this_single_double.one); } } } void loop() { // put your main code here, to run repeatedly: matrix.setBrightness(250); Cayenne.loop(); if (WiFi.status() != WL_CONNECTED) { delay(10000); ESP.restart(); } // static const char* const wd[7] = {"Вс","Пн","Вт","Ср","Чт","Пт","Сб"}; t = time(NULL); //Serial.println(t); if (last_t + 30 > t) return; // draw each second Serial.println("last_t=" + String(last_t) + " t=" + String(t)); fl_pressure = ! fl_pressure; Serial.println(fl_pressure); last_t = t; tm = localtime(&t); matrix.clearDisplay(); // Clear(64,13); matrix.setCursor(1, 0); matrix.setTextColor(myGREEN); // matrix.printf("%04d/%02d/%02d\n", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday); matrix.printf("%02d/%02d/%04d\n", tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900); matrix.setCursor(40, 8); //43 matrix.setTextColor(tm->tm_wday == 0 ? myRED : tm->tm_wday == 6 ? myMAGENTA : myCYAN); //matrix.printf("%s", wd[tm->tm_wday]); matrix.print(utf8rus( wd_rus[tm->tm_wday])); matrix.setTextColor(myCYAN); // matrix.setFont(&FreeSansBold9pt7b); matrix.setCursor(1, 8); matrix.printf("%02d:%02d", tm->tm_hour, tm->tm_min); printValues(); matrix.setCursor(1, 16); matrix.setTextColor(myMAGENTA); matrix.print("C:"); // icon_index++; // if (icon_index > 10) { // icon_index = 0; // } // draw_weather_icon (icon_index, 0, 15); // matrix.setCursor(11, 16); matrix.setTextColor(Temperature < 0 ? myWHITE : Temperature > 20 ? myRED : myBLUE); matrix.print( Temperature, 0); matrix.setTextColor(myMAGENTA); matrix.setCursor(34, 16); matrix.print("B:"); matrix.setTextColor(temperatureIn < 0 ? myWHITE : temperatureIn > 20 ? myRED : myBLUE); matrix.print(temperatureIn, 0); matrix.setCursor(1, 24); matrix.setTextColor(myYELLOW); if (fl_pressure) { matrix.print(Pressure, 0); matrix.print(utf8rus(" мм.рт.")); } else { matrix.print(Humidity, 0); matrix.print(utf8rus(" % влаж.")); } } //CAYENNE_IN(26) //{ // int value = getValue.asInt(); // if (value == 1) // { // HTTP_OTA = true; // } // else { // HTTP_OTA = false; // } //}