@@ -1283,9 +1283,10 @@ void wifiVerifyTables()
12831283// Constructor
12841284// Inputs:
12851285// verbose: Set to true to display additional WiFi debug data
1286+ // For AP on RTK Firmware, we set the Gateway to 192.168.4.1, not 0.0.0.0. Let's do the same here.
12861287RTK_WIFI::RTK_WIFI (bool verbose)
12871288 : _apChannel{0 }, _apCount{0 }, _apDnsAddress{IPAddress ((uint32_t )0 )}, _apFirstDhcpAddress{IPAddress (" 192.168.4.32" )},
1288- _apGatewayAddress{( uint32_t ) 0 }, _apIpAddress{IPAddress (" 192.168.4.1" )}, _apMacAddress{0 , 0 , 0 , 0 , 0 , 0 },
1289+ _apGatewayAddress{IPAddress ( " 192.168.4.1 " ) }, _apIpAddress{IPAddress (" 192.168.4.1" )}, _apMacAddress{0 , 0 , 0 , 0 , 0 , 0 },
12891290 _apSubnetMask{IPAddress (" 255.255.255.0" )}, _espNowChannel{0 }, _scanRunning{false },
12901291 _staIpAddress{IPAddress ((uint32_t )0 )}, _staIpType{0 }, _staMacAddress{0 , 0 , 0 , 0 , 0 , 0 }, _staRemoteApSsid{nullptr },
12911292 _staRemoteApPassword{nullptr }, _started{false }, _stationChannel{0 }, _usingDefaultChannel{true }, _verbose{verbose}
@@ -2715,7 +2716,8 @@ bool RTK_WIFI::stopStart(WIFI_ACTION_t stopping, WIFI_ACTION_t starting)
27152716 }
27162717
27172718 // Stop the DNS server
2718- if (stopping & _started & WIFI_AP_START_DNS_SERVER)
2719+ // if (stopping & _started & WIFI_AP_START_DNS_SERVER) ???
2720+ if (stopping & WIFI_AP_START_DNS_SERVER)
27192721 {
27202722 if (settings.debugWifiState && _verbose)
27212723 systemPrintf (" Calling dnsServer.stop for soft AP\r\n " );
@@ -2858,8 +2860,8 @@ bool RTK_WIFI::stopStart(WIFI_ACTION_t stopping, WIFI_ACTION_t starting)
28582860 // Finish the channel selection
28592861 if (starting & WIFI_SELECT_CHANNEL)
28602862 {
2861- _started = _started | starting & WIFI_SELECT_CHANNEL;
2862- if (channel & (starting & WIFI_STA_START_SCAN))
2863+ _started = _started | ( starting & WIFI_SELECT_CHANNEL) ;
2864+ if (channel && (starting & WIFI_STA_START_SCAN))
28632865 {
28642866 if (settings.debugWifiState && _verbose)
28652867 systemPrintf (" Channel: %d, determined by remote AP scan\r\n " , channel);
@@ -2882,12 +2884,12 @@ bool RTK_WIFI::stopStart(WIFI_ACTION_t stopping, WIFI_ACTION_t starting)
28822884 // Set the soft AP subnet mask, IP, gateway, DNS, and first DHCP addresses
28832885 if (starting & WIFI_AP_SET_IP_ADDR)
28842886 {
2885- // if (!softApSetIpAddress(_apIpAddress.toString().c_str(), _apSubnetMask.toString().c_str(),
2886- // _apGatewayAddress.toString().c_str(), _apDnsAddress.toString().c_str(),
2887- // _apFirstDhcpAddress.toString().c_str()))
2888- // {
2889- // break;
2890- // }
2887+ if (!softApSetIpAddress (_apIpAddress.toString ().c_str (), _apSubnetMask.toString ().c_str (),
2888+ _apGatewayAddress.toString ().c_str (), _apDnsAddress.toString ().c_str (),
2889+ _apFirstDhcpAddress.toString ().c_str ()))
2890+ {
2891+ break ;
2892+ }
28912893 _started = _started | WIFI_AP_SET_IP_ADDR;
28922894 }
28932895
0 commit comments