ThingPulse / esp8266-weather-station-color

ESP8266 Weather Station in Color using ILI9341 TFT 240x320 display
https://thingpulse.com/product/esp8266-wifi-color-display-kit-2-4/
MIT License
565 stars 221 forks source link

TouchControllerWS::isTouched() missing return #125

Closed TiVoHomeUser closed 3 years ago

TiVoHomeUser commented 3 years ago

Return value missing from function in TouchControllerWS.cpp causing random results

line 90 TouchControllerWS.cpp master branch as of April 14 2021

bool TouchControllerWS::isTouched() {
  touchScreen->touched();
}

Proposed change:

bool TouchControllerWS::isTouched() {
 return touchScreen->touched();
}

Expected behavior

function TouchControllerWS::isTouched(void) return true or false depending on screen touch.

Actual behavior

The return value from function bool TouchControllerWS::isTouched() is undefined not always agrees with touchscreen actions

Test code

I attempting to check for a screen touch to interrupt going into the "Now in sleep mode" using the isTouched(void) function I was getting unreliable results. Tested by putting in repeating loop

if( true == touchController.isTouched() ) Serial.println("True"); else Serial.println("False");

Weather Station Color version

download from ThingPulse master branch April 14 2021

Hardware

ThingPulse Weather Station Color kit purchased through Amazon March 2021

G6EJD commented 3 years ago

Interesting, it was OK with the earlier ESP8266 compiler and I’m surprised the current version isn’t reporting an error, the ESP32 variant would.

marcelstoer commented 3 years ago

It's frustrating a compiler would ever accept such code, sigh. @TiVoHomeUser willing to create a PR?

TiVoHomeUser commented 3 years ago

It's frustrating a compiler would ever accept such code, sigh. @TiVoHomeUser willing to create a PR?

Done (I think)