Merge pull request #339 from eried/recognition-of-audio-chip

Recognition of audio chip
This commit is contained in:
Erwin Ried 2021-04-14 09:24:46 +02:00 committed by GitHub
commit 838451f491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -121,7 +121,8 @@ void TemperatureWidget::paint(Painter& painter) {
} }
TemperatureWidget::temperature_t TemperatureWidget::temperature(const sample_t sensor_value) const { TemperatureWidget::temperature_t TemperatureWidget::temperature(const sample_t sensor_value) const {
return -35 + sensor_value * 4; //max2837 datasheet temp 25ºC has sensor value: 15 /*It seems to be a temperature difference of 25C*/
return -40 +(sensor_value * 4.31)+25; //max2837 datasheet temp 25ºC has sensor value: 15
} }
std::string TemperatureWidget::temperature_str(const temperature_t temperature) const { std::string TemperatureWidget::temperature_str(const temperature_t temperature) const {

View File

@ -179,20 +179,23 @@ static PortaPackModel portapack_model() {
static Optional<PortaPackModel> model; static Optional<PortaPackModel> model;
if( !model.is_valid() ) { if( !model.is_valid() ) {
if( audio_codec_wm8731.detected() ) { /*For the time being, it is impossible to distinguish the hardware of R1 and R2 from the software level*/
model = PortaPackModel::R1_20150901; /*At this point, I2c is not ready.*/
} else { //if( audio_codec_wm8731.detected() ) {
// model = PortaPackModel::R1_20150901;
//} else {
model = PortaPackModel::R2_20170522; model = PortaPackModel::R2_20170522;
} //}
} }
return model.value(); return model.value();
} }
static audio::Codec* portapack_audio_codec() { static audio::Codec* portapack_audio_codec() {
return (portapack_model() == PortaPackModel::R2_20170522) /* I2C ready OK, Automatic recognition of audio chip */
? static_cast<audio::Codec*>(&audio_codec_ak4951) return (audio_codec_wm8731.detected())
: static_cast<audio::Codec*>(&audio_codec_wm8731) ? static_cast<audio::Codec*>(&audio_codec_wm8731)
: static_cast<audio::Codec*>(&audio_codec_ak4951)
; ;
} }