mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-25 07:17:16 +00:00
Fix improve wrong ip address
This commit is contained in:
parent
8588340bff
commit
4cb6dc2f58
@ -379,18 +379,16 @@ String WifiGetIPv6(void)
|
|||||||
#endif // LWIP_IPV6=1
|
#endif // LWIP_IPV6=1
|
||||||
|
|
||||||
// Check to see if we have any routable IP address
|
// Check to see if we have any routable IP address
|
||||||
inline bool WifiCheck_hasIP(IPAddress const & ip_address)
|
bool WifiHasIP(void) {
|
||||||
{
|
|
||||||
#ifdef LWIP2_IPV6
|
#ifdef LWIP2_IPV6
|
||||||
return !a.isLocal();
|
return !a.isLocal();
|
||||||
#else
|
#else
|
||||||
return static_cast<uint32_t>(ip_address) != 0;
|
return (uint32_t)WiFi.localIP() != 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void WifiCheckIp(void)
|
void WifiCheckIp(void) {
|
||||||
{
|
if ((WL_CONNECTED == WiFi.status()) && WifiHasIP()) {
|
||||||
if ((WL_CONNECTED == WiFi.status()) && WifiCheck_hasIP(WiFi.localIP())) {
|
|
||||||
WifiSetState(1);
|
WifiSetState(1);
|
||||||
Wifi.counter = WIFI_CHECK_SEC;
|
Wifi.counter = WIFI_CHECK_SEC;
|
||||||
Wifi.retry = Wifi.retry_init;
|
Wifi.retry = Wifi.retry_init;
|
||||||
@ -520,7 +518,7 @@ void WifiCheck(uint8_t param)
|
|||||||
Wifi.counter = WIFI_CHECK_SEC;
|
Wifi.counter = WIFI_CHECK_SEC;
|
||||||
WifiCheckIp();
|
WifiCheckIp();
|
||||||
}
|
}
|
||||||
if ((WL_CONNECTED == WiFi.status()) && WifiCheck_hasIP(WiFi.localIP()) && !Wifi.config_type) {
|
if ((WL_CONNECTED == WiFi.status()) && WifiHasIP() && !Wifi.config_type) {
|
||||||
WifiSetState(1);
|
WifiSetState(1);
|
||||||
if (Settings->flag3.use_wifi_rescan) { // SetOption57 - Scan wifi network every 44 minutes for configured AP's
|
if (Settings->flag3.use_wifi_rescan) { // SetOption57 - Scan wifi network every 44 minutes for configured AP's
|
||||||
if (!(TasmotaGlobal.uptime % (60 * WIFI_RESCAN_MINUTES))) {
|
if (!(TasmotaGlobal.uptime % (60 * WIFI_RESCAN_MINUTES))) {
|
||||||
|
@ -105,7 +105,7 @@ const char HTTP_SCRIPT_WIFI[] PROGMEM =
|
|||||||
"}";
|
"}";
|
||||||
|
|
||||||
const char HTTP_SCRIPT_HIDE[] PROGMEM =
|
const char HTTP_SCRIPT_HIDE[] PROGMEM =
|
||||||
"function hidBtns() {"
|
"function hidBtns(){"
|
||||||
"eb('butmo').style.display='none';"
|
"eb('butmo').style.display='none';"
|
||||||
"eb('butmod').style.display='none';"
|
"eb('butmod').style.display='none';"
|
||||||
"eb('but0').style.display='block';"
|
"eb('but0').style.display='block';"
|
||||||
@ -3549,7 +3549,7 @@ bool Xdrv01(uint8_t function)
|
|||||||
if (Web.wifi_test_counter) {
|
if (Web.wifi_test_counter) {
|
||||||
Web.wifi_test_counter--;
|
Web.wifi_test_counter--;
|
||||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_TRYING_TO_CONNECT " %s"), SettingsText(SET_STASSID1));
|
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_TRYING_TO_CONNECT " %s"), SettingsText(SET_STASSID1));
|
||||||
if ( WifiCheck_hasIP(WiFi.localIP()) ) { // Got IP - Connection Established
|
if (WifiHasIP()) { // Got IP - Connection Established
|
||||||
Web.wifi_test_AP_TIMEOUT = false;
|
Web.wifi_test_AP_TIMEOUT = false;
|
||||||
Web.wifi_test_counter = 0;
|
Web.wifi_test_counter = 0;
|
||||||
Web.wifiTest = WIFI_TEST_FINISHED;
|
Web.wifiTest = WIFI_TEST_FINISHED;
|
||||||
|
@ -293,7 +293,7 @@ void ImprovEverySecond(void) {
|
|||||||
if (Improv.wifi_timeout) {
|
if (Improv.wifi_timeout) {
|
||||||
Improv.wifi_timeout--;
|
Improv.wifi_timeout--;
|
||||||
if (Improv.wifi_timeout < IMPROV_WIFI_TIMEOUT -3) { // Tasmota restarts after ssid or password change
|
if (Improv.wifi_timeout < IMPROV_WIFI_TIMEOUT -3) { // Tasmota restarts after ssid or password change
|
||||||
if ((!TasmotaGlobal.global_state.wifi_down)) {
|
if (WifiHasIP()) {
|
||||||
Improv.wifi_timeout = 0;
|
Improv.wifi_timeout = 0;
|
||||||
if (IMPROV_STATE_AUTHORIZED == RtcSettings.improv_state) {
|
if (IMPROV_STATE_AUTHORIZED == RtcSettings.improv_state) {
|
||||||
RtcSettings.improv_state = IMPROV_STATE_PROVISIONED;
|
RtcSettings.improv_state = IMPROV_STATE_PROVISIONED;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user