From ab434dfc1298ff616a5f06bdca0a534cb50a65bd Mon Sep 17 00:00:00 2001 From: Thorsten von Eicken Date: Thu, 25 Jun 2015 21:14:25 -0700 Subject: [PATCH] fix wifi disconnect reason; fix espFsInit ok/err; don't display wifi password --- user/cgiwifi.c | 11 +++++------ user/user_main.c | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/user/cgiwifi.c b/user/cgiwifi.c index 1d5c245..0ac843a 100644 --- a/user/cgiwifi.c +++ b/user/cgiwifi.c @@ -44,7 +44,7 @@ static char *wifiPhy[] = { 0, "11b", "11g", "11n" }; static char* ICACHE_FLASH_ATTR wifiGetReason(void) { if (wifiReason <= 24) return wifiReasons[wifiReason]; - if (wifiReason >= 200 && wifiReason <= 201) return wifiReasons[wifiReason-200+25]; + if (wifiReason >= 200 && wifiReason <= 201) return wifiReasons[wifiReason-200+24]; return wifiReasons[1]; } @@ -61,8 +61,8 @@ static void ICACHE_FLASH_ATTR wifiHandleEventCb(System_Event_t *evt) { case EVENT_STAMODE_DISCONNECTED: wifiState = wifiIsDisconnected; wifiReason = evt->event_info.disconnected.reason; - os_printf("Wifi disconnected from ssid %s, reason %s\n", - evt->event_info.disconnected.ssid, wifiGetReason()); + os_printf("Wifi disconnected from ssid %s, reason %s (%d)\n", + evt->event_info.disconnected.ssid, wifiGetReason(), evt->event_info.disconnected.reason); statusWifiUpdate(wifiState); break; case EVENT_STAMODE_AUTHMODE_CHANGE: @@ -502,9 +502,8 @@ int ICACHE_FLASH_ATTR printWifiInfo(char *buff) { len = os_sprintf(buff, "\"mode\": \"%s\", \"ssid\": \"%s\", \"status\": \"%s\", \"phy\": \"%s\", " - "\"rssi\": \"%ddB\", \"warn\": \"%s\", \"passwd\": \"%s\", " - "\"mac\":\"%02x:%02x:%02x:%02x:%02x:%02x\"", - mode, (char*)stconf.ssid, status, phy, rssi, warn, (char*)stconf.password, + "\"rssi\": \"%ddB\", \"warn\": \"%s\", \"mac\":\"%02x:%02x:%02x:%02x:%02x:%02x\"", + mode, (char*)stconf.ssid, status, phy, rssi, warn, mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); struct ip_info info; diff --git a/user/user_main.c b/user/user_main.c index af3b37b..d7e1ba1 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -137,7 +137,7 @@ void user_init(void) { wifiInit(); // init the flash filesystem with the html stuff EspFsInitResult res = espFsInit(&_binary_espfs_img_start); - os_printf("espFsInit %s\n", res?"ok":"ERR"); + os_printf("espFsInit %s\n", res?"ERR":"ok"); // mount the http handlers httpdInit(builtInUrls, 80); // init the wifi-serial transparent bridge (port 23)