mirror of
https://github.com/esphome/esphome.git
synced 2024-12-24 14:34:54 +01:00
Clang format
This commit is contained in:
parent
6d85a73815
commit
37a73aebd4
3 changed files with 11 additions and 17 deletions
|
@ -48,7 +48,7 @@ void ICNT86Touchscreen::update_touches() {
|
|||
UWORD Y = ((UWORD) buf[4 + 7 * i] << 8) + buf[3 + 7 * i];
|
||||
UWORD P = buf[5 + 7 * i];
|
||||
UWORD TouchEvenid = buf[6 + 7 * i];
|
||||
ESP_LOGD(TAG, "Touch x: %d, y: %d, p: %d", X, Y, P);
|
||||
ESP_LOGD(TAG, "Touch x: %d, y: %d, p: %d", X, Y, P);
|
||||
|
||||
this->set_raw_touch_position_(TouchEvenid, X, Y, P);
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@ class ICNT86Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice
|
|||
void reset_touch_sensor_();
|
||||
InternalGPIOPin *interrupt_pin_{};
|
||||
GPIOPin *reset_pin_{nullptr};
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace icnt86
|
||||
|
|
|
@ -148,27 +148,23 @@ void Touchscreen::send_touches_() {
|
|||
}
|
||||
|
||||
int16_t Touchscreen::normalize_(int16_t val, int16_t min_val, int16_t max_val, bool inverted) {
|
||||
|
||||
int16_t ret;
|
||||
|
||||
//only normalize when min and max value are specified
|
||||
if(min_val && max_val)
|
||||
{
|
||||
if (val <= min_val) {
|
||||
ret = 0;
|
||||
} else if (val >= max_val) {
|
||||
ret = 0xfff;
|
||||
} else {
|
||||
// only normalize when min and max value are specified
|
||||
if (min_val && max_val) {
|
||||
if (val <= min_val) {
|
||||
ret = 0;
|
||||
} else if (val >= max_val) {
|
||||
ret = 0xfff;
|
||||
} else {
|
||||
ret = (int16_t) ((int) 0xfff * (val - min_val) / (max_val - min_val));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ret = val;
|
||||
}
|
||||
ret = (inverted) ? 0xfff - ret : ret;
|
||||
ret = (inverted) ? 0xfff - ret : ret;
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace touchscreen
|
||||
|
|
Loading…
Reference in a new issue