kopia lustrzana https://github.com/cyoung/stratux
AHRS replay log.
rodzic
c80de8856f
commit
324bef7701
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/dustin/go-humanize"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
@ -13,7 +14,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"github.com/dustin/go-humanize"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// http://www.faa.gov/nextgen/programs/adsb/wsa/media/GDL90_Public_ICD_RevA.PDF
|
// http://www.faa.gov/nextgen/programs/adsb/wsa/media/GDL90_Public_ICD_RevA.PDF
|
||||||
|
@ -27,6 +27,7 @@ const (
|
||||||
uatReplayLog = "/var/log/stratux-uat.log"
|
uatReplayLog = "/var/log/stratux-uat.log"
|
||||||
esReplayLog = "/var/log/stratux-es.log"
|
esReplayLog = "/var/log/stratux-es.log"
|
||||||
gpsReplayLog = "/var/log/stratux-gps.log"
|
gpsReplayLog = "/var/log/stratux-gps.log"
|
||||||
|
ahrsReplayLog = "/var/log/stratux-ahrs.log"
|
||||||
|
|
||||||
UPLINK_BLOCK_DATA_BITS = 576
|
UPLINK_BLOCK_DATA_BITS = 576
|
||||||
UPLINK_BLOCK_BITS = (UPLINK_BLOCK_DATA_BITS + 160)
|
UPLINK_BLOCK_BITS = (UPLINK_BLOCK_DATA_BITS + 160)
|
||||||
|
@ -50,6 +51,7 @@ const (
|
||||||
MSGCLASS_UAT = 0
|
MSGCLASS_UAT = 0
|
||||||
MSGCLASS_ES = 1
|
MSGCLASS_ES = 1
|
||||||
MSGCLASS_GPS = 3
|
MSGCLASS_GPS = 3
|
||||||
|
MSGCLASS_AHRS = 4
|
||||||
|
|
||||||
LON_LAT_RESOLUTION = float32(180.0 / 8388608.0)
|
LON_LAT_RESOLUTION = float32(180.0 / 8388608.0)
|
||||||
TRACK_RESOLUTION = float32(360.0 / 256.0)
|
TRACK_RESOLUTION = float32(360.0 / 256.0)
|
||||||
|
@ -68,6 +70,7 @@ var mySituation SituationData
|
||||||
var uatReplayfp *os.File
|
var uatReplayfp *os.File
|
||||||
var esReplayfp *os.File
|
var esReplayfp *os.File
|
||||||
var gpsReplayfp *os.File
|
var gpsReplayfp *os.File
|
||||||
|
var ahrsReplayfp *os.File
|
||||||
|
|
||||||
type msg struct {
|
type msg struct {
|
||||||
MessageClass uint
|
MessageClass uint
|
||||||
|
@ -361,12 +364,19 @@ func replayLog(msg string, msgclass int) {
|
||||||
if len(msg) == 0 { // Blank message.
|
if len(msg) == 0 { // Blank message.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if msgclass == MSGCLASS_UAT {
|
var fp *os.File
|
||||||
fmt.Fprintf(uatReplayfp, "%d,%s\n", time.Since(timeStarted).Nanoseconds(), msg)
|
switch msgclass {
|
||||||
} else if msgclass == MSGCLASS_ES {
|
case MSGCLASS_UAT:
|
||||||
fmt.Fprintf(esReplayfp, "%d,%s\n", time.Since(timeStarted).Nanoseconds(), msg)
|
fp = uatReplayfp
|
||||||
} else if msgclass == MSGCLASS_GPS {
|
case MSGCLASS_ES:
|
||||||
fmt.Fprintf(gpsReplayfp, "%d,%s\n", time.Since(timeStarted).Nanoseconds(), msg)
|
fp = esReplayfp
|
||||||
|
case MSGCLASS_GPS:
|
||||||
|
fp = gpsReplayfp
|
||||||
|
case MSGCLASS_AHRS:
|
||||||
|
fp = ahrsReplayfp
|
||||||
|
}
|
||||||
|
if fp != nil {
|
||||||
|
fmt.Fprintf(fp, "%d,%s\n", time.Since(timeStarted).Nanoseconds(), msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +675,13 @@ func main() {
|
||||||
gpsReplayfp = gpsfp
|
gpsReplayfp = gpsfp
|
||||||
defer gpsReplayfp.Close()
|
defer gpsReplayfp.Close()
|
||||||
}
|
}
|
||||||
|
// AHRS replay log.
|
||||||
|
if ahrsfp, err := openReplay(ahrsReplayLog); err != nil {
|
||||||
|
globalSettings.ReplayLog = false
|
||||||
|
} else {
|
||||||
|
ahrsReplayfp = ahrsfp
|
||||||
|
defer ahrsReplayfp.Close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initRY835AI()
|
initRY835AI()
|
||||||
|
|
Ładowanie…
Reference in New Issue