Hello,
I am checking my wifi connection status.
I am using timer to check the connection status as below
B4X:
Sub Process_Globals
Public Serial1 As Serial
Private wifi As ESP8266WiFi
Private softserial As SoftwareSerial
Private astream As AsyncStreams
Private timer1 As Timer
End Sub
Private Sub AppStart
'Serial1.Initialize(115200)
softserial.Initialize(115200,5,4)
Log("AppStart")
If wifi.Connect2("xxxxx", "xxxxxx") Then
Log("Connected to network")
Else
Log("Failed to connect to network")
End If
timer1.Initialize("Checkconnstat",2000)
timer1.Enabled=True
End Sub
Private Sub CheckConnection()
If wifi.IsConnected Then
'--->Do nothing
Else
wifi.Connect2("xxxxx", "xxxxx")
End If
End Sub
Private Sub Checkconnstat()
CheckConnection
End Sub
But If want to use CallSubPlus instead of timer how Do I use it
one way is to call one time your sub and this sub will call sub itself by a callsubplus
B4X:
Private Sub AppStart
'Serial1.Initialize(115200)
softserial.Initialize(115200,5,4)
Log("AppStart")
If wifi.Connect2("xxxxx", "xxxxxx") Then
Log("Connected to network")
Else
Log("Failed to connect to network")
End If
callsubplus("Checkconnection",2000,0)
End Sub
Private Sub CheckConnection(tag as byte))
If wifi.IsConnected Then
'--->Do nothing
Else
wifi.Connect2("xxxxx", "xxxxx")
End If
callsubplus("Checkconnstat",2000,0)
End Sub