ground-dashboard/ground/tool/summerizers/util.go

16 lines
425 B
Go
Raw Normal View History

2022-12-05 22:25:36 +00:00
package summerizers
import "github.com/johnjones4/model-rocket-telemetry/dashboard/core"
func timeInMode(fd []core.DataSegment, mode core.FlightMode) float64 {
startTime := -1.0
for _, d := range fd {
if d.Computed.FlightMode == mode && startTime < 0 {
startTime = d.Raw.flightTime
} else if d.Computed.FlightMode != mode && startTime > 0 {
return d.Raw.flightTime - startTime
}
}
return 0
}