|
229 | 229 | text-shadow: 0 0 8px rgba(10, 255, 157, .5); |
230 | 230 | } |
231 | 231 |
|
| 232 | + #wifiIndicator { |
| 233 | + margin-right: 12px; |
| 234 | + font-family: "Share Tech Mono", monospace; |
| 235 | + font-size: .9rem; |
| 236 | + color: var(--cp-cyan); |
| 237 | + text-shadow: 0 0 8px rgba(0, 240, 255, .5); |
| 238 | + } |
| 239 | + |
| 240 | + #wifiIndicator #wifiLevel { |
| 241 | + margin-left: 3px; |
| 242 | + } |
| 243 | + |
| 244 | + #wifiIndicator.wifi-good { |
| 245 | + color: var(--cp-green); |
| 246 | + text-shadow: 0 0 8px rgba(10, 255, 157, .5); |
| 247 | + } |
| 248 | + |
| 249 | + #wifiIndicator.wifi-weak { |
| 250 | + color: var(--cp-magenta); |
| 251 | + text-shadow: 0 0 8px rgba(255, 42, 109, .6); |
| 252 | + } |
| 253 | + |
232 | 254 | #batteryIndicator.battery-low { |
233 | 255 | color: var(--cp-magenta); |
234 | 256 | text-shadow: 0 0 8px rgba(255, 42, 109, .6); |
|
1197 | 1219 | <div class="collapse navbar-collapse justify-content-end"> |
1198 | 1220 | <span class="navbar-text" id="connLost" data-i18n="[title]toast.conlost"><i class="fas fa-link-slash"></i></span> |
1199 | 1221 | <span class="navbar-text" id="actionOk" aria-hidden="true"><i class="fas fa-check"></i> OK</span> |
| 1222 | + <span class="navbar-text" id="wifiIndicator" data-visible="false" data-i18n="[title]nav.wifi"> |
| 1223 | + <i class="fas fa-wifi" id="wifiIcon"></i><span id="wifiLevel"></span> |
| 1224 | + </span> |
1200 | 1225 | <span class="navbar-text" id="batteryIndicator" data-visible="false"> |
1201 | 1226 | <i class="fas fa-battery-three-quarters" id="batteryIcon"></i><span id="batteryLevel"></span> |
1202 | 1227 | </span> |
@@ -3605,6 +3630,9 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5> |
3605 | 3630 | if ("battery" in socketMsg) { |
3606 | 3631 | updateBatteryIndicator(socketMsg.battery); |
3607 | 3632 | } |
| 3633 | + if ("rssi" in socketMsg) { |
| 3634 | + updateWifiIndicator(socketMsg.rssi); |
| 3635 | + } |
3608 | 3636 | if ("volume" in socketMsg) { |
3609 | 3637 | volumeSlider.setValue(parseInt(socketMsg.volume)); |
3610 | 3638 | } |
@@ -4881,6 +4909,18 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5> |
4881 | 4909 | } |
4882 | 4910 | } |
4883 | 4911 |
|
| 4912 | + // Update the navbar WiFi indicator from the RSSI (dBm) reported by the device. |
| 4913 | + function updateWifiIndicator(rssi) { |
| 4914 | + const indicator = document.getElementById('wifiIndicator'); |
| 4915 | + if (!indicator || rssi == null) return; |
| 4916 | + // same quality mapping as the firmware WiFi scan (0..100 %) |
| 4917 | + let quality = rssi <= -100 ? 0 : rssi >= -50 ? 100 : 2 * (rssi + 100); |
| 4918 | + document.getElementById('wifiLevel').textContent = quality + '%'; |
| 4919 | + indicator.title = rssi + ' dBm'; |
| 4920 | + indicator.classList.toggle('wifi-good', quality >= 60); |
| 4921 | + indicator.classList.toggle('wifi-weak', quality < 30); |
| 4922 | + indicator.setAttribute('data-visible', true); |
| 4923 | + } |
4884 | 4924 | var batteryLowWarned = false; |
4885 | 4925 | function updateBatteryIndicator(battery) { |
4886 | 4926 | const indicator = document.getElementById('batteryIndicator'); |
|
0 commit comments