SmartAxiom / openhab

Automatically exported from code.google.com/p/openhab
0 stars 0 forks source link

Sliders fire too many commands in iOS UI #67

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When a slider is used, a command request is sent on every slightest move - I am 
getting a server request every millisecond.

In an earlier version of the app, we agreed on not more than a request every 
50ms - and it used to work, I remember. This feature seems to be lost again...

A related issue: When quickly changing the slider position, the last position 
always "jumps" to some other value, once the page update from the server is 
done. I am not completely sure if this is the case because there are too many 
command requests and they might hence not be processed by the server in the 
right order. Or if the slider does not always send its "final" position at all 
to the server.

Original issue reported on code.google.com by kai.openhab on 29 Jan 2012 at 7:39

GoogleCodeExporter commented 8 years ago
There are two ways of updating slider values in iOS. Continuous or not. We 
agreed to divide per 5 the number of requests to the server. So, a faster 
device will make more device calls to the server and a slower device will make 
less calls to it. It is already defined in the code to send 5 times less 
requests. If you feel it is too much, we can change it to 10 times or less.

The related issue is because the multithreading. When you are moving the 
slider, say , to the right, you are generating lots of requests -divided per 5- 
to the server. This requests do have their own responses. We cannot be sure the 
order the responses arrive to the device, so, the device puts the slider to the 
value received in the LAST response, which might not be the last one.

We can change this two behaviors changing the way the slider is updated. We can 
change it to NOT CONTINUOUS, so the slider only updates when you release it. 
Then you will send just one request.

It is up to you ;)

Original comment by openhabi...@gmail.com on 29 Jan 2012 at 8:28

GoogleCodeExporter commented 8 years ago
I definitely want "continuous" as this gives direct feedback to the user (and 
he will only release the slider, once he is happy with the setting). The 
problem is that the current implementation is flooding my KNX bus, so that it 
gets unresponsive - so clearly a no-go. (Have you already tried it in your KNX 
environment?)

I don't know the possibilities of iOS, but I would have expected that in 
"continuous" mode some function is called that you have to implement (and which 
currently sends the HTTP requests). Couldn't you simply include a check "if 
last command was sent < 50ms ago, return" in this function?

Original comment by kai.openhab on 29 Jan 2012 at 8:46

GoogleCodeExporter commented 8 years ago
Ok, so, just to sum up:

No more than 1 request per 50 ms. at sliders.

Original comment by openhabi...@gmail.com on 30 Jan 2012 at 9:07

GoogleCodeExporter commented 8 years ago
Would be great. The 50ms is only a guess from my side - if you have the 
possibility, try yourself with a KNX dimmer and see what frequency feels ok.

Original comment by kai.openhab on 30 Jan 2012 at 9:22

GoogleCodeExporter commented 8 years ago
I have no dimmers... Maybe an update ever 0,1 or 0,2 seconds is more than 
enough. I am thinking that you may not notice more changes on a dimmer or a 
rollershutter if you update more than that. I will give you a beta before I 
publish the update, and you tell me.

Original comment by openhabi...@gmail.com on 30 Jan 2012 at 9:54

GoogleCodeExporter commented 8 years ago

Original comment by openhabi...@gmail.com on 30 Aug 2012 at 9:19