how can I increase the refresh rate

279 views
Skip to first unread message

delph...@gmail.com

unread,
Sep 17, 2013, 10:09:07 AM9/17/13
to web...@googlegroups.com
Hello all forum members
I have a question
I can read the status of the INPUT with refreshGPIO(true);
but how can I increase the refresh rate?

Andreas Riegg

unread,
Sep 18, 2013, 9:57:13 AM9/18/13
to web...@googlegroups.com
Hi,
 
I think there is no official API to do that so far, but the brute-force way would be:
 
Look for the file ..../htdocs/webiopi.js and change line 268
 
                setTimeout(function(){w().refreshGPIO(repeat)}, 1000); 
the value of 1000 (ms = 1 s) to something lower like e.g. 500 to have the refesh 2 times per second.
 
Keep in mind that reducing this time runs parts of js code in the browser more often. This will increase CPU usage and may lead to problems when choosing values too short.
 
Maybe the hack above can be also integrated as part of an inline script section within your custom html page to avoid modification of webiopi.js, but this may interfere with the call within the unchanged webiopi.js then.
 
Andreas 
 

Andreas Riegg

unread,
Sep 18, 2013, 10:32:52 AM9/18/13
to web...@googlegroups.com
And, as an additional hint, there are additional js classes in webiopi.js for all device categories that have individual refresh times, you may also be able to use those classes
 
var myDevice = webiopi().newDevice(...); 
and optionally change those times with something like
 
myDevice.refreshTime = 200_or_some_other_int; 
This kind of code is used within the devices monitor example and you may be able to adapt some ideas from there.
 
Andreas

delph...@gmail.com

unread,
Sep 18, 2013, 3:06:23 PM9/18/13
to web...@googlegroups.com
Thank for reply :)
Reply all
Reply to author
Forward
0 new messages