1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-06-12 04:10:39 +00:00

update examples with esp8266 specifics

This commit is contained in:
David Gauchard
2023-07-19 12:07:25 +02:00
parent c3bf9c5d00
commit b45f4f7356
6 changed files with 80 additions and 0 deletions

View File

@ -8,7 +8,17 @@ DNSServer dnsServer;
#if defined(ESP32)
#include <WiFi.h>
#else
// esp8266
#include <ESP8266WiFi.h>
#include <umm_malloc/umm_heap_select.h>
#ifndef MMU_IRAM_HEAP
#warning Try MMU option '2nd heap shared' in 'tools' IDE menu (cf. https://arduino-esp8266.readthedocs.io/en/latest/mmu.html#option-summary)
#warning use decorators: { HeapSelectIram doAllocationsInIRAM; ESPUI.addControl(...) ... } (cf. https://arduino-esp8266.readthedocs.io/en/latest/mmu.html#how-to-select-heap)
#warning then check http://<ip>/heap
#endif // MMU_IRAM_HEAP
#ifndef DEBUG_ESP_OOM
#error on ESP8266 and ESPUI, you must define OOM debug option when developping
#endif
#endif
const char* ssid = "ESPUI";
@ -225,6 +235,10 @@ void setup(void)
Serial.print("IP address: ");
Serial.println(WiFi.getMode() == WIFI_AP ? WiFi.softAPIP() : WiFi.localIP());
#ifdef ESP8266
{ HeapSelectIram doAllocationsInIRAM;
#endif
statusLabelId = ESPUI.label("Status:", ControlColor::Turquoise, "Stop");
millisLabelId = ESPUI.label("Millis:", ControlColor::Emerald, "0");
ESPUI.button("Push Button", &buttonCallback, ControlColor::Peterriver, "Press");
@ -257,6 +271,10 @@ void setup(void)
* password, for example begin("ESPUI Control", "username", "password")
*/
ESPUI.begin("ESPUI Control");
#ifdef ESP8266
} // HeapSelectIram
#endif
}
void loop(void)