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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user