No announcement yet.

Backgroung leddigit display

  • Filter
  • Time
  • Show
Clear All
new posts

  • Backgroung leddigit display


    I'm strugling with a programming issue ( Gen4-23DT alone with Visie Genie)

    I use an encoder with the functionQencoder1 : it works great, background counting without any issue.

    I want to display on a leddiggit, a calculated position with the encoder counter and I would like to have this display to run alone in the background and I can't get it to work.

    What I did : I used a button (in Magictouch) to activate a code which calculate and display the position (with a loop) but if I want to access other screens (for setup for example), I need to touch the screen once to exit the loop and again to activate another button. Of course, as soon as I exit the loop, the display is no more updated and I need to remember to touch the button to activate again the position display.
    I tried to paste my code in the Mainloop Magic code but then, I can't get the buttons to works …
    I’m probably missing a nice and smooth solution ….
    Thanks for your help !

  • #2
    Hi Lorenz,

    I believe the best solution here would be to have your calculate code function to be always running in the main loop code, but keep the position/result stored in a global variable. Then, store a boolean variable (0 or 1) that controls whether the position is displayed or not. Then when the button is pressed, the boolean is set to true, which then shows the position on screen, and if the form is switched, you can set it the boolean to false and hide the position. Meanwhile, the position is always being calculated the background.

    Alternatively, you could set the form switch events to show and hide the position, so if you are on the main form it will show the position, and if you are on another form like the setup one, it will hide the position.

    Let me know if this is a suitable solution,


    • #3
      Hi Adem,

      Thanks for your help : I will look into your solution next week and wil let you know.
      Thanks again !


      • #4

        I created a main loop with the following code :

        flt_ITOF(flt_delta, delta);
        goto main;

        I also have a program Magictouch to manage the touch buttons

        If I download this programm, the screen is like frozen .. (nothing happen when I touch it)

        Thanks for your help !

        UPDATE : without the goto, it works much better ... 😊
        Last edited by Lorenz; 4 March 2021, 05:28 AM.


        • #5
          Hi Lorenz,

          I am glad you managed to get your program running. Please feel free to contact us again if you need any more help.