feat: show MAC address on splash screen

Splash/waiting screen now shows:
  Row 1: "DongLoRa" (bold)
  Row 2: "Board Name vX.Y.Z"
  Row 3: MAC address (XX:XX:XX:XX:XX:XX)
  Row 4: "Waiting for host..."

Each board reads its MAC at init:
- ESP32-S3: efuse MAC via esp_hal::efuse::Efuse::mac_address()
- nRF52840: FICR device address registers

BoardInfo struct bundles name/version/mac to keep dashboard() under
clippy's argument limit.
This commit is contained in:
swaits committed 2026-03-29 21:33:07 -06:00
1 parent 7dc79c1a24
commit d22d2b92ac
5 files changed
+67 -19

No files matched your search

+3 -1
View File
@@ -41,6 +41,7 @@ pub struct UsbParts {
pub struct DisplayParts {
pub i2c: DisplayI2c,
pub mac: [u8; 6],
}
// ── Board init ───────────────────────────────────────────────────────
@@ -130,7 +131,8 @@ impl Board {
.with_sda(p.GPIO17)
.with_scl(p.GPIO18)
.into_async();
let display = Some(DisplayParts { i2c });
let mac = esp_hal::efuse::Efuse::mac_address();
let display = Some(DisplayParts { i2c, mac });
(radio, usb, display)
}
+3 -1
View File
@@ -41,6 +41,7 @@ pub struct UsbParts {
pub struct DisplayParts {
pub i2c: DisplayI2c,
pub mac: [u8; 6],
}
// ── Board init ───────────────────────────────────────────────────────
@@ -141,7 +142,8 @@ impl Board {
.with_sda(p.GPIO17)
.with_scl(p.GPIO18)
.into_async();
let display = Some(DisplayParts { i2c });
let mac = esp_hal::efuse::Efuse::mac_address();
let display = Some(DisplayParts { i2c, mac });
(radio, usb, display)
}
+18 -1
View File
@@ -49,6 +49,7 @@ pub struct UsbParts {
pub struct DisplayParts {
pub i2c: DisplayI2c,
pub mac: [u8; 6],
}
// ── Board init ───────────────────────────────────────────────────────
@@ -110,7 +111,23 @@ impl Board {
// via SSD1306 init (fails gracefully if no display attached).
let i2c_cfg = twim::Config::default();
let i2c = Twim::new(p.TWISPI0, Irqs, p.P0_13, p.P0_14, i2c_cfg);
let display = Some(DisplayParts { i2c });
// Read device address from FICR (factory info registers).
// FICR is at fixed address 0x10000000 on nRF52840.
let mac = unsafe {
let ficr = 0x10000000 as *const u32;
// DEVICEADDR[0] at offset 0x0A4, DEVICEADDR[1] at offset 0x0A8
let addr0 = core::ptr::read_volatile(ficr.byte_add(0x0A4));
let addr1 = core::ptr::read_volatile(ficr.byte_add(0x0A8));
[
addr0 as u8,
(addr0 >> 8) as u8,
(addr0 >> 16) as u8,
(addr0 >> 24) as u8,
addr1 as u8,
(addr1 >> 8) as u8,
]
};
let display = Some(DisplayParts { i2c, mac });
(radio, usb, display)
}