Hello,
If this code is executed and the while loop exits, a connection to the WiFi network is established, but it is not guaranteed that an IP address is already obtained.
WFConnect(WF_DEFAULT);
while (WFStatus != CONNECTED);
I try to send something to pachube after the code above, but of course that does not work without IP address. So I have to wait:
WFConnect(WF_DEFAULT);
while (WFStatus != CONNECTED);
vTaskDelay(500);
sendPachube();
I don't like this delay, that is kind of dirty to implement it that way.
Question: Is there any kind of state in WFStatus that notifies me of a new IP? Or is there any other state variable which I should poll?
my output, you can see that the IP address is obtained after the connection event
Start WiFi Connect
Event: Connection Successful
Flyport say: hello world!
New IP Address: 192.168.1.12
Regards,
Michael

.png)

At this point there is no specific function that can do this. The UARTWrite related to the new ip address is located inside the Main.c file.
You could tweak this file and set a flag if the current IP is different, but you could do this also inside the taskFlyport.c using the same method of Main.c.
For my own, I can suggest this kind of code for the taskFlyport.c (attached also the C source code) :
This Cat's on a Hot Tin Roof!
Thank you very much for your fast response.
Your code looks very promising :-) I'll try it out tonight, but I'm sure it'll work much better than my stupid delay.
Thanks,
Michael
Thank you very much for your fast response.
Your code looks very promising :-) I'll try it out tonight, but I'm sure it'll work much better than my stupid delay.
Your delay is not so stupid... if you have to check only one time... a simple delay is more code-fast friendly for our lazy minds!!! :D
I use it very often...
Thanks,
Michael
you are welcome!
This Cat's on a Hot Tin Roof!