prepare for merge and minor esp8266 things
This commit is contained in:
parent
dd2c6b6117
commit
e3eb58cef1
@ -29,11 +29,15 @@
|
||||
Light Resistance (at 10 Lux): 5-10 Kohm
|
||||
Dark Resistance: 0.5 Mohm
|
||||
over a 56k voltage divider . Dark (0.5MOhm) , 10Lux (5-10kOhm)
|
||||
-----------------
|
||||
ESP8266 24LED
|
||||
5V--10k-+-LDR--GND -ADC
|
||||
- 150k--220k-+-100k--GND
|
||||
*/
|
||||
#ifdef ESP8266
|
||||
//#define LDR_PIN 4
|
||||
#define LDR_PIN A0
|
||||
#define IOTWEBCONF_DEBUG_DISABLED
|
||||
#define DATA_PIN 5 //DMA RDX0/GPIO3 | Uart1 TXD1/GPIO2 | UART0 GPIO1
|
||||
#define DATA_PIN D7 //DMA RDX0/GPIO3 | Uart1 TXD1/GPIO2 | UART0 GPIO1
|
||||
#elif defined(ESP32)
|
||||
#define LDR_PIN A6
|
||||
#define DATA_PIN 17
|
||||
@ -41,7 +45,7 @@
|
||||
#define NUM_LEDS 60
|
||||
#define SERIAL_BAUD 115200
|
||||
|
||||
//#define RGBW
|
||||
#define RGBW
|
||||
volatile bool singleSecond = true; //show seconds
|
||||
volatile bool allDotsOn = true; //lighten up all leds
|
||||
volatile bool followingHour = true; //move hour like an analog one
|
||||
@ -57,9 +61,10 @@ void brightnessAdjustmentCallback();
|
||||
#define LDR_SCALE 16
|
||||
#define colorSaturation 255
|
||||
#ifdef ESP8266
|
||||
NeoPixelBrightnessBus<NeoGrbwFeature, Neo800KbpsMethod> strip(NUM_LEDS);//RDX0 GPIO3
|
||||
//NeoPixelBrightnessBus<NeoGrbwFeature, Neo800KbpsMethod> strip(NUM_LEDS);//RDX0 GPIO3
|
||||
//NeoPixelBrightnessBus<NeoGrbwFeature, NeoEsp8266AsyncUart0Sk6812Method> strip(NUM_LEDS);
|
||||
//NeoPixelBrightnessBus<NeoGrbwFeature, NeoEsp8266Uart0Sk6812Method> strip(NUM_LEDS);
|
||||
NeoPixelBrightnessBus<NeoGrbwFeature, NeoEsp8266BitBang800KbpsMethod> strip(NUM_LEDS, DATA_PIN);
|
||||
#elif defined(ESP32)
|
||||
NeoPixelBrightnessBus<NeoGrbwFeature, NeoEsp32I2s1800KbpsMethod> strip(NUM_LEDS, DATA_PIN); //ESP32
|
||||
#endif
|
||||
@ -116,8 +121,13 @@ void transformHtmltoStrip(RgbwColor* outputColor, char* sInput) {
|
||||
#define MINIMAL_BRIGHTNESS 20
|
||||
#define LDR_SCALE 16
|
||||
#define colorSaturation 192
|
||||
//NeoPixelBrightnessBus<NeoGrbFeature, Neo800KbpsMethod> strip(NUM_LEDS, DATA_PIN); //ws2812B
|
||||
NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp32I2s1800KbpsMethod> strip(NUM_LEDS, DATA_PIN);
|
||||
#ifdef ESP8266
|
||||
//NeoPixelBrightnessBus<NeoGrbFeature, Neo800KbpsMethod> strip(NUM_LEDS);//RDX0 GPIO3 Broken due IoTWebConf
|
||||
NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart1800KbpsMethod> strip(NUM_LEDS);
|
||||
//NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266BitBang800KbpsMethod> strip(NUM_LEDS, DATA_PIN);
|
||||
#elif defined(ESP32)
|
||||
NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp32I2s1800KbpsMethod> strip(NUM_LEDS, DATA_PIN); //ESP32
|
||||
#endif
|
||||
RgbColor red(colorSaturation, 0, 0);
|
||||
RgbColor green(0, colorSaturation, 0);
|
||||
RgbColor blue(0, 0, colorSaturation);
|
||||
@ -483,7 +493,18 @@ void iotWebConf_Setup() {
|
||||
void syncNTP() {
|
||||
if (iotWebConf.getState() == IOTWEBCONF_STATE_ONLINE) {
|
||||
//init and get the time
|
||||
configTime(gmtOffset_sec, daylightOffset_sec, ntpServerParamValue);
|
||||
#ifdef ESP8266
|
||||
//sntp_servermode_dhcp(0);
|
||||
configTime(MYTZ, ntpServerParamValue);
|
||||
#endif
|
||||
#ifdef ESP32
|
||||
configTime(0, 0, ntpServer);
|
||||
// TZ string information: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
|
||||
setenv("TZ", "AEST-10", 1);
|
||||
tzset(); // save the TZ variable
|
||||
//setTimeZone(long offset, int daylight);
|
||||
//configTime(gmtOffset_sec, daylightOffset_sec, ntpServerParamValue);
|
||||
#endif
|
||||
Serial.println(printLocalTime());
|
||||
if (NTPreachable) {
|
||||
//inverted logic - remaining time
|
||||
@ -520,8 +541,8 @@ void setup() {
|
||||
Serial.println(WiFi.macAddress()); //Get CPU clock
|
||||
|
||||
strip.Begin();
|
||||
strip.SetBrightness( MINIMAL_BRIGHTNESS );
|
||||
strip.ClearTo(white);
|
||||
strip.SetBrightness( MINIMAL_BRIGHTNESS );
|
||||
strip.Show();
|
||||
|
||||
runner.init();
|
||||
@ -601,31 +622,33 @@ void clockTickCallback() {
|
||||
|
||||
void bootAnimCallback() {
|
||||
strip.ClearTo(black);
|
||||
int tail = -1;
|
||||
currentSec--;
|
||||
if (currentSec < 0) {
|
||||
currentSec = 59;
|
||||
currentSec = NUM_LEDS-1;
|
||||
tail = 1;
|
||||
}
|
||||
|
||||
if (iotWebConf.getState() == IOTWEBCONF_STATE_ONLINE && !NTPreachable) {
|
||||
strip.ClearTo(white);
|
||||
strip.SetPixelColor(MOD((currentSec - 0), NUM_LEDS), black);
|
||||
strip.SetPixelColor(MOD((currentSec - 1), NUM_LEDS), black);
|
||||
strip.SetPixelColor(MOD((currentSec - 2), NUM_LEDS), black);
|
||||
strip.SetPixelColor(MOD((currentSec - 1 * tail), NUM_LEDS), black);
|
||||
strip.SetPixelColor(MOD((currentSec - 2 * tail), NUM_LEDS), black);
|
||||
}
|
||||
if (iotWebConf.getState() == IOTWEBCONF_STATE_CONNECTING) {
|
||||
strip.SetPixelColor(MOD((currentSec - 0), NUM_LEDS), white);
|
||||
strip.SetPixelColor(MOD((currentSec - 1), NUM_LEDS), whiter);
|
||||
strip.SetPixelColor(MOD((currentSec - 2), NUM_LEDS), white12);
|
||||
strip.SetPixelColor(MOD((currentSec - 1 * tail), NUM_LEDS), whiter);
|
||||
strip.SetPixelColor(MOD((currentSec - 2 * tail), NUM_LEDS), white12);
|
||||
}
|
||||
if (iotWebConf.getState() == IOTWEBCONF_STATE_AP_MODE) {
|
||||
strip.SetPixelColor(MOD((currentSec - 0), NUM_LEDS), lightgreen);
|
||||
strip.SetPixelColor(MOD((currentSec - 1), NUM_LEDS), green);
|
||||
strip.SetPixelColor(MOD((currentSec - 2), NUM_LEDS), darkgreen);
|
||||
strip.SetPixelColor(MOD((currentSec - 1 * tail), NUM_LEDS), green);
|
||||
strip.SetPixelColor(MOD((currentSec - 2 * tail), NUM_LEDS), darkgreen);
|
||||
}
|
||||
if (iotWebConf.getState() == IOTWEBCONF_STATE_BOOT || iotWebConf.getState() == IOTWEBCONF_STATE_NOT_CONFIGURED) {
|
||||
strip.SetPixelColor(MOD((currentSec - 0), NUM_LEDS), orangered);
|
||||
strip.SetPixelColor(MOD((currentSec - 1), NUM_LEDS), red);
|
||||
strip.SetPixelColor(MOD((currentSec - 2), NUM_LEDS), darkred);
|
||||
strip.SetPixelColor(MOD((currentSec - 1 * tail), NUM_LEDS), red);
|
||||
strip.SetPixelColor(MOD((currentSec - 2 * tail), NUM_LEDS), darkred);
|
||||
}
|
||||
|
||||
strip.Show();
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user