1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 07:08:20 +00:00

Use signed value

This commit is contained in:
Otto Winter 2019-06-02 14:06:09 +02:00
parent 92f3ae64d6
commit e0ae7c1601
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E

View File

@ -27,8 +27,9 @@ float HX711Sensor::get_setup_priority() const { return setup_priority::DATA; }
void HX711Sensor::update() { void HX711Sensor::update() {
uint32_t result; uint32_t result;
if (this->read_sensor_(&result)) { if (this->read_sensor_(&result)) {
ESP_LOGD(TAG, "'%s': Got value %u", this->name_.c_str(), result); int32_t value = static_cast<int32_t>(result)
this->publish_state(result); ESP_LOGD(TAG, "'%s': Got value %d", this->name_.c_str(), value);
this->publish_state(value);
} }
} }
bool HX711Sensor::read_sensor_(uint32_t *result) { bool HX711Sensor::read_sensor_(uint32_t *result) {