.github
.vscode
_3D Print Files
docs
html
img
scripts
src
api.cpp
api.h
bambu.cpp
bambu.h
bambu_cert.h
commonFS.cpp
commonFS.h
config.cpp
config.h
display.cpp
display.h
icons.h
main.cpp
nfc.cpp
nfc.h
ota.cpp
ota.h
scale.cpp
scale.h
website.cpp
website.h
wlan.cpp
wlan.h
CHANGELOG.md
LICENSE.txt
README.de.md
README.md
ca.cert
partitions.csv
platformio.ini
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#include <Arduino.h>
|
|
#include "wlan.h"
|
|
#include <WiFi.h>
|
|
#include <esp_wifi.h>
|
|
#include <WiFiManager.h>
|
|
#include "display.h"
|
|
#include "config.h"
|
|
|
|
WiFiManager wm;
|
|
bool wm_nonblocking = false;
|
|
|
|
void initWiFi() {
|
|
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
|
|
|
|
esp_wifi_set_max_tx_power(72); // Setze maximale Sendeleistung auf 20dBm
|
|
|
|
if(wm_nonblocking) wm.setConfigPortalBlocking(false);
|
|
wm.setConfigPortalTimeout(320); // Portal nach 5min schließen
|
|
|
|
oledShowTopRow();
|
|
oledShowMessage("WiFi Setup");
|
|
|
|
bool res;
|
|
// res = wm.autoConnect(); // auto generated AP name from chipid
|
|
res = wm.autoConnect("FilaMan"); // anonymous ap
|
|
// res = wm.autoConnect("spoolman","password"); // password protected ap
|
|
|
|
if(!res) {
|
|
Serial.println("Failed to connect or hit timeout");
|
|
// ESP.restart();
|
|
oledShowTopRow();
|
|
oledShowMessage("WiFi not connected Check Portal");
|
|
}
|
|
else {
|
|
wifiOn = true;
|
|
|
|
//if you get here you have connected to the WiFi
|
|
Serial.println("connected...yeey :)");
|
|
Serial.print("IP address: ");
|
|
Serial.println(WiFi.localIP());
|
|
|
|
oledShowTopRow();
|
|
display.display();
|
|
}
|
|
} |