kopia lustrzana https://github.com/cyoung/stratux
Add GPS attitude logging to sqlite log
rodzic
cbd117d216
commit
3d4dec80a4
|
@ -474,6 +474,7 @@ func dataLog() {
|
||||||
makeTable(msg{}, "messages", db)
|
makeTable(msg{}, "messages", db)
|
||||||
makeTable(esmsg{}, "es_messages", db)
|
makeTable(esmsg{}, "es_messages", db)
|
||||||
makeTable(Dump1090TermMessage{}, "dump1090_terminal", db)
|
makeTable(Dump1090TermMessage{}, "dump1090_terminal", db)
|
||||||
|
makeTable(gpsPerfStats{}, "gps_attitude", db)
|
||||||
makeTable(StratuxStartup{}, "startup", db)
|
makeTable(StratuxStartup{}, "startup", db)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,6 +568,12 @@ func logESMsg(m esmsg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func logGPSAttitude(gpsPerf gpsPerfStats) {
|
||||||
|
if globalSettings.ReplayLog && isDataLogReady() {
|
||||||
|
dataLogChan <- DataLogRow{tbl: "gps_attitude", data: gpsPerf}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func logDump1090TermMessage(m Dump1090TermMessage) {
|
func logDump1090TermMessage(m Dump1090TermMessage) {
|
||||||
if globalSettings.DEBUG && globalSettings.ReplayLog && isDataLogReady() {
|
if globalSettings.DEBUG && globalSettings.ReplayLog && isDataLogReady() {
|
||||||
dataLogChan <- DataLogRow{tbl: "dump1090_terminal", data: m}
|
dataLogChan <- DataLogRow{tbl: "dump1090_terminal", data: m}
|
||||||
|
|
|
@ -1218,6 +1218,9 @@ func main() {
|
||||||
globalStatus.HardwareBuild = "FlightBox"
|
globalStatus.HardwareBuild = "FlightBox"
|
||||||
debugLogf = debugLog_FB
|
debugLogf = debugLog_FB
|
||||||
dataLogFilef = dataLogFile_FB
|
dataLogFilef = dataLogFile_FB
|
||||||
|
} else {
|
||||||
|
debugLogf = debugLog
|
||||||
|
dataLogFilef = dataLogFile
|
||||||
}
|
}
|
||||||
|
|
||||||
// replayESFilename := flag.String("eslog", "none", "ES Log filename")
|
// replayESFilename := flag.String("eslog", "none", "ES Log filename")
|
||||||
|
|
|
@ -659,7 +659,8 @@ func calcGPSAttitude() bool {
|
||||||
log.Printf("GPS attitude: Error calculating speed regression from NMEA RMC position messages")
|
log.Printf("GPS attitude: Error calculating speed regression from NMEA RMC position messages")
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
v_x = (slope*float64(myGPSPerfStats[index].nmeaTime) + intercept) * 1.687810 // units are knots, converted to feet/sec
|
v_x = (slope*float64(myGPSPerfStats[index].nmeaTime) + intercept) * 1.687810 // units are knots, converted to feet/sec
|
||||||
|
log.Printf("Avg speed %f calculated from %d RMC messages\n", v_x, lengthSpeed) // FIXME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,8 +686,8 @@ func calcGPSAttitude() bool {
|
||||||
log.Printf("GPS attitude: Error calculating vertical speed regression from NMEA GGA messages")
|
log.Printf("GPS attitude: Error calculating vertical speed regression from NMEA GGA messages")
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
v_z = slope // units are feet/sec
|
v_z = slope // units are feet/sec
|
||||||
|
log.Printf("Avg VV %f calculated from %d GGA messages\n", v_z, lengthSpeed) // FIXME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,6 +709,7 @@ func calcGPSAttitude() bool {
|
||||||
if globalSettings.DEBUG {
|
if globalSettings.DEBUG {
|
||||||
log.Printf("%s", buf) // FIXME. Send to sqlite log or other file?
|
log.Printf("%s", buf) // FIXME. Send to sqlite log or other file?
|
||||||
}
|
}
|
||||||
|
logGPSAttitude(myGPSPerfStats[index])
|
||||||
//replayLog(buf, MSGCLASS_AHRS)
|
//replayLog(buf, MSGCLASS_AHRS)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -820,7 +822,7 @@ func calcGPSAttitude() bool {
|
||||||
if globalSettings.DEBUG {
|
if globalSettings.DEBUG {
|
||||||
log.Printf("%s", buf) // FIXME. Send to sqlite log or other file?
|
log.Printf("%s", buf) // FIXME. Send to sqlite log or other file?
|
||||||
}
|
}
|
||||||
|
logGPSAttitude(myGPSPerfStats[index])
|
||||||
//replayLog(buf, MSGCLASS_AHRS)
|
//replayLog(buf, MSGCLASS_AHRS)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue