kopia lustrzana https://github.com/cyoung/stratux
Add mySituation uibroadcast.
rodzic
504d97ec7a
commit
a949bda34f
|
@ -36,6 +36,9 @@ type SettingMessage struct {
|
|||
var weatherUpdate *uibroadcaster
|
||||
var trafficUpdate *uibroadcaster
|
||||
|
||||
// Situation updates channel.
|
||||
var situationUpdate *uibroadcaster
|
||||
|
||||
/*
|
||||
The /weather websocket starts off by sending the current buffer of weather messages, then sends updates as they are received.
|
||||
*/
|
||||
|
@ -511,6 +514,7 @@ func viewLogs(w http.ResponseWriter, r *http.Request) {
|
|||
func managementInterface() {
|
||||
weatherUpdate = NewUIBroadcaster()
|
||||
trafficUpdate = NewUIBroadcaster()
|
||||
situationUpdate = NewUIBroadcaster()
|
||||
|
||||
http.HandleFunc("/", defaultServer)
|
||||
http.Handle("/logs/", http.StripPrefix("/logs/", http.FileServer(http.Dir("/var/log"))))
|
||||
|
|
|
@ -456,6 +456,15 @@ func calculateNACp(accuracy float32) uint8 {
|
|||
return ret
|
||||
}
|
||||
|
||||
/*
|
||||
registerSituationUpdate().
|
||||
Called whenever there is a change in mySituation.
|
||||
*/
|
||||
func registerSituationUpdate() {
|
||||
logSituation()
|
||||
situationUpdate.SendJSON(mySituation)
|
||||
}
|
||||
|
||||
/*
|
||||
processNMEALine parses NMEA-0183 formatted strings against several message types.
|
||||
|
||||
|
@ -472,7 +481,7 @@ func processNMEALine(l string) (sentenceUsed bool) {
|
|||
|
||||
defer func() {
|
||||
if sentenceUsed || globalSettings.DEBUG {
|
||||
logSituation()
|
||||
registerSituationUpdate()
|
||||
}
|
||||
mySituation.mu_GPS.Unlock()
|
||||
}()
|
||||
|
|
Ładowanie…
Reference in New Issue