| Crates.io | esp-embassy-config |
| lib.rs | esp-embassy-config |
| version | 0.1.0 |
| created_at | 2025-05-09 18:36:58.569915+00 |
| updated_at | 2025-05-09 18:36:58.569915+00 |
| description | Stores config information in flash, which is managed by a uart menu system. |
| homepage | https://github.com/oyvindnetland/esp-embassy-config |
| repository | https://github.com/oyvindnetland/esp-embassy-config |
| max_upload_size | |
| id | 1667483 |
| size | 80,553 |
A crate for storing data on persistent flash on esp32 devices. This can us used for storing information like wifi ssid/password, some url to connect to etc. An uart menu is used to list and update this config.
ConfigEntryA static arrays of ConfigEntry objects has to be passdd is passed to an ConfigMenu
object. This means that the config setup is defined at compile time, which makes sense
for a embedded project. In the examples this is done with StaticCell, which possibly could
be improved with a macro.
// setup config menu
static ENTRIES: StaticCell<[ConfigEntry; 2]> = StaticCell::new();
static CONFIG_MENU: StaticCell<Mutex<CriticalSectionRawMutex, ConfigMenu>> = StaticCell::new();
let entries = ENTRIES.init([
ConfigEntry::new("value", 16, "What is this value?", false),
ConfigEntry::new("long_value", 32, "What is this other value?", true),
]);
let config_menu = CONFIG_MENU.init(Mutex::new(ConfigMenu::new(entries, encoded_key, aes)));
Notice that the "2" in the first line has to match the number of entries.
The ConfigEntry has:
ConfigMenu.The information is AES encrypted before its written to flash. This is not intended to be an absolute secure solution, but to prevent things like wifi password to be stored in clear text on flash. The key for the encryption is a hash created from a supplied key
The wifi feature adds some default entries to the config, and a menu item for connecting
to wifi. This makes it easy to store wifi password (relatively) safely on the device,
and connect using the esp-embassy-wifihelper crate. It is still possible to add your
own custom entries, the wifi ones will just be there as well.
Adding the wifi dependencies adds significant build time and flash size (flash time), so if its not needed, it should probably be skipped.
Simple project for testing out how the menu works.
A project that demonstrate the wifi feature, and connects to wifi using
esp-embassy-wifihelper crate with the information stored in the config.