Redirecting HMI from studio
-
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!
-
@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.- Create
CUSTOM
andCUSTOM/js
folder in yourhmisrc
folder. - Create
custom.js
file in theCUSTOM/js
folder - 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 - 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 } }); };
- Create
-
@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).
-
@tcele
Are you sure, that your custom.js is included during the build? Please addalert('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 requestsservis
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 -
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.
-
-
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.
-
@tcele
You are almost done. The last step is to create new file in HMI Designer save it tohmisrc
dir and name itservis.hmi.svg
. You can design new screen in this file. -
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
-
@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