Actually set provided gas config, closes #3.

Failure to set the provided gas config lead to incorrect gas resistance values.
This commit is contained in:
marcelbuesing 2018-06-05 23:42:11 +02:00
parent 76e20820ee
commit 722e054f58
No known key found for this signature in database
GPG key ID: E51C4F8A2B7FF43E

View file

@ -213,18 +213,21 @@ impl SettingsBuilder {
self.sensor_settings.gas_sett.heatr_temp = Some(heatr_temp); self.sensor_settings.gas_sett.heatr_temp = Some(heatr_temp);
self.sensor_settings.gas_sett.ambient_temperature = ambient_temperature; self.sensor_settings.gas_sett.ambient_temperature = ambient_temperature;
self.desired_settings |= DesiredSensorSettings::RUN_GAS_SEL; self.desired_settings |= DesiredSensorSettings::RUN_GAS_SEL;
self.desired_settings |= DesiredSensorSettings::GAS_MEAS_SEL;
self self
} }
pub fn with_nb_conv(mut self, nb_conv: u8) -> SettingsBuilder { pub fn with_nb_conv(mut self, nb_conv: u8) -> SettingsBuilder {
self.sensor_settings.gas_sett.nb_conv = nb_conv; self.sensor_settings.gas_sett.nb_conv = nb_conv;
self.desired_settings |= DesiredSensorSettings::NBCONV_SEL; self.desired_settings |= DesiredSensorSettings::NBCONV_SEL;
self.desired_settings |= DesiredSensorSettings::GAS_MEAS_SEL;
self self
} }
pub fn with_run_gas(mut self, run_gas: bool) -> SettingsBuilder { pub fn with_run_gas(mut self, run_gas: bool) -> SettingsBuilder {
self.sensor_settings.gas_sett.run_gas_measurement = run_gas; self.sensor_settings.gas_sett.run_gas_measurement = run_gas;
self.desired_settings |= DesiredSensorSettings::RUN_GAS_SEL; self.desired_settings |= DesiredSensorSettings::RUN_GAS_SEL;
self.desired_settings |= DesiredSensorSettings::GAS_MEAS_SEL;
self self
} }