No announcement yet.

img_Touched always returns 6,0,0 after screen touched.

  • Filter
  • Time
  • Show
Clear All
new posts

  • img_Touched always returns 6,0,0 after screen touched.

    I'm using a Parallax Propeller as a master and a uLCD-32PTU as a slave in serial command mode. I've created a Propeller library with the Picaso serial commands in C and now I'm testing them.

    My question: Does img_Touched function as expected when only a single image is on the screen?

    What I'm doing is flashing a series of images on the screen, and I want img_Touched to return the one being displayed when I touch the screen. I'm getting the screen touch, but not getting the img_Touched. The return is always 6,0,0. (Ack successful, Image 0 pressed.)

    My complete code looks like this:

    #include "simpletools.h"
    #include "fdserial.h"
    #include "libPicaso.h"
    #include "PICASO_CONST4D.H"
    // ********************** From 4D Systems

    int main()
    char Return3Bytes[3];
    // **************** My generic returns from Picaso Serial functions
    char DAT[ ] = "images7.dat";
    char GCI[ ] = "images7.gci";
    int ScreenTouched = 0;

    PTU = fdserial_open(13,14,0,9600); /
    / *************** Controller RX = 13, TX = 14, mode 0 (Not sure about mode), BAUD Rate 9600 - Parallax function
    sys_Reset(15); // *************** Reset is connected to Pin 15.

    pause(3000); // **************** Allow internal reset to complete.


    file_LoadImageControl(Return3Bytes, DAT, GCI, 1);
    int HandleE = (Return3Bytes[1] << 8) + (Return3Bytes[2]);

    img_ClearAttributes(Return3Bytes, HandleE, -1, I_TOUCH_DISABLE);

    for(int Counter = 0; Counter < 9; Counter++)
    img_Show(Return3Bytes, HandleE, Counter);
    touch_Get(Return3Bytes, TOUCH_STATUS) ;
    ScreenTouched = (Return3Bytes[1] << 8) + Return3Bytes[2];
    if(ScreenTouched == 1)
    // ******************* I want the image when pressed, not when released.
    img_Touched(Return3Bytes, HandleE, 0xFFFF);
    print("img_Touched returned %0x, %0x, %0x.\n", Return3Bytes[0], Return3Bytes[1], Return3Bytes[2]);
    // displays "img_Touched returned 6, 0, 0."
    print("The counter was at image %d.\n", Counter); // displays "The counter was at image 2 or whatever."
    // ****************** Pause long enough to show the image

    if(Counter == 8) Counter = 0; // ******************* No image selected, loop again


    I found this problem when I was originally testing my Propeller's img_Touched function. Since then I created a different file and tested all of these functions of a keypad file and img_Touched works as expected. It's only when I show a single image of the screen that img_Touched allows returns 6,0,0.

    What am I missing?
    Last edited by TomLewis; 11 January 2018, 03:19 PM. Reason: Updated to show complete code and most resent test results.

  • #2
    I still have this mystery, so I decided to take a different approach. I tried to duplicate the problem with Serial Commander. Here's my actions and results:

    Click image for larger version

Name:	Serial commander output.jpg
Views:	49
Size:	25.3 KB
ID:	61439

    Everything worked as expected, except the img_Touched still returned 0! My understanding is that it should return 4 (since that is the image that I displayed.)

    Comments please.


    • #3
      img_Touched returns the first image/video in the GCI that is enabled for touch detection.

      So if image 0 is a full screen image which has not been disabled for touch, then img_Touched will return 0