GainSpan Wi-Fi library see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
Dependents: GSwifi_httpd GSwifi_websocket GSwifi_tcpclient GSwifi_tcpserver ... more
Fork of GSwifi by
GainSpan Wi-Fi library
The GS1011 is an ultra low power 802.11b wireless module from GainSpan.
see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
ゲインスパン Wi-Fi モジュール ライブラリ
ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011 シリーズ用のライブラリです。
解説: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
Diff: GSwifi.cpp
- Revision:
- 42:9b3c38d66fa8
- Parent:
- 41:0afda15e9bb4
- Child:
- 43:0b5e2727e020
--- a/GSwifi.cpp Wed Aug 21 13:53:56 2013 +0000 +++ b/GSwifi.cpp Wed Dec 18 01:16:04 2013 +0000 @@ -135,7 +135,6 @@ _ssid = NULL; _pass = NULL; _reconnect = 0; - _reconnect_time = 0; _buf_cmd.flush(); wait_ms(100); @@ -643,6 +642,8 @@ void GSwifi::poll () { int i, j; + static int t = 0; + static Timer timer; for (i = 0; i < 16; i ++) { if (_gs_sock[i].connect && _gs_sock[i].received) { @@ -657,12 +658,12 @@ } } - if (_reconnect > 0 && ! _connect) { - if (_reconnect_time < time(NULL)) { - DBG("reconnect %d\r\n", _reconnect_time); - if (reconnect()) { - _reconnect_time = time(NULL) + _reconnect; - } + if (t == 0 || timer.read() > _reconnect) { + DBG("reconnect\r\n"); + if (reconnect()) { + timer.reset(); + timer.start(); + t = 1; } } } @@ -822,8 +823,7 @@ if (r == 0) { _connect = true; - _reconnect = reconnect; - _reconnect_time = 0; + _reconnect = reconnect * 1000; _sec = sec; _dhcp = dhcp; if (_reconnect && ssid) {