Visualizzazione post con etichetta Lolin32. Mostra tutti i post
Visualizzazione post con etichetta Lolin32. Mostra tutti i post

mercoledì 12 settembre 2018

ESP32 Lolin Lite Captive Portal

Dopo il Wemos TTGO ho provato Lolin 32 Lite. Nonostante sia un prodotto non piu' in produzione risulta interessante



I driver per la seriale virtuale sono relativi al CH340


Da misure fatte da altre persone sembra che il consumo sia di circa 800 microA in sleep mode e di circa 50 mA in modalita' normale

Una delle caratteristiche piu' interessanti e' che si puo' alimentare tramite una LiPo tramite JST PH-2 2.0mm e c'e' montato anche un circuito di ricarica che, nel caso di collegamento USB, va a ricaricare la LiPo

Ho provato a montare lo skect ESP32 di Captive Portal (negli esempi sotto DNSServer) ma per rendere la cosa non banale ho provato ad inserire una immagine nella home. Di fatto non esiste un file system e per includere la img ho preso un file (a caso ;>), lo ho convertito in BASE 64 tramite questa pagina e poi ho incollato la conversione nello sketch come segue

------------------------------------------------------------------


#include <WiFi.h>
#include <DNSServer.h>

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

String responseHTML = ""
  "<!DOCTYPE html><html><head><title>CaptivePortal</title></head><body>"
  "<h1>Hello World!</h1><p>This is a captive portal example. <br>"
   "<img src='data:image/jpg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKC
gkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEB
AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wA
ARCABgAGADASIAAhEBAxEB/8QAHQAAAgIDAQEBAAAAAAAAAAAABgcFCAMECQEAAv/EADgQA
AEDAgUCAwYEBgIDAAAAAAECAwQFEQAGBxIhMVETQWEIIjJxgbEUFUKhI1KRwdHwJOEWYvH/xAA
bAQACAwEBAQAAAAAAAAAAAAAFBgMEBwEAAv/EADARAAEDAgQFA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2bLW0tqRxs8xbscacJLdNpKXlNAuzgpW8/pseAP6YhZ0h15TRUoABKebdD0/tgm20lpNhVZ+Qt9eZe9WP09z2K3TtyVJTIZ2icyCAN3k4B2P34xZ3KWa6HDyVJmOPNJREZUtxalc2Aucc6soVubRsytTWHVIB3h9IPC27XI/b7Yd2Y83yYOQqi00/ZuewjwlhR2uIWR7w+l+MJmLYJxJCUt6JUR99fFM8HFA5GJc/UkXPelDmvM0vM2YalWHUnxp763lqPkD8KfoLD6YhggNAqWoLPJJHTrj67iUqSVpQk3IG2/wDXGBS9hKCUAc3+WHxKQ2kJTsNKTFKK1FR3NZVqQEhKUBXFgeOBjEHRsI2naT17fXGJDhPAVbaPO3Xy4x+UPkJB8RKb8XItfHiqvBNf/9k='/>"
   "</body></html>";

void setup() {
  WiFi.mode(WIFI_AP);
  WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
  WiFi.softAP("CaptivePortal");

  // if DNSServer is started with "*" for domain name, it will reply with
  // provided IP to all DNS request
  dnsServer.start(DNS_PORT, "*", apIP);

  server.begin();
}

void loop() {
  dnsServer.processNextRequest();
  WiFiClient client = server.available();   // listen for incoming clients

  if (client) {
    String currentLine = "";
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        if (c == '\n') {
          if (currentLine.length() == 0) {
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();
            client.print(responseHTML);
            break;
          } else {
            currentLine = "";
          }
        } else if (c != '\r') {
          currentLine += c;
        }
      }
    }
    client.stop();
  }
}
---------------------------------------------------------

Il risultato e' il seguente



Debugger integrato ESP32S3

Aggiornamento In realta' il Jtag USB funziona anche sui moduli cinesi Il problema risiede  nell'ID USB della porta Jtag. Nel modulo...