Reorganisation fichiers
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
#include <WiFi.h>
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <AsyncTCP.h>
|
||||
|
||||
void launchWiFiConfig();
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <TFT_eSPI.h>
|
||||
#include "color.h"
|
||||
#include <EEPROM.h>
|
||||
#include <WiFi.h>
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <EEPROM.h>
|
||||
#include <AsyncTCP.h>
|
||||
#include <SD.h>
|
||||
|
||||
#include "color.h"
|
||||
|
||||
void launchWiFiConfig();
|
||||
|
||||
// Read WiFi credentials from EEPROM
|
||||
#define WIFI_SSID_ADDR 0
|
||||
@@ -75,13 +73,28 @@ void setup()
|
||||
tft.println("WiFi credentials missing!");
|
||||
tft.setCursor(10, 40);
|
||||
tft.setTextColor(COLOR_YELLOW);
|
||||
tft.println("Launch WiFiConfig to set them.");
|
||||
tft.println("Please connect to CYD_Config AP");
|
||||
tft.setCursor(10, 55);
|
||||
tft.println("and set WiFi credentials");
|
||||
launchWiFiConfig(); // Function to start WiFi configuration mode (not implemented here)
|
||||
|
||||
} else {
|
||||
// Ok connect to WiFi
|
||||
tft.setCursor(60, 10);
|
||||
tft.setTextColor(COLOR_GREEN);
|
||||
tft.println("OK");
|
||||
DEBUG_MSG("WiFi SSID: %s", wifi_ssid);
|
||||
DEBUG_MSG("WiFi PASS: %s", wifi_pass);
|
||||
}
|
||||
// Try to open SD card and read content
|
||||
if (!SD.begin()) {
|
||||
tft.println("SD Card not found!");
|
||||
while (1); // or handle error as needed
|
||||
}
|
||||
if (!SD.exists("/loco")) {
|
||||
tft.println("loco/ folder not found!");
|
||||
while (1); // or handle error as needed
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,7 +127,7 @@ void launchWiFiConfig()
|
||||
WiFi.softAP("CYD_Config", "12345678");
|
||||
IPAddress myIP = WiFi.softAPIP();
|
||||
DEBUG_MSG("AP IP address: %s", myIP.toString().c_str());
|
||||
AsyncWebServer server(80);
|
||||
AsyncWebServer server(80);
|
||||
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
String html = "<html><body><h2>WiFi Config</h2>"
|
||||
"<form action='/save' method='post'>"
|
||||
|
||||
Reference in New Issue
Block a user