From fe81be47d5845bce211644e025eb5807dddd9e25 Mon Sep 17 00:00:00 2001 From: Russ Handorf Date: Tue, 30 Jun 2020 21:26:38 -0400 Subject: [PATCH] new wifi --- code/rhandorf-vfd-clock/config.h | 17 - .../rhandorf-vfd-clock/rhandorf-vfd-clock.ino | 271 ---------------- code/sketch_dec10a.ino | 302 +++++++++++++----- 3 files changed, 218 insertions(+), 372 deletions(-) delete mode 100644 code/rhandorf-vfd-clock/config.h delete mode 100644 code/rhandorf-vfd-clock/rhandorf-vfd-clock.ino diff --git a/code/rhandorf-vfd-clock/config.h b/code/rhandorf-vfd-clock/config.h deleted file mode 100644 index 096623d..0000000 --- a/code/rhandorf-vfd-clock/config.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Configuration options for the VFD Clock - */ - -/* SSID to connect to (must support 2.4GHz channels and WPA-Personal) */ -const char *ssid = "SSID"; -/* WPA/WPA2 password/PSK */ -const char *password = "PASSWORD"; - -/* Time offset from UTC */ -const long utcOffsetInSeconds = 3600*-5; - -/* Comment out to disable casino mode each minute */ -#define SPIN_CASINO - -/* Change the offset in colors between hours, minutes, seconds */ -#define COLOR_OFFSET 60 diff --git a/code/rhandorf-vfd-clock/rhandorf-vfd-clock.ino b/code/rhandorf-vfd-clock/rhandorf-vfd-clock.ino deleted file mode 100644 index 03bd4ae..0000000 --- a/code/rhandorf-vfd-clock/rhandorf-vfd-clock.ino +++ /dev/null @@ -1,271 +0,0 @@ -//NodeMCU Wemos D1 -//Arduino as ISP -#include -#include -#include -#include -#include - -#include "config.h" - -/* - * TO CONFIGURE YOUR SSID AND TIME ZONE, EDIT CONFIG.H - */ - -#define LED_PIN D6 -#define LED_COUNT 6 - -static uint16_t hue = 0; // 0-359 -uint8_t saturation = 100; // 0-100 -uint8_t lightness = 50; // 0-100 - -unsigned int HColor = 0; -unsigned int MColor = 0; -unsigned int SColor = 0; - -unsigned int Hour1 = 0; -unsigned int Hour2 = 0; -unsigned int Minute1 = 0; -unsigned int Minute2 = 0; -unsigned int Second1 = 0; -unsigned int Second2 = 0; - -WiFiUDP ntpUDP; -NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds); -Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); - -//arduino -//const int dataPin = 13; //Outputs the byte to transfer -//const int loadPin = 11; //3 //Controls the internal transference of data in SN74HC595 internal registers -//const int clockPin = 12; // 4//Generates the clock signal to control the transference of data - -//nodeMCU -//const int dataPin = 14; //Outputs the byte to transfer -//const int loadPin = 0; //3 //Controls the internal transference of data in SN74HC595 internal registers -//const int clockPin = 4; // 4//Generates the clock signal to control the transference of data - -//wemos -const int dataPin = 14; //D5 //Outputs the byte to transfer -const int loadPin = 0; //D3 //3 //Controls the internal transference of data in SN74HC595 internal registers -const int clockPin = 4; //D2 // 4//Generates the clock signal to control the transference of data - -byte digits[10] { - 0b11111100, //0 - 0b01100000, //1 - 0b11011010, //2 - 0b11110010, //3 - 0b01100110, //4 - 0b10110110, //5 - 0b10111110, //6 - 0b11100000, //7 - 0b11111110, //8 - 0b11100110 //9 -}; - -void setup() { - Serial.begin(115200); - - HColor = 0; - MColor = HColor + COLOR_OFFSET; - SColor = MColor + COLOR_OFFSET; - - pinMode(dataPin, OUTPUT); - pinMode(loadPin, OUTPUT); - pinMode(clockPin, OUTPUT); - digitalWrite(loadPin, 0); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - digitalWrite(loadPin, 1); - - WiFi.begin(ssid, password); - int i=0; - int b=0; - while ( WiFi.status() != WL_CONNECTED ) { - delay ( 500 ); - digitalWrite(loadPin, 0); - shiftOut(dataPin, clockPin, LSBFIRST, digits[i]); //right - shiftOut(dataPin, clockPin, LSBFIRST, digits[b]); //left - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - digitalWrite(loadPin, 1); - i++; - if (i==10) { - i=0; - b++; - } - if (b==9 && i==9) { - digitalWrite(loadPin, 0); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000001); //right - shiftOut(dataPin, clockPin, LSBFIRST, 0b00001011); //right - shiftOut(dataPin, clockPin, LSBFIRST, 0b00111010); //00111111 - shiftOut(dataPin, clockPin, LSBFIRST, 0b00001010); //right - shiftOut(dataPin, clockPin, LSBFIRST, 0b00001010); //right - shiftOut(dataPin, clockPin, LSBFIRST, 0b10011110); //left - digitalWrite(loadPin, 1); - delay(10000); - i=0; - b=0; - } - } - timeClient.begin(); - strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) - strip.show(); // Turn OFF all pixels ASAP - strip.setBrightness(25); // Set BRIGHTNESS to about 1/5 (max = 255) - - chase(); -} - -void chase() { - byte disp = 0; - for (unsigned int j=0; j<5; j++) { - for (unsigned int i=0; i<8; i++) { - digitalWrite(loadPin, 0); - bitSet(disp, i); - shiftOut(dataPin, clockPin, LSBFIRST, disp); //right - shiftOut(dataPin, clockPin, LSBFIRST, disp); //left - digitalWrite(loadPin, 1); - delay(25); - bitClear(disp, i); - } - } -} - -void casino() { - for (unsigned int i=0; i<20; i++) { - digitalWrite(loadPin, 0); - shiftOut(dataPin, clockPin, LSBFIRST, digits[random(0,9)]); //right - shiftOut(dataPin, clockPin, LSBFIRST, digits[random(0,9)]); //left - shiftOut(dataPin, clockPin, LSBFIRST, digits[random(0,9)]); //left - shiftOut(dataPin, clockPin, LSBFIRST, digits[random(0,9)]); //left - shiftOut(dataPin, clockPin, LSBFIRST, digits[random(0,9)]); //left - shiftOut(dataPin, clockPin, LSBFIRST, digits[random(0,9)]); //left - digitalWrite(loadPin, 1); - delay(25); - } -} - -/** - * Map HSL color space to RGB - * - * Totally borrowed from: - * http://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl/ - * - * Probably not the most efficient solution, but - * it get's the job done. - */ -uint32_t hsl(uint16_t ih, uint8_t is, uint8_t il) { - - float h, s, l, t1, t2, tr, tg, tb; - uint8_t r, g, b; - - h = (ih % 360) / 360.0; - s = constrain(is, 0, 100) / 100.0; - l = constrain(il, 0, 100) / 100.0; - - if ( s == 0 ) { - r = g = b = 255 * l; - return ((uint32_t)r << 16) | ((uint32_t)g << 8) | b; - } - - if ( l < 0.5 ) t1 = l * (1.0 + s); - else t1 = l + s - l * s; - - t2 = 2 * l - t1; - tr = h + 1/3.0; - tg = h; - tb = h - 1/3.0; - - r = hsl_convert(tr, t1, t2); - g = hsl_convert(tg, t1, t2); - b = hsl_convert(tb, t1, t2); - - // NeoPixel packed RGB color - return ((uint32_t)r << 16) | ((uint32_t)g << 8) | b; -} -/** - * HSL Convert - * Helper function - */ -uint8_t hsl_convert(float c, float t1, float t2) { - - if ( c < 0 ) c+=1; - else if ( c > 1 ) c-=1; - - if ( 6 * c < 1 ) c = t2 + ( t1 - t2 ) * 6 * c; - else if ( 2 * c < 1 ) c = t1; - else if ( 3 * c < 2 ) c = t2 + ( t1 - t2 ) * ( 2/3.0 - c ) * 6; - else c = t2; - - return (uint8_t)(c*255); -} - -void loop() { - timeClient.update(); - - unsigned int b=0; - unsigned int Hour = timeClient.getHours(); - unsigned int Minute = timeClient.getMinutes(); - unsigned int Seconds = timeClient.getSeconds(); - - digitalWrite(loadPin, 0); - shiftOut(dataPin, clockPin, LSBFIRST, 0b000000000000000000000000000000000000000000000000); - digitalWrite(loadPin, 1); - - chase(); - - while (Seconds<60) { - Hour1 = (Hour/10U) % 10; - Hour2 = (Hour/1U) % 10; - Minute1 = (Minute/10U) % 10; - Minute2 = (Minute/1U) % 10; - Second1 = (Seconds/10U) % 10; - Second2 = (Seconds/1U) % 10; - unsigned int pause = 1000; - - strip.setPixelColor(0, hsl(HColor, saturation, lightness)); - strip.show(); - strip.setPixelColor(1, hsl(HColor, saturation, lightness)); - strip.show(); - strip.setPixelColor(2, hsl(MColor, saturation, lightness)); - strip.show(); - strip.setPixelColor(3, hsl(MColor, saturation, lightness)); - strip.show(); - strip.setPixelColor(4, hsl(SColor, saturation, lightness)); - strip.show(); - strip.setPixelColor(5, hsl(SColor, saturation, lightness)); - strip.show(); - - HColor = (HColor + 1) % 360; - MColor = (MColor + 1) % 360; - SColor = (SColor + 1) % 360; - - #ifdef SPIN_CASINO - if (Second2==0) { - casino(); - pause=500; - } else { - pause = 1000; - } - #else - pause = 1000; - #endif - - digitalWrite(loadPin, 0); - - shiftOut(dataPin, clockPin, LSBFIRST, digits[Second2]); //right - shiftOut(dataPin, clockPin, LSBFIRST, digits[Second1]); //left - shiftOut(dataPin, clockPin, LSBFIRST, digits[Minute2]); //right - shiftOut(dataPin, clockPin, LSBFIRST, digits[Minute1]); //left - shiftOut(dataPin, clockPin, LSBFIRST, digits[Hour2]); //right - shiftOut(dataPin, clockPin, LSBFIRST, digits[Hour1]); //left - digitalWrite(loadPin, 1); - delay(pause); - Seconds = Seconds+1; - } -} diff --git a/code/sketch_dec10a.ino b/code/sketch_dec10a.ino index 7f9f18c..432a945 100644 --- a/code/sketch_dec10a.ino +++ b/code/sketch_dec10a.ino @@ -5,6 +5,13 @@ #include #include #include +#include + +#include +#include +#include + +#include #define LED_PIN D6 @@ -21,25 +28,40 @@ unsigned int Minute2 = 0; unsigned int Second1 = 0; unsigned int Second2 = 0; +int utc=0; +bool displaySwitch=true; +unsigned int pause = 0; +unsigned long timeout; +//unsigned long newNTPreq; +unsigned long secondTick; +bool dst = false; +int minTmp; + + +const char *ssid = ""; +const char *password = ""; + +long utcOffsetInSeconds = 3600*utc; + +// /header.html +const char data_header_html[] PROGMEM = {0X3C,0X68,0X74,0X6D,0X6C,0X3E,0X3C,0X68,0X65,0X61,0X64,0X3E,0X3C,0X6D,0X65,0X74,0X61,0X20,0X6E,0X61,0X6D,0X65,0X3D,0X76,0X69,0X65,0X77,0X70,0X6F,0X72,0X74,0X20,0X63,0X6F,0X6E,0X74,0X65,0X6E,0X74,0X3D,0X22,0X77,0X69,0X64,0X74,0X68,0X3D,0X64,0X65,0X76,0X69,0X63,0X65,0X2D,0X77,0X69,0X64,0X74,0X68,0X2C,0X69,0X6E,0X69,0X74,0X69,0X61,0X6C,0X2D,0X73,0X63,0X61,0X6C,0X65,0X3D,0X31,0X22,0X3E,0X3C,0X6D,0X65,0X74,0X61,0X20,0X63,0X68,0X61,0X72,0X73,0X65,0X74,0X3D,0X75,0X74,0X66,0X2D,0X38,0X3E,0X3C,0X73,0X74,0X79,0X6C,0X65,0X3E,0X62,0X6F,0X64,0X79,0X7B,0X66,0X6F,0X6E,0X74,0X2D,0X73,0X69,0X7A,0X65,0X3A,0X31,0X34,0X30,0X25,0X7D,0X23,0X6D,0X61,0X69,0X6E,0X7B,0X64,0X69,0X73,0X70,0X6C,0X61,0X79,0X3A,0X74,0X61,0X62,0X6C,0X65,0X3B,0X6D,0X61,0X72,0X67,0X69,0X6E,0X3A,0X61,0X75,0X74,0X6F,0X3B,0X70,0X61,0X64,0X64,0X69,0X6E,0X67,0X3A,0X30,0X20,0X31,0X30,0X70,0X78,0X20,0X30,0X20,0X31,0X30,0X70,0X78,0X7D,0X2C,0X68,0X32,0X7B,0X74,0X65,0X78,0X74,0X2D,0X61,0X6C,0X69,0X67,0X6E,0X3A,0X63,0X65,0X6E,0X74,0X65,0X72,0X7D,0X2E,0X62,0X75,0X74,0X74,0X6F,0X6E,0X7B,0X70,0X61,0X64,0X64,0X69,0X6E,0X67,0X3A,0X31,0X30,0X70,0X78,0X20,0X31,0X30,0X70,0X78,0X20,0X31,0X30,0X70,0X78,0X20,0X31,0X30,0X70,0X78,0X3B,0X77,0X69,0X64,0X74,0X68,0X3A,0X31,0X30,0X30,0X25,0X3B,0X62,0X61,0X63,0X6B,0X67,0X72,0X6F,0X75,0X6E,0X64,0X2D,0X63,0X6F,0X6C,0X6F,0X72,0X3A,0X23,0X34,0X43,0X41,0X46,0X35,0X30,0X3B,0X66,0X6F,0X6E,0X74,0X2D,0X73,0X69,0X7A,0X65,0X3A,0X31,0X32,0X30,0X25,0X7D,0X3C,0X2F,0X73,0X74,0X79,0X6C,0X65,0X3E,0X3C,0X74,0X69,0X74,0X6C,0X65,0X3E,0X56,0X46,0X44,0X20,0X43,0X6c,0X6f,0X63,0X6b,0X20,0X43,0X6f,0X6e,0X74,0X72,0X6f,0X6c,0X3C,0X2F,0X74,0X69,0X74,0X6C,0X65,0X3E,0X3C,0X2F,0X68,0X65,0X61,0X64,0X3E,0X3C,0X62,0X6F,0X64,0X79,0X3E,0X3C,0X64,0X69,0X76,0X20,0X69,0X64,0X3D,0X6D,0X61,0X69,0X6E,0X3E,0X3C,0X68,0X32,0x20,0x61,0x6c,0x69,0x67,0x6e,0x3d,0x22,0x63,0x65,0x6e,0x74,0x65,0x72,0x22,0X3E,0X56,0X46,0X44,0X20,0X43,0X6c,0X6f,0X63,0X6b,0X20,0X43,0X6f,0X6e,0X74,0X72,0X6f,0X6c,0X3C,0X2F,0X68,0X32,0X3E,0XA,0X3C,0X62,0X72,0X3E,0XA,0X3C,0X63,0X65,0X6E,0X74,0X65,0X72,0X3E,0X0A,0X00}; + +// /footer.html +const char data_footer_html[] PROGMEM = {0x3c,0x2f,0x63,0x65,0x6e,0x74,0x65,0x72,0x3e,0X3c,0X2f,0X62,0X6f,0X64,0X79,0X3e,0X0a,0X3c,0X2f,0X68,0X74,0X6d,0X6c,0X3e,0X0a,0x00}; -const char *ssid = "SSID"; -const char *password = "PASSWORD"; +// /body.html +const char data_body_html[] PROGMEM = {0X3C,0X66,0X6F,0X72,0X6D,0X20,0X61,0X63,0X74,0X69,0X6F,0X6E,0X3D,0X2F,0X20,0X6D,0X65,0X74,0X68,0X6F,0X64,0X3D,0X50,0X4F,0X53,0X54,0X3E,0XA,0X53,0X65,0X6C,0X65,0X63,0X74,0X20,0X79,0X6F,0X75,0X72,0X20,0X74,0X69,0X6D,0X65,0X7A,0X6F,0X6E,0X65,0X3A,0XA,0X3C,0X73,0X65,0X6C,0X65,0X63,0X74,0X20,0X6E,0X61,0X6D,0X65,0X3D,0X75,0X74,0X63,0X20,0X69,0X64,0X3D,0X75,0X74,0X63,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X31,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X31,0X32,0X3A,0X30,0X30,0X29,0X20,0X49,0X6E,0X74,0X65,0X72,0X6E,0X61,0X74,0X69,0X6F,0X6E,0X61,0X6C,0X20,0X44,0X61,0X74,0X65,0X20,0X4C,0X69,0X6E,0X65,0X20,0X57,0X65,0X73,0X74,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X31,0X31,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X31,0X31,0X3A,0X30,0X30,0X29,0X20,0X4D,0X69,0X64,0X77,0X61,0X79,0X20,0X49,0X73,0X6C,0X61,0X6E,0X64,0X2C,0X20,0X53,0X61,0X6D,0X6F,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X31,0X30,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X31,0X30,0X3A,0X30,0X30,0X29,0X20,0X48,0X61,0X77,0X61,0X69,0X69,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X39,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X39,0X3A,0X30,0X30,0X29,0X20,0X41,0X6C,0X61,0X73,0X6B,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X38,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X38,0X3A,0X30,0X30,0X29,0X20,0X50,0X61,0X63,0X69,0X66,0X69,0X63,0X20,0X54,0X69,0X6D,0X65,0X20,0X28,0X55,0X53,0X20,0X26,0X20,0X43,0X61,0X6E,0X61,0X64,0X61,0X29,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X38,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X38,0X3A,0X30,0X30,0X29,0X20,0X54,0X69,0X6A,0X75,0X61,0X6E,0X61,0X2C,0X20,0X42,0X61,0X6A,0X61,0X20,0X43,0X61,0X6C,0X69,0X66,0X6F,0X72,0X6E,0X69,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X37,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X37,0X3A,0X30,0X30,0X29,0X20,0X41,0X72,0X69,0X7A,0X6F,0X6E,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X37,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X37,0X3A,0X30,0X30,0X29,0X20,0X43,0X68,0X69,0X68,0X75,0X61,0X68,0X75,0X61,0X2C,0X20,0X4C,0X61,0X20,0X50,0X61,0X7A,0X2C,0X20,0X4D,0X61,0X7A,0X61,0X74,0X6C,0X61,0X6E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X37,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X37,0X3A,0X30,0X30,0X29,0X20,0X4D,0X6F,0X75,0X6E,0X74,0X61,0X69,0X6E,0X20,0X54,0X69,0X6D,0X65,0X20,0X28,0X55,0X53,0X20,0X26,0X20,0X43,0X61,0X6E,0X61,0X64,0X61,0X29,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X36,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X36,0X3A,0X30,0X30,0X29,0X20,0X43,0X65,0X6E,0X74,0X72,0X61,0X6C,0X20,0X41,0X6D,0X65,0X72,0X69,0X63,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X36,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X36,0X3A,0X30,0X30,0X29,0X20,0X43,0X65,0X6E,0X74,0X72,0X61,0X6C,0X20,0X54,0X69,0X6D,0X65,0X20,0X28,0X55,0X53,0X20,0X26,0X20,0X43,0X61,0X6E,0X61,0X64,0X61,0X29,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X36,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X36,0X3A,0X30,0X30,0X29,0X20,0X47,0X75,0X61,0X64,0X61,0X6C,0X61,0X6A,0X61,0X72,0X61,0X2C,0X20,0X4D,0X65,0X78,0X69,0X63,0X6F,0X20,0X43,0X69,0X74,0X79,0X2C,0X20,0X4D,0X6F,0X6E,0X74,0X65,0X72,0X72,0X65,0X79,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X36,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X36,0X3A,0X30,0X30,0X29,0X20,0X53,0X61,0X73,0X6B,0X61,0X74,0X63,0X68,0X65,0X77,0X61,0X6E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X35,0X3A,0X30,0X30,0X29,0X20,0X42,0X6F,0X67,0X6F,0X74,0X61,0X2C,0X20,0X4C,0X69,0X6D,0X61,0X2C,0X20,0X51,0X75,0X69,0X74,0X6F,0X2C,0X20,0X52,0X69,0X6F,0X20,0X42,0X72,0X61,0X6E,0X63,0X6F,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X35,0X3A,0X30,0X30,0X29,0X20,0X45,0X61,0X73,0X74,0X65,0X72,0X6E,0X20,0X54,0X69,0X6D,0X65,0X20,0X28,0X55,0X53,0X20,0X26,0X20,0X43,0X61,0X6E,0X61,0X64,0X61,0X29,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X35,0X3A,0X30,0X30,0X29,0X20,0X49,0X6E,0X64,0X69,0X61,0X6E,0X61,0X20,0X28,0X45,0X61,0X73,0X74,0X29,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X34,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X34,0X3A,0X30,0X30,0X29,0X20,0X41,0X74,0X6C,0X61,0X6E,0X74,0X69,0X63,0X20,0X54,0X69,0X6D,0X65,0X20,0X28,0X43,0X61,0X6E,0X61,0X64,0X61,0X29,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X34,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X34,0X3A,0X30,0X30,0X29,0X20,0X43,0X61,0X72,0X61,0X63,0X61,0X73,0X2C,0X20,0X4C,0X61,0X20,0X50,0X61,0X7A,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X34,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X34,0X3A,0X30,0X30,0X29,0X20,0X4D,0X61,0X6E,0X61,0X75,0X73,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X34,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X34,0X3A,0X30,0X30,0X29,0X20,0X53,0X61,0X6E,0X74,0X69,0X61,0X67,0X6F,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X33,0X2E,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X33,0X3A,0X33,0X30,0X29,0X20,0X4E,0X65,0X77,0X66,0X6F,0X75,0X6E,0X64,0X6C,0X61,0X6E,0X64,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X33,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X33,0X3A,0X30,0X30,0X29,0X20,0X42,0X72,0X61,0X73,0X69,0X6C,0X69,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X33,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X33,0X3A,0X30,0X30,0X29,0X20,0X42,0X75,0X65,0X6E,0X6F,0X73,0X20,0X41,0X69,0X72,0X65,0X73,0X2C,0X20,0X47,0X65,0X6F,0X72,0X67,0X65,0X74,0X6F,0X77,0X6E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X33,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X33,0X3A,0X30,0X30,0X29,0X20,0X47,0X72,0X65,0X65,0X6E,0X6C,0X61,0X6E,0X64,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X33,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X33,0X3A,0X30,0X30,0X29,0X20,0X4D,0X6F,0X6E,0X74,0X65,0X76,0X69,0X64,0X65,0X6F,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X32,0X3A,0X30,0X30,0X29,0X20,0X4D,0X69,0X64,0X2D,0X41,0X74,0X6C,0X61,0X6E,0X74,0X69,0X63,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X31,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X31,0X3A,0X30,0X30,0X29,0X20,0X43,0X61,0X70,0X65,0X20,0X56,0X65,0X72,0X64,0X65,0X20,0X49,0X73,0X2E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X2D,0X31,0X3E,0X28,0X47,0X4D,0X54,0X2D,0X30,0X31,0X3A,0X30,0X30,0X29,0X20,0X41,0X7A,0X6F,0X72,0X65,0X73,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X30,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X30,0X3A,0X30,0X30,0X29,0X20,0X43,0X61,0X73,0X61,0X62,0X6C,0X61,0X6E,0X63,0X61,0X2C,0X20,0X4D,0X6F,0X6E,0X72,0X6F,0X76,0X69,0X61,0X2C,0X20,0X52,0X65,0X79,0X6B,0X6A,0X61,0X76,0X69,0X6B,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X30,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X30,0X3A,0X30,0X30,0X29,0X20,0X47,0X72,0X65,0X65,0X6E,0X77,0X69,0X63,0X68,0X20,0X4D,0X65,0X61,0X6E,0X20,0X54,0X69,0X6D,0X65,0X20,0X3A,0X20,0X44,0X75,0X62,0X6C,0X69,0X6E,0X2C,0X20,0X45,0X64,0X69,0X6E,0X62,0X75,0X72,0X67,0X68,0X2C,0X20,0X4C,0X69,0X73,0X62,0X6F,0X6E,0X2C,0X20,0X4C,0X6F,0X6E,0X64,0X6F,0X6E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X31,0X3A,0X30,0X30,0X29,0X20,0X41,0X6D,0X73,0X74,0X65,0X72,0X64,0X61,0X6D,0X2C,0X20,0X42,0X65,0X72,0X6C,0X69,0X6E,0X2C,0X20,0X42,0X65,0X72,0X6E,0X2C,0X20,0X52,0X6F,0X6D,0X65,0X2C,0X20,0X53,0X74,0X6F,0X63,0X6B,0X68,0X6F,0X6C,0X6D,0X2C,0X20,0X56,0X69,0X65,0X6E,0X6E,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X31,0X3A,0X30,0X30,0X29,0X20,0X42,0X65,0X6C,0X67,0X72,0X61,0X64,0X65,0X2C,0X20,0X42,0X72,0X61,0X74,0X69,0X73,0X6C,0X61,0X76,0X61,0X2C,0X20,0X42,0X75,0X64,0X61,0X70,0X65,0X73,0X74,0X2C,0X20,0X4C,0X6A,0X75,0X62,0X6C,0X6A,0X61,0X6E,0X61,0X2C,0X20,0X50,0X72,0X61,0X67,0X75,0X65,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X31,0X3A,0X30,0X30,0X29,0X20,0X42,0X72,0X75,0X73,0X73,0X65,0X6C,0X73,0X2C,0X20,0X43,0X6F,0X70,0X65,0X6E,0X68,0X61,0X67,0X65,0X6E,0X2C,0X20,0X4D,0X61,0X64,0X72,0X69,0X64,0X2C,0X20,0X50,0X61,0X72,0X69,0X73,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X31,0X3A,0X30,0X30,0X29,0X20,0X53,0X61,0X72,0X61,0X6A,0X65,0X76,0X6F,0X2C,0X20,0X53,0X6B,0X6F,0X70,0X6A,0X65,0X2C,0X20,0X57,0X61,0X72,0X73,0X61,0X77,0X2C,0X20,0X5A,0X61,0X67,0X72,0X65,0X62,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X31,0X3A,0X30,0X30,0X29,0X20,0X57,0X65,0X73,0X74,0X20,0X43,0X65,0X6E,0X74,0X72,0X61,0X6C,0X20,0X41,0X66,0X72,0X69,0X63,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X32,0X3A,0X30,0X30,0X29,0X20,0X41,0X6D,0X6D,0X61,0X6E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X32,0X3A,0X30,0X30,0X29,0X20,0X41,0X74,0X68,0X65,0X6E,0X73,0X2C,0X20,0X42,0X75,0X63,0X68,0X61,0X72,0X65,0X73,0X74,0X2C,0X20,0X49,0X73,0X74,0X61,0X6E,0X62,0X75,0X6C,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X32,0X3A,0X30,0X30,0X29,0X20,0X42,0X65,0X69,0X72,0X75,0X74,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X32,0X3A,0X30,0X30,0X29,0X20,0X43,0X61,0X69,0X72,0X6F,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X32,0X3A,0X30,0X30,0X29,0X20,0X48,0X61,0X72,0X61,0X72,0X65,0X2C,0X20,0X50,0X72,0X65,0X74,0X6F,0X72,0X69,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X32,0X3A,0X30,0X30,0X29,0X20,0X48,0X65,0X6C,0X73,0X69,0X6E,0X6B,0X69,0X2C,0X20,0X4B,0X79,0X69,0X76,0X2C,0X20,0X52,0X69,0X67,0X61,0X2C,0X20,0X53,0X6F,0X66,0X69,0X61,0X2C,0X20,0X54,0X61,0X6C,0X6C,0X69,0X6E,0X6E,0X2C,0X20,0X56,0X69,0X6C,0X6E,0X69,0X75,0X73,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X32,0X3A,0X30,0X30,0X29,0X20,0X4A,0X65,0X72,0X75,0X73,0X61,0X6C,0X65,0X6D,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X32,0X3A,0X30,0X30,0X29,0X20,0X4D,0X69,0X6E,0X73,0X6B,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X32,0X3A,0X30,0X30,0X29,0X20,0X57,0X69,0X6E,0X64,0X68,0X6F,0X65,0X6B,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X33,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X33,0X3A,0X30,0X30,0X29,0X20,0X4B,0X75,0X77,0X61,0X69,0X74,0X2C,0X20,0X52,0X69,0X79,0X61,0X64,0X68,0X2C,0X20,0X42,0X61,0X67,0X68,0X64,0X61,0X64,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X33,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X33,0X3A,0X30,0X30,0X29,0X20,0X4D,0X6F,0X73,0X63,0X6F,0X77,0X2C,0X20,0X53,0X74,0X2E,0X20,0X50,0X65,0X74,0X65,0X72,0X73,0X62,0X75,0X72,0X67,0X2C,0X20,0X56,0X6F,0X6C,0X67,0X6F,0X67,0X72,0X61,0X64,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X33,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X33,0X3A,0X30,0X30,0X29,0X20,0X4E,0X61,0X69,0X72,0X6F,0X62,0X69,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X33,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X33,0X3A,0X30,0X30,0X29,0X20,0X54,0X62,0X69,0X6C,0X69,0X73,0X69,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X33,0X2E,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X33,0X3A,0X33,0X30,0X29,0X20,0X54,0X65,0X68,0X72,0X61,0X6E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X34,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X34,0X3A,0X30,0X30,0X29,0X20,0X41,0X62,0X75,0X20,0X44,0X68,0X61,0X62,0X69,0X2C,0X20,0X4D,0X75,0X73,0X63,0X61,0X74,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X34,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X34,0X3A,0X30,0X30,0X29,0X20,0X42,0X61,0X6B,0X75,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X34,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X34,0X3A,0X30,0X30,0X29,0X20,0X59,0X65,0X72,0X65,0X76,0X61,0X6E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X34,0X2E,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X34,0X3A,0X33,0X30,0X29,0X20,0X4B,0X61,0X62,0X75,0X6C,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X35,0X3A,0X30,0X30,0X29,0X20,0X59,0X65,0X6B,0X61,0X74,0X65,0X72,0X69,0X6E,0X62,0X75,0X72,0X67,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X35,0X3A,0X30,0X30,0X29,0X20,0X49,0X73,0X6C,0X61,0X6D,0X61,0X62,0X61,0X64,0X2C,0X20,0X4B,0X61,0X72,0X61,0X63,0X68,0X69,0X2C,0X20,0X54,0X61,0X73,0X68,0X6B,0X65,0X6E,0X74,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X35,0X2E,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X35,0X3A,0X33,0X30,0X29,0X20,0X53,0X72,0X69,0X20,0X4A,0X61,0X79,0X61,0X77,0X61,0X72,0X64,0X65,0X6E,0X61,0X70,0X75,0X72,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X35,0X2E,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X35,0X3A,0X33,0X30,0X29,0X20,0X43,0X68,0X65,0X6E,0X6E,0X61,0X69,0X2C,0X20,0X4B,0X6F,0X6C,0X6B,0X61,0X74,0X61,0X2C,0X20,0X4D,0X75,0X6D,0X62,0X61,0X69,0X2C,0X20,0X4E,0X65,0X77,0X20,0X44,0X65,0X6C,0X68,0X69,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X35,0X2E,0X37,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X35,0X3A,0X34,0X35,0X29,0X20,0X4B,0X61,0X74,0X68,0X6D,0X61,0X6E,0X64,0X75,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X36,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X36,0X3A,0X30,0X30,0X29,0X20,0X41,0X6C,0X6D,0X61,0X74,0X79,0X2C,0X20,0X4E,0X6F,0X76,0X6F,0X73,0X69,0X62,0X69,0X72,0X73,0X6B,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X36,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X36,0X3A,0X30,0X30,0X29,0X20,0X41,0X73,0X74,0X61,0X6E,0X61,0X2C,0X20,0X44,0X68,0X61,0X6B,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X36,0X2E,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X36,0X3A,0X33,0X30,0X29,0X20,0X59,0X61,0X6E,0X67,0X6F,0X6E,0X20,0X28,0X52,0X61,0X6E,0X67,0X6F,0X6F,0X6E,0X29,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X37,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X37,0X3A,0X30,0X30,0X29,0X20,0X42,0X61,0X6E,0X67,0X6B,0X6F,0X6B,0X2C,0X20,0X48,0X61,0X6E,0X6F,0X69,0X2C,0X20,0X4A,0X61,0X6B,0X61,0X72,0X74,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X37,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X37,0X3A,0X30,0X30,0X29,0X20,0X4B,0X72,0X61,0X73,0X6E,0X6F,0X79,0X61,0X72,0X73,0X6B,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X38,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X38,0X3A,0X30,0X30,0X29,0X20,0X42,0X65,0X69,0X6A,0X69,0X6E,0X67,0X2C,0X20,0X43,0X68,0X6F,0X6E,0X67,0X71,0X69,0X6E,0X67,0X2C,0X20,0X48,0X6F,0X6E,0X67,0X20,0X4B,0X6F,0X6E,0X67,0X2C,0X20,0X55,0X72,0X75,0X6D,0X71,0X69,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X38,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X38,0X3A,0X30,0X30,0X29,0X20,0X4B,0X75,0X61,0X6C,0X61,0X20,0X4C,0X75,0X6D,0X70,0X75,0X72,0X2C,0X20,0X53,0X69,0X6E,0X67,0X61,0X70,0X6F,0X72,0X65,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X38,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X38,0X3A,0X30,0X30,0X29,0X20,0X49,0X72,0X6B,0X75,0X74,0X73,0X6B,0X2C,0X20,0X55,0X6C,0X61,0X61,0X6E,0X20,0X42,0X61,0X74,0X61,0X61,0X72,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X38,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X38,0X3A,0X30,0X30,0X29,0X20,0X50,0X65,0X72,0X74,0X68,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X38,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X38,0X3A,0X30,0X30,0X29,0X20,0X54,0X61,0X69,0X70,0X65,0X69,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X39,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X39,0X3A,0X30,0X30,0X29,0X20,0X4F,0X73,0X61,0X6B,0X61,0X2C,0X20,0X53,0X61,0X70,0X70,0X6F,0X72,0X6F,0X2C,0X20,0X54,0X6F,0X6B,0X79,0X6F,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X39,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X39,0X3A,0X30,0X30,0X29,0X20,0X53,0X65,0X6F,0X75,0X6C,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X39,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X39,0X3A,0X30,0X30,0X29,0X20,0X59,0X61,0X6B,0X75,0X74,0X73,0X6B,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X39,0X2E,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X39,0X3A,0X33,0X30,0X29,0X20,0X41,0X64,0X65,0X6C,0X61,0X69,0X64,0X65,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X39,0X2E,0X35,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X30,0X39,0X3A,0X33,0X30,0X29,0X20,0X44,0X61,0X72,0X77,0X69,0X6E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X30,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X31,0X30,0X3A,0X30,0X30,0X29,0X20,0X42,0X72,0X69,0X73,0X62,0X61,0X6E,0X65,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X30,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X31,0X30,0X3A,0X30,0X30,0X29,0X20,0X43,0X61,0X6E,0X62,0X65,0X72,0X72,0X61,0X2C,0X20,0X4D,0X65,0X6C,0X62,0X6F,0X75,0X72,0X6E,0X65,0X2C,0X20,0X53,0X79,0X64,0X6E,0X65,0X79,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X30,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X31,0X30,0X3A,0X30,0X30,0X29,0X20,0X48,0X6F,0X62,0X61,0X72,0X74,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X30,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X31,0X30,0X3A,0X30,0X30,0X29,0X20,0X47,0X75,0X61,0X6D,0X2C,0X20,0X50,0X6F,0X72,0X74,0X20,0X4D,0X6F,0X72,0X65,0X73,0X62,0X79,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X30,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X31,0X30,0X3A,0X30,0X30,0X29,0X20,0X56,0X6C,0X61,0X64,0X69,0X76,0X6F,0X73,0X74,0X6F,0X6B,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X31,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X31,0X31,0X3A,0X30,0X30,0X29,0X20,0X4D,0X61,0X67,0X61,0X64,0X61,0X6E,0X2C,0X20,0X53,0X6F,0X6C,0X6F,0X6D,0X6F,0X6E,0X20,0X49,0X73,0X2E,0X2C,0X20,0X4E,0X65,0X77,0X20,0X43,0X61,0X6C,0X65,0X64,0X6F,0X6E,0X69,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X31,0X32,0X3A,0X30,0X30,0X29,0X20,0X41,0X75,0X63,0X6B,0X6C,0X61,0X6E,0X64,0X2C,0X20,0X57,0X65,0X6C,0X6C,0X69,0X6E,0X67,0X74,0X6F,0X6E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X32,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X31,0X32,0X3A,0X30,0X30,0X29,0X20,0X46,0X69,0X6A,0X69,0X2C,0X20,0X4B,0X61,0X6D,0X63,0X68,0X61,0X74,0X6B,0X61,0X2C,0X20,0X4D,0X61,0X72,0X73,0X68,0X61,0X6C,0X6C,0X20,0X49,0X73,0X2E,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X31,0X33,0X3E,0X28,0X47,0X4D,0X54,0X2B,0X31,0X33,0X3A,0X30,0X30,0X29,0X20,0X4E,0X75,0X6B,0X75,0X27,0X61,0X6C,0X6F,0X66,0X61,0X3C,0X2F,0X6F,0X70,0X74,0X69,0X6F,0X6E,0X3E,0XA,0X3C,0X2F,0X73,0X65,0X6C,0X65,0X63,0X74,0X3E,0XA,0X3C,0X62,0X72,0X3E,0X3C,0X69,0X6E,0X70,0X75,0X74,0X20,0X74,0X79,0X70,0X65,0X3D,0X73,0X75,0X62,0X6D,0X69,0X74,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X53,0X75,0X62,0X6D,0X69,0X74,0X3E,0XA,0X3C,0X2F,0X66,0X6F,0X72,0X6D,0X3E,0XA,0x00}; -const long utcOffsetInSeconds = 3600*-5; +WiFiManager wifiManager; +WiFiServer server(80); WiFiUDP ntpUDP; -NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds); -Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); +NTPClient timeClient(ntpUDP, "pool.ntp.org"); -//arduino -//const int dataPin = 13; //Outputs the byte to transfer -//const int loadPin = 11; //3 //Controls the internal transference of data in SN74HC595 internal registers -//const int clockPin = 12; // 4//Generates the clock signal to control the transference of data +Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); -//nodeMCU -//const int dataPin = 14; //Outputs the byte to transfer -//const int loadPin = 0; //3 //Controls the internal transference of data in SN74HC595 internal registers -//const int clockPin = 4; // 4//Generates the clock signal to control the transference of data +String header = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"; +String request = ""; //wemos const int dataPin = 14; //D5 //Outputs the byte to transfer @@ -61,6 +83,10 @@ byte digits[10] { void setup() { Serial.begin(115200); + EEPROM.begin(512); + //utc = int(EEPROM.read(0)); + EEPROM.get(0,utc); + EEPROM.end(); pinMode(dataPin, OUTPUT); pinMode(loadPin, OUTPUT); @@ -74,42 +100,52 @@ void setup() { shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); digitalWrite(loadPin, 1); - WiFi.begin(ssid, password); - int i=0; - int b=0; - while ( WiFi.status() != WL_CONNECTED ) { - delay ( 500 ); - digitalWrite(loadPin, 0); - shiftOut(dataPin, clockPin, LSBFIRST, digits[i]); //right - shiftOut(dataPin, clockPin, LSBFIRST, digits[b]); //left - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); - digitalWrite(loadPin, 1); - i++; - if (i==10) { - i=0; - b++; - } - if (b==9 && i==9) { - digitalWrite(loadPin, 0); - shiftOut(dataPin, clockPin, LSBFIRST, 0b00000001); //right - shiftOut(dataPin, clockPin, LSBFIRST, 0b00001011); //right - shiftOut(dataPin, clockPin, LSBFIRST, 0b00111010); //00111111 - shiftOut(dataPin, clockPin, LSBFIRST, 0b00001010); //right - shiftOut(dataPin, clockPin, LSBFIRST, 0b00001010); //right - shiftOut(dataPin, clockPin, LSBFIRST, 0b10011110); //left - digitalWrite(loadPin, 1); - delay(10000); - i=0; - b=0; - } - } - timeClient.begin(); strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) strip.show(); // Turn OFF all pixels ASAP strip.setBrightness(25); // Set BRIGHTNESS to about 1/5 (max = 255) + for (int b=0; b<6; b++) { + strip.setPixelColor(b,255,0,0); + } + strip.show(); + for (int b=0; b<3; b++) { + chase(); + } + + WiFi.hostname("VFD-Clock"); + wifiManager.setHostname("VFD-Clock"); + int i=0; + wifiManager.autoConnect("VFD WiFi Manager"); + + timeClient.begin(); + server.begin(); + timeClient.update(); + timeClient.setUpdateInterval(86400000); + + utcOffsetInSeconds = 3600*utc; + timeClient.setTimeOffset(utcOffsetInSeconds); + setTime(timeClient.getEpochTime()); + + //US DST CALC + if(month() == 11 && day() < 8 && day() < weekday()) { + dst=true; + } + if(month() == 11 && day() < 8 && weekday() == 1 && hour() < 1) { + dst=true; + } + + if(month() < 11 && month() > 3) dst = true; + + if(month() == 3 && day() > 7 && day() >= (weekday() + 7)) { + if(!(weekday() == 1 && hour() < 2)) dst = true; + } + + if(dst) utcOffsetInSeconds += 3600UL; + + + timeClient.setTimeOffset(utcOffsetInSeconds); + setTime(timeClient.getEpochTime()); + timeout=millis()+5000; + secondTick=millis()+1000; } void chase() { @@ -197,49 +233,147 @@ uint8_t hsl_convert(float c, float t1, float t2) { } void loop() { - timeClient.update(); + WiFiClient client = server.available(); unsigned int b=0; - unsigned int Hour = timeClient.getHours(); - unsigned int Minute = timeClient.getMinutes(); - unsigned int Seconds = timeClient.getSeconds(); - digitalWrite(loadPin, 0); - shiftOut(dataPin, clockPin, LSBFIRST, 0b000000000000000000000000000000000000000000000000); - digitalWrite(loadPin, 1); - chase(); - while (Seconds<60) { - Hour1 = (Hour/10U) % 10; - Hour2 = (Hour/1U) % 10; - Minute1 = (Minute/10U) % 10; - Minute2 = (Minute/1U) % 10; - Second1 = (Seconds/10U) % 10; - Second2 = (Seconds/1U) % 10; - unsigned int pause = 1000; - for (b=0; b<6; b++) { - strip.setPixelColor(b, hsl(PColor, saturation, lightness)); - strip.show(); - } - PColor++; - if (PColor>360) { - PColor=0; - } + if (client) { // if !available yet, we return to this client in next loop + char line[64]; + int l = client.readBytesUntil('\n', line, sizeof(line)); + line[l] = 0; + client.find((char*) "\r\n\r\n"); + if (strncmp_P(line, PSTR("POST"), strlen("POST")) == 0) { + l = client.readBytes(line, sizeof(line)); + line[l] = 0; + + // parse the parameters sent by the html form + const char* delims = "="; //was =& + strtok(line, delims); + const char* value = strtok(NULL, delims); + //strtok(NULL, delims); + //const char* pass = strtok(NULL, delims); + + // send a response before attemting to connect to the WiFi network + // because it will reset the SoftAP and disconnect the client station + client.println(F("HTTP/1.1 200 OK")); + client.println(F("Connection: close")); + client.println(F("Refresh: 1")); + client.println(); + client.println(F("

Applying configuration


please wait...")); + client.stop(); - if (Second2==0) { - casino(); - pause=500; + utc=atoi(value); + utcOffsetInSeconds = 3600*utc; + + //US DST CALC + if(month() == 11 && day() < 8 && day() < weekday()) { + dst=true; + } + if(month() == 11 && day() < 8 && weekday() == 1 && hour() < 1) { + dst=true; + } + + if(month() < 11 && month() > 3) dst = true; + + if(month() == 3 && day() > 7 && day() >= (weekday() + 7)) { + if(!(weekday() == 1 && hour() < 2)) dst = true; + } + + if(dst) utcOffsetInSeconds += 3600UL; + + timeClient.update(); + timeClient.setTimeOffset(utcOffsetInSeconds); + setTime(timeClient.getEpochTime()); + EEPROM.begin(512); + EEPROM.put(0, utc); + //EEPROM.update(0, utc); + //EEPROM.commit(); + EEPROM.end(); + //setTime(timeClient.getEpochTime()+utcOffsetInSeconds); } else { - pause = 1000; + client.println(); + client.print(data_header_html); + client.print(F("Current GMT offset: ")); + client.println((utc)); + client.print(F("Current GMT offset in seconds: ")); + client.println((utcOffsetInSeconds)); + client.print(data_body_html); + client.println(); + client.print(data_footer_html); + client.stop(); + } + } else { + if (millis()>=secondTick) { + secondTick=millis()+1000; + for (b=0; b<6; b++) { + strip.setPixelColor(b, hsl(PColor, saturation, 0)); + } + PColor++; + if (PColor>360) { + PColor=0; + } + int secondd = (second()/1U) % 10; + int secondu = (second()/10U) % 10; + float percent = (float)secondd/10; + if (secondu==0) { + strip.setPixelColor(1, hsl(PColor, saturation, (float)((lightness*(1-percent))))); + strip.setPixelColor(0, hsl(PColor, saturation, (float)((lightness*percent)))); + } + if (secondu==1) { + strip.setPixelColor(0, hsl(PColor, saturation, (float)((lightness*(1-percent))))); + strip.setPixelColor(5, hsl(PColor, saturation, (float)((lightness*percent)))); + } + if (secondu==2) { + strip.setPixelColor(5, hsl(PColor, saturation, (float)((lightness*(1-percent))))); + strip.setPixelColor(4, hsl(PColor, saturation, (float)((lightness*percent)))); + } + if (secondu==3) { + strip.setPixelColor(4, hsl(PColor, saturation, (float)((lightness*(1-percent))))); + strip.setPixelColor(3, hsl(PColor, saturation, (float)((lightness*percent)))); + } + if (secondu==4) { + strip.setPixelColor(3, hsl(PColor, saturation, (float)((lightness*(1-percent))))); + strip.setPixelColor(2, hsl(PColor, saturation, (float)((lightness*percent)))); + } + if (secondu==5) { + strip.setPixelColor(1, hsl(PColor, saturation, (float)((lightness*percent)))); + strip.setPixelColor(2, hsl(PColor, saturation, (float)((lightness*(1-percent))))); + } + strip.show(); } - digitalWrite(loadPin, 0); - shiftOut(dataPin, clockPin, LSBFIRST, digits[Second2]); //right - shiftOut(dataPin, clockPin, LSBFIRST, digits[Second1]); //left - shiftOut(dataPin, clockPin, LSBFIRST, digits[Minute2]); //right - shiftOut(dataPin, clockPin, LSBFIRST, digits[Minute1]); //left - shiftOut(dataPin, clockPin, LSBFIRST, digits[Hour2]); //right - shiftOut(dataPin, clockPin, LSBFIRST, digits[Hour1]); //left - digitalWrite(loadPin, 1); - delay(pause); - Seconds = Seconds+1; + //if (millis()>=timeout) { + timeout=millis()+5000; + + unsigned int b=0; + int Hour = hour(); + int Minute = minute(); + int Seconds = second(); + int Hour1 = (Hour/10U) % 10; + int Hour2 = (Hour/1U) % 10; + int Minute1 = (Minute/10U) % 10; + int Minute2 = (Minute/1U) % 10; + int Second1 = (Seconds/10U) % 10; + int Second2 = (Seconds/1U) % 10; + + if (minTmp != Minute2) { + //chase(); + casino(); + } + minTmp = Minute2; + //digitalWrite(loadPin, 0); + //shiftOut(dataPin, clockPin, LSBFIRST, 0b000000000000000000000000000000000000000000000000); + //digitalWrite(loadPin, 1); + //if (Second2==0 && Second1==0) { + // casino(); + //} + digitalWrite(loadPin, 0); + shiftOut(dataPin, clockPin, LSBFIRST, digits[Second2]); //right + shiftOut(dataPin, clockPin, LSBFIRST, digits[Second1]); //left + shiftOut(dataPin, clockPin, LSBFIRST, digits[Minute2]); //right + shiftOut(dataPin, clockPin, LSBFIRST, digits[Minute1]); //left + shiftOut(dataPin, clockPin, LSBFIRST, digits[Hour2]); //right + shiftOut(dataPin, clockPin, LSBFIRST, digits[Hour1]); //left + digitalWrite(loadPin, 1); + //} } } -- 2.34.1