mlt / schwinn810

Software for Schwinn 810 (and also some Mio, Cresta, and RedClover) GPS sport watch with heart rate monitor (Linux, Windows, and Mac OS)
https://github.com/mlt/schwinn810/wiki/Windows
14 stars 6 forks source link

TriggerMethod field in TCX #31

Open sandrovich opened 9 years ago

sandrovich commented 9 years ago

Hi, this is not a bug or issue but a acording to tcx schema, in every lap there is a TriggerMethod field which indicate if this was triggered by distance, location.. or manual. In the actual version, it always says "Location"

           if heart_max>0:
                print("""    <MaximumHeartRateBpm><Value>{:d}</Value></MaximumHeartRateBpm>""".format(heart_max))
            print("""    <Intensity>Active</Intensity>
    <TriggerMethod>Location</TriggerMethod>
    <Track>""")

Looking into sourcode it is possible to know if this was manual or by distance (0.5, 1.0, 2.0 etc) but never by location. I think it could check autolap var to print different trigger method, for example:

            print("""    <Intensity>Active</Intensity>""")
            if int(theLap['autolap']) > 0:
                print("""    <TriggerMethod>Distance</TriggerMethod>""")
            else:
                print("""    <TriggerMethod>Manual</TriggerMethod>""")

            print("""    <Track>""")

Thank you for your software, I'm using it in Mac OS X Mavericks without problem.

One last thing, I'm trying to extract the settings of my watch but there is no read_settings method in reader_cresta.py. I have copied the one in reader_schwinn.py but it throw an error unpacking the data. I've changed the amount of data read from 25 to 20 without success. Any help?

mlt commented 9 years ago

Sweet! You are the very first user of this software on Mac OS who let me know it works! Could you share some details? Did you have to compile any extra kernel modules for USB to serial converter? Was it just python stuff and that was it?

I didn't finish figuring out the exact meaning of autolaps thus far. Feel free to edit the wiki on that.

Please let me know if you are planning to do major editing before actually diving into it. I still have a backlog of changes that I want to edit a bit before pushing here. I'm somewhat behind on my other things. This would reduce possible merge conflicts.

there is no read_settings method in reader_cresta.py

There was an issue with incomplete data fetching. This caused some issues when trying to extract data anew without disconnecting the watch first. I see even for Schwinn it still fetches 25 bytes in read_settings (I need to check on that in my work copy). I'd suggest opening another issue like "Support for settings extraction on Cresta alike watch". Post there an exact error you are getting. If it is about failed signatures in other parts of the code, it well might be that you subsequently trying to fetch things again and again without disconnecting the watch and something is just stuck in a buffer that was not flushed. Disconnecting the watch before the new attempt might help if that was an issue.

sandrovich commented 9 years ago

Sweet! You are the very first user of this software on Mac OS who let me know it works! Could you >share some details? Did you have to compile any extra kernel modules for USB to serial converter? >Was it just python stuff and that was it?

There is no need to compile anything, the driver is there out of the box. I have just installed some additional python modules like TZ and Serial.

I didn't finish figuring out the exact meaning of autolaps thus far. Feel free to edit the wiki on that.

In my Cresta alike watch, the settings for autolap are: off, 0.5, 1, 2, 3, 4, 5 kilometers. If you change units the values are the same but in miles. The actual byte code for each one are unknown for me, I'm trying to read the dump bin file without success, I need help on this. Going back to the trigger method in TCX file, in this watch you only get manual (autolap off) you must press lap+ button to start a new lap, or by distance (autolap 0.5, 1, 2, 3, 4 or 5 km). Is what I've done in the code above.