Added ArduinoOTA
Fixed HSB slider changing to RGB unintentionally Fixed NTP on ESP32 Fixed countdown macro execution
This commit is contained in:
parent
31d84311d0
commit
3db38726ca
@ -13,6 +13,7 @@
|
|||||||
var fxa=false;
|
var fxa=false;
|
||||||
var psa=false;
|
var psa=false;
|
||||||
var uwv=false;
|
var uwv=false;
|
||||||
|
var firstload=true;
|
||||||
var lastsx = 0;
|
var lastsx = 0;
|
||||||
var nState = 0;
|
var nState = 0;
|
||||||
bCol = "DarkTurquoise";
|
bCol = "DarkTurquoise";
|
||||||
@ -61,7 +62,7 @@
|
|||||||
nState = 0;
|
nState = 0;
|
||||||
nState = (this.responseXML.getElementsByTagName('nr')[0].innerHTML)!=0?1:0;
|
nState = (this.responseXML.getElementsByTagName('nr')[0].innerHTML)!=0?1:0;
|
||||||
nState += (this.responseXML.getElementsByTagName('ns')[0].innerHTML)!=0?2:0;
|
nState += (this.responseXML.getElementsByTagName('ns')[0].innerHTML)!=0?2:0;
|
||||||
hsb = (this.responseXML.getElementsByTagName('md')[0].innerHTML)!=0?true:false;
|
if(firstload)hsb = (this.responseXML.getElementsByTagName('md')[0].innerHTML)!=0?true:false;
|
||||||
d.getElementsByClassName("desc")[0].innerHTML = this.responseXML.getElementsByTagName('desc')[0].innerHTML;
|
d.getElementsByClassName("desc")[0].innerHTML = this.responseXML.getElementsByTagName('desc')[0].innerHTML;
|
||||||
UV();
|
UV();
|
||||||
}
|
}
|
||||||
@ -71,6 +72,7 @@
|
|||||||
request.open("GET", "win/" +resp +nocache, true);
|
request.open("GET", "win/" +resp +nocache, true);
|
||||||
request.send(null);
|
request.send(null);
|
||||||
resp="";
|
resp="";
|
||||||
|
firstload=false;
|
||||||
}
|
}
|
||||||
function GetCheck()
|
function GetCheck()
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
Server description: <input name="DESC" maxlength="32"> <br>
|
Server description: <input name="DESC" maxlength="32"> <br>
|
||||||
Use HSB sliders instead of RGB by default: <input type="checkbox" name="COLMD"> <br>
|
Use HSB sliders instead of RGB by default: <input type="checkbox" name="COLMD"> <br>
|
||||||
<h3>LED setup</h3>
|
<h3>LED setup</h3>
|
||||||
LED count (max. 255): <input name="LEDCN" type="number" min="0" max="255" required> <br>
|
LED count (max. 255): <input name="LEDCN" type="number" min="1" max="255" required> <br>
|
||||||
<i>The default boot color is always saved in preset slot 0.</i><br>
|
<i>The default boot color is always saved in preset slot 0.</i><br>
|
||||||
Alternatively, apply preset <input name="BOOTP" type="number" min="0" max="25" required> at boot<br>
|
Alternatively, apply preset <input name="BOOTP" type="number" min="0" max="25" required> at boot<br>
|
||||||
Default RGB color:
|
Default RGB color:
|
||||||
|
File diff suppressed because one or more lines are too long
@ -60,7 +60,7 @@ AP IP: <span class="sip"> Not active </span> <br>
|
|||||||
Server description: <input name="DESC" maxlength="32"> <br>
|
Server description: <input name="DESC" maxlength="32"> <br>
|
||||||
Use HSB sliders instead of RGB by default: <input type="checkbox" name="COLMD"> <br>
|
Use HSB sliders instead of RGB by default: <input type="checkbox" name="COLMD"> <br>
|
||||||
<h3>LED setup</h3>
|
<h3>LED setup</h3>
|
||||||
LED count (max. 255): <input name="LEDCN" type="number" min="0" max="255" required> <br>
|
LED count (max. 255): <input name="LEDCN" type="number" min="1" max="255" required> <br>
|
||||||
<i>The default boot color is saved in preset slot 0.</i><br>
|
<i>The default boot color is saved in preset slot 0.</i><br>
|
||||||
Alternatively, apply preset <input name="BOOTP" type="number" min="0" max="25" required> at boot<br>
|
Alternatively, apply preset <input name="BOOTP" type="number" min="0" max="25" required> at boot<br>
|
||||||
Default RGB color:
|
Default RGB color:
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <ESP8266HTTPUpdateServer.h>
|
#include <ESP8266HTTPUpdateServer.h>
|
||||||
#endif
|
#endif
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
|
#include <ArduinoOTA.h>
|
||||||
#include <WiFiUDP.h>
|
#include <WiFiUDP.h>
|
||||||
#include "src/dependencies/time/Time.h"
|
#include "src/dependencies/time/Time.h"
|
||||||
#include "src/dependencies/time/TimeLib.h"
|
#include "src/dependencies/time/TimeLib.h"
|
||||||
@ -28,7 +29,7 @@
|
|||||||
#include "WS2812FX.h"
|
#include "WS2812FX.h"
|
||||||
|
|
||||||
//version in format yymmddb (b = daily build)
|
//version in format yymmddb (b = daily build)
|
||||||
#define VERSION 1801102
|
#define VERSION 1801140
|
||||||
const String versionName = "WLED 0.5dev";
|
const String versionName = "WLED 0.5dev";
|
||||||
|
|
||||||
//AP and OTA default passwords (change them!)
|
//AP and OTA default passwords (change them!)
|
||||||
@ -98,6 +99,7 @@ boolean recoveryAPDisabled = false;
|
|||||||
IPAddress staticip(0, 0, 0, 0);
|
IPAddress staticip(0, 0, 0, 0);
|
||||||
IPAddress staticgateway(0, 0, 0, 0);
|
IPAddress staticgateway(0, 0, 0, 0);
|
||||||
IPAddress staticsubnet(255, 255, 255, 0);
|
IPAddress staticsubnet(255, 255, 255, 0);
|
||||||
|
IPAddress staticdns(8, 8, 8, 8); //only for NTP
|
||||||
boolean useHSB = false, useHSBDefault = false;
|
boolean useHSB = false, useHSBDefault = false;
|
||||||
boolean turnOnAtBoot = true;
|
boolean turnOnAtBoot = true;
|
||||||
uint8_t bootPreset = 0;
|
uint8_t bootPreset = 0;
|
||||||
@ -189,8 +191,8 @@ const unsigned long seventyYears = 2208988800UL;
|
|||||||
uint8_t overlayDefault = 0;
|
uint8_t overlayDefault = 0;
|
||||||
uint8_t overlayCurrent = 0;
|
uint8_t overlayCurrent = 0;
|
||||||
#ifdef USEOVERLAYS
|
#ifdef USEOVERLAYS
|
||||||
int overlayMin = 0, overlayMax = 79;
|
int overlayMin = 0, overlayMax = 79; //bb: 35, 46, t: 0, 79
|
||||||
int analogClock12pixel = 25;
|
int analogClock12pixel = 25; //bb: 41, t: 25
|
||||||
bool overlayDimBg = true;
|
bool overlayDimBg = true;
|
||||||
boolean analogClockSecondsTrail = false;
|
boolean analogClockSecondsTrail = false;
|
||||||
boolean analogClock5MinuteMarks = false;
|
boolean analogClock5MinuteMarks = false;
|
||||||
@ -312,6 +314,7 @@ void loop() {
|
|||||||
yield();
|
yield();
|
||||||
handleButton();
|
handleButton();
|
||||||
handleNetworkTime();
|
handleNetworkTime();
|
||||||
|
if (!otaLock) ArduinoOTA.handle();
|
||||||
#ifdef CRONIXIE
|
#ifdef CRONIXIE
|
||||||
handleCronixie();
|
handleCronixie();
|
||||||
#endif
|
#endif
|
||||||
@ -324,7 +327,7 @@ void loop() {
|
|||||||
#endif
|
#endif
|
||||||
strip.service();
|
strip.service();
|
||||||
}
|
}
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (millis() - debugTime > 5000)
|
if (millis() - debugTime > 5000)
|
||||||
|
@ -537,7 +537,7 @@ boolean handleSet(String req)
|
|||||||
pos = req.indexOf("CT=");
|
pos = req.indexOf("CT=");
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
countdownTime = req.substring(pos+3).toInt();
|
countdownTime = req.substring(pos+3).toInt();
|
||||||
countdownOverTriggered = false;
|
if (countdownTime - now() > 0) countdownOverTriggered = false;
|
||||||
}
|
}
|
||||||
//set custom chase data
|
//set custom chase data
|
||||||
bool _cc_updated = false;
|
bool _cc_updated = false;
|
||||||
|
@ -31,7 +31,7 @@ void wledInit()
|
|||||||
|
|
||||||
if (staticip[0] != 0)
|
if (staticip[0] != 0)
|
||||||
{
|
{
|
||||||
WiFi.config(staticip, staticgateway, staticsubnet);
|
WiFi.config(staticip, staticgateway, staticsubnet, staticdns);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
WiFi.config(0U, 0U, 0U);
|
WiFi.config(0U, 0U, 0U);
|
||||||
@ -183,9 +183,11 @@ void wledInit()
|
|||||||
httpUpdater.setup(&server); //only for ESP8266
|
httpUpdater.setup(&server); //only for ESP8266
|
||||||
#else
|
#else
|
||||||
server.on("/update", HTTP_GET, [](){
|
server.on("/update", HTTP_GET, [](){
|
||||||
server.send(200, "text/plain", "OTA update is not supported on ESP32 at this time.");
|
server.send(200, "text/plain", "OTA update is not supported on ESP32 at this time. You may want to use ArduinoOTA.");
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
//init ArduinoOTA
|
||||||
|
ArduinoOTA.begin();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
server.on("/edit", HTTP_GET, [](){
|
server.on("/edit", HTTP_GET, [](){
|
||||||
@ -221,7 +223,7 @@ void wledInit()
|
|||||||
DEBUG_PRINTLN("HTTP server started");
|
DEBUG_PRINTLN("HTTP server started");
|
||||||
// Add service to MDNS
|
// Add service to MDNS
|
||||||
MDNS.addService("http", "tcp", 80);
|
MDNS.addService("http", "tcp", 80);
|
||||||
|
|
||||||
// Initialize NeoPixel Strip
|
// Initialize NeoPixel Strip
|
||||||
strip.init();
|
strip.init();
|
||||||
strip.setLedCount(ledcount);
|
strip.setLedCount(ledcount);
|
||||||
@ -230,6 +232,8 @@ void wledInit()
|
|||||||
strip.setSpeed(effectSpeed);
|
strip.setSpeed(effectSpeed);
|
||||||
strip.setBrightness(255);
|
strip.setBrightness(255);
|
||||||
strip.start();
|
strip.start();
|
||||||
|
|
||||||
|
|
||||||
#ifdef CRONIXIE
|
#ifdef CRONIXIE
|
||||||
strip.driverModeCronixie(true);
|
strip.driverModeCronixie(true);
|
||||||
strip.setCronixieBacklight(cronixieBacklight);
|
strip.setCronixieBacklight(cronixieBacklight);
|
||||||
|
@ -21,7 +21,7 @@ void handleNetworkTime()
|
|||||||
void sendNTPPacket()
|
void sendNTPPacket()
|
||||||
{
|
{
|
||||||
WiFi.hostByName(ntpServerName, ntpServerIP);
|
WiFi.hostByName(ntpServerName, ntpServerIP);
|
||||||
Serial.println("sending NTP packet...");
|
DEBUG_PRINTLN("send NTP packet");
|
||||||
|
|
||||||
memset(ntpPacketBuffer, 0, NTP_PACKET_SIZE);
|
memset(ntpPacketBuffer, 0, NTP_PACKET_SIZE);
|
||||||
|
|
||||||
@ -59,6 +59,7 @@ boolean checkNTPResponse()
|
|||||||
unsigned long epoch = secsSince1900 - seventyYears;
|
unsigned long epoch = secsSince1900 - seventyYears;
|
||||||
setTime(epoch);
|
setTime(epoch);
|
||||||
DEBUG_PRINTLN(epoch);
|
DEBUG_PRINTLN(epoch);
|
||||||
|
if (countdownTime - now() > 0) countdownOverTriggered = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -160,12 +160,12 @@ void _overlayAnalogClock()
|
|||||||
}
|
}
|
||||||
if (analogClockSecondsTrail)
|
if (analogClockSecondsTrail)
|
||||||
{
|
{
|
||||||
strip.setRange(analogClock12pixel, secondPixel, 0x00FF00);
|
strip.setRange(analogClock12pixel, secondPixel, 0xFF0000);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
strip.setIndividual(secondPixel, 0x00FF00);
|
strip.setIndividual(secondPixel, 0xFF0000);
|
||||||
}
|
}
|
||||||
strip.setIndividual(minutePixel, 0xEEEEEE);
|
strip.setIndividual(minutePixel, 0x00FF00);
|
||||||
strip.setIndividual(hourPixel, 0x0000FF);
|
strip.setIndividual(hourPixel, 0x0000FF);
|
||||||
overlayRefreshMs = 998;
|
overlayRefreshMs = 998;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/*
|
||||||
|
* Support for the Cronixie clock
|
||||||
|
*/
|
||||||
#ifdef CRONIXIE
|
#ifdef CRONIXIE
|
||||||
uint8_t getSameCodeLength(char code, int index, char const digits[])
|
uint8_t getSameCodeLength(char code, int index, char const digits[])
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user