Skip to content

Commit 67cccee

Browse files
committed
use uint16
1 parent e54e8e7 commit 67cccee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

main/main.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,17 @@ esp_err_t sht21_cmd_bytes(i2c_port_t port, uint8_t cmd, uint8_t *buff) {
7272
esp_err_t sht21_rh(i2c_port_t port, float *ans) {
7373
uint8_t buff[3];
7474
ERET( sht21_cmd_bytes(port, SHT21_CMD_RH_NO_HOLD, buff) );
75-
int16_t intv = (buff[0] << 8) | (buff[1] && 0xFC);
76-
*ans = -6 + 125 * (intv / 65536.0);
75+
uint16_t val = (buff[0] << 8) | (buff[1] && 0xFC);
76+
*ans = -6 + 125 * (val / 65536.0);
7777
return ESP_OK;
7878
}
7979

8080

8181
esp_err_t sht21_temp(i2c_port_t port, float *ans) {
8282
uint8_t buff[3];
8383
ERET( sht21_cmd_bytes(port, SHT21_CMD_TEMP_NO_HOLD, buff) );
84-
int16_t intv = (buff[0] << 8) | (buff[1] && 0xFC);
85-
*ans = -46.25 + 175.72 * (intv / 65536.0);
84+
uint16_t val = (buff[0] << 8) | (buff[1] && 0xFC);
85+
*ans = -46.25 + 175.72 * (val / 65536.0);
8686
return ESP_OK;
8787
}
8888

0 commit comments

Comments
 (0)