Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
OnRotary accelerator (one liner)
This thread has no replies.
Post 1 made on Saturday January 3, 2009 at 10:01
Rusty Fobe
Long Time Member
Joined:
Posts:
December 2008
47
For the interested.

In my exercises to learn javascript I wanted to avoid the more complex onRotary coding shown in the PS guide with variables and if-else needed for the first three numbers. The coding window is already very small, consequently...

Following algorithm generates, both in negative and positive, following numbers:
0 1 1 3 6 12 25 50 100 200 400 800 1600 etc.
The PS Developers guide's algorithm yields
0 1 1 3 6 13 29 67 156 372 900 2200 5443 etc.

The round numbers are just a nice to have, nothing more, a side effect when I tuned the following algorithm:

accClicks = ((clicks<0)?-1:1)*parseInt(0.390641*Math.pow(2,Math.abs(clicks))+0.4);

Replacing 0.390641 by 0.4, generates, both in negative and positive:
0 1 2 3 6 13 26 51 102 205 410 etc.

Last edited by Rusty Fobe on January 3, 2009 17:58.

Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse