Skip to content

Commit

Permalink
withWebSocket.ino fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cotestatnt committed Jan 12, 2024
1 parent 90244b9 commit 43f043d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 25 deletions.
1 change: 0 additions & 1 deletion examples/csvLogger/csvLogger.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
AsyncFsWebServer server(80, LittleFS, "myServer");
bool captiveRun = false;


// Timezone definition to get properly time from NTP server
#define MYTZ "CET-1CEST,M3.5.0,M10.5.0/3"
#include <time.h>
Expand Down
19 changes: 3 additions & 16 deletions examples/withWebSocket/withWebSocket.ino
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,6 @@ void setup() {
Serial.begin(115200);
delay(1000);

// Try to connect to stored SSID, start AP if fails after timeout
// IPAddress myIP = server.startWiFi(15000, "ESP_AP", "123456789");

WiFi.begin("iPhoneAP", "aat191ee");

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}

Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());


// FILESYSTEM INIT
if (startFilesystem()) {
// Load configuration (if not present, default will be created when webserver will start)
Expand All @@ -190,6 +174,9 @@ void setup() {
Serial.println(F("Application options NOT loaded!"));
}

// Try to connect to stored SSID, start AP if fails after timeout
IPAddress myIP = server.startWiFi(15000, "ESP_AP", "123456789");

// Configure /setup page
server.addOptionBox("My Options");
server.addOption("LED Pin", ledPin);
Expand Down
4 changes: 3 additions & 1 deletion src/AsyncFsWebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ bool AsyncFsWebServer::init(AwsEventHandler wsHandle) {
});

on("/get_config", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send(200, "text/plain", CONFIG_FOLDER CONFIG_FILE);
// We need top remove the first "/" char
String name = CONFIG_FOLDER CONFIG_FILE;
request->send(200, "text/plain", name.substring(1));
});

onNotFound( std::bind(&AsyncFsWebServer::notFound, this, _1));
Expand Down
7 changes: 0 additions & 7 deletions src/AsyncFsWebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ class AsyncFsWebServer : public AsyncWebServer

void setTaskWdt(uint32_t timeout);

/*
Add an option which contain "raw" HTML code to be injected in /setup page
Th HTML code will be written in a file with named as option id
*/
void addSource(const char* source, const char* tag, bool overWrite = false) ;

/*
Create a dir if not exist on uploading files
*/
Expand Down Expand Up @@ -241,7 +235,6 @@ class AsyncFsWebServer : public AsyncWebServer
/////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////// BACKWARD COMPATIBILITY ONLY /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
bool optionToFile(const char* f, const char* id, bool ow) {return setup.optionToFile(f, id, ow);}
void addHTML(const char* h, const char* id, bool ow = false) {setup.addHTML(h, id, ow);}
void addCSS(const char* c, const char* id, bool ow = false){setup.addCSS(c, id, ow);}
void addJavascript(const char* s, const char* id, bool ow = false) {setup.addJavascript(s, id, ow);}
Expand Down

0 comments on commit 43f043d

Please sign in to comment.