Repository navigation
feat(companion): add CLI commands for Wi-Fi and BLE MAC addresses - #13
Merged
Merged
Conversation
Users had no way to read the device MACs without a serial log or a network scan, which they need for DHCP reservations and MAC filtering. Meshcomod chat and the on-device terminal get `mac`. The companion CLI (app console, USB serial) gets `get mac`, `get wifi.mac` and `get ble.mac`. The addresses come from eFuse via esp_read_mac, so they work while either radio is off. Chips without the interface, and non-ESP32 builds, answer n/a.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
New commands that show the device's Wi-Fi and BLE MAC addresses:
macget mac,get wifi.mac,get ble.macmacis also listed inhelp, in the touch terminal's command picker, and in the terminal's keyword list, so it still runs while a chat is open. The README command table lists it too.Why
Users need the MACs for things like DHCP reservations and router MAC filtering. Until now the only ways to get them were a serial boot log or a network scan.
How it works
The addresses come from eFuse via
esp_read_mac(ESP_MAC_WIFI_STA,ESP_MAC_BT), so they are correct even when Wi-Fi or BLE is turned off. If the chip has no such interface (ESP32-S2 has no Bluetooth), or the build is not ESP32, the command answersn/a. NimBLE uses the public BT address by default, so the BLE MAC shown should match what phones see.Testing
pio run -e heltec_v4_companion_radio_usb_tcpbuilds.pio run -e heltec_v4_tft_companion_radio_usb_tcp_touchbuilds.Firmware / build impact
Companion firmware only, and the flash cost is small. Repeater and room server CLIs (
CommonCLI) are not changed.