fn boot_time_calibration(&mut self) -> Result<()> {
        if !Path::new(&self.setting.dsm_param).exists() {
            return Err(Error::MissingDSMParam);
        }

        let num_channels = self.setting.num_channels();
        let dsm = DSM::new(
            &self.card.name(),
            num_channels,
            Self::rdc_to_ohm,
            Self::TEMP_UPPER_LIMIT_CELSIUS,
            Self::TEMP_LOWER_LIMIT_CELSIUS,
        );
        self.set_volume(VolumeMode::Low)?;

        let calib = if !self.setting.boot_time_calibration_enabled {
            info!("skip boot time calibration and use vpd values");
            // Needs Rdc updates to be done after internal speaker is ready otherwise
            // it would be overwritten by the DSM blob update.
            dsm.wait_for_speakers_ready()?;
            dsm.get_all_vpd_calibration_value()?
        } else {
            match dsm.check_speaker_over_heated_workflow()? {
                SpeakerStatus::Hot(previous_calib) => previous_calib,
                SpeakerStatus::Cold => {
                    let all_temp = self.get_ambient_temp()?;
                    let all_rdc = self.do_rdc_calibration()?;
                    all_rdc
                        .iter()
                        .zip(all_temp)
                        .enumerate()
                        .map(|(ch, (&rdc, temp))| {
                            dsm.decide_calibration_value_workflow(ch, CalibData { rdc, temp })
                        })
                        .collect::<Result<Vec<_>>>()?
                }
            }
        };
        self.apply_calibration_value(&calib)?;
        self.set_volume(VolumeMode::High)?;
        Ok(())
    }
/// Performs max98373d boot time calibration.
///
/// # Errors
///
/// If any amplifiers fail to complete the calibration.
Performs max98373d boot time calibration.
Performs max98373d boot time calibration .
fn boot_time_calibration(&mut self) -> Result<()> {
        if !Path::new(&self.setting.dsm_param).exists() {
            return Err(Error::MissingDSMParam);
        }
        let num_channels = self.setting.num_channels();
        let dsm = DSM::new(
            &self.card.name(),
            num_channels,
            Self::rdc_to_ohm,
            Self::TEMP_UPPER_LIMIT_CELSIUS,
            Self::TEMP_LOWER_LIMIT_CELSIUS,
        );
        self.set_volume(VolumeMode::Low)?;
        let calib = if !self.setting.boot_time_calibration_enabled {
            info!("skip boot time calibration and use vpd values");
            // Needs Rdc updates to be done after internal speaker is ready otherwise
            // it would be overwritten by the DSM blob update.
            dsm.wait_for_speakers_ready()?;
            dsm.get_all_vpd_calibration_value()?
        } else {
            match dsm.check_speaker_over_heated_workflow()? {
                SpeakerStatus::Hot(previous_calib) => previous_calib,
                SpeakerStatus::Cold => {
                    let all_temp = self.get_ambient_temp()?;
                    let all_rdc = self.do_rdc_calibration()?;
                    all_rdc
                        .iter()
                        .zip(all_temp)
                        .enumerate()
                        .map(|(ch, (&rdc, temp))| {
                            dsm.decide_calibration_value_workflow(ch, CalibData { rdc, temp })
                        })
                        .collect::<Result<Vec<_>>>()?
                }
            }
        };
        self.apply_calibration_value(&calib)?;
        self.set_volume(VolumeMode::High)?;
        Ok(())
    }
fn boot_time_calibration ( & mut self ) -> Result < ( ) > { if ! Path :: new ( & self . setting . dsm_param ) . exists ( ) { return Err ( Error :: MissingDSMParam ) ; } let num_channels = self . setting . num_channels ( ) ; let dsm = DSM :: new ( & self . card . name ( ) , num_channels , Self :: rdc_to_ohm , Self :: TEMP_UPPER_LIMIT_CELSIUS , Self :: TEMP_LOWER_LIMIT_CELSIUS , ) ; self . set_volume ( VolumeMode :: Low ) ? ; let calib = if ! self . setting . boot_time_calibration_enabled { info ! ( " " ) ; // Needs Rdc updates to be done after internal speaker is ready otherwise // it would be overwritten by the DSM blob update. dsm . wait_for_speakers_ready ( ) ? ; dsm . get_all_vpd_calibration_value ( ) ? } else { match dsm . check_speaker_over_heated_workflow ( ) ? { SpeakerStatus :: Hot ( previous_calib ) => previous_calib , SpeakerStatus :: Cold => { let all_temp = self . get_ambient_temp ( ) ? ; let all_rdc = self . do_rdc_calibration ( ) ? ; all_rdc . iter ( ) . zip ( all_temp ) . enumerate ( ) . map ( | ( ch , ( & rdc , temp ) ) | { dsm . decide_calibration_value_workflow ( ch , CalibData { rdc , temp } ) } ) . collect :: < Result < Vec < _ > > > ( ) ? } } } ; self . apply_calibration_value ( & calib ) ? ; self . set_volume ( VolumeMode :: High ) ? ; Ok ( ( ) ) }
Performs max98373d boot time calibration.
Performs max98373d boot time calibration .
&mut self
&mut self
errors
If any amplifiers fail to complete the calibration.
If any amplifiers fail to complete the calibration .