Hi,
I'd rather ask this on GitHub, but unfortunately the issues tab is not available for the fit-javascript-sdk. i've noticed that the enconding of altitude and enhanced altitude seems a bit off. Check the snippet below. i try encoding a record with altitude "20". When decoding it back, I get 6892.8. Opening the output FIT file in online FIT viewers also yields this weird value, instead of the expected 20.
import { Decoder, Stream, Profile, Encoder } from '@garmin/fitsdk'
const recordMesg = {
timestamp: new Date('2025-05-28T08:38:47.000Z'),
heartRate: 125,
speed: 1.1,
distance: 1.8,
altitude: 20,
}
const encoder = new Encoder()
encoder.onMesg(Profile.MesgNum.RECORD, recordMesg)
const stream = Stream.fromByteArray(encoder.close())
const decoder = new Decoder(stream)
const { messages, errors } = decoder.read()
console.log(messages.recordMesgs[0])
// Output:
// {
// timestamp: 2025-05-28T08:38:47.000Z,
// heartRate: 125,
// speed: 1.1,
// distance: 1.8,
// altitude: 6892.8,
// enhancedAltitude: 6892.8,
// enhancedSpeed: 1.1
// }
Does anyone have an idea on why's this happening?
Thanks