Meshtastic 自定义固件
构建 Meshtastic 固件
Meshtastic 使用 PlatformIO,这是一个开发环境,可实现轻松的多平台开发和集中式工具。
搭建构建
- 安装 Git
- 安装 PlatformIO
- 克隆 Meshtastic 固件存储库
git clone https://github.com/meshtastic/firmware.git
- 更新仓库的子模块
cd firmware && git submodule update --init
适配开发板
- 在Visual Studio Code中打开新克隆的文件夹。如果是第一次执行此操作,可能需要一些时间,因为 PlatformIO 会下载所有必要的工具和库。此外,如果 PlatformIO 未安装,VSCode 会提示您安装,这可能需要重启程序。
- 要选择要构建的设备,请打开命令面板:
Ctrl + Shift + P - 输入:PlatformIO: Pick Project Environment 并选择您的目标。选择 esp32c3_super_mini 开发板。我这里使用的 lora 模块是 RA-01SC、RA-01SC-P、HT-RA62、RA-01S-P(SX126X 和 LLCC68) 其他的 lora 模块需要选择其他的开发板。
- 要构建固件,只需PlatformIO: Build从命令面板运行即可。
- 最后,运行以下命令将固件刷入您的设备:PlatformIO: Upload
最关键的定义在 firmware\variants\esp32c3\diy\esp32c3_super_mini\ 文件夹下。
variant.h 是关键的文件,该文件定义了 esp32 的引脚和 lora 模块引脚的关系。还有 OLED 屏幕、GPS、Button、LED 的引脚定义。需要按照实际走线关系来定义。
esp32c3_super_mini 开发板 定义的引脚关系如下:
#define LORA_DIO0 RADIOLIB_NC
#define LORA_RESET (5)
#define LORA_DIO1 (3)
#define LORA_RXEN (2)
#define LORA_BUSY (4)
#define LORA_SCK (10)
#define LORA_MISO (6)
#define LORA_MOSI (7)
#define LORA_CS (8)

浙公网安备 33010602011771号