kopia lustrzana https://github.com/sh123/esp32_loraprs
Use wifi when KISS TCP/IP is needed
rodzic
89ef736c93
commit
cb3960e963
|
@ -63,25 +63,24 @@ void Service::setup(const Config &conf)
|
||||||
|
|
||||||
void Service::setupWifi(const String &wifiName, const String &wifiKey)
|
void Service::setupWifi(const String &wifiName, const String &wifiKey)
|
||||||
{
|
{
|
||||||
if (!config_.IsClientMode) {
|
Serial.print("WIFI connecting to " + wifiName);
|
||||||
Serial.print("WIFI connecting to " + wifiName);
|
|
||||||
|
|
||||||
WiFi.setHostname("loraprs");
|
WiFi.setHostname("loraprs");
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.begin(wifiName.c_str(), wifiKey.c_str());
|
WiFi.begin(wifiName.c_str(), wifiKey.c_str());
|
||||||
|
|
||||||
int retryCnt = 0;
|
int retryCnt = 0;
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
delay(CfgConnRetryMs);
|
delay(CfgConnRetryMs);
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
if (retryCnt++ >= CfgConnRetryMaxTimes) {
|
if (retryCnt++ >= CfgConnRetryMaxTimes) {
|
||||||
Serial.println("failed");
|
Serial.println("failed");
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Serial.println("ok");
|
|
||||||
Serial.println(WiFi.localIP());
|
|
||||||
}
|
}
|
||||||
|
Serial.println("ok");
|
||||||
|
Serial.println(WiFi.localIP());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Service::reconnectWifi() const
|
void Service::reconnectWifi() const
|
||||||
|
|
|
@ -56,7 +56,7 @@ private:
|
||||||
void processIncomingRawPacketAsServer(const byte *packet, int packetLength);
|
void processIncomingRawPacketAsServer(const byte *packet, int packetLength);
|
||||||
|
|
||||||
inline bool needsAprsis() const {
|
inline bool needsAprsis() const {
|
||||||
return !config_.IsClientMode && (config_.EnableRfToIs || config_.EnableIsToRf);
|
return !config_.IsClientMode && (config_.EnableRfToIs || config_.EnableIsToRf);
|
||||||
}
|
}
|
||||||
inline bool needsWifi() const { return needsAprsis() || config_.KissEnableTcpIp; }
|
inline bool needsWifi() const { return needsAprsis() || config_.KissEnableTcpIp; }
|
||||||
inline bool needsBt() const { return config_.IsClientMode; }
|
inline bool needsBt() const { return config_.IsClientMode; }
|
||||||
|
|
Ładowanie…
Reference in New Issue