pub fn check_speaker_over_heated_workflow(&self) -> Result<SpeakerStatus> {
        if self.is_first_boot() {
            return Ok(SpeakerStatus::Cold);
        }
        match self.is_speaker_over_heated() {
            Ok(overheated) => {
                if overheated {
                    let calib: Vec<CalibData> = (0..self.num_channels)
                        .map(|ch| -> Result<CalibData> { self.get_previous_calibration_value(ch) })
                        .collect::<Result<Vec<CalibData>>>()?;
                    info!("the speakers are hot, the boot time calibration should be skipped");
                    return Ok(SpeakerStatus::Hot(calib));
                }
                Ok(SpeakerStatus::Cold)
            }
            Err(err) => {
                // We cannot assume the speakers are not replaced or not overheated
                // when the shutdown time file is invalid; therefore we can not use the datastore
                // value anymore and we can not trigger boot time calibration.
                for ch in 0..self.num_channels {
                    if let Err(e) = Datastore::delete(&self.snd_card, ch) {
                        error!("error delete datastore: {}", e);
                    }
                }
                Err(err)
            }
        }
    }
/// Checks whether the speakers are overheated or not according to the previous shutdown time.
/// The boot time calibration should be skipped when the speakers may be too hot
/// and the Amp should use the previous calibration value returned by the
/// SpeakerStatus::Hot(Vec<CalibData>).
///
/// # Results
///
/// * `SpeakerStatus::Cold` - which means the speakers are not overheated and the Amp can
///    trigger the boot time calibration.
/// * `SpeakerStatus::Hot(Vec<CalibData>)` - when the speakers may be too hot. The boot
///   time calibration should be skipped and the Amp should use the previous calibration values
///   returned by the enum.
///
/// # Errors
///
/// * The speakers are overheated and there are no previous calibration values stored.
/// * Cannot determine whether the speakers are overheated as previous shutdown time record is
///   invalid.
Checks whether the speakers are overheated or not according to the previous shutdown time.
The boot time calibration should be skipped when the speakers may be too hot
and the Amp should use the previous calibration value returned by the
SpeakerStatus::Hot(Vec).
Checks whether the speakers are overheated or not according to the previous shutdown time . The boot time calibration should be skipped when the speakers may be too hot and the Amp should use the previous calibration value returned by the SpeakerStatus :: Hot ( Vec ) .
pub fn check_speaker_over_heated_workflow(&self) -> Result<SpeakerStatus> {
        if self.is_first_boot() {
            return Ok(SpeakerStatus::Cold);
        }
        match self.is_speaker_over_heated() {
            Ok(overheated) => {
                if overheated {
                    let calib: Vec<CalibData> = (0..self.num_channels)
                        .map(|ch| -> Result<CalibData> { self.get_previous_calibration_value(ch) })
                        .collect::<Result<Vec<CalibData>>>()?;
                    info!("the speakers are hot, the boot time calibration should be skipped");
                    return Ok(SpeakerStatus::Hot(calib));
                }
                Ok(SpeakerStatus::Cold)
            }
            Err(err) => {
                // We cannot assume the speakers are not replaced or not overheated
                // when the shutdown time file is invalid; therefore we can not use the datastore
                // value anymore and we can not trigger boot time calibration.
                for ch in 0..self.num_channels {
                    if let Err(e) = Datastore::delete(&self.snd_card, ch) {
                        error!("error delete datastore: {}", e);
                    }
                }
                Err(err)
            }
        }
    }
pub fn check_speaker_over_heated_workflow ( & self ) -> Result < SpeakerStatus > { if self . is_first_boot ( ) { return Ok ( SpeakerStatus :: Cold ) ; } match self . is_speaker_over_heated ( ) { Ok ( overheated ) => { if overheated { let calib : Vec < CalibData > = ( 0 .. self . num_channels ) . map ( | ch | -> Result < CalibData > { self . get_previous_calibration_value ( ch ) } ) . collect :: < Result < Vec < CalibData > > > ( ) ? ; info ! ( " " ) ; return Ok ( SpeakerStatus :: Hot ( calib ) ) ; } Ok ( SpeakerStatus :: Cold ) } Err ( err ) => { // We cannot assume the speakers are not replaced or not overheated // when the shutdown time file is invalid; therefore we can not use the datastore // value anymore and we can not trigger boot time calibration. for ch in 0 .. self . num_channels { if let Err ( e ) = Datastore :: delete ( & self . snd_card , ch ) { error ! ( " " e ) ; } } Err ( err ) } } }
Checks whether the speakers are overheated or not according to the previous shutdown time.
Checks whether the speakers are overheated or not according to the previous shutdown time .
&self
&self
results
`SpeakerStatus::Cold` - which means the speakers are not overheated and the Amp can
trigger the boot time calibration.
`SpeakerStatus::Hot(Vec)` - when the speakers may be too hot. The boot
time calibration should be skipped and the Amp should use the previous calibration values
returned by the enum.
` SpeakerStatus :: Cold ` - which means the speakers are not overheated and the Amp can trigger the boot time calibration . ` SpeakerStatus :: Hot ( Vec ) ` - when the speakers may be too hot . The boot time calibration should be skipped and the Amp should use the previous calibration values returned by the enum .
errors
The speakers are overheated and there are no previous calibration values stored.
Cannot determine whether the speakers are overheated as previous shutdown time record is
invalid.
The speakers are overheated and there are no previous calibration values stored . Cannot determine whether the speakers are overheated as previous shutdown time record is invalid .