forked from M-Labs/kirdy
Add cmd to Store IP Settings in Flash
- Cmds Setup Flow: Set IP -> Save Settings to Flash -> Issue HardRst
This commit is contained in:
parent
911d9a7bc9
commit
65b757ac3c
@ -19,12 +19,13 @@ use crate::thermostat::thermostat::{Thermostat, ThermostatSettingsSummary};
|
|||||||
use crate::thermostat::pid_state::PidSettings::*;
|
use crate::thermostat::pid_state::PidSettings::*;
|
||||||
use crate::device::{dfu, sys_timer};
|
use crate::device::{dfu, sys_timer};
|
||||||
use log::info;
|
use log::info;
|
||||||
use crate::{DeviceSettings, State};
|
use crate::{DeviceSettings, State, IpSettings};
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Copy, Clone, Default, Debug)]
|
#[derive(Deserialize, Serialize, Copy, Clone, Default, Debug)]
|
||||||
enum DeviceCmd {
|
enum DeviceCmd {
|
||||||
#[default]
|
#[default]
|
||||||
Reserved,
|
Reserved,
|
||||||
|
SetIPSettings,
|
||||||
SetActiveReportMode,
|
SetActiveReportMode,
|
||||||
GetStatusReport,
|
GetStatusReport,
|
||||||
GetSettingsSummary,
|
GetSettingsSummary,
|
||||||
@ -96,6 +97,7 @@ pub struct CmdJsonObj{
|
|||||||
data_f32: Option<f32>,
|
data_f32: Option<f32>,
|
||||||
data_f64: Option<f64>,
|
data_f64: Option<f64>,
|
||||||
temp_adc_filter: Option<TempAdcFilter>,
|
temp_adc_filter: Option<TempAdcFilter>,
|
||||||
|
ip_settings: Option<IpSettings>,
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Copy, Clone, Debug, Default, Tree)]
|
#[derive(Deserialize, Serialize, Copy, Clone, Debug, Default, Tree)]
|
||||||
pub struct Cmd {
|
pub struct Cmd {
|
||||||
@ -185,6 +187,16 @@ pub fn execute_cmd(buffer: &mut [u8], buffer_size: usize, mut laser: LdDrive, mu
|
|||||||
info!("############ Device Command Received {:?}", cmd.json.device_cmd);
|
info!("############ Device Command Received {:?}", cmd.json.device_cmd);
|
||||||
|
|
||||||
match cmd.json.device_cmd {
|
match cmd.json.device_cmd {
|
||||||
|
Some(DeviceCmd::SetIPSettings) => {
|
||||||
|
match cmd.json.ip_settings {
|
||||||
|
Some(val) => {
|
||||||
|
device_settings.ip_settings = val;
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
info!("Wrong Data type is received")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some(DeviceCmd::Dfu) => {
|
Some(DeviceCmd::Dfu) => {
|
||||||
unsafe {
|
unsafe {
|
||||||
dfu::set_dfu_trigger();
|
dfu::set_dfu_trigger();
|
||||||
|
Loading…
Reference in New Issue
Block a user