Skip to content

Commit a296532

Browse files
committed
Merge branch 'bugfix/temperature_get_value_negative' into 'master'
bugfix(temperature_sensor): Fix issue that get the value is negative See merge request espressif/esp-idf!25165
2 parents 23c89cd + 4ccbec9 commit a296532

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

components/driver/temperature_sensor/temperature_sensor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static esp_err_t read_delta_t_from_efuse(void)
215215
return ESP_OK;
216216
}
217217

218-
static float parse_temp_sensor_raw_value(uint32_t tsens_raw)
218+
static float parse_temp_sensor_raw_value(int16_t tsens_raw)
219219
{
220220
if (isnan(s_deltaT)) { //suggests that the value is not initialized
221221
read_delta_t_from_efuse();
@@ -230,7 +230,7 @@ esp_err_t temperature_sensor_get_celsius(temperature_sensor_handle_t tsens, floa
230230
ESP_RETURN_ON_FALSE(out_celsius != NULL, ESP_ERR_INVALID_ARG, TAG, "Celsius points to nothing");
231231
ESP_RETURN_ON_FALSE(tsens->fsm == TEMP_SENSOR_FSM_ENABLE, ESP_ERR_INVALID_STATE, TAG, "tsens not enabled yet");
232232
bool range_changed;
233-
uint16_t tsens_out = temp_sensor_get_raw_value(&range_changed);
233+
int16_t tsens_out = temp_sensor_get_raw_value(&range_changed);
234234
*out_celsius = parse_temp_sensor_raw_value(tsens_out);
235235

236236
if (*out_celsius < TEMPERATURE_SENSOR_LL_MEASURE_MIN || *out_celsius > TEMPERATURE_SENSOR_LL_MEASURE_MAX) {

0 commit comments

Comments
 (0)