diff --git a/README.md b/README.md
index bff1dd7..3f70bd4 100644
--- a/README.md
+++ b/README.md
@@ -95,16 +95,16 @@ also set username and password inside `upload.py`, if you want to use OTA Update
Connect them like this and remember to set them in `include/constants.h` according to your board.
-| LCD | ESP32 | TTGO LoRa32 |
-| :----------------|:------:|:-----------:|
-| GND | GND | GND |
-| VCC | 5V | 5V |
-| EN | GPIO26 | IO22 |
-| IN | GPIO27 | IO23 |
-| CLK | GPIO14 | IO02 |
-| CLA | GPIO12 | IO15 |
-| BUTTON one end | GPIO16 | IO21 |
-| BUTTON other end | GND | GND |
+| LCD | ESP32 | TTGO LoRa32 | NodeMCUv2 |
+| :----------------|:------:|:-----------:|:---------:|
+| GND | GND | GND | GND |
+| VCC | 5V | 5V | VIN |
+| EN (PIN_ENABLE) | GPIO26 | IO22 | GPIO16 D0 |
+| IN (PIN_DATA) | GPIO27 | IO23 | GPIO5 D1 |
+| CLK (PIN_CLOCK) | GPIO14 | IO02 | GPIO4 D2 |
+| CLA (PIN_LATCH) | GPIO12 | IO15 | GPIO0 D3 |
+| BUTTON one end | GPIO16 | IO21 | GPIO2 D4 |
+| BUTTON other end | GND | GND | GND |
diff --git a/include/constants.h b/include/constants.h
index c80ff55..937e14d 100644
--- a/include/constants.h
+++ b/include/constants.h
@@ -1,11 +1,20 @@
#pragma once
+#ifdef ESP32
#define PIN_ENABLE 26
#define PIN_DATA 27
#define PIN_CLOCK 14
#define PIN_LATCH 12
#define PIN_BUTTON 16
+#endif
+#ifdef ESP8266
+#define PIN_ENABLE 16
+#define PIN_DATA 5
+#define PIN_CLOCK 4
+#define PIN_LATCH 0
+#define PIN_BUTTON 2
+#endif
// disable if you do not want to have online functionality
#define ENABLE_SERVER
diff --git a/include/mode/clock.h b/include/mode/clock.h
index fb12221..d94c01d 100644
--- a/include/mode/clock.h
+++ b/include/mode/clock.h
@@ -15,4 +15,9 @@ extern int previousHour;
void clockSetup();
void clockLoop();
+#ifndef ESP32
+bool getLocalTime(struct tm * info, uint32_t ms = 5000);
+#endif
+
+
#endif
diff --git a/include/mode/weather.h b/include/mode/weather.h
index eac2e3c..b263a46 100644
--- a/include/mode/weather.h
+++ b/include/mode/weather.h
@@ -2,7 +2,12 @@
#include "constants.h"
#include
+#ifdef ESP32
#include
+#endif
+#ifdef ESP8266
+#include
+#endif
#ifdef ENABLE_SERVER
diff --git a/platformio.ini b/platformio.ini
index 7de6c6a..207d773 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -12,10 +12,34 @@
platform = espressif32
board = esp32dev
framework = arduino
-lib_deps =
+lib_deps =
https://github.com/me-no-dev/ESPAsyncWebServer.git
bblanchon/ArduinoJson@^6.19.4
monitor_speed = 115200
; extra_scripts = upload.py
-; upload_protocol = custom
-; upload_url = http://192.168.178.101/update
\ No newline at end of file
+
+[env:esp01_1m]
+board = esp01_1m
+platform = espressif8266
+framework = arduino
+build_type = debug
+monitor_filters = esp8266_exception_decoder
+lib_deps =
+ https://github.com/me-no-dev/ESPAsyncWebServer.git
+ https://github.com/vshymanskyy/Preferences.git
+ bblanchon/ArduinoJson@^6.21.1
+monitor_speed = 115200
+
+[env:nodemcuv2]
+board = nodemcuv2
+platform = espressif8266
+framework = arduino
+build_type = debug
+monitor_filters = esp8266_exception_decoder
+lib_deps =
+ https://github.com/me-no-dev/ESPAsyncWebServer.git
+ https://github.com/vshymanskyy/Preferences.git
+ bblanchon/ArduinoJson@^6.21.1
+monitor_speed = 115200
+; change MCU frequency
+board_build.f_cpu = 80000000L
diff --git a/src/main.cpp b/src/main.cpp
index 8dda74c..4f0d9f9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,5 +1,12 @@
#include
+
+#ifdef ESP32
#include
+#endif
+
+#ifdef ESP8266
+#include
+#endif
#include "constants.h"
#include "mode/mode.h"
@@ -15,7 +22,7 @@ void setup()
Serial.begin(115200);
pinMode(PIN_LATCH, OUTPUT);
- pinMode(PIN_CLOCK, OUTPUT);
+ pinMode(PIN_CLOCK, OUTPUT);
pinMode(PIN_DATA, OUTPUT);
pinMode(PIN_ENABLE, OUTPUT);
pinMode(PIN_BUTTON, INPUT_PULLUP);
@@ -24,7 +31,9 @@ void setup()
#ifdef ENABLE_SERVER
// wifi
int attempts = 0;
+ #ifdef ESP32
WiFi.setHostname(WIFI_HOSTNAME);
+ #endif
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED && attempts < 7)
{
diff --git a/src/mode/clock.cpp b/src/mode/clock.cpp
index 3e7717e..ba3dddd 100644
--- a/src/mode/clock.cpp
+++ b/src/mode/clock.cpp
@@ -40,4 +40,21 @@ void clockLoop()
delay(60);
}
+#ifndef ESP32
+bool getLocalTime(struct tm * info, uint32_t ms)
+{
+ uint32_t start = millis();
+ time_t now;
+ while((millis()-start) <= ms) {
+ time(&now);
+ localtime_r(&now, info);
+ if(info->tm_year > (2016 - 1900)){
+ return true;
+ }
+ delay(10);
+ }
+ return false;
+}
+#endif
+
#endif