Pitmairen / bryton-gps-linux

An attempt to read Bryton GPS devices on Linux
GNU General Public License v3.0
29 stars 14 forks source link

Rider50 does not read rides from planned trips. #21

Open chronossc opened 10 years ago

chronossc commented 10 years ago

Hello!

Today I needed to use planned trips to go to some places here, and now when I uploading it to strava I found that it does not read entire track.

So I tried to just show summary and then save TCX file:

$ python brytongps.py -T 3 --summary      
===================================================
2014-01-13 08:51:04
2014-01-13 08:51:04 - 2014-01-13 10:28:51 (1:05:40)
   Dist: 24.07Km
    Cal: 1664058
    Alt: 174.0m / 173.0m (gain/loss)
  Speed: 22.0Kph / 49.5Kph (avg/max)
$ python brytongps.py -T 3 --tcx          
/home/felipe/projects/bryton/bryton-gps-linux/code/rider50.py:296: RuntimeWarning: Untested gps file format version. It's probably ok, but you should check that the values in the output file looks correct.
  RuntimeWarning)
Traceback (most recent call last):
  File "brytongps.py", line 483, in <module>
    sys.exit(main())
  File "brytongps.py", line 414, in main
    'tcx', args)
  File "brytongps.py", line 205, in export_tracks
    out = export_func(t, pretty=args.no_whitespace)
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/tcx.py", line 226, in track_to_tcx
    create_laps(track, no_laps, activity, ns)
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/tcx.py", line 156, in create_laps
    for sum, segments in _get_lap_trackpoints(track, no_laps):
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/tcx.py", line 257, in _get_lap_trackpoints
    for seg in track.merged_segments(remove_empty_track_segs=False):
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/rider40.py", line 227, in merged_segments
    for tseg, lseg in zip(self.trackpoints, self.logpoints):
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/utils.py", line 63, in __get__
    value = self.func(obj)
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/rider50.py", line 159, in trackpoints
    return _read_trackpoint_segments(buf)
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/rider50.py", line 313, in _read_trackpoint_segments
    segment_type, timestamp, count)
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/rider50.py", line 344, in _read_trackpoint_segment
    track_points, num_read = _read_trackpoints(buf, start_timestamp, count)
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/rider50.py", line 358, in _read_trackpoints
    if buf.be_uint16_from(0) == 1 and buf.be_uint32_from(4) == 0:
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/common.py", line 146, in be_uint16_from
    return struct.unpack('>H', self.read_from(offset, 2))[0]
  File "/home/felipe/projects/bryton/bryton-gps-linux/code/common.py", line 99, in read_from
    blocks = end_offset / self.device.BLOCK_SIZE
AttributeError: 'NoneType' object has no attribute 'BLOCK_SIZE'

Same happens with gpx option.

To reproduce this, go to some windows machine, go to bryton site, add new tracks to planned trips and then download it to device. Run the track you created, and try to upload workout.

If u need some dump just tell me how do it :)

Pitmairen commented 10 years ago

If you can upload an image of the device filesystem as described in this comment: https://github.com/Pitmairen/bryton-gps-linux/issues/16#issuecomment-21406950, i will have a look at it. The track that is failing must be on the device when creating the image.

chronossc commented 10 years ago

Here is compressed image (with bz2) and his md5 in a tar file (also with md5): https://www.dropbox.com/sh/241rhacqiphvekg/RNCg6YeCwn

It has around 50M and I'm uploading it now. Check md5 after download plz :)

Pitmairen commented 10 years ago

I have updated the code, it think it should be working now. The count of the number of trackpoints and logpoints seems to be off by 2 which causes the software to try to read past the end of the file. It probably have something to do with the planned trip.

Do you have the bdx file of this track so i can compare it with the data on the device?

chronossc commented 10 years ago

Hi. Just uploaded two bdx files that used planned trips. They are on dropbox folder that I shared rider50 images.

chronossc commented 10 years ago

@Pitmairen just confirming that I successfully uploaded tracks with planned trips to Strava. THX!