diff --git a/html/style.css b/html/style.css index 5b6801c..2a2f758 100644 --- a/html/style.css +++ b/html/style.css @@ -14,3 +14,4 @@ body { margin: 0 auto; padding: 20px } + diff --git a/html/wifi/icons.png b/html/wifi/icons.png new file mode 100644 index 0000000..03109e1 Binary files /dev/null and b/html/wifi/icons.png differ diff --git a/html/wifi/style.css b/html/wifi/style.css index 5b6801c..abcfb10 100644 --- a/html/wifi/style.css +++ b/html/wifi/style.css @@ -14,3 +14,11 @@ body { margin: 0 auto; padding: 20px } + +.icon { + background-image: url("icons.png"); + background-color: transparent; + width: 32px; + height: 32px; + display: inline-block; +} \ No newline at end of file diff --git a/html/wifi/wifi.tpl b/html/wifi/wifi.tpl index cd43566..39a8e3c 100644 --- a/html/wifi/wifi.tpl +++ b/html/wifi/wifi.tpl @@ -10,6 +10,16 @@ function createInputForAp(ap) { if (ap.essid=="" && ap.rssi==0) return; var div=document.createElement("div"); div.id="apdiv"; + var rssi=document.createElement("div"); + var rssiVal=Math.floor(ap.rssi/5)*32; + rssi.className="icon"; + rssi.style.backgroundPosition="0px "+rssiVal+"px"; + var encrypt=document.createElement("div"); + var encVal="-64"; //assume wpa/wpa2 + if (ap.enc=="0") encVal="0"; //open + if (ap.enc=="1") encVal="-32"; //wep + encrypt.className="icon"; + encrypt.style.backgroundPosition="32px "+encVal+"px"; var input=document.createElement("input"); input.type="radio"; input.name="essid"; @@ -18,8 +28,10 @@ function createInputForAp(ap) { input.id="opt-"+ap.essid; var label=document.createElement("label"); label.htmlFor="opt-"+ap.essid; - label.textContent=ap.essid+" (rssi "+ap.rssi+")"; + label.textContent=ap.essid; div.appendChild(input); + div.appendChild(rssi); + div.appendChild(encrypt); div.appendChild(label); return div; } diff --git a/user/cgiwifi.c b/user/cgiwifi.c index 91e5270..91f6d4b 100644 --- a/user/cgiwifi.c +++ b/user/cgiwifi.c @@ -95,15 +95,6 @@ static void ICACHE_FLASH_ATTR wifiStartScan() { // int x; if (cgiWifiAps.scanInProgress) return; cgiWifiAps.scanInProgress=1; -#if 0 - //Not sure if this is still needed. - x=wifi_station_get_connect_status(); - if (x!=STATION_GOT_IP) { - //Unit probably is trying to connect to a bogus AP. This messes up scanning. Stop that. - os_printf("STA status = %d. Disconnecting STA...\n", x); - wifi_station_disconnect(); - } -#endif wifi_station_scan(NULL, wifiScanDoneCb); } @@ -145,13 +136,6 @@ int ICACHE_FLASH_ATTR cgiWiFiScan(HttpdConnData *connData) { //Temp store for new ap info. static struct station_config stconf; -/* -ToDo: -- Thoroughly test this code -- Simplify if possible. The cascaded delayed routines are probably not - needed anymore. I hope. -*/ - //This routine is ran some time after a connection attempt to an access point. If //the connect succeeds, this gets the module in STA-only mode. @@ -213,7 +197,6 @@ int ICACHE_FLASH_ATTR cgiWiFiConnect(HttpdConnData *connData) { //Set to 0 if you want to disable the actual reconnecting bit #if 1 os_timer_arm(&reassTimer, 1000, 0); - httpdRedirect(connData, "connecting.html"); #else httpdRedirect(connData, "/wifi");