Tabellen erhalten, wenn Settings gespeichert werden
This commit is contained in:
parent
49bd17d52b
commit
84eb4b2365
12
src/main.rs
12
src/main.rs
@ -161,7 +161,17 @@ async fn save_settings(
|
||||
settings: web::Json<AppConfig>,
|
||||
) -> Result<HttpResponse> {
|
||||
let mut config = data.config.lock().unwrap();
|
||||
let new_config = settings.into_inner();
|
||||
let mut new_config = settings.into_inner();
|
||||
// Tabellenwerte erhalten, falls sie im Request null sind
|
||||
if new_config.modbus_coils.is_none() {
|
||||
new_config.modbus_coils = config.modbus_coils.clone();
|
||||
}
|
||||
if new_config.modbus_input_register.is_none() {
|
||||
new_config.modbus_input_register = config.modbus_input_register.clone();
|
||||
}
|
||||
if new_config.modbus_holding_register.is_none() {
|
||||
new_config.modbus_holding_register = config.modbus_holding_register.clone();
|
||||
}
|
||||
// Value-Maps neu initialisieren
|
||||
let mut value_maps = data.value_maps.lock().unwrap();
|
||||
*value_maps = ModbusValueMaps::from_config(&new_config);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user