I cannot get speed to record to the fit file from my watch app when using a speed/cadence sensor (Garmin 830 with SDK 3.1). I have tried everything I can think of but it just won't come through.
To debug I have made a super simple watch app, with a fit_file class which does the writing for me. This works, and it is recording data, but speed does not appear and distance remains zero throughout. What am I missing?
using Toybox.FitContributor as Fit; using Toybox.ActivityRecording as Record; using Toybox.WatchUi as Ui; using Toybox.System as Sys; using Toybox.Sensor; var session = null; var FIELD_COUNT = 1; var FIELD_0 = 0; class fit_file { // FIT fields: static var fields = new [20]; static function startLog() { Sensor.setEnabledSensors([Sensor.SENSOR_BIKESPEED, Sensor.SENSOR_BIKECADENCE]); // Create session: session = Record.createSession({:name=>"AeroSesssion", :sport=>Record.SPORT_CYCLING}); // Create fields: fields[FIELD_0] = session.createField("field_0",FIELD_0,Fit.DATA_TYPE_FLOAT,{ :mesgType=>Fit.MESG_TYPE_RECORD, :units=>"m" }); for (var i=0;i<FIELD_COUNT;i++) { fields[i].setData(0.0f); } session.start(); Ui.requestUpdate(); } static function stopLog() { if( ( session != null ) && session.isRecording() ) { session.stop(); session.save(); session = null; Ui.requestUpdate(); } } static function startStopLog() { if( Toybox has :ActivityRecording ) { if (( session == null ) || ( session.isRecording() == false ) ) { me.startLog(); } else if( ( session != null ) && session.isRecording() ) { me.stopLog(); } } } static function isLogging() { if( ( session != null ) && session.isRecording()) { return true; } else { return false; } } static function addLap() { session.addLap(); } }