diff --git a/main/datalog.go b/main/datalog.go index eda48cd5..621400fa 100644 --- a/main/datalog.go +++ b/main/datalog.go @@ -474,6 +474,7 @@ func dataLog() { makeTable(msg{}, "messages", db) makeTable(esmsg{}, "es_messages", db) makeTable(Dump1090TermMessage{}, "dump1090_terminal", db) + makeTable(gpsPerfStats{}, "gps_attitude", 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) { if globalSettings.DEBUG && globalSettings.ReplayLog && isDataLogReady() { dataLogChan <- DataLogRow{tbl: "dump1090_terminal", data: m} diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index 5ba0d3c7..dfdd1ea0 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -1218,6 +1218,9 @@ func main() { globalStatus.HardwareBuild = "FlightBox" debugLogf = debugLog_FB dataLogFilef = dataLogFile_FB + } else { + debugLogf = debugLog + dataLogFilef = dataLogFile } // replayESFilename := flag.String("eslog", "none", "ES Log filename") diff --git a/main/ry835ai.go b/main/ry835ai.go index 4007d5e9..f0c3af4c 100644 --- a/main/ry835ai.go +++ b/main/ry835ai.go @@ -659,7 +659,8 @@ func calcGPSAttitude() bool { log.Printf("GPS attitude: Error calculating speed regression from NMEA RMC position messages") return false } 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") return false } 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 { log.Printf("%s", buf) // FIXME. Send to sqlite log or other file? } + logGPSAttitude(myGPSPerfStats[index]) //replayLog(buf, MSGCLASS_AHRS) return true @@ -820,7 +822,7 @@ func calcGPSAttitude() bool { if globalSettings.DEBUG { log.Printf("%s", buf) // FIXME. Send to sqlite log or other file? } - + logGPSAttitude(myGPSPerfStats[index]) //replayLog(buf, MSGCLASS_AHRS) return true }