Browse Source

Added BSSID, channel, RSSI and distance to status tab

i18n
Xose Pérez 6 years ago
parent
commit
f3421a6a4a
6 changed files with 2585 additions and 2556 deletions
  1. +3
    -0
      code/espurna/config/general.h
  2. BIN
      code/espurna/data/index.html.gz
  3. +2558
    -2556
      code/espurna/static/index.html.gz.h
  4. +5
    -0
      code/espurna/wifi.ino
  5. +10
    -0
      code/espurna/ws.ino
  6. +9
    -0
      code/html/index.html

+ 3
- 0
code/espurna/config/general.h View File

@ -318,6 +318,9 @@ PROGMEM const char* const custom_reset_string[] = {
//#define WIFI2_SSID "..." //#define WIFI2_SSID "..."
//#define WIFI2_PASS "..." //#define WIFI2_PASS "..."
#define WIFI_RSSI_1M -30 // Calibrate it with your router reading the RSSI at 1m
#define WIFI_PROPAGATION_CONST 4 // This is typically something between 2.7 to 4.3 (free space is 2)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// WEB // WEB
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


BIN
code/espurna/data/index.html.gz View File


+ 2558
- 2556
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 5
- 0
code/espurna/wifi.ino View File

@ -41,6 +41,11 @@ String getNetwork() {
return WiFi.SSID(); return WiFi.SSID();
} }
double wifiDistance(int rssi) {
double exponent = (double) (WIFI_RSSI_1M - rssi) / WIFI_PROPAGATION_CONST / 10.0;
return round(pow(10, exponent));
}
void wifiDisconnect() { void wifiDisconnect() {
jw.disconnect(); jw.disconnect();
} }


+ 10
- 0
code/espurna/ws.ino View File

@ -220,6 +220,12 @@ void _wsOnStart(JsonObject& root) {
char chipid[7]; char chipid[7];
snprintf_P(chipid, sizeof(chipid), PSTR("%06X"), ESP.getChipId()); snprintf_P(chipid, sizeof(chipid), PSTR("%06X"), ESP.getChipId());
uint8_t * bssid = WiFi.BSSID();
char bssid_str[20];
snprintf_P(bssid_str, sizeof(bssid_str),
PSTR("%02X:%02X:%02X:%02X:%02X:%02X"),
bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]
);
root["webMode"] = WEB_MODE_NORMAL; root["webMode"] = WEB_MODE_NORMAL;
@ -229,6 +235,10 @@ void _wsOnStart(JsonObject& root) {
root["manufacturer"] = MANUFACTURER; root["manufacturer"] = MANUFACTURER;
root["chipid"] = String(chipid); root["chipid"] = String(chipid);
root["mac"] = WiFi.macAddress(); root["mac"] = WiFi.macAddress();
root["bssid"] = String(bssid_str);
root["channel"] = WiFi.channel();
root["rssi"] = WiFi.RSSI();
root["distance"] = wifiDistance(WiFi.RSSI());
root["device"] = DEVICE; root["device"] = DEVICE;
root["hostname"] = getSetting("hostname"); root["hostname"] = getSetting("hostname");
root["network"] = getNetwork(); root["network"] = getNetwork();


+ 9
- 0
code/html/index.html View File

@ -190,6 +190,15 @@
<div class="pure-u-1-2 pure-u-lg-1-4">Network</div> <div class="pure-u-1-2 pure-u-lg-1-4">Network</div>
<div class="pure-u-11-24 pure-u-lg-17-24"><span class="right" name="network"></span></div> <div class="pure-u-11-24 pure-u-lg-17-24"><span class="right" name="network"></span></div>
<div class="pure-u-1-2 pure-u-lg-1-4">BSSID</div>
<div class="pure-u-11-24 pure-u-lg-17-24"><span class="right" name="bssid"></span></div>
<div class="pure-u-1-2 pure-u-lg-1-4">Channel</div>
<div class="pure-u-11-24 pure-u-lg-17-24"><span class="right" name="channel"></span></div>
<div class="pure-u-1-2 pure-u-lg-1-4">RSSI</div>
<div class="pure-u-11-24 pure-u-lg-17-24"><span class="right" name="rssi"></span> (<span name="distance" post="m"></span>)</div>
<div class="pure-u-1-2 pure-u-lg-1-4">IP</div> <div class="pure-u-1-2 pure-u-lg-1-4">IP</div>
<div class="pure-u-11-24 pure-u-lg-17-24"><span class="right" name="deviceip"></span></div> <div class="pure-u-11-24 pure-u-lg-17-24"><span class="right" name="deviceip"></span></div>


Loading…
Cancel
Save