Added ArduinoOTA

Fixed HSB slider changing to RGB unintentionally
Fixed NTP on ESP32
Fixed countdown macro execution
This commit is contained in:
cschwinne 2018-01-14 00:53:16 +01:00
parent 31d84311d0
commit 3db38726ca
10 changed files with 29 additions and 16 deletions

View File

@ -13,6 +13,7 @@
var fxa=false;
var psa=false;
var uwv=false;
var firstload=true;
var lastsx = 0;
var nState = 0;
bCol = "DarkTurquoise";
@ -61,7 +62,7 @@
nState = 0;
nState = (this.responseXML.getElementsByTagName('nr')[0].innerHTML)!=0?1: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;
UV();
}
@ -71,6 +72,7 @@
request.open("GET", "win/" +resp +nocache, true);
request.send(null);
resp="";
firstload=false;
}
function GetCheck()
{

View File

@ -61,7 +61,7 @@
Server description: <input name="DESC" maxlength="32"> <br>
Use HSB sliders instead of RGB by default: <input type="checkbox" name="COLMD"> <br>
<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>
Alternatively, apply preset <input name="BOOTP" type="number" min="0" max="25" required> at boot<br>
Default RGB color:

File diff suppressed because one or more lines are too long

View File

@ -60,7 +60,7 @@ AP IP: <span class="sip"> Not active </span> <br>
Server description: <input name="DESC" maxlength="32"> <br>
Use HSB sliders instead of RGB by default: <input type="checkbox" name="COLMD"> <br>
<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>
Alternatively, apply preset <input name="BOOTP" type="number" min="0" max="25" required> at boot<br>
Default RGB color:

View File

@ -19,6 +19,7 @@
#include <ESP8266HTTPUpdateServer.h>
#endif
#include <EEPROM.h>
#include <ArduinoOTA.h>
#include <WiFiUDP.h>
#include "src/dependencies/time/Time.h"
#include "src/dependencies/time/TimeLib.h"
@ -28,7 +29,7 @@
#include "WS2812FX.h"
//version in format yymmddb (b = daily build)
#define VERSION 1801102
#define VERSION 1801140
const String versionName = "WLED 0.5dev";
//AP and OTA default passwords (change them!)
@ -98,6 +99,7 @@ boolean recoveryAPDisabled = false;
IPAddress staticip(0, 0, 0, 0);
IPAddress staticgateway(0, 0, 0, 0);
IPAddress staticsubnet(255, 255, 255, 0);
IPAddress staticdns(8, 8, 8, 8); //only for NTP
boolean useHSB = false, useHSBDefault = false;
boolean turnOnAtBoot = true;
uint8_t bootPreset = 0;
@ -189,8 +191,8 @@ const unsigned long seventyYears = 2208988800UL;
uint8_t overlayDefault = 0;
uint8_t overlayCurrent = 0;
#ifdef USEOVERLAYS
int overlayMin = 0, overlayMax = 79;
int analogClock12pixel = 25;
int overlayMin = 0, overlayMax = 79; //bb: 35, 46, t: 0, 79
int analogClock12pixel = 25; //bb: 41, t: 25
bool overlayDimBg = true;
boolean analogClockSecondsTrail = false;
boolean analogClock5MinuteMarks = false;
@ -312,6 +314,7 @@ void loop() {
yield();
handleButton();
handleNetworkTime();
if (!otaLock) ArduinoOTA.handle();
#ifdef CRONIXIE
handleCronixie();
#endif

View File

@ -537,7 +537,7 @@ boolean handleSet(String req)
pos = req.indexOf("CT=");
if (pos > 0) {
countdownTime = req.substring(pos+3).toInt();
countdownOverTriggered = false;
if (countdownTime - now() > 0) countdownOverTriggered = false;
}
//set custom chase data
bool _cc_updated = false;

View File

@ -31,7 +31,7 @@ void wledInit()
if (staticip[0] != 0)
{
WiFi.config(staticip, staticgateway, staticsubnet);
WiFi.config(staticip, staticgateway, staticsubnet, staticdns);
} else
{
WiFi.config(0U, 0U, 0U);
@ -183,9 +183,11 @@ void wledInit()
httpUpdater.setup(&server); //only for ESP8266
#else
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
//init ArduinoOTA
ArduinoOTA.begin();
} else
{
server.on("/edit", HTTP_GET, [](){
@ -230,6 +232,8 @@ void wledInit()
strip.setSpeed(effectSpeed);
strip.setBrightness(255);
strip.start();
#ifdef CRONIXIE
strip.driverModeCronixie(true);
strip.setCronixieBacklight(cronixieBacklight);

View File

@ -21,7 +21,7 @@ void handleNetworkTime()
void sendNTPPacket()
{
WiFi.hostByName(ntpServerName, ntpServerIP);
Serial.println("sending NTP packet...");
DEBUG_PRINTLN("send NTP packet");
memset(ntpPacketBuffer, 0, NTP_PACKET_SIZE);
@ -59,6 +59,7 @@ boolean checkNTPResponse()
unsigned long epoch = secsSince1900 - seventyYears;
setTime(epoch);
DEBUG_PRINTLN(epoch);
if (countdownTime - now() > 0) countdownOverTriggered = false;
return true;
}
return false;

View File

@ -160,12 +160,12 @@ void _overlayAnalogClock()
}
if (analogClockSecondsTrail)
{
strip.setRange(analogClock12pixel, secondPixel, 0x00FF00);
strip.setRange(analogClock12pixel, secondPixel, 0xFF0000);
} else
{
strip.setIndividual(secondPixel, 0x00FF00);
strip.setIndividual(secondPixel, 0xFF0000);
}
strip.setIndividual(minutePixel, 0xEEEEEE);
strip.setIndividual(minutePixel, 0x00FF00);
strip.setIndividual(hourPixel, 0x0000FF);
overlayRefreshMs = 998;
}

View File

@ -1,3 +1,6 @@
/*
* Support for the Cronixie clock
*/
#ifdef CRONIXIE
uint8_t getSameCodeLength(char code, int index, char const digits[])
{