2024-09-2400
This commit is contained in:
parent
18e2cc2eb9
commit
8994baad3c
|
@ -24,12 +24,12 @@ lib_deps =
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DDEBUG=0
|
-DDEBUG=0
|
||||||
-DNOADS=0
|
-DNOADS=0
|
||||||
-DNAME=\"BLE_GATE\"
|
-DNAME=\"BLE-Praesenz\"
|
||||||
-DSTASSID=\"MagentaWLAN-RGDO\"
|
-DSTASSID=\"MagentaWLAN-RGDO\"
|
||||||
-DSTAPSK=\"93329248424922704583\"
|
-DSTAPSK=\"93329248424922704583\"
|
||||||
-DGATEWAY=\"192.168.127.1\"
|
-DGATEWAY=\"192.168.127.1\"
|
||||||
-DDNS=\"192.168.127.1\"
|
-DDNS=\"192.168.127.1\"
|
||||||
-DKMYIP=\"192.168.127.42\"
|
-DKMYIP=\"192.168.127.241\"
|
||||||
-Dmqtt_server=\"192.168.127.193\"
|
-Dmqtt_server=\"192.168.127.193\"
|
||||||
-Dmqtt_port=1883
|
-Dmqtt_port=1883
|
||||||
|
|
||||||
|
|
24
src/main.cpp
24
src/main.cpp
|
@ -37,11 +37,13 @@ int scanTime = 5; //In seconds
|
||||||
long int Feldstaerke;
|
long int Feldstaerke;
|
||||||
|
|
||||||
// WiFI
|
// WiFI
|
||||||
IPAddress ip( 192, 168, 127, 241 ); // 10 bis 29 für feste IP
|
IPAddress ip;
|
||||||
IPAddress gateway( 192, 168, 127, 1 );
|
IPAddress gateway;
|
||||||
IPAddress subnet(255,255,255,0);
|
IPAddress subnet(255,255,255,0);
|
||||||
IPAddress dns(192, 168, 127, 1); // DNS-Server
|
IPAddress dns;
|
||||||
|
IPAddress secondaryDNS(8, 8, 8, 8);
|
||||||
String hostname = NAME;
|
String hostname = NAME;
|
||||||
|
const char *MyIP = KMYIP;
|
||||||
char msg[20];
|
char msg[20];
|
||||||
char clientName[30];
|
char clientName[30];
|
||||||
char topic[50];
|
char topic[50];
|
||||||
|
@ -96,8 +98,20 @@ static void setup_wifi() {
|
||||||
WiFi.persistent( false );
|
WiFi.persistent( false );
|
||||||
WiFi.setHostname(hostname.c_str()); //define hostname
|
WiFi.setHostname(hostname.c_str()); //define hostname
|
||||||
WiFi.mode( WIFI_STA );
|
WiFi.mode( WIFI_STA );
|
||||||
WiFi.config( ip, gateway, subnet, dns, dns );
|
if (!ip.fromString(MyIP)) { // try to parse into the IPAddress
|
||||||
|
Serial.println("UnParsable IP");
|
||||||
|
}
|
||||||
|
if (!dns.fromString(DNS)) { // try to parse into the IPAddress
|
||||||
|
Serial.println("UnParsable DNS");
|
||||||
|
}
|
||||||
|
if (!gateway.fromString(GATEWAY)) { // try to parse into the IPAddress
|
||||||
|
Serial.println("UnParsable GATEWAY");
|
||||||
|
}
|
||||||
|
//WiFi.config( ip, dns, gateway, subnet );
|
||||||
|
if (!WiFi.config(ip, gateway, subnet, dns, secondaryDNS))
|
||||||
|
{
|
||||||
|
Serial.println("STA Failed to configure");
|
||||||
|
}
|
||||||
WiFi.begin (STASSID, STAPSK);
|
WiFi.begin (STASSID, STAPSK);
|
||||||
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user