feat(settings): Implement persistent Modbus configuration
- Integrate the Zephyr Settings subsystem to persist Modbus parameters. - Use NVS (Non-Volatile Storage) as the backend with a dedicated flash partition. - Modbus baudrate and slave ID are now loaded at startup. - Changes made via the shell are saved to flash and survive a reboot. - Add a 'reset' command to the shell for easier testing. - Fix all compiler and devicetree warnings for a clean build.
This commit is contained in:
12
software/apps/slave_node/src/shell_system.c
Normal file
12
software/apps/slave_node/src/shell_system.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <zephyr/shell/shell.h>
|
||||
#include <zephyr/sys/reboot.h>
|
||||
|
||||
static int cmd_reset(const struct shell *sh, size_t argc, char **argv)
|
||||
{
|
||||
shell_print(sh, "Rebooting system...");
|
||||
k_sleep(K_MSEC(100)); // Allow the shell to print the message
|
||||
sys_reboot(SYS_REBOOT_WARM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SHELL_CMD_REGISTER(reset, NULL, "Reboot the system", cmd_reset);
|
||||
Reference in New Issue
Block a user