mirror of
https://codeberg.org/portospaceteam/ground-dashboard.git
synced 2024-11-25 08:26:26 +00:00
16 lines
408 B
Go
16 lines
408 B
Go
|
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.Timestamp
|
||
|
} else if d.Computed.FlightMode != mode && startTime > 0 {
|
||
|
return d.Raw.Timestamp - startTime
|
||
|
}
|
||
|
}
|
||
|
return 0
|
||
|
}
|