Clang format

This commit is contained in:
SGE 2024-04-01 18:11:43 +02:00
parent 6d85a73815
commit 37a73aebd4
3 changed files with 11 additions and 17 deletions

View file

@ -48,7 +48,7 @@ void ICNT86Touchscreen::update_touches() {
UWORD Y = ((UWORD) buf[4 + 7 * i] << 8) + buf[3 + 7 * i]; UWORD Y = ((UWORD) buf[4 + 7 * i] << 8) + buf[3 + 7 * i];
UWORD P = buf[5 + 7 * i]; UWORD P = buf[5 + 7 * i];
UWORD TouchEvenid = buf[6 + 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); this->set_raw_touch_position_(TouchEvenid, X, Y, P);
} }

View file

@ -31,8 +31,6 @@ class ICNT86Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice
void reset_touch_sensor_(); void reset_touch_sensor_();
InternalGPIOPin *interrupt_pin_{}; InternalGPIOPin *interrupt_pin_{};
GPIOPin *reset_pin_{nullptr}; GPIOPin *reset_pin_{nullptr};
}; };
} // namespace icnt86 } // namespace icnt86

View file

@ -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 Touchscreen::normalize_(int16_t val, int16_t min_val, int16_t max_val, bool inverted) {
int16_t ret; int16_t ret;
//only normalize when min and max value are specified // only normalize when min and max value are specified
if(min_val && max_val) if (min_val && max_val) {
{ if (val <= min_val) {
if (val <= min_val) { ret = 0;
ret = 0; } else if (val >= max_val) {
} else if (val >= max_val) { ret = 0xfff;
ret = 0xfff; } else {
} else {
ret = (int16_t) ((int) 0xfff * (val - min_val) / (max_val - min_val)); ret = (int16_t) ((int) 0xfff * (val - min_val) / (max_val - min_val));
} }
} } else {
else
{
ret = val; ret = val;
} }
ret = (inverted) ? 0xfff - ret : ret; ret = (inverted) ? 0xfff - ret : ret;
return ret; return ret;
} }
} // namespace touchscreen } // namespace touchscreen