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)
|
||||
{
|
||||
if (!config_.IsClientMode) {
|
||||
Serial.print("WIFI connecting to " + wifiName);
|
||||
Serial.print("WIFI connecting to " + wifiName);
|
||||
|
||||
WiFi.setHostname("loraprs");
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin(wifiName.c_str(), wifiKey.c_str());
|
||||
WiFi.setHostname("loraprs");
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin(wifiName.c_str(), wifiKey.c_str());
|
||||
|
||||
int retryCnt = 0;
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(CfgConnRetryMs);
|
||||
Serial.print(".");
|
||||
if (retryCnt++ >= CfgConnRetryMaxTimes) {
|
||||
Serial.println("failed");
|
||||
return;
|
||||
}
|
||||
int retryCnt = 0;
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(CfgConnRetryMs);
|
||||
Serial.print(".");
|
||||
if (retryCnt++ >= CfgConnRetryMaxTimes) {
|
||||
Serial.println("failed");
|
||||
return;
|
||||
}
|
||||
Serial.println("ok");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
Serial.println("ok");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
}
|
||||
|
||||
void Service::reconnectWifi() const
|
||||
|
|
|
@ -56,7 +56,7 @@ private:
|
|||
void processIncomingRawPacketAsServer(const byte *packet, int packetLength);
|
||||
|
||||
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 needsBt() const { return config_.IsClientMode; }
|
||||
|
|
Ładowanie…
Reference in New Issue