From cd89fe3a4e4d3f1d4fc7dd4d981ad788eae5277b Mon Sep 17 00:00:00 2001 From: Hikmatulloh Hari Mukti Date: Sat, 31 Aug 2024 23:59:37 +0700 Subject: [PATCH 1/3] chore: remove invalid value check on degrees method --- internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl b/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl index 93e8c69..ebeae2d 100644 --- a/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl +++ b/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl @@ -212,11 +212,8 @@ func (m *{{ $.Name }}) {{ .Name }}Scaled() {{ if gt .FixedArraySize 0 }} [{{ .Fi // {{ .Name }}Degrees returns {{ .Name }} in degrees instead of semicircles. // If {{ .Name }} value is invalid, float64 invalid value will be returned. func (m *{{ $.Name }}) {{ .Name }}Degrees() float64 { - if {{ .ComparableValue }} == {{ .InvalidValue }} { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.{{ .Name }}) - } +} {{ end }} {{ end }} From 3f94a0fa1448893d7ec8114848689acf7d4bb521 Mon Sep 17 00:00:00 2001 From: Hikmatulloh Hari Mukti Date: Sun, 1 Sep 2024 00:01:46 +0700 Subject: [PATCH 2/3] chore: mesgdef.tmlp replace four space with one tab --- .../cmd/fitgen/profile/mesgdef/mesgdef.tmpl | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl b/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl index ebeae2d..d65bddf 100644 --- a/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl +++ b/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl @@ -8,14 +8,14 @@ package {{ .Package }} import ( - "github.com/muktihari/fit/factory" + "github.com/muktihari/fit/factory" "github.com/muktihari/fit/profile/typedef" "github.com/muktihari/fit/proto" {{- if .Imports -}} - {{ range $_, $v := .Imports }} - {{ printf "%q" $v -}} - {{ end }} - {{ end }} + {{ range $_, $v := .Imports }} + {{ printf "%q" $v -}} + {{ end }} + {{ end }} ) // {{ .Name }} is a {{ .Name }} message. @@ -41,32 +41,32 @@ type {{ .Name }} struct { // New{{ .Name }} creates new {{ .Name }} struct based on given mesg. // If mesg is nil, it will return {{ .Name }} with all fields being set to its corresponding invalid value. func New{{ .Name }}(mesg *proto.Message) *{{ .Name }} { - vals := [{{ .MaxFieldNum }}]proto.Value{} + vals := [{{ .MaxFieldNum }}]proto.Value{} {{ if gt .MaxFieldExpandNum 1 -}} var state [{{ byteDiv .MaxFieldExpandNum 8 | byteAdd 1 }}]uint8 {{ end -}} - {{ if and (not (eq .Name "FileId")) (not (eq .Name "DeveloperDataId")) (not (eq .Name "FieldDescription")) -}} - var developerFields []proto.DeveloperField - {{ end -}} - if mesg != nil { - for i := range mesg.Fields { - if mesg.Fields[i].Num > {{ byteSub .MaxFieldNum 1 }} { - continue - } + {{ if and (not (eq .Name "FileId")) (not (eq .Name "DeveloperDataId")) (not (eq .Name "FieldDescription")) -}} + var developerFields []proto.DeveloperField + {{ end -}} + if mesg != nil { + for i := range mesg.Fields { + if mesg.Fields[i].Num > {{ byteSub .MaxFieldNum 1 }} { + continue + } {{ if gt $.MaxFieldExpandNum 1 -}} if mesg.Fields[i].Num < {{ .MaxFieldExpandNum }} && mesg.Fields[i].IsExpandedField { pos := mesg.Fields[i].Num/8 state[pos] |= 1 << (mesg.Fields[i].Num - (8 * pos)) } {{ end -}} - vals[mesg.Fields[i].Num] = mesg.Fields[i].Value - } - {{- if and (not (eq .Name "FileId")) (not (eq .Name "DeveloperDataId")) (not (eq .Name "FieldDescription")) }} - developerFields = mesg.DeveloperFields - {{ end -}} - } + vals[mesg.Fields[i].Num] = mesg.Fields[i].Value + } + {{- if and (not (eq .Name "FileId")) (not (eq .Name "DeveloperDataId")) (not (eq .Name "FieldDescription")) }} + developerFields = mesg.DeveloperFields + {{ end -}} + } return &{{ .Name }}{ @@ -87,25 +87,25 @@ func (m *{{ .Name }}) ToMesg(options *Options) proto.Message { if options == nil { options = defaultOptions } else if options.Factory == nil { - options.Factory = factory.StandardFactory() - } + options.Factory = factory.StandardFactory() + } - fac := options.Factory + fac := options.Factory - arr := pool.Get().(*[poolsize]proto.Field) - fields := arr[:0] - - mesg := proto.Message{ Num: typedef.MesgNum{{ .Name }} } + arr := pool.Get().(*[poolsize]proto.Field) + fields := arr[:0] + + mesg := proto.Message{ Num: typedef.MesgNum{{ .Name }} } - {{ range .Fields -}} - {{ if and (eq .Type "bool") (eq .FixedArraySize 0) -}} + {{ range .Fields -}} + {{ if and (eq .Type "bool") (eq .FixedArraySize 0) -}} { field := fac.CreateField(mesg.Num, {{ .Num }}) field.Value = {{ .ProtoValue }} fields = append(fields, field) } {{ else -}} - if {{ .IsValidValue -}} { + if {{ .IsValidValue -}} { {{- if eq .CanExpand true -}} if expanded := m.IsExpandedField({{ .Num }}); !expanded || (expanded && options.IncludeExpandedFields) { {{ end }} field := fac.CreateField(mesg.Num, {{ .Num }}) {{ if gt .FixedArraySize 0 -}} @@ -123,13 +123,13 @@ func (m *{{ .Name }}) ToMesg(options *Options) proto.Message { {{ end -}} fields = append(fields, field) {{ if eq .CanExpand true -}} } {{ end -}} - } - {{ end -}} + } + {{ end -}} {{ end }} - mesg.Fields = make([]proto.Field, len(fields)) - copy(mesg.Fields, fields) - pool.Put(arr) + mesg.Fields = make([]proto.Field, len(fields)) + copy(mesg.Fields, fields) + pool.Put(arr) {{ if and (not (eq .Name "FileId")) (not (eq .Name "DeveloperDataId")) (not (eq .Name "FieldDescription")) }} mesg.DeveloperFields = m.DeveloperFields @@ -212,7 +212,7 @@ func (m *{{ $.Name }}) {{ .Name }}Scaled() {{ if gt .FixedArraySize 0 }} [{{ .Fi // {{ .Name }}Degrees returns {{ .Name }} in degrees instead of semicircles. // If {{ .Name }} value is invalid, float64 invalid value will be returned. func (m *{{ $.Name }}) {{ .Name }}Degrees() float64 { - return semicircles.ToDegrees(m.{{ .Name }}) + return semicircles.ToDegrees(m.{{ .Name }}) } {{ end }} {{ end }} @@ -222,8 +222,8 @@ func (m *{{ $.Name }}) {{ .Name }}Degrees() float64 { // // {{ .Comment }} func (m *{{ $.Name }}) Set{{ .Name }}(v {{ .Type }}) *{{ $.Name }} { - m.{{ .Name }} = v - return m + m.{{ .Name }} = v + return m } {{ if not (and (eq .Scale 1.0) (eq .Offset 0.0)) -}} @@ -255,16 +255,16 @@ func (m *{{ $.Name }}) Set{{ .Name }}Scaled({{ if gt .FixedArraySize 0 }} vs [{{ } m.{{ .Name }}[i] = {{ extractExactlyType .Type }}(unscaled) } - {{ else -}} + {{ else -}} unscaled := (v + {{ .Offset }}) * {{ .Scale }} if math.IsNaN(unscaled) || math.IsInf(unscaled, 0) || unscaled > float64({{ .BaseTypeInvalid }}) { m.{{ .Name }} = {{ .Type }}({{ .BaseTypeInvalid }}) return m } m.{{ .Name }} = {{ .Type }}(unscaled) - {{ end -}} + {{ end -}} - return m + return m } {{ end -}} @@ -272,8 +272,8 @@ func (m *{{ $.Name }}) Set{{ .Name }}Scaled({{ if gt .FixedArraySize 0 }} vs [{{ // Set{{ .Name }}Degrees is similar to Set{{ .Name }} except it accepts a value in degrees. // This method will automatically convert given degrees value to semicircles ({{ .Type }}) form. func (m *{{ $.Name }}) Set{{ .Name }}Degrees(degrees float64) *{{ $.Name }} { - m.{{ .Name }} = semicircles.ToSemicircles(degrees) - return m + m.{{ .Name }} = semicircles.ToSemicircles(degrees) + return m } {{ end -}} @@ -282,8 +282,8 @@ func (m *{{ $.Name }}) Set{{ .Name }}Degrees(degrees float64) *{{ $.Name }} { {{- if and (not (eq .Name "FileId")) (not (eq .Name "DeveloperDataId")) (not (eq .Name "FieldDescription")) }} // SetDeveloperFields {{ $.Name }}'s DeveloperFields. func (m *{{ $.Name }}) SetDeveloperFields(developerFields ...proto.DeveloperField) *{{ $.Name }} { - m.DeveloperFields = developerFields - return m + m.DeveloperFields = developerFields + return m } {{ end }} @@ -340,8 +340,8 @@ func (m *{{ $.Name }}) IsExpandedField(fieldNum byte) bool { package {{ .Package }} import ( - "github.com/muktihari/fit/proto" - "sync" + "github.com/muktihari/fit/proto" + "sync" ) const poolsize = {{ .MaxLenFields }} // Max fields' length from the entire messages. From fb99c8449783809538d78ac9896b6982e5cbe491 Mon Sep 17 00:00:00 2001 From: Hikmatulloh Hari Mukti Date: Sun, 1 Sep 2024 00:04:02 +0700 Subject: [PATCH 3/3] fitgen: generate mesgdef --- profile/mesgdef/climb_pro_gen.go | 6 ------ profile/mesgdef/course_point_gen.go | 6 ------ profile/mesgdef/gps_metadata_gen.go | 6 ------ profile/mesgdef/jump_gen.go | 6 ------ profile/mesgdef/lap_gen.go | 12 ------------ profile/mesgdef/record_gen.go | 6 ------ profile/mesgdef/segment_lap_gen.go | 24 ----------------------- profile/mesgdef/segment_point_gen.go | 6 ------ profile/mesgdef/session_gen.go | 24 ----------------------- profile/mesgdef/split_gen.go | 12 ------------ profile/mesgdef/weather_conditions_gen.go | 6 ------ 11 files changed, 114 deletions(-) diff --git a/profile/mesgdef/climb_pro_gen.go b/profile/mesgdef/climb_pro_gen.go index 4bb84bf..99580b7 100755 --- a/profile/mesgdef/climb_pro_gen.go +++ b/profile/mesgdef/climb_pro_gen.go @@ -130,18 +130,12 @@ func (m *ClimbPro) TimestampUint32() uint32 { return datetime.ToUint32(m.Timesta // PositionLatDegrees returns PositionLat in degrees instead of semicircles. // If PositionLat value is invalid, float64 invalid value will be returned. func (m *ClimbPro) PositionLatDegrees() float64 { - if m.PositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLat) } // PositionLongDegrees returns PositionLong in degrees instead of semicircles. // If PositionLong value is invalid, float64 invalid value will be returned. func (m *ClimbPro) PositionLongDegrees() float64 { - if m.PositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLong) } diff --git a/profile/mesgdef/course_point_gen.go b/profile/mesgdef/course_point_gen.go index d13ec01..d089688 100755 --- a/profile/mesgdef/course_point_gen.go +++ b/profile/mesgdef/course_point_gen.go @@ -148,18 +148,12 @@ func (m *CoursePoint) DistanceScaled() float64 { // PositionLatDegrees returns PositionLat in degrees instead of semicircles. // If PositionLat value is invalid, float64 invalid value will be returned. func (m *CoursePoint) PositionLatDegrees() float64 { - if m.PositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLat) } // PositionLongDegrees returns PositionLong in degrees instead of semicircles. // If PositionLong value is invalid, float64 invalid value will be returned. func (m *CoursePoint) PositionLongDegrees() float64 { - if m.PositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLong) } diff --git a/profile/mesgdef/gps_metadata_gen.go b/profile/mesgdef/gps_metadata_gen.go index 041346d..a96dfab 100755 --- a/profile/mesgdef/gps_metadata_gen.go +++ b/profile/mesgdef/gps_metadata_gen.go @@ -220,18 +220,12 @@ func (m *GpsMetadata) VelocityScaled() [3]float64 { // PositionLatDegrees returns PositionLat in degrees instead of semicircles. // If PositionLat value is invalid, float64 invalid value will be returned. func (m *GpsMetadata) PositionLatDegrees() float64 { - if m.PositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLat) } // PositionLongDegrees returns PositionLong in degrees instead of semicircles. // If PositionLong value is invalid, float64 invalid value will be returned. func (m *GpsMetadata) PositionLongDegrees() float64 { - if m.PositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLong) } diff --git a/profile/mesgdef/jump_gen.go b/profile/mesgdef/jump_gen.go index e423a54..2f0cbc2 100755 --- a/profile/mesgdef/jump_gen.go +++ b/profile/mesgdef/jump_gen.go @@ -185,18 +185,12 @@ func (m *Jump) EnhancedSpeedScaled() float64 { // PositionLatDegrees returns PositionLat in degrees instead of semicircles. // If PositionLat value is invalid, float64 invalid value will be returned. func (m *Jump) PositionLatDegrees() float64 { - if m.PositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLat) } // PositionLongDegrees returns PositionLong in degrees instead of semicircles. // If PositionLong value is invalid, float64 invalid value will be returned. func (m *Jump) PositionLongDegrees() float64 { - if m.PositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLong) } diff --git a/profile/mesgdef/lap_gen.go b/profile/mesgdef/lap_gen.go index 564c024..b28762f 100755 --- a/profile/mesgdef/lap_gen.go +++ b/profile/mesgdef/lap_gen.go @@ -1839,36 +1839,24 @@ func (m *Lap) MaxCoreTemperatureScaled() float64 { // StartPositionLatDegrees returns StartPositionLat in degrees instead of semicircles. // If StartPositionLat value is invalid, float64 invalid value will be returned. func (m *Lap) StartPositionLatDegrees() float64 { - if m.StartPositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.StartPositionLat) } // StartPositionLongDegrees returns StartPositionLong in degrees instead of semicircles. // If StartPositionLong value is invalid, float64 invalid value will be returned. func (m *Lap) StartPositionLongDegrees() float64 { - if m.StartPositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.StartPositionLong) } // EndPositionLatDegrees returns EndPositionLat in degrees instead of semicircles. // If EndPositionLat value is invalid, float64 invalid value will be returned. func (m *Lap) EndPositionLatDegrees() float64 { - if m.EndPositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.EndPositionLat) } // EndPositionLongDegrees returns EndPositionLong in degrees instead of semicircles. // If EndPositionLong value is invalid, float64 invalid value will be returned. func (m *Lap) EndPositionLongDegrees() float64 { - if m.EndPositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.EndPositionLong) } diff --git a/profile/mesgdef/record_gen.go b/profile/mesgdef/record_gen.go index 8135679..2702b40 100755 --- a/profile/mesgdef/record_gen.go +++ b/profile/mesgdef/record_gen.go @@ -1269,18 +1269,12 @@ func (m *Record) CoreTemperatureScaled() float64 { // PositionLatDegrees returns PositionLat in degrees instead of semicircles. // If PositionLat value is invalid, float64 invalid value will be returned. func (m *Record) PositionLatDegrees() float64 { - if m.PositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLat) } // PositionLongDegrees returns PositionLong in degrees instead of semicircles. // If PositionLong value is invalid, float64 invalid value will be returned. func (m *Record) PositionLongDegrees() float64 { - if m.PositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLong) } diff --git a/profile/mesgdef/segment_lap_gen.go b/profile/mesgdef/segment_lap_gen.go index c5c6e83..65d1ff4 100755 --- a/profile/mesgdef/segment_lap_gen.go +++ b/profile/mesgdef/segment_lap_gen.go @@ -1297,72 +1297,48 @@ func (m *SegmentLap) EnhancedMinAltitudeScaled() float64 { // StartPositionLatDegrees returns StartPositionLat in degrees instead of semicircles. // If StartPositionLat value is invalid, float64 invalid value will be returned. func (m *SegmentLap) StartPositionLatDegrees() float64 { - if m.StartPositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.StartPositionLat) } // StartPositionLongDegrees returns StartPositionLong in degrees instead of semicircles. // If StartPositionLong value is invalid, float64 invalid value will be returned. func (m *SegmentLap) StartPositionLongDegrees() float64 { - if m.StartPositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.StartPositionLong) } // EndPositionLatDegrees returns EndPositionLat in degrees instead of semicircles. // If EndPositionLat value is invalid, float64 invalid value will be returned. func (m *SegmentLap) EndPositionLatDegrees() float64 { - if m.EndPositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.EndPositionLat) } // EndPositionLongDegrees returns EndPositionLong in degrees instead of semicircles. // If EndPositionLong value is invalid, float64 invalid value will be returned. func (m *SegmentLap) EndPositionLongDegrees() float64 { - if m.EndPositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.EndPositionLong) } // NecLatDegrees returns NecLat in degrees instead of semicircles. // If NecLat value is invalid, float64 invalid value will be returned. func (m *SegmentLap) NecLatDegrees() float64 { - if m.NecLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.NecLat) } // NecLongDegrees returns NecLong in degrees instead of semicircles. // If NecLong value is invalid, float64 invalid value will be returned. func (m *SegmentLap) NecLongDegrees() float64 { - if m.NecLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.NecLong) } // SwcLatDegrees returns SwcLat in degrees instead of semicircles. // If SwcLat value is invalid, float64 invalid value will be returned. func (m *SegmentLap) SwcLatDegrees() float64 { - if m.SwcLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.SwcLat) } // SwcLongDegrees returns SwcLong in degrees instead of semicircles. // If SwcLong value is invalid, float64 invalid value will be returned. func (m *SegmentLap) SwcLongDegrees() float64 { - if m.SwcLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.SwcLong) } diff --git a/profile/mesgdef/segment_point_gen.go b/profile/mesgdef/segment_point_gen.go index 0c425dd..d20e873 100755 --- a/profile/mesgdef/segment_point_gen.go +++ b/profile/mesgdef/segment_point_gen.go @@ -189,18 +189,12 @@ func (m *SegmentPoint) EnhancedAltitudeScaled() float64 { // PositionLatDegrees returns PositionLat in degrees instead of semicircles. // If PositionLat value is invalid, float64 invalid value will be returned. func (m *SegmentPoint) PositionLatDegrees() float64 { - if m.PositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLat) } // PositionLongDegrees returns PositionLong in degrees instead of semicircles. // If PositionLong value is invalid, float64 invalid value will be returned. func (m *SegmentPoint) PositionLongDegrees() float64 { - if m.PositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.PositionLong) } diff --git a/profile/mesgdef/session_gen.go b/profile/mesgdef/session_gen.go index 119fd4c..db961f2 100755 --- a/profile/mesgdef/session_gen.go +++ b/profile/mesgdef/session_gen.go @@ -2194,72 +2194,48 @@ func (m *Session) MaxCoreTemperatureScaled() float64 { // StartPositionLatDegrees returns StartPositionLat in degrees instead of semicircles. // If StartPositionLat value is invalid, float64 invalid value will be returned. func (m *Session) StartPositionLatDegrees() float64 { - if m.StartPositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.StartPositionLat) } // StartPositionLongDegrees returns StartPositionLong in degrees instead of semicircles. // If StartPositionLong value is invalid, float64 invalid value will be returned. func (m *Session) StartPositionLongDegrees() float64 { - if m.StartPositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.StartPositionLong) } // NecLatDegrees returns NecLat in degrees instead of semicircles. // If NecLat value is invalid, float64 invalid value will be returned. func (m *Session) NecLatDegrees() float64 { - if m.NecLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.NecLat) } // NecLongDegrees returns NecLong in degrees instead of semicircles. // If NecLong value is invalid, float64 invalid value will be returned. func (m *Session) NecLongDegrees() float64 { - if m.NecLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.NecLong) } // SwcLatDegrees returns SwcLat in degrees instead of semicircles. // If SwcLat value is invalid, float64 invalid value will be returned. func (m *Session) SwcLatDegrees() float64 { - if m.SwcLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.SwcLat) } // SwcLongDegrees returns SwcLong in degrees instead of semicircles. // If SwcLong value is invalid, float64 invalid value will be returned. func (m *Session) SwcLongDegrees() float64 { - if m.SwcLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.SwcLong) } // EndPositionLatDegrees returns EndPositionLat in degrees instead of semicircles. // If EndPositionLat value is invalid, float64 invalid value will be returned. func (m *Session) EndPositionLatDegrees() float64 { - if m.EndPositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.EndPositionLat) } // EndPositionLongDegrees returns EndPositionLong in degrees instead of semicircles. // If EndPositionLong value is invalid, float64 invalid value will be returned. func (m *Session) EndPositionLongDegrees() float64 { - if m.EndPositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.EndPositionLong) } diff --git a/profile/mesgdef/split_gen.go b/profile/mesgdef/split_gen.go index 898700c..6b72e84 100755 --- a/profile/mesgdef/split_gen.go +++ b/profile/mesgdef/split_gen.go @@ -305,36 +305,24 @@ func (m *Split) TotalMovingTimeScaled() float64 { // StartPositionLatDegrees returns StartPositionLat in degrees instead of semicircles. // If StartPositionLat value is invalid, float64 invalid value will be returned. func (m *Split) StartPositionLatDegrees() float64 { - if m.StartPositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.StartPositionLat) } // StartPositionLongDegrees returns StartPositionLong in degrees instead of semicircles. // If StartPositionLong value is invalid, float64 invalid value will be returned. func (m *Split) StartPositionLongDegrees() float64 { - if m.StartPositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.StartPositionLong) } // EndPositionLatDegrees returns EndPositionLat in degrees instead of semicircles. // If EndPositionLat value is invalid, float64 invalid value will be returned. func (m *Split) EndPositionLatDegrees() float64 { - if m.EndPositionLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.EndPositionLat) } // EndPositionLongDegrees returns EndPositionLong in degrees instead of semicircles. // If EndPositionLong value is invalid, float64 invalid value will be returned. func (m *Split) EndPositionLongDegrees() float64 { - if m.EndPositionLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.EndPositionLong) } diff --git a/profile/mesgdef/weather_conditions_gen.go b/profile/mesgdef/weather_conditions_gen.go index 2b7874d..a5d6c49 100755 --- a/profile/mesgdef/weather_conditions_gen.go +++ b/profile/mesgdef/weather_conditions_gen.go @@ -207,18 +207,12 @@ func (m *WeatherConditions) WindSpeedScaled() float64 { // ObservedLocationLatDegrees returns ObservedLocationLat in degrees instead of semicircles. // If ObservedLocationLat value is invalid, float64 invalid value will be returned. func (m *WeatherConditions) ObservedLocationLatDegrees() float64 { - if m.ObservedLocationLat == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.ObservedLocationLat) } // ObservedLocationLongDegrees returns ObservedLocationLong in degrees instead of semicircles. // If ObservedLocationLong value is invalid, float64 invalid value will be returned. func (m *WeatherConditions) ObservedLocationLongDegrees() float64 { - if m.ObservedLocationLong == basetype.Sint32Invalid { - return math.Float64frombits(basetype.Float64Invalid) - } return semicircles.ToDegrees(m.ObservedLocationLong) }