An ESP32-based Redis-watcher and info-displayer https://rpjios.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
592 B

  1. #include <WiFi.h>
  2. #include "zw_logging.h"
  3. #include "zw_displays.h"
  4. #include "zw_provision.h"
  5. bool zwWiFiInit(const char *hostname, ZWAppConfig config)
  6. {
  7. WiFi.mode(WIFI_MODE_STA);
  8. WiFi.enableAP(false);
  9. if (!WiFi.setHostname(hostname))
  10. {
  11. dprint("WARNING: failed to set hostname\n");
  12. }
  13. auto bstat = WiFi.begin(EEPROMCFG_WiFiSSID, EEPROMCFG_WiFiPass);
  14. zlog("Connecting to '%s'\n", EEPROMCFG_WiFiSSID);
  15. // TODO: timeout!
  16. while (WiFi.status() != WL_CONNECTED) {}
  17. zlog("Connected as %s\n", WiFi.localIP().toString().c_str());
  18. return true;
  19. }