kopia lustrzana https://github.com/cyoung/stratux
All logs go to /root/ for FlightBox.
rodzic
f1ff15031f
commit
5667c1a871
|
@ -23,6 +23,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -38,17 +39,18 @@ import (
|
||||||
// https://www.faa.gov/nextgen/programs/adsb/Archival/
|
// https://www.faa.gov/nextgen/programs/adsb/Archival/
|
||||||
// https://www.faa.gov/nextgen/programs/adsb/Archival/media/GDL90_Public_ICD_RevA.PDF
|
// https://www.faa.gov/nextgen/programs/adsb/Archival/media/GDL90_Public_ICD_RevA.PDF
|
||||||
|
|
||||||
var debugLogf string // Set according to OS config.
|
var logDirf string // Directory for all logging
|
||||||
|
var debugLogf string // Set according to OS config.
|
||||||
var dataLogFilef string // Set according to OS config.
|
var dataLogFilef string // Set according to OS config.
|
||||||
|
|
||||||
const (
|
const (
|
||||||
configLocation = "/etc/stratux.conf"
|
configLocation = "/etc/stratux.conf"
|
||||||
managementAddr = ":80"
|
managementAddr = ":80"
|
||||||
debugLog = "/var/log/stratux.log"
|
logDir = "/var/log/"
|
||||||
dataLogFile = "/var/log/stratux.sqlite"
|
debugLogFile = "stratux.log"
|
||||||
|
dataLogFile = "stratux.sqlite"
|
||||||
//FlightBox: log to /root.
|
//FlightBox: log to /root.
|
||||||
debugLog_FB = "/root/stratux.log"
|
logDir_FB = "/root/"
|
||||||
dataLogFile_FB = "/var/log/stratux.sqlite"
|
|
||||||
maxDatagramSize = 8192
|
maxDatagramSize = 8192
|
||||||
maxUserMsgQueueSize = 25000 // About 10MB per port per connected client.
|
maxUserMsgQueueSize = 25000 // About 10MB per port per connected client.
|
||||||
|
|
||||||
|
@ -1345,12 +1347,12 @@ func main() {
|
||||||
//FlightBox: detect via presence of /etc/FlightBox file.
|
//FlightBox: detect via presence of /etc/FlightBox file.
|
||||||
if _, err := os.Stat("/etc/FlightBox"); !os.IsNotExist(err) {
|
if _, err := os.Stat("/etc/FlightBox"); !os.IsNotExist(err) {
|
||||||
globalStatus.HardwareBuild = "FlightBox"
|
globalStatus.HardwareBuild = "FlightBox"
|
||||||
debugLogf = debugLog_FB
|
logDirf = logDir_FB
|
||||||
dataLogFilef = dataLogFile_FB
|
|
||||||
} else { // if not using the FlightBox config, use "normal" log file locations
|
} else { // if not using the FlightBox config, use "normal" log file locations
|
||||||
debugLogf = debugLog
|
logDirf = logDir
|
||||||
dataLogFilef = dataLogFile
|
|
||||||
}
|
}
|
||||||
|
debugLogf = filepath.Join(logDirf, debugLogFile)
|
||||||
|
dataLogFilef = filepath.Join(logDirf, dataLogFile)
|
||||||
//FIXME: All of this should be removed by 08/01/2016.
|
//FIXME: All of this should be removed by 08/01/2016.
|
||||||
// Check if Raspbian version is <8.0. Throw a warning if so.
|
// Check if Raspbian version is <8.0. Throw a warning if so.
|
||||||
vt, err := ioutil.ReadFile("/etc/debian_version")
|
vt, err := ioutil.ReadFile("/etc/debian_version")
|
||||||
|
@ -1387,7 +1389,7 @@ func main() {
|
||||||
timeStarted = time.Now()
|
timeStarted = time.Now()
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU()) // redundant with Go v1.5+ compiler
|
runtime.GOMAXPROCS(runtime.NumCPU()) // redundant with Go v1.5+ compiler
|
||||||
|
|
||||||
// Duplicate log.* output to debugLog.
|
// Duplicate log.* output to debugLogFile.
|
||||||
fp, err := os.OpenFile(debugLogf, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
fp, err := os.OpenFile(debugLogf, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err_log := fmt.Errorf("Failed to open '%s': %s", debugLogf, err.Error())
|
err_log := fmt.Errorf("Failed to open '%s': %s", debugLogf, err.Error())
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
// "github.com/kidoman/embd/sensor/bmp180"
|
// "github.com/kidoman/embd/sensor/bmp180"
|
||||||
"github.com/westphae/goflying/ahrs"
|
"github.com/westphae/goflying/ahrs"
|
||||||
"github.com/westphae/goflying/ahrsweb"
|
"github.com/westphae/goflying/ahrsweb"
|
||||||
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
const numRetries uint8 = 5
|
const numRetries uint8 = 5
|
||||||
|
@ -274,7 +275,8 @@ func sensorAttitudeSender() {
|
||||||
// Log it to csv for analysis
|
// Log it to csv for analysis
|
||||||
if globalSettings.AHRSLog {
|
if globalSettings.AHRSLog {
|
||||||
if analysisLogger == nil {
|
if analysisLogger == nil {
|
||||||
analysisFilename := fmt.Sprintf("/var/log/sensors_%s.csv", time.Now().Format("20060102_150405"))
|
analysisFilename := filepath.Join(logDirf, fmt.Sprintf("sensors_%s.csv",
|
||||||
|
time.Now().Format("20060102_150405")))
|
||||||
analysisLogger = ahrs.NewAHRSLogger(analysisFilename, s.GetLogMap())
|
analysisLogger = ahrs.NewAHRSLogger(analysisFilename, s.GetLogMap())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue