feat(shell): Add commands for valve timing

- Add shell commands 'valve set_open_time' and 'valve set_close_time' to configure the virtual valve.
- Extend the 'show_config' command to display the new timing values.
- The new settings are persisted to flash storage.
This commit is contained in:
2025-07-01 18:24:20 +02:00
parent 269e9e88a1
commit b100a8acf7
3 changed files with 71 additions and 11 deletions

View File

@@ -238,6 +238,28 @@ uint8_t modbus_get_unit_id(void)
return server_param.server.unit_id;
}
void valve_set_max_open_time(uint16_t seconds)
{
max_opening_time_s = seconds;
settings_save_one("valve/max_open_time", &max_opening_time_s, sizeof(max_opening_time_s));
}
void valve_set_max_close_time(uint16_t seconds)
{
max_closing_time_s = seconds;
settings_save_one("valve/max_close_time", &max_closing_time_s, sizeof(max_closing_time_s));
}
uint16_t valve_get_max_open_time(void)
{
return max_opening_time_s;
}
uint16_t valve_get_max_close_time(void)
{
return max_closing_time_s;
}
static int settings_load_cb(const char *name, size_t len,
settings_read_cb read_cb, void *cb_arg)
{