Skip to content

Commit

Permalink
Some example improvements by @thomastech
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Bachschwell <[email protected]>
  • Loading branch information
s00500 committed Jan 8, 2022
1 parent 29964a8 commit e3638be
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 16 deletions.
15 changes: 13 additions & 2 deletions examples/gui-generic-api/gui-generic-api.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <ESPUI.h>

const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1);
IPAddress apIP(192, 168, 4, 1);
DNSServer dnsServer;

#if defined(ESP32)
Expand Down Expand Up @@ -200,8 +200,19 @@ void setup(void)
Serial.print("\n\nCreating hotspot");

WiFi.mode(WIFI_AP);
delay(100);
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;

Expand Down
16 changes: 14 additions & 2 deletions examples/gui/gui.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <ESPUI.h>

const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1);
IPAddress apIP(192, 168, 4, 1);
DNSServer dnsServer;

#if defined(ESP32)
Expand Down Expand Up @@ -190,8 +190,20 @@ void setup(void)
Serial.print("\n\nCreating hotspot");

WiFi.mode(WIFI_AP);
delay(100);
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;

Expand Down
16 changes: 14 additions & 2 deletions examples/tabbedGui/tabbedGui.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <ESPUI.h>

const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1);
IPAddress apIP(192, 168, 4, 1);
DNSServer dnsServer;

#if defined(ESP32)
Expand Down Expand Up @@ -198,8 +198,20 @@ void setup(void)
Serial.print("\n\nCreating hotspot");

WiFi.mode(WIFI_AP);
delay(100);
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;

Expand Down
28 changes: 20 additions & 8 deletions pio_examples/gui/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,30 @@
; Please visit documentation for the other options and examples
; 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]
platform = espressif8266
board = nodemcuv2
framework = arduino

lib_extra_dirs = ../../
board = nodemcuv2
lib_deps =
bblanchon/ArduinoJson @ ^6.18.5
me-no-dev/ESP Async WebServer @ ^1.2.3

[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino

lib_extra_dirs = ../../

lib_deps = lorol/LittleFS_esp32
board = esp32dev
lib_deps =
lorol/LittleFS_esp32@^1.0.6
bblanchon/ArduinoJson @ ^6.18.5
me-no-dev/ESP Async WebServer @ ^1.2.3
17 changes: 15 additions & 2 deletions pio_examples/gui/src/gui.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <ESPUI.h>

const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1);
IPAddress apIP(192, 168, 4, 1);
DNSServer dnsServer;

#if defined(ESP32)
Expand Down Expand Up @@ -190,8 +190,21 @@ void setup(void)
Serial.print("\n\nCreating hotspot");

WiFi.mode(WIFI_AP);
delay(100);
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;

Expand Down

0 comments on commit e3638be

Please sign in to comment.