kopia lustrzana https://github.com/cyoung/stratux
Standardize TODOs.
rodzic
ff7a7a2781
commit
5c70640eac
|
@ -96,7 +96,7 @@ type SituationData struct {
|
||||||
var serialConfig *serial.Config
|
var serialConfig *serial.Config
|
||||||
var serialPort *serial.Port
|
var serialPort *serial.Port
|
||||||
|
|
||||||
var readyToInitGPS bool // TO-DO: replace with channel control to terminate goroutine when complete
|
var readyToInitGPS bool //TODO: replace with channel control to terminate goroutine when complete
|
||||||
|
|
||||||
var satelliteMutex *sync.Mutex
|
var satelliteMutex *sync.Mutex
|
||||||
var Satellites map[string]SatelliteInfo
|
var Satellites map[string]SatelliteInfo
|
||||||
|
@ -618,13 +618,13 @@ func processNMEALine(l string) (sentenceUsed bool) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if groundspeed > 3 { // TO-DO: use average groundspeed over last n seconds to avoid random "jumps"
|
if groundspeed > 3 { //TODO: use average groundspeed over last n seconds to avoid random "jumps"
|
||||||
trueCourse = float32(tc)
|
trueCourse = float32(tc)
|
||||||
setTrueCourse(uint16(groundspeed), tc)
|
setTrueCourse(uint16(groundspeed), tc)
|
||||||
tmpSituation.TrueCourse = trueCourse
|
tmpSituation.TrueCourse = trueCourse
|
||||||
} else {
|
} else {
|
||||||
// Negligible movement. Don't update course, but do use the slow speed.
|
// Negligible movement. Don't update course, but do use the slow speed.
|
||||||
// TO-DO: use average course over last n seconds?
|
//TODO: use average course over last n seconds?
|
||||||
}
|
}
|
||||||
tmpSituation.LastGroundTrackTime = stratuxClock.Time
|
tmpSituation.LastGroundTrackTime = stratuxClock.Time
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ func processNMEALine(l string) (sentenceUsed bool) {
|
||||||
svType = SAT_TYPE_SBAS
|
svType = SAT_TYPE_SBAS
|
||||||
svStr = fmt.Sprintf("S%d", sv)
|
svStr = fmt.Sprintf("S%d", sv)
|
||||||
sv -= 87 // subtract 87 to convert to NMEA from PRN.
|
sv -= 87 // subtract 87 to convert to NMEA from PRN.
|
||||||
} else { // TO-DO: Galileo
|
} else { //TODO: Galileo
|
||||||
svType = SAT_TYPE_UNKNOWN
|
svType = SAT_TYPE_UNKNOWN
|
||||||
svStr = fmt.Sprintf("U%d", sv)
|
svStr = fmt.Sprintf("U%d", sv)
|
||||||
}
|
}
|
||||||
|
@ -857,13 +857,13 @@ func processNMEALine(l string) (sentenceUsed bool) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if groundspeed > 3 { // TO-DO: use average groundspeed over last n seconds to avoid random "jumps"
|
if groundspeed > 3 { //TODO: use average groundspeed over last n seconds to avoid random "jumps"
|
||||||
trueCourse = float32(tc)
|
trueCourse = float32(tc)
|
||||||
setTrueCourse(uint16(groundspeed), tc)
|
setTrueCourse(uint16(groundspeed), tc)
|
||||||
tmpSituation.TrueCourse = trueCourse
|
tmpSituation.TrueCourse = trueCourse
|
||||||
} else {
|
} else {
|
||||||
// Negligible movement. Don't update course, but do use the slow speed.
|
// Negligible movement. Don't update course, but do use the slow speed.
|
||||||
// TO-DO: use average course over last n seconds?
|
//TODO: use average course over last n seconds?
|
||||||
}
|
}
|
||||||
tmpSituation.LastGroundTrackTime = stratuxClock.Time
|
tmpSituation.LastGroundTrackTime = stratuxClock.Time
|
||||||
|
|
||||||
|
@ -1054,13 +1054,13 @@ func processNMEALine(l string) (sentenceUsed bool) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if groundspeed > 3 { // TO-DO: use average groundspeed over last n seconds to avoid random "jumps"
|
if groundspeed > 3 { //TODO: use average groundspeed over last n seconds to avoid random "jumps"
|
||||||
trueCourse = float32(tc)
|
trueCourse = float32(tc)
|
||||||
setTrueCourse(uint16(groundspeed), tc)
|
setTrueCourse(uint16(groundspeed), tc)
|
||||||
tmpSituation.TrueCourse = trueCourse
|
tmpSituation.TrueCourse = trueCourse
|
||||||
} else {
|
} else {
|
||||||
// Negligible movement. Don't update course, but do use the slow speed.
|
// Negligible movement. Don't update course, but do use the slow speed.
|
||||||
// TO-DO: use average course over last n seconds?
|
//TODO: use average course over last n seconds?
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpSituation.LastGroundTrackTime = stratuxClock.Time
|
tmpSituation.LastGroundTrackTime = stratuxClock.Time
|
||||||
|
@ -1118,7 +1118,7 @@ func processNMEALine(l string) (sentenceUsed bool) {
|
||||||
svType = SAT_TYPE_GLONASS
|
svType = SAT_TYPE_GLONASS
|
||||||
svStr = fmt.Sprintf("R%d", sv-64) // subtract 64 to convert from NMEA to PRN.
|
svStr = fmt.Sprintf("R%d", sv-64) // subtract 64 to convert from NMEA to PRN.
|
||||||
svGLONASS = true
|
svGLONASS = true
|
||||||
} else { // TO-DO: Galileo
|
} else { //TODO: Galileo
|
||||||
svType = SAT_TYPE_UNKNOWN
|
svType = SAT_TYPE_UNKNOWN
|
||||||
svStr = fmt.Sprintf("U%d", sv)
|
svStr = fmt.Sprintf("U%d", sv)
|
||||||
}
|
}
|
||||||
|
@ -1243,7 +1243,7 @@ func processNMEALine(l string) (sentenceUsed bool) {
|
||||||
} else if sv < 97 { // GLONASS
|
} else if sv < 97 { // GLONASS
|
||||||
svType = SAT_TYPE_GLONASS
|
svType = SAT_TYPE_GLONASS
|
||||||
svStr = fmt.Sprintf("R%d", sv-64) // subtract 64 to convert from NMEA to PRN.
|
svStr = fmt.Sprintf("R%d", sv-64) // subtract 64 to convert from NMEA to PRN.
|
||||||
} else { // TO-DO: Galileo
|
} else { //TODO: Galileo
|
||||||
svType = SAT_TYPE_UNKNOWN
|
svType = SAT_TYPE_UNKNOWN
|
||||||
svStr = fmt.Sprintf("U%d", sv)
|
svStr = fmt.Sprintf("U%d", sv)
|
||||||
}
|
}
|
||||||
|
@ -1327,7 +1327,7 @@ func processNMEALine(l string) (sentenceUsed bool) {
|
||||||
|
|
||||||
func gpsSerialReader() {
|
func gpsSerialReader() {
|
||||||
defer serialPort.Close()
|
defer serialPort.Close()
|
||||||
readyToInitGPS = false // TO-DO: replace with channel control to terminate goroutine when complete
|
readyToInitGPS = false //TODO: replace with channel control to terminate goroutine when complete
|
||||||
|
|
||||||
i := 0 //debug monitor
|
i := 0 //debug monitor
|
||||||
scanner := bufio.NewScanner(serialPort)
|
scanner := bufio.NewScanner(serialPort)
|
||||||
|
@ -1353,7 +1353,7 @@ func gpsSerialReader() {
|
||||||
log.Printf("Exiting gpsSerialReader() after i=%d loops\n", i) // debug monitor
|
log.Printf("Exiting gpsSerialReader() after i=%d loops\n", i) // debug monitor
|
||||||
}
|
}
|
||||||
globalStatus.GPS_connected = false
|
globalStatus.GPS_connected = false
|
||||||
readyToInitGPS = true // TO-DO: replace with channel control to terminate goroutine when complete
|
readyToInitGPS = true //TODO: replace with channel control to terminate goroutine when complete
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1584,7 +1584,7 @@ func initAHRS() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func pollRY835AI() {
|
func pollRY835AI() {
|
||||||
readyToInitGPS = true //TO-DO: Implement more robust method (channel control) to kill zombie serial readers
|
readyToInitGPS = true //TODO: Implement more robust method (channel control) to kill zombie serial readers
|
||||||
timer := time.NewTicker(4 * time.Second)
|
timer := time.NewTicker(4 * time.Second)
|
||||||
for {
|
for {
|
||||||
<-timer.C
|
<-timer.C
|
||||||
|
|
|
@ -84,7 +84,7 @@ type TrafficInfo struct {
|
||||||
TargetType uint8 // types decribed in const above
|
TargetType uint8 // types decribed in const above
|
||||||
SignalLevel float64 // Signal level, dB RSSI.
|
SignalLevel float64 // Signal level, dB RSSI.
|
||||||
Squawk int // Squawk code
|
Squawk int // Squawk code
|
||||||
Position_valid bool // set when position report received. Unset after n seconds? (To-do)
|
Position_valid bool //TODO: set when position report received. Unset after n seconds?
|
||||||
Lat float32 // decimal degrees, north positive
|
Lat float32 // decimal degrees, north positive
|
||||||
Lng float32 // decimal degrees, east positive
|
Lng float32 // decimal degrees, east positive
|
||||||
Alt int32 // Pressure altitude, feet
|
Alt int32 // Pressure altitude, feet
|
||||||
|
@ -109,7 +109,7 @@ type TrafficInfo struct {
|
||||||
Last_GnssDiffAlt int32 // Altitude at last GnssDiffFromBaroAlt update.
|
Last_GnssDiffAlt int32 // Altitude at last GnssDiffFromBaroAlt update.
|
||||||
Last_speed time.Time // Time of last velocity and track update (stratuxClock).
|
Last_speed time.Time // Time of last velocity and track update (stratuxClock).
|
||||||
Last_source uint8 // Last frequency on which this target was received.
|
Last_source uint8 // Last frequency on which this target was received.
|
||||||
ExtrapolatedPosition bool // TO-DO: True if Stratux is "coasting" the target from last known position.
|
ExtrapolatedPosition bool //TODO: True if Stratux is "coasting" the target from last known position.
|
||||||
Bearing float64 // Bearing in degrees true to traffic from ownship, if it can be calculated.
|
Bearing float64 // Bearing in degrees true to traffic from ownship, if it can be calculated.
|
||||||
Distance float64 // Distance to traffic from ownship, if it can be calculated.
|
Distance float64 // Distance to traffic from ownship, if it can be calculated.
|
||||||
//FIXME: Some indicator that Bearing and Distance are valid, since they aren't always available.
|
//FIXME: Some indicator that Bearing and Distance are valid, since they aren't always available.
|
||||||
|
@ -184,7 +184,7 @@ func sendTrafficUpdates() {
|
||||||
log.Printf("==================================================================\n")
|
log.Printf("==================================================================\n")
|
||||||
}
|
}
|
||||||
code, _ := strconv.ParseInt(globalSettings.OwnshipModeS, 16, 32)
|
code, _ := strconv.ParseInt(globalSettings.OwnshipModeS, 16, 32)
|
||||||
for icao, ti := range traffic { // TO-DO: Limit number of aircraft in traffic message. ForeFlight 7.5 chokes at ~1000-2000 messages depending on iDevice RAM. Practical limit likely around ~500 aircraft without filtering.
|
for icao, ti := range traffic { //TODO: Limit number of aircraft in traffic message. ForeFlight 7.5 chokes at ~1000-2000 messages depending on iDevice RAM. Practical limit likely around ~500 aircraft without filtering.
|
||||||
if isGPSValid() {
|
if isGPSValid() {
|
||||||
// func distRect(lat1, lon1, lat2, lon2 float64) (dist, bearing, distN, distE float64) {
|
// func distRect(lat1, lon1, lat2, lon2 float64) (dist, bearing, distN, distE float64) {
|
||||||
dist, bearing := distance(float64(mySituation.Lat), float64(mySituation.Lng), float64(ti.Lat), float64(ti.Lng))
|
dist, bearing := distance(float64(mySituation.Lat), float64(mySituation.Lng), float64(ti.Lat), float64(ti.Lng))
|
||||||
|
@ -209,7 +209,8 @@ func sendTrafficUpdates() {
|
||||||
if ti.Age > 2 { // if nothing polls an inactive ti, it won't push to the webUI, and its Age won't update.
|
if ti.Age > 2 { // if nothing polls an inactive ti, it won't push to the webUI, and its Age won't update.
|
||||||
trafficUpdate.SendJSON(ti)
|
trafficUpdate.SendJSON(ti)
|
||||||
}
|
}
|
||||||
if ti.Position_valid && ti.Age < 6 { // ... but don't pass stale data to the EFB. TO-DO: Coast old traffic? Need to determine how FF, WingX, etc deal with stale targets.
|
if ti.Position_valid && ti.Age < 6 { // ... but don't pass stale data to the EFB.
|
||||||
|
//TODO: Coast old traffic? Need to determine how FF, WingX, etc deal with stale targets.
|
||||||
logTraffic(ti) // only add to the SQLite log if it's not stale
|
logTraffic(ti) // only add to the SQLite log if it's not stale
|
||||||
|
|
||||||
if ti.Icao_addr == uint32(code) { //
|
if ti.Icao_addr == uint32(code) { //
|
||||||
|
@ -688,7 +689,7 @@ func esListen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate human readable summary of message types for debug
|
// generate human readable summary of message types for debug
|
||||||
// TO-DO: Use for ES message statistics?
|
//TODO: Use for ES message statistics?
|
||||||
/*
|
/*
|
||||||
var s1 string
|
var s1 string
|
||||||
if newTi.DF == 17 {
|
if newTi.DF == 17 {
|
||||||
|
@ -1072,7 +1073,7 @@ func icao2reg(icao_addr uint32) (string, bool) {
|
||||||
} else if (icao_addr >= 0xC00001) && (icao_addr <= 0xC3FFFF) {
|
} else if (icao_addr >= 0xC00001) && (icao_addr <= 0xC3FFFF) {
|
||||||
nation = "CA"
|
nation = "CA"
|
||||||
} else {
|
} else {
|
||||||
// future national decoding is TO-DO
|
//TODO: future national decoding.
|
||||||
return "NON-NA", false
|
return "NON-NA", false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ func icao2reg(icao_addr uint32) (string, bool) {
|
||||||
} else if (icao_addr >= 0xC00001) && (icao_addr <= 0xC3FFFF) {
|
} else if (icao_addr >= 0xC00001) && (icao_addr <= 0xC3FFFF) {
|
||||||
nation = "CA"
|
nation = "CA"
|
||||||
} else {
|
} else {
|
||||||
// future national decoding is TO-DO
|
//TODO: future national decoding.
|
||||||
return "NON-NA", false
|
return "NON-NA", false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue