merge error fix

pull/41/head
Benjamin Runnels 9 years ago
parent 248f2f3f47
commit 47b33f837f
  1. 19
      esp-link/cgiwifi.c
  2. 1
      esp-link/cgiwifi.h

@ -24,7 +24,8 @@ Cgi/template routines for the /wifi url.
//#define SLEEP_MODE LIGHT_SLEEP_T
#define SLEEP_MODE MODEM_SLEEP_T
// ===== wifi status change callback
// ===== wifi status change callbacks
static WifiStateChangeCb wifi_state_change_cb[4];
uint8_t wifiState = wifiIsDisconnected;
// reasons for which a connection failed
@ -88,7 +89,21 @@ static void ICACHE_FLASH_ATTR wifiHandleEventCb(System_Event_t *evt) {
default:
break;
}
if (wifiStatusCb) (*wifiStatusCb)(wifiState);
for (int i = 0; i < 4; i++) {
if (wifi_state_change_cb[i] != NULL) (wifi_state_change_cb[i])(wifiState);
}
}
void ICACHE_FLASH_ATTR
wifiAddStateChangeCb(WifiStateChangeCb cb) {
for (int i = 0; i < 4; i++) {
if (wifi_state_change_cb[i] == NULL) {
wifi_state_change_cb[i] = cb;
return;
}
}
os_printf("WIFI: max state change cb count exceeded\n");
}
// ===== wifi scanning

@ -17,6 +17,5 @@ void wifiInit(void);
void wifiAddStateChangeCb(WifiStateChangeCb cb);
extern uint8_t wifiState;
//extern void (*wifiStatusCb)(uint8_t); // callback when wifi status changes
#endif

Loading…
Cancel
Save