|
36 | 36 | #include "esp_random.h" |
37 | 37 |
|
38 | 38 | #include "driver/gpio.h" |
| 39 | +#include "soc/soc_caps.h" |
| 40 | +#if SOC_TEMP_SENSOR_SUPPORTED |
| 41 | +#include "driver/temperature_sensor.h" |
| 42 | +#endif |
39 | 43 | #include "router_globals.h" |
40 | 44 | #include "cmd_router.h" |
41 | 45 | #include "pcap_capture.h" |
@@ -1360,18 +1364,39 @@ static int show(int argc, char **argv) |
1360 | 1364 | printf("Uplink IP: none\n"); |
1361 | 1365 | } |
1362 | 1366 |
|
1363 | | - // Byte counts |
1364 | | - printf("Bytes sent/received: %" PRIu64 " / %" PRIu64 " bytes\n", get_sta_bytes_sent(), get_sta_bytes_received()); |
1365 | | - |
1366 | | - // Free heap |
1367 | | - printf("Free heap: %lu bytes\n", (unsigned long)esp_get_free_heap_size()); |
1368 | | - |
1369 | 1367 | // AP interface state |
1370 | 1368 | printf("AP interface: %s\n", ap_disabled ? "disabled" : "enabled"); |
1371 | 1369 |
|
1372 | 1370 | // Connected clients |
1373 | 1371 | resync_connect_count(); |
1374 | 1372 | printf("Connected clients: %u\n", connect_count); |
| 1373 | + |
| 1374 | + // Byte counts |
| 1375 | + char _sent_buf[16], _recv_buf[16]; |
| 1376 | + format_bytes_human(get_sta_bytes_sent(), _sent_buf, sizeof(_sent_buf)); |
| 1377 | + format_bytes_human(get_sta_bytes_received(), _recv_buf, sizeof(_recv_buf)); |
| 1378 | + printf("Bytes sent/received: %s / %s\n", _sent_buf, _recv_buf); |
| 1379 | + |
| 1380 | + |
| 1381 | +#if SOC_TEMP_SENSOR_SUPPORTED |
| 1382 | + // CPU temperature |
| 1383 | + { |
| 1384 | + temperature_sensor_handle_t tsens; |
| 1385 | + temperature_sensor_config_t tsens_cfg = TEMPERATURE_SENSOR_CONFIG_DEFAULT(-10, 80); |
| 1386 | + if (temperature_sensor_install(&tsens_cfg, &tsens) == ESP_OK) { |
| 1387 | + float celsius = 0.0f; |
| 1388 | + temperature_sensor_enable(tsens); |
| 1389 | + if (temperature_sensor_get_celsius(tsens, &celsius) == ESP_OK) { |
| 1390 | + printf("CPU temperature: %.1f °C\n", celsius); |
| 1391 | + } |
| 1392 | + temperature_sensor_disable(tsens); |
| 1393 | + temperature_sensor_uninstall(tsens); |
| 1394 | + } |
| 1395 | + } |
| 1396 | +#endif |
| 1397 | + // Free heap |
| 1398 | + printf("Free heap: %lu bytes\n", (unsigned long)esp_get_free_heap_size()); |
| 1399 | + |
1375 | 1400 | if (connect_count > 0) { |
1376 | 1401 | connected_client_t clients[8]; |
1377 | 1402 | int count = get_connected_clients(clients, 8); |
|
0 commit comments