Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CST816S touch interface #20213

Merged
merged 9 commits into from
Dec 18, 2023

Conversation

ameeuw
Copy link
Contributor

@ameeuw ameeuw commented Dec 12, 2023

Description:

This PR adds the driver for CST816S found in cheap, smartwatch like ESP32C3 "2424S012" boards (Aliexress Search Link). Touch works and gesture recognition works.

Functionality is tested with the named model in [env:tasmota32c3] with -DFIRMWARE_LVGL and -DUSE_CST816S.

Code compiles for [env:tasmota-display] with -DUSE_CST816S and runs, but is untested for functionality on esp8266.

I have attached a .autoconf to upload and test - remove the ".zip" extension before (only added due to Github's limitations). A remap :M,240,0,240,0 is still necessary in the display.ini.

Related issue (if applicable): based on discussion #19487

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
  • The code change is tested and works with Tasmota core ESP32 V.2.0.14
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

ESP32C3-2424S012.autoconf.zip

@arendst
Copy link
Owner

arendst commented Dec 12, 2023

OMG! Did you use a source code formatter? The current format breaks all silent Tasmota conventions. Pls undo the formatting.

Just add your code changes for us to review.

@arendst arendst added the on hold by dev team Result - Feature request put on hold by member of development team label Dec 12, 2023
@ameeuw
Copy link
Contributor Author

ameeuw commented Dec 12, 2023

OMG! Did you use a source code formatter? The current format breaks all silent Tasmota conventions. Pls undo the formatting.

Just add your code changes for us to review.

Yes I did 🙈 - Sorry for that - that's why I only submitted as Draft.

Is there a list of formatting rules I can feed into vscode?

@ameeuw ameeuw marked this pull request as ready for review December 12, 2023 21:57
@arendst
Copy link
Owner

arendst commented Dec 13, 2023

Is there a list of formatting rules I can feed into vscode?

No there isn't. But I prefer to use brackets like:

  if (test) {

  }

instead of

  if (test)
  {

  }

Same for functions and every situation brackets are needed.

@arendst
Copy link
Owner

arendst commented Dec 13, 2023

The code fails on ESP8266.

Considering the amount of code overlap between the library and xdrv_55_touch.ino I suggest to skip the library and add the needed functions into xdrv_55_touch.ino. Then also test for ESP8266 before re-submitting PR.

@ameeuw
Copy link
Contributor Author

ameeuw commented Dec 14, 2023

The code fails on ESP8266.

Considering the amount of code overlap between the library and xdrv_55_touch.ino I suggest to skip the library and add the needed functions into xdrv_55_touch.ino. Then also test for ESP8266 before re-submitting PR.

Thank you for your comments - before starting I just want to clarify: You suggest moving the i2c communication and ISR handling into the xdrv_55_touch.ino?

@arendst
Copy link
Owner

arendst commented Dec 14, 2023

Yes.

Looking at the library I think most of the code is already available in Tasmota. Have a look at Tasmota's I2C support functions in support_a_i2c.ino and how they are being used by other drivers.

@ameeuw
Copy link
Contributor Author

ameeuw commented Dec 14, 2023

Thank you for the hints. I have reduced the changes and checked compilation on esp8266. Tested tasmota-display on a 8266-12F D1 mini for normal behaviour but can't test with hardware.

@arendst arendst merged commit 6b35fc8 into arendst:development Dec 18, 2023
64 checks passed
hawa-lc4 pushed a commit to hawa-lc4/Tasmota-dev that referenced this pull request Jan 20, 2024
* Add initial version (prints coordinates)

* Add CST816S_found

* Revert formatting

* Add supported gestures (untested)

* Correct use of enums

* Remove library dependency

* Unification of methods

* Remove redundant variables and format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold by dev team Result - Feature request put on hold by member of development team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants