fn update_on_ack(&mut self, ack: ControlAck) {
        match ack.setting {
            ControlSetting::PeakPressure => {
                self.last_machine_snapshot.peak_command = ack.value as u8
            }
            ControlSetting::PlateauPressure => {
                self.last_machine_snapshot.plateau_command = ack.value as u8
            }
            ControlSetting::PEEP => self.last_machine_snapshot.peep_command = ack.value as u8,
            ControlSetting::CyclesPerMinute => {
                self.last_machine_snapshot.cpm_command = ack.value as u8
            }
            ControlSetting::TriggerEnabled => {
                self.settings.inspiratory_trigger.state = if ack.value == 0 {
                    TriggerInspiratoryState::Disabled
                } else {
                    TriggerInspiratoryState::Enabled
                }
            }
            ControlSetting::TriggerOffset => {
                self.settings.inspiratory_trigger.inspiratory_trigger_offset = ack.value as usize
            }
            ControlSetting::ExpiratoryTerm => {
                self.settings.inspiratory_trigger.expiratory_term = ack.value as usize
            }
        }
    }
// TODO: Mutate the last_machine_snapshot is not great, need to be reworked
Mutate the last_machine_snapshot is not great, need to be reworked
Mutate the last_machine_snapshot is not great need to be reworked
fn update_on_ack(&mut self, ack: ControlAck) {
        match ack.setting {
            ControlSetting::PeakPressure => {
                self.last_machine_snapshot.peak_command = ack.value as u8
            }
            ControlSetting::PlateauPressure => {
                self.last_machine_snapshot.plateau_command = ack.value as u8
            }
            ControlSetting::PEEP => self.last_machine_snapshot.peep_command = ack.value as u8,
            ControlSetting::CyclesPerMinute => {
                self.last_machine_snapshot.cpm_command = ack.value as u8
            }
            ControlSetting::TriggerEnabled => {
                self.settings.inspiratory_trigger.state = if ack.value == 0 {
                    TriggerInspiratoryState::Disabled
                } else {
                    TriggerInspiratoryState::Enabled
                }
            }
            ControlSetting::TriggerOffset => {
                self.settings.inspiratory_trigger.inspiratory_trigger_offset = ack.value as usize
            }
            ControlSetting::ExpiratoryTerm => {
                self.settings.inspiratory_trigger.expiratory_term = ack.value as usize
            }
        }
    }
fn update_on_ack ( & mut self , ack : ControlAck ) { match ack . setting { ControlSetting :: PeakPressure => { self . last_machine_snapshot . peak_command = ack . value as u8 } ControlSetting :: PlateauPressure => { self . last_machine_snapshot . plateau_command = ack . value as u8 } ControlSetting :: PEEP => self . last_machine_snapshot . peep_command = ack . value as u8 , ControlSetting :: CyclesPerMinute => { self . last_machine_snapshot . cpm_command = ack . value as u8 } ControlSetting :: TriggerEnabled => { self . settings . inspiratory_trigger . state = if ack . value == 0 { TriggerInspiratoryState :: Disabled } else { TriggerInspiratoryState :: Enabled } } ControlSetting :: TriggerOffset => { self . settings . inspiratory_trigger . inspiratory_trigger_offset = ack . value as usize } ControlSetting :: ExpiratoryTerm => { self . settings . inspiratory_trigger . expiratory_term = ack . value as usize } } }
TODO: Mutate the last_machine_snapshot is not great, need to be reworked
TODO : Mutate the last_machine_snapshot is not great need to be reworked
&mut self
ack
ControlAck
&mut self
ack
ControlAck