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

Help with Serial Reads from touch controller. #24

Open
Shach01 opened this issue Jun 18, 2024 · 3 comments
Open

Help with Serial Reads from touch controller. #24

Shach01 opened this issue Jun 18, 2024 · 3 comments

Comments

@Shach01
Copy link

Shach01 commented Jun 18, 2024

Hi Adward, we are struggling to get usable serial information from the touch controller. it is always the same stream no matter if we attemp to trigger any form of touch event:

AA 55 1 7 0 62 3B 46 57 53 57 45 53 2D 54 35 54 4F 55 43 48 2D 54 35 2D 43

any help or guidance would be much appreciated, have a great day man!

Kind regards,

Josh

@edwardtfn
Copy link
Owner

edwardtfn commented Jun 19, 2024

Hey @Shach01,
In fact I haven't explored the protocol that much, so I've just used the custom component by @SmartHome-yourself (https://github.com/SmartHome-yourself/sonoff-tx-ultimate-for-esphome) with minor changes.
You can enable verbose logging and you will see a bit more from the UART data.

From what I got from the protocol, a message always starts with AA 55 01, then the next byte informs the touch type:

        const static uint8_t TOUCH_STATE_RELEASE = 1;
        const static uint8_t TOUCH_STATE_PRESS = 2;
        const static uint8_t TOUCH_STATE_SWIPE = 3;
        const static uint8_t TOUCH_STATE_MULTI_TOUCH = 11;
        const static uint8_t TOUCH_STATE_SWIPE_RIGHT = 12;
        const static uint8_t TOUCH_STATE_SWIPE_LEFT = 13;

I don't know why, but the code sets as invalid when the message starts with AA 55 01 02.

The position of the touch (a number between 0 a 10) is defined by the 6th or 7th byte:

        int TxUltimateEasy::get_touch_position_x(int uart_received_bytes[]) {
            int state = uart_received_bytes[4];
            switch (state) {
                case TOUCH_STATE_RELEASE:
                case TOUCH_STATE_MULTI_TOUCH:
                case TOUCH_STATE_SWIPE_LEFT:
                case TOUCH_STATE_SWIPE_RIGHT:
                    return uart_received_bytes[5];
                    break;

                default:
                    return uart_received_bytes[6];
                    break;
            }
        }

I can try to look more at this later. Please share here if you find something more. 😉

@edwardtfn
Copy link
Owner

Hey @Shach01, did you got what you were looking for?

@Shach01
Copy link
Author

Shach01 commented Jul 12, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants