Fix parsing numbers in Anova (#2816)

This commit is contained in:
Oxan van Leeuwen
2021-11-28 20:00:29 +01:00
committed by GitHub
parent 7a564b222d
commit 10a2a7e0fc
3 changed files with 14 additions and 3 deletions
+3 -3
View File
@@ -104,21 +104,21 @@ void AnovaCodec::decode(const uint8_t *data, uint16_t length) {
break;
}
case READ_TARGET_TEMPERATURE: {
this->target_temp_ = parse_number<float>(buf, sizeof(buf)).value_or(0.0f);
this->target_temp_ = parse_number<float>(str_until(buf, '\r')).value_or(0.0f);
if (this->fahrenheit_)
this->target_temp_ = ftoc(this->target_temp_);
this->has_target_temp_ = true;
break;
}
case SET_TARGET_TEMPERATURE: {
this->target_temp_ = parse_number<float>(buf, sizeof(buf)).value_or(0.0f);
this->target_temp_ = parse_number<float>(str_until(buf, '\r')).value_or(0.0f);
if (this->fahrenheit_)
this->target_temp_ = ftoc(this->target_temp_);
this->has_target_temp_ = true;
break;
}
case READ_CURRENT_TEMPERATURE: {
this->current_temp_ = parse_number<float>(buf, sizeof(buf)).value_or(0.0f);
this->current_temp_ = parse_number<float>(str_until(buf, '\r')).value_or(0.0f);
if (this->fahrenheit_)
this->current_temp_ = ftoc(this->current_temp_);
this->has_current_temp_ = true;