1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-11-21 22:50:55 +00:00

Some example improvements by @thomastech

Signed-off-by: Lukas Bachschwell <lukas@lbsfilm.at>
This commit is contained in:
Lukas Bachschwell 2022-01-08 17:31:37 +01:00
parent 29964a83f2
commit e3638beb14
Signed by: lbsadmin
GPG Key ID: CCC6AA87CC8DF425
5 changed files with 76 additions and 16 deletions

View File

@ -2,7 +2,7 @@
#include <ESPUI.h> #include <ESPUI.h>
const byte DNS_PORT = 53; const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1); IPAddress apIP(192, 168, 4, 1);
DNSServer dnsServer; DNSServer dnsServer;
#if defined(ESP32) #if defined(ESP32)
@ -200,8 +200,19 @@ void setup(void)
Serial.print("\n\nCreating hotspot"); Serial.print("\n\nCreating hotspot");
WiFi.mode(WIFI_AP); WiFi.mode(WIFI_AP);
delay(100);
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP(ssid); #if defined(ESP32)
uint32_t chipid = 0;
for (int i = 0; i < 17; i = i + 8)
{
chipid |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
#else
uint32_t chipid = ESP.getChipId();
#endif char ap_ssid[25];
snprintf(ap_ssid, 26, "ESPUI-%08X", chipid);
WiFi.softAP(ap_ssid);
timeout = 5; timeout = 5;

View File

@ -2,7 +2,7 @@
#include <ESPUI.h> #include <ESPUI.h>
const byte DNS_PORT = 53; const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1); IPAddress apIP(192, 168, 4, 1);
DNSServer dnsServer; DNSServer dnsServer;
#if defined(ESP32) #if defined(ESP32)
@ -190,8 +190,20 @@ void setup(void)
Serial.print("\n\nCreating hotspot"); Serial.print("\n\nCreating hotspot");
WiFi.mode(WIFI_AP); WiFi.mode(WIFI_AP);
delay(100);
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP(ssid); #if defined(ESP32)
uint32_t chipid = 0;
for (int i = 0; i < 17; i = i + 8)
{
chipid |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
#else
uint32_t chipid = ESP.getChipId();
#endif
char ap_ssid[25];
snprintf(ap_ssid, 26, "ESPUI-%08X", chipid);
WiFi.softAP(ap_ssid);
timeout = 5; timeout = 5;

View File

@ -2,7 +2,7 @@
#include <ESPUI.h> #include <ESPUI.h>
const byte DNS_PORT = 53; const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1); IPAddress apIP(192, 168, 4, 1);
DNSServer dnsServer; DNSServer dnsServer;
#if defined(ESP32) #if defined(ESP32)
@ -198,8 +198,20 @@ void setup(void)
Serial.print("\n\nCreating hotspot"); Serial.print("\n\nCreating hotspot");
WiFi.mode(WIFI_AP); WiFi.mode(WIFI_AP);
delay(100);
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP(ssid); #if defined(ESP32)
uint32_t chipid = 0;
for (int i = 0; i < 17; i = i + 8)
{
chipid |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
#else
uint32_t chipid = ESP.getChipId();
#endif
char ap_ssid[25];
snprintf(ap_ssid, 26, "ESPUI-%08X", chipid);
WiFi.softAP(ap_ssid);
timeout = 5; timeout = 5;

View File

@ -8,18 +8,30 @@
; Please visit documentation for the other options and examples ; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[platformio]
src_dir = ./src
data_dir = ../../data
[env]
lib_extra_dirs = ../../
board_build.filesystem = littlefs
; Additional scripts: Usage: see https://github.com/s00500/ESPUI/issues/144#issuecomment-1005135077
;extra_scripts =
; LittleFSBuilder.py
[env:esp8266] [env:esp8266]
platform = espressif8266 platform = espressif8266
board = nodemcuv2
framework = arduino framework = arduino
board = nodemcuv2
lib_extra_dirs = ../../ lib_deps =
bblanchon/ArduinoJson @ ^6.18.5
me-no-dev/ESP Async WebServer @ ^1.2.3
[env:esp32] [env:esp32]
platform = espressif32 platform = espressif32
board = esp32dev
framework = arduino framework = arduino
board = esp32dev
lib_extra_dirs = ../../ lib_deps =
lorol/LittleFS_esp32@^1.0.6
lib_deps = lorol/LittleFS_esp32 bblanchon/ArduinoJson @ ^6.18.5
me-no-dev/ESP Async WebServer @ ^1.2.3

View File

@ -2,7 +2,7 @@
#include <ESPUI.h> #include <ESPUI.h>
const byte DNS_PORT = 53; const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1); IPAddress apIP(192, 168, 4, 1);
DNSServer dnsServer; DNSServer dnsServer;
#if defined(ESP32) #if defined(ESP32)
@ -190,8 +190,21 @@ void setup(void)
Serial.print("\n\nCreating hotspot"); Serial.print("\n\nCreating hotspot");
WiFi.mode(WIFI_AP); WiFi.mode(WIFI_AP);
delay(100);
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP(ssid); #if defined(ESP32)
uint32_t chipid = 0;
for (int i = 0; i < 17; i = i + 8)
{
chipid |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
#else
uint32_t chipid = ESP.getChipId();
#endif
char ap_ssid[25];
snprintf(ap_ssid, 26, "ESPUI-%08X", chipid);
WiFi.softAP(ap_ssid);
timeout = 5; timeout = 5;