Announcement

Collapse
No announcement yet.

Simulate Touch Input

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simulate Touch Input

    Hello,

    I'm looking to see if there is an easy way to simulate touch input on a gen4 Diablo16 device. Specifically, I have a variety of programs that I would like to create user interface videos of for promotional material, help walkthroughs, etc. I'm assuming there's no emulator for the Diablo16 chip, so doing this in software on a PC is likely out of the question, so I was wondering if I could do it directly on the displays. I'd like to do this in a manner that doesn't involve my ugly finger moving around, knocking the camera, etc., so I'm wondering if anyone has solutions for simulating touches.

    At this point my main thought is to find/replace all of my touch_Get() calls into a touch_GetFake() that checks a register for the simulated results, and then use serial to load that register from some application running on the PC. This would involve writing the logic of the touch_Get(TOUCH_STATUS) to ensure that it matches actual functionality, but I don't particularly see any way around that unless there's a back door to the touch_Get function. I also will likely run into issues with this implementation since I often use timers and events to set up threadlike actions, and in some cases use sys_EventsPostpone() to disable my UI updates. I think however if I ensure that the serial input is in the main loop I could still keep simulating input. It's not particularly pretty, but I think it would work.

    The other option I was considering is essentially the opposite - I would constantly save the screen onto an SD card into individual images, and then reconstruct those images on the PC into a movie. That would require overlaying touch input post-hoc, but would give me the ability to clean it up digitally.

    edit: Although this second option may require a bulk gci -> bmp converter to be feasible. I've used the single shot gci converter that you have for screen saves performed via file_ScreenCapture(), and haven't tried the Append mode on that, so maybe that's the best method for multiple shots?

    Thoughts? Anyone have to do something similar and have a best practice?
    Last edited by mspringer; 30th October 2018, 01:41 AM.

  • #2
    Hi mspringer,

    I’m not entirely sure if I have understood your desired output, but I have given it a try and made a project that basically does a simulation. If this is not what you meant, then more explanation would be a great help.

    This project has two modes: User Interface and simulation mode. The User mode allows the user to draw on the screen while the simulation mode redraws what the user has previously drawn in the User Interface Mode.

    Arrays made this easier. First is storing what the touch_Get() function returns into an array then do your routines again with the values stored in your array. In practical ways with simulation, you’ll just change your touch_Get() into your expected value.

    For example,

    Actual Code:
    Code:
    x := touch_Get(TOUCH_GETX);
    y := touch_Get(TOUCH_GETY);
     
    if(x == 200 && y == 200)//if touch is at (200,200), turn Userled1 on
        img_SetWord(hndl, iUserled1, IMAGE_INDEX, 0) ;
        img_Show(hndl,iUserled1) ;
    endif
    Simulation Code:
    Code:
    x:= 200;
    y:= 200;
    
    if(x == 200 && y == 200)//if touch is at (200,200), turn Userled1 on
        img_SetWord(hndl, iUserled1, IMAGE_INDEX, 0) ;
        img_Show(hndl,iUserled1) ;
    endif
    This way, you won’t have to wait for touch anymore.

    Hope this helps and Best Regards,
    Attached Files
    Eran

    Comment


    • #3
      Eran,

      Thank you for the reply, I really like the idea of using some sort of "record then playback" mode. I might include time as well to have it behave like the user demo I'm looking for, but I think that's a great approach. It still would mean a lot of work to replace all of the calls to touch_Get with something from the simulation, but certainly is do-able.

      I guess in reality I should have labeled this post differently. Ultimately I'm looking for an emulator, specifically to generate "nice" videos for help or demonstrative purposes. I had thought that my best approach to do this without having to rework my projects too much was some sort of touch simulator, to be able to create these videos without fingers interacting on the screen. I would imagine folks who have professional marketing groups would do it all with screen captures and someone mocking that all up in video editing software - and we don't have those resources so I'm trying to work with what I have. Maybe however that's where we'll end up.

      In terms of the touch input simulation, what I was really hoping for was some sort of reserved register that the touch_Get() function works with while calculating its response. I sifted through the .lst file but found nothing. I could then implement the simulation over serial or over playback as you suggest and simply poke the register and override whatever touch_Get() is doing without having to go through and modify each function where I'm using touch_Get().

      Comment


      • #4
        Hi mspringer,

        Actually, it depends on your routines. If you’re using the touch_Get(TOUCH_GETX) to wait if a certain widget is pressed, then you don’t need to change/wait for the touch_Get(TOUCH_GETX) anymore. What you would be needing with your project is changing your imgTouched := img_Touched(hndl, -1); to your expected-to-be-touched widget (eg. imgTouched := iWinbutton1).

        Here is another way of doing the simulation—using another host controller just like the one that you’ve mentioned in your first post.

        In my setup, I used two displays to which I have loaded my project. Using serin and serout functions, the display1 detects whether a touch has been registered and send it to display2 as both of them execute the routine. Here is a video of the output: https://www.dropbox.com/s/33huufw16u...ation.mp4?dl=0

        Hope this helps and Best Regards,
        Attached Files
        Last edited by Eran; 31st October 2018, 06:15 PM.
        Eran

        Comment

        Working...
        X