12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #if defined(ESP8266)
- #include <ESP8266WiFi.h>
- #else
- #include <WiFi.h>
- #endif
- #include <ESPAsyncWebServer.h>
- #include <ESPAsyncWiFiManager.h>
- AsyncWebServer server(80);
- DNSServer dns;
- AsyncWiFiManager wifiManager(&server,&dns);
- volatile boolean guard = true;
- const uint32_t callCycleCount = ESP.getCpuFreqMHz() * 1024 / 8;
- void ICACHE_RAM_ATTR interruptFunction() {
-
- uint32_t ccount;
- __asm__ __volatile__("esync; rsr %0,ccount":"=a" (ccount));
- timer0_write(ccount + callCycleCount);
- if (!guard) {
-
-
-
- ESP.getChipId();
- }
- }
- void setup() {
-
- Serial.begin(115200);
-
-
-
-
-
-
-
-
-
-
-
-
-
- wifiManager.startConfigPortalModeless("ModelessAP", "Password");
- server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
- request->send(200, "text/plain", "Hello World");
- });
-
- guard = true;
- timer0_isr_init();
- timer0_attachInterrupt(interruptFunction);
- timer0_write(ESP.getCycleCount() + ESP.getCpuFreqMHz() * 1024);
- }
- void loop() {
-
-
-
- wifiManager.safeLoop();
- guard = true;
-
- wifiManager.criticalLoop();
- guard = false;
- }
|