mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-09-28 07:11:01 +02:00
Added json mode and worker to editor
Example - updates
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
examples/ESP_AsyncFSBrowser/data/worker-json.js.gz
Normal file
BIN
examples/ESP_AsyncFSBrowser/data/worker-json.js.gz
Normal file
Binary file not shown.
@@ -166,7 +166,8 @@ float t = 0;
|
||||
float h = 0;
|
||||
bool udht = false;
|
||||
bool heat_enabled_prev = false;
|
||||
int ledState = LED_OFF;
|
||||
bool ledState = LED_OFF;
|
||||
bool ledOut = LED_OFF;
|
||||
|
||||
struct EE_bl {
|
||||
byte memid; //here goes the EEMARK stamp
|
||||
@@ -199,6 +200,15 @@ void readEE() {
|
||||
}
|
||||
}
|
||||
|
||||
void doOut(){
|
||||
if (ledOut != ledState){ // only if changed
|
||||
digitalWrite(ledPin, ledState); //consolidated here
|
||||
ledOut = ledState; //update
|
||||
if (ledState == LED_OFF) ws.textAll("led,ledoff");
|
||||
else ws.textAll("led,ledon");
|
||||
}
|
||||
}
|
||||
|
||||
void showTime()
|
||||
{
|
||||
byte tmpch = 0;
|
||||
@@ -245,12 +255,10 @@ void showTime()
|
||||
if (heat_enabled_prev){ // smart control (delayed one cycle)
|
||||
if (((t + HYST) < ee.tempe)&&(ledState == LED_OFF)){ // OFF->ON once
|
||||
ledState = LED_ON;
|
||||
digitalWrite(ledPin, ledState); // apply change
|
||||
ws.textAll("led,ledon");
|
||||
}
|
||||
if ((((t - HYST) > ee.tempe)&&(ledState == LED_ON))||(!heat_enabled)){ // ON->OFF once, also turn off at end of period.
|
||||
ledState = LED_OFF;
|
||||
digitalWrite(ledPin, ledState); // apply change
|
||||
ws.textAll("led,ledoff");
|
||||
}
|
||||
|
||||
@@ -282,7 +290,6 @@ void checkPhysicalButton()
|
||||
if (digitalRead(btnPin) == LOW){
|
||||
if (btnState != LOW){ // btnState is used to avoid sequential toggles
|
||||
ledState = !ledState;
|
||||
digitalWrite(ledPin, ledState);
|
||||
if (ledState == LED_OFF){
|
||||
ws.textAll("led,ledoff");
|
||||
Serial.println(F("LED-OFF"));
|
||||
@@ -397,7 +404,6 @@ void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventT
|
||||
ledState = LED_OFF;
|
||||
ws.textAll("led,ledoff");
|
||||
}
|
||||
digitalWrite(ledPin, ledState); // apply change
|
||||
|
||||
} else if(data[0] == 'T'){ // timeset
|
||||
if (len > 11){
|
||||
@@ -488,7 +494,7 @@ void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventT
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
Serial.setDebugOutput(true);
|
||||
//Serial.setDebugOutput(true);
|
||||
|
||||
//Wifi
|
||||
#ifdef USE_WFM
|
||||
@@ -545,7 +551,6 @@ void setup(){
|
||||
EEPROM.begin(EEALL);
|
||||
//EEPROM.get(EECH, memch); //current channel, no need
|
||||
readEE(); // populate structure if healthy
|
||||
digitalWrite(ledPin, ledState);
|
||||
Serial.printf("Timer set %02d:%02d - %02d:%02d\n", ee.hstart, ee.mstart, ee.hstop, ee.mstop);
|
||||
Serial.printf("Temp set %+2.1f\n", ee.tempe);
|
||||
|
||||
@@ -742,5 +747,6 @@ void loop(){
|
||||
updateDHT();
|
||||
udht = false;
|
||||
}
|
||||
doOut();
|
||||
ArduinoOTA.handle();
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
examples/SmartSwitch/data/worker-json.js.gz
Normal file
BIN
examples/SmartSwitch/data/worker-json.js.gz
Normal file
Binary file not shown.
@@ -4,6 +4,7 @@ REM fetcher --url=resource_url --out=output_directory
|
||||
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/ace.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/mode-html.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/mode-json.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/theme-monokai.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/ext-searchbox.js" --out=tmp1
|
||||
|
||||
@@ -12,12 +13,14 @@ REM and do not take and include them below
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/worker-html.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/worker-css.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/worker-javascript.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/worker-json.js" --out=tmp1
|
||||
|
||||
cd tmp1
|
||||
type ace.js mode-html.js theme-monokai.js ext-searchbox.js > acefull.js
|
||||
type ace.js mode-html.js mode-json.js theme-monokai.js ext-searchbox.js > acefull.js
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 acefull.js.gz acefull.js
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 worker-html.js.gz worker-html.js
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 worker-javascript.js.gz worker-javascript.js
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 worker-json.js.gz worker-json.js
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 worker-css.js.gz worker-css.js
|
||||
|
||||
REM update SmartSwitch /data:
|
||||
@@ -25,6 +28,7 @@ pause
|
||||
copy acefull.js.gz ..\..\examples\SmartSwitch\data\acefull.js.gz
|
||||
copy worker-html.js.gz ..\..\examples\SmartSwitch\data\worker-html.js.gz
|
||||
copy worker-javascript.js.gz ..\..\examples\SmartSwitch\data\worker-javascript.js.gz
|
||||
copy worker-json.js.gz ..\..\examples\SmartSwitch\data\worker-json.js.gz
|
||||
copy worker-css.js.gz ..\..\examples\SmartSwitch\data\worker-css.js.gz
|
||||
|
||||
REM update ESP_AsyncFSBrowser /data:
|
||||
@@ -32,6 +36,7 @@ pause
|
||||
copy acefull.js.gz ..\..\examples\ESP_AsyncFSBrowser\data\acefull.js.gz
|
||||
copy worker-html.js.gz ..\..\examples\ESP_AsyncFSBrowser\data\worker-html.js.gz
|
||||
copy worker-javascript.js.gz ..\..\examples\ESP_AsyncFSBrowser\data\worker-javascript.js.gz
|
||||
copy worker-json.js.gz ..\..\examples\ESP_AsyncFSBrowser\data\worker-json.js.gz
|
||||
copy worker-css.js.gz ..\..\examples\ESP_AsyncFSBrowser\data\worker-css.js.gz
|
||||
|
||||
REM delete temporary stuff
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//File: edit.htm.gz, Size: 4503
|
||||
#define edit_htm_gz_len 4503
|
||||
const uint8_t edit_htm_gz[] PROGMEM = {
|
||||
0x1F,0x8B,0x08,0x08,0x2A,0x97,0x6B,0x5F,0x02,0x00,0x65,0x64,0x69,0x74,0x2E,0x68,0x74,0x6D,0x00,0xB5,
|
||||
0x1F,0x8B,0x08,0x08,0x89,0xFA,0x86,0x5F,0x02,0x00,0x65,0x64,0x69,0x74,0x2E,0x68,0x74,0x6D,0x00,0xB5,
|
||||
0x1A,0x0B,0x5B,0xDB,0x36,0xF0,0xAF,0x18,0x6F,0x63,0xF6,0xE2,0x38,0x0E,0x50,0xD6,0x3A,0x18,0x16,0x1E,
|
||||
0xEB,0xBB,0x50,0x12,0xDA,0xD1,0x8E,0xED,0x53,0x6C,0x25,0x56,0xB1,0x25,0xCF,0x96,0x09,0x34,0xCD,0x7F,
|
||||
0xDF,0x49,0xF2,0x93,0x84,0xEE,0xF1,0x6D,0xA5,0x60,0x49,0xA7,0x3B,0xDD,0x9D,0xEE,0x25,0xD9,0x7B,0x1B,
|
||||
|
Reference in New Issue
Block a user