B4R Question WIFI OFF (sleep) and after 60 second WIFI ON, with ESP8266 + change WifiPower

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear friends, I am using ESP8266MOD

my code:

B4X:
Dim ota As ESP8266OTA
Private esp As ESP8266extras
Private wifi As ESP8266WiFi

If wifi.IsConnected=True Then
    wifi.Disconnect
    If esp.WIFI_MODE_STA=True Then esp.SetWifiMode(esp.WIFI_MODE_OFF)  ' **** here is my mistake
    Log("go sleep")
End If
                                      
Delay(60000)                                     
                                      
esp.SetWifiMode(esp.WIFI_MODE_STA)
esp.SetPower(18)
Log("wake up")

but I get:
\Objects\bin\libraries\ESP8266HTTPClient\ESP8266HTTPClient.a" "\Objects\bin\libraries\EEPROM\EEPROM.cpp.o" "C:\Objects\bin\core\core.a" -lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group "-L\Objects\bin"
/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: \Objects\bin\sketch\rESP8266extras.cpp.o: in function `B4R::B4RESP8266extras::GetMacAddress(B4R::Array*)':Objects\bin\sketch/rESP8266extras.cpp:48: undefined reference to `B4R::WiFiGeneric'
collect2.exe: error: ld returned 1 exit statusexit status 1exit status 1

the reason of mistake is: esp.SetPower(18)

- I need activate some "sleep wifi mode" for 1 minute, but without connecting GPIO16 pin to RST pin and set power to 18.
- I need recognize state: "If esp.WIFI_MODE_STA=True"

Please very much for help
Best regards
p4ppc
 
Last edited:
Top