Exemple #1
0
//...............................................................................
//  WiFi start connection
//...............................................................................
void WIFI::start() {
  staMode     = ffs.cfg.readItem("wifi"); // off, dhcp, manual
  apMode      = ffs.cfg.readItem("ap");   // on, off, auto

  logging.info("MAC address: "+macAddress());

  // some workaround for WiFi.status() showing disconnect although WiFi
  // is connected
  WiFi.disconnect(true);
  WiFi.persistent(false);
  //ESP.eraseConfig();
  WiFi.mode(WIFI_OFF);

  if (staMode=="off" and apMode=="off"){
    logging.info("WiFi staMode=off and apMode=off -> no WiFi functions available!");
  } else if (apMode=="on") {
    logging.info("WiFi apMode=on -> starting AP");
    startAP(true);
  } else if (staMode=="off" and apMode=="auto") {
    logging.info("WiFi staMode=off and apMode=auto -> starting AP");
    startAP(true);

  } else {  //staMode dhcp or auto
    startSTA();
  }
}
Exemple #2
0
void cmdAP(String commandLine, CommandOutput* commandOutput) {
    startAP();
}