I'm using D4D with an adafruit capacitive touchscreen, but cannot get the menu button to change screens. Through debugging, I've determined that I am receiving correct touchscreen coordinates and those are being passed to D4D with D4D_PutTouchScreen. The menu button is recognized as the object that is touched, but it never executes the OnClick function.
Why does touching the menu button not result in a screen change?
Original Attachment has been moved to: screen_main.c.zip
Solved! Go to Solution.
Hello Michael,
Unfortunately, I don't have an Adafruit Capacitive Touchscreen to debug your project but I can do as much as I can to help you to solve that problem.
I was watching the function dependencies to assume a flow in the program. I found that the onClick function is called in the functions D4D_BtnOnKeyUp and D4D_BtnUnTouched which are called in the function D4D_BtnOnMessage, please be sure that the function D4D_BtnOnMessage is called when you touch the screen and that it enters to the D4D_MSG_UNTOUCHED case.
Another thing that I think you must check is that in the function D4D_ManageTouchScreenEvents the variable d4d_TouchScreen_Status be modified and then in the function D4D_HandleTouchScreen the program call the function:
// Send prepared message
D4D_SendMessageBack(&d4d_msg);
I hope this helps.
Regards,
Earl.
Hello Michael,
Unfortunately, I don't have an Adafruit Capacitive Touchscreen to debug your project but I can do as much as I can to help you to solve that problem.
I was watching the function dependencies to assume a flow in the program. I found that the onClick function is called in the functions D4D_BtnOnKeyUp and D4D_BtnUnTouched which are called in the function D4D_BtnOnMessage, please be sure that the function D4D_BtnOnMessage is called when you touch the screen and that it enters to the D4D_MSG_UNTOUCHED case.
Another thing that I think you must check is that in the function D4D_ManageTouchScreenEvents the variable d4d_TouchScreen_Status be modified and then in the function D4D_HandleTouchScreen the program call the function:
// Send prepared message
D4D_SendMessageBack(&d4d_msg);
I hope this helps.
Regards,
Earl.
Thank you, Earl. This helps. The problem seems to be that I am never entering the D4D_MSG_UNTOUCHED case.
I set a breakpoint in the D4D_HandleTouchScreen after I had pressed the menu button, and I changed the d4d_TouchScreen_Status so that it would prepare the message D4D_MSG_UNTOUCHED. This caused the OnClick function to execute and finally change screens.
The root of the problem was that D4D_TouchScreen_Status was always set to 0x1. With a little bit of searching, I figured out that I was never executing D4D_CheckTouchScreen. Since I was using a custom driver, I was only polling the touchscreen and adding events as they happened. I needed to execute D4D_CheckTouchScreen to also check for when objects are untouched.
Thanks, again.
I am glad that your problem is solved. If you have any other issue please let me know.
Best regards,
Earl.