Rummys Blog An world of endless Monday

Friday, 1 July, 2016

Code Thoughts

Filed under: — Andrew.Rowbottom @ 1:13 pm

Autoselect Routes to display : simply use bounding boxes

Alongside raw route information, sale stash expected update frequency? So that long straight stretches where the rider isn’t expected to go wrong dont update as often, but as they approach corners the refresh rate goes up.

Segment the compass/bearing rotation so that there aren’t as many refreshes (depends on how strongly google redraw the map)
Allow the blue dot to move up the page a way before bringing it back to “below-center” .. again google may already do this — no they don’t because we don’t ask them to.. to reduce map refreshes and save on battery

 

GridViewPager implements onInterceptTouchEvent and returns false for a 1×1 grid
flow of event after gridviewpager has returned false
… CardScrollView is checked for canViewReceivePointerEvents

Location/GPS handling

Location handling is not as trivial as I was hoping.
I’m going for the following design..
A single LocationListener that is registered with the fusedLocationApi (somewhere, still under debate)
This broadcasts LocationEvents for the logger and the map fragment to recieve.
The loggers just log (though they may perform some filtering in future)
The MapFragment then post processes the data to optionally

  • add bearing and speed data (the sdk location provider doesn’t add these)
  • pass onto the map LocationListener “as is” for the blue dot
  • Filter/”segment” the bearing for map rotation to reduce frequency of map rotations which may be CPU intensive
  • Filter the location to a specific distance according to the provided accuracy .. so if the accuracy overlaps it doesn’t unduly move the map
  • check that the blue dot will be on screen (or ideally in the bottom 2/3)

Display Updates

To synchronize the screen updating for the displayed clock and duration (mainly affects the statistics panels) the Controller fires UpdateDisplayedData events at 2 different frequencies, when on and when in ambient.
However we also get data from the GPS which will (in effect) come in at random times unrelated to the controller ticks.
In ambient mode where display updates are rare (30 seconds) this could lead to a serious, max 1 minute, lag in some of the displayed data.
So the Stats panels also listen to Location Update events and updates GPS related data on that event seperately.
I *dont* really like this design at all, but it avoids weird clock seconds

NOTE: The map update is primarily DRIVEN by the GPS, the GPS does change its frequency based on ambient/notAmbient but independently of the controller, in truth this could be a design mistake as this makes for 2 independent update controllers! But at a 30 sec update the GPS isn’t guaranteed to have a position at the time the controller updateDisplay event is seen, and we could end up with a 1 minute lag!

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress