Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Oiling my tablet
Message
From
29/04/2013 07:44:52
 
 
General information
Forum:
Javascript
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01572116
Message ID:
01572135
Views:
43
>>>>>>had a look - it uses an array
>>>>>
>>>>>But claims to be far more efficient than using the native behaviour ?
>>>>>
>>>>
>>>>Dunno - but if you only keep 5 to 10 items - what difference will it make ?
>>>
>>>True. Probably not worth worrying about. I'm going to try with a stack of 10 which equates (roughly) to averaging over the last second. But the GPS interval of 20 secs is too long to wait to update the display so I'll use my own timer - I think I'll initially try using 5 second intervals.
>>
>>You're doing the updates from the direction readings ? Why is the GPS interval important ?
>>
>>
>>>>>BTW, another quirk (at least on Nexus 7):
>>>>>
>>>>>I've got energy saving configured to shut down the screen after a couple of mins. inactivity. When the screen shuts down GPS readings stop coming in - but orientation continues for about another 5 mins (by which time it's accumulated about 5000 events :-{ )
>>>>
>>>>
>>>>>Don't know why it stops at that point - maybe some other power-saving setting.....
>>>>>
>>>>>Same thing if I switch to a different app - gps stops, orientation continues .....
>>>>
>>>>Is that a problem ?
>>>
>>>No, guess not. Biggest problem I anticipated was if orientation stopped coming in when it was not changing - but that turns out to not be the case (at least on the Nexus - but this may not be true of other devices....)
>>
>>
>>In both cases (inactivity, switched to another app ), no one is watching the screen anyway
>
>Hit another problem: How to average the results when the readings oscillate around north.....
>Assume I buffer 10 results and, for simplicities sake, assume five were 350 and five were 10 degrees.
>What's the average of that :-{


Think you need a little conversion before calculating the average

- Anything less than or equal to 180 , no conversion
- others, subtract 360


The data above would then give
( (350-360) * 5 + 10 * 5 ) / 10 = zero
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform