REXYGEN Community Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Login

    Redirecting HMI from studio

    REXYGEN Studio
    3
    12
    2.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cechuratC
      cechurat @TCELE
      last edited by

      @tcele Hello Ivan,

      thank you for your post. I would suggest to solve this request by means of REXYGEN HMI Designer. Just introduce another layer which will hide/show (Group Animation -> Opacity) according to the key switch digital signal.

      Kind Regards,
      Tomas

      T 1 Reply Last reply Reply Quote 0
      • T
        TCELE @cechurat
        last edited by TCELE

        @cechurat

        So after implementing a solution with the hide_by option we are getting a bug where most input components set their state from ONLINE to ERROR, visually they are disabled (greyed out), after a short period of running. No other functional problems, just buttons/sliders not working.

        HMI log set on TRACE option:

        Periodic reading failed! Request 7559 timed out
        State changed to ERROR (multiple times, for reach HMI component)
        Request 7559 timed out
        Remaining commands: 0 message length: 0
        State changed to ONLINE (multiple times, for reach HMI component)
        Periodic reading failed! Request 5038 timed out
        

        Ive used the hide_by parameter in the same manner before without problems. Any idea to the cause? Thanks in advance!

        ondrej_severaO 1 Reply Last reply Reply Quote 0
        • ondrej_severaO
          ondrej_severa @TCELE
          last edited by

          @tcele
          This behavior indicates that you are requesting too many datapoints and thus the read request is timeout. I suggest opening the SERVICE page on a different web page. You can do it by adding redirect request to custom javascript.

          1. Create CUSTOM and CUSTOM/js folder in your hmisrc folder.
          2. Create custom.js file in the CUSTOM/js folder
          3. Open your page in HMI Designer, open HMI Configuration and in the HTML Export tab check Expert mode. Add two rows in the Library Path with GENERAL and CUSTOM texts. This will tell the HMI builder to include components from GENERAL library and your CUSTOM foilder. That how you append the custom.js file to your project
          4. Edit the custom.js file with following content:
          REX.HMI.init = function(){
          
          let servis= REX.HMI.get('<name of the alias defined in HMI Designer>');
          //or
          let servis= // REX.HMI.add({alias:"servis",cstring:"task.block:parameter"}'alias defined in HMI Designer>'); // Add new item
          
          // Subsribe to onChange event
          servis.on('change',(itm)=>{
              // If true and not in the page redirect current page to servis page
             // The check for href is not necessary if only on used in index.html page
              if(itm.getValue() && window.location.href.indexof('servis.html') == -1 ){
                  window.location.href = '/hmi/servis.html';
                  // or open new tab
                  // window.open('/hmi/servis.html','blank_');
              }
              else{
                  // do nothing
              }
          });
          };
          
          T 1 Reply Last reply Reply Quote 0
          • T
            TCELE @ondrej_severa
            last edited by

            @ondrej_severa
            I have done as instructed, but I don't get redirected to the service.html page, I tried to use a button component as well as a slider component. Any more advice?

            The reason behind this behaviour is correct, I think, when I set the refresh rate higher/slower it takes a longer time before the components get a timeout, but it still happens even on 500 ms (default).

            ondrej_severaO 1 Reply Last reply Reply Quote 0
            • ondrej_severaO
              ondrej_severa @TCELE
              last edited by

              @tcele
              Are you sure, that your custom.js is included during the build? Please add alert('I am here') to your code and test if the alert occurs. I was told that you want to open this screen, whenever some operator switches some digital input. That's why my code requests servis data point and wait until the read value is non-zero. There is no need for a Button or Slider.

              If you want you can send me the source for your HMI and I can check it for you.

              Best regards
              Ondrej

              T 1 Reply Last reply Reply Quote 0
              • T
                TCELE @ondrej_severa
                last edited by

                @ondrej_severa

                Hello,

                The alert is there, custom.js is included. All the screens work now as before, it's just that the components that switch them time out after a short while and are disabled.

                Ignoring that I also force switched to the servis.html but no page is there, I checked the directory over ssh too.

                I've also updated rexygen studio to 2.50.10.13072, mentioning it just in case.

                hmisrc.zip

                ondrej_severaO 1 Reply Last reply Reply Quote 0
                • ondrej_severaO
                  ondrej_severa @TCELE
                  last edited by

                  @tcele
                  I have created a minimal working example and find out there is a little typo in my example source code

                  // indexOf
                  if(itm.getValue() && window.location.href.indexOf('servis.html') == -1 ){ 
                  

                  After the fix, code is working fine for me. See the attachment.
                  BR
                  Ondrej
                  tcele.zip

                  T 1 Reply Last reply Reply Quote 0
                  • T
                    TCELE @ondrej_severa
                    last edited by

                    @ondrej_severa

                    Thanks for the example, it works as intended, I'm guessing, except that I am still missing the service.html and land on an Error 404 - Not Found page.

                    Any dependencies I could be missing? I am running your example on a new Raspbian lite image with fresh rex core and HMI chromium installation.

                    ondrej_severaO 1 Reply Last reply Reply Quote 0
                    • ondrej_severaO
                      ondrej_severa @TCELE
                      last edited by

                      @tcele
                      You are almost done. The last step is to create new file in HMI Designer save it to hmisrc dir and name it servis.hmi.svg. You can design new screen in this file.

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        TCELE @ondrej_severa
                        last edited by TCELE

                        @ondrej_severa

                        I believe there was a misunderstanding, the logic changing screens was already done with the hide_by parameters and worked, it's just that some components happened to be timing out. This didn't happen before in other projects done the same way.

                        Neverminding that, I reworked the project to use javascript as you suggested, I like the fact that .hmi.svg files are split, it keeps things organized. After some prolonged tests, there are no more timeouts.

                        There is one last flaw that I would like to work out. The chromium instance allows the user to use gestures and go back and forth in the history of pages. In some cases get to a restricted page this way.

                        I googled vigorously to solve this issue, but so far to no avail. Any advice on this topic?

                        Thanks for all the help so far!

                        chromium flags I tried:

                        --user-data-dir=/tmp/hmi-chromium
                        --kiosk
                        --incognito
                        --disable-pinch
                        --overscroll-history-navigation=0 #This should fix it but it doesn't
                        --disable-overscroll-edge-effect #Tried this one too
                        --no-sandbox
                        --start-fullscreen
                        --window-size=$SIZE
                        --window-position=0,0
                        --no-first-run
                        --disable-translate
                        --noerrdialogs
                        --disable-infobars
                        --disable-component-update
                        
                        cechuratC 1 Reply Last reply Reply Quote 0
                        • cechuratC
                          cechurat @TCELE
                          last edited by

                          @tcele said in Redirecting HMI from studio:

                          There is one last flaw that I would like to work out. The chromium instance allows the user to use gestures and go back and forth in the history of pages. In some cases get to a restricted page this way.
                          I googled vigorously to solve this issue, but so far to no avail. Any advice on this topic?

                          Hi Ivan,
                          I wasn't successful in finding any suitable solution as well. Have a look at xinput command which might help you to disable all the gestures at Linux level. I didn't tried it myself however if you find any working solution our team and the community will be happy to hear about it.

                          Cheers,
                          Tomas

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          This is a community forum for REXYGEN users and fans. Detailed information can be found at REXYGEN homepage.

                          There is also an outdated REXYGEN community forum.

                          Powered by NodeBB.