From 4de24208032083af94560ddd82218096eb676f1d Mon Sep 17 00:00:00 2001 From: Christopher Young Date: Tue, 10 Oct 2017 11:27:15 -0400 Subject: [PATCH 01/10] Clean up cputemp. --- main/cputemp.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main/cputemp.go b/main/cputemp.go index 93f018ed..0e2df678 100644 --- a/main/cputemp.go +++ b/main/cputemp.go @@ -19,8 +19,6 @@ and often times reading this file hangs quite some time. */ func cpuTempMonitor(updater CpuTempUpdateFunc) { timer := time.NewTicker(1 * time.Second) for { - <-timer.C - // Update CPUTemp. temp, err := ioutil.ReadFile("/sys/class/thermal/thermal_zone0/temp") tempStr := strings.Trim(string(temp), "\n") @@ -38,7 +36,7 @@ func cpuTempMonitor(updater CpuTempUpdateFunc) { if t >= invalidCpuTemp { // Only update if valid value was obtained. updater(t) } - + <-timer.C } } From 4da6af19055818e523a09cbbdf343a356e18727c Mon Sep 17 00:00:00 2001 From: cyoung Date: Wed, 11 Oct 2017 08:07:30 -0400 Subject: [PATCH 02/10] Add dhcpd.conf and interfaces files to .sh update. --- selfupdate/makeupdate.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selfupdate/makeupdate.sh b/selfupdate/makeupdate.sh index 54ae511c..01de5970 100755 --- a/selfupdate/makeupdate.sh +++ b/selfupdate/makeupdate.sh @@ -37,6 +37,8 @@ cp image/99-uavionix.rules work/bin/ cp image/motd work/bin/ cp image/stratux-wifi.sh work/bin/ cp image/rc.local work/bin/ +cp image/dhcpd.conf work/bin/ +cp image/interfaces work/bin/ #TODO: librtlsdr. cd work/ From 62b6df682b8ec1574387948bc8c489537d4678b5 Mon Sep 17 00:00:00 2001 From: cyoung Date: Wed, 11 Oct 2017 08:23:57 -0400 Subject: [PATCH 03/10] Remove sqlite log and stratux.log on update. --- selfupdate/update_header.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfupdate/update_header.sh b/selfupdate/update_header.sh index 8f5dec58..ff758008 100755 --- a/selfupdate/update_header.sh +++ b/selfupdate/update_header.sh @@ -3,5 +3,5 @@ rm -rf /root/stratux-update mkdir -p /root/stratux-update cd /root/stratux-update -mv -f /var/log/stratux.sqlite /var/log/stratux.sqlite.`date +%s` -rm -f /var/log/stratux.sqlite-wal /var/log/stratux.sqlite-shm +rm -f /var/log/stratux.sqlite /var/log/stratux.sqlite-wal /var/log/stratux.sqlite-shm +rm -f /var/log/stratux.log From b695353d44994f48ff2c6aa27744d6c8212626c2 Mon Sep 17 00:00:00 2001 From: cyoung Date: Wed, 11 Oct 2017 08:33:11 -0400 Subject: [PATCH 04/10] Install dhcpd.conf and interfaces file. --- selfupdate/update_footer.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/selfupdate/update_footer.sh b/selfupdate/update_footer.sh index 2a2f2018..e8d8af15 100755 --- a/selfupdate/update_footer.sh +++ b/selfupdate/update_footer.sh @@ -70,6 +70,12 @@ chmod 755 /usr/bin/fancontrol cp -f dump1090 /usr/bin/ +# DHCPD Config. +cp -f dhcpd.conf /etc/dhcp/dhcpd.conf + +# Interfaces file. +cp -f interfaces /etc/network/interfaces + # Web files install. cd web/ && make stratuxBuild=${stratuxBuild} From 4fa548b3802252c74a360f18cfb6dd103d2351d1 Mon Sep 17 00:00:00 2001 From: cyoung Date: Wed, 11 Oct 2017 08:39:09 -0400 Subject: [PATCH 05/10] stratux.log cleanup. --- main/gen_gdl90.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index 24da2f5f..8be4385f 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -1230,18 +1230,21 @@ func printStats() { log.Printf("stats [started: %s]\n", humanize.RelTime(time.Time{}, stratuxClock.Time, "ago", "from now")) log.Printf(" - Disk bytes used = %s (%.1f %%), Disk bytes free = %s (%.1f %%)\n", humanize.Bytes(usage.Used()), 100*usage.Usage(), humanize.Bytes(usage.Free()), 100*(1-usage.Usage())) log.Printf(" - CPUTemp=%.02f deg C, MemStats.Alloc=%s, MemStats.Sys=%s, totalNetworkMessagesSent=%s\n", globalStatus.CPUTemp, humanize.Bytes(uint64(memstats.Alloc)), humanize.Bytes(uint64(memstats.Sys)), humanize.Comma(int64(totalNetworkMessagesSent))) - log.Printf(" - CPU load %s\n", globalStatus.CPULoad) log.Printf(" - UAT/min %s/%s [maxSS=%.02f%%], ES/min %s/%s, Total traffic targets tracked=%s", humanize.Comma(int64(globalStatus.UAT_messages_last_minute)), humanize.Comma(int64(globalStatus.UAT_messages_max)), float64(maxSignalStrength)/10.0, humanize.Comma(int64(globalStatus.ES_messages_last_minute)), humanize.Comma(int64(globalStatus.ES_messages_max)), humanize.Comma(int64(len(seenTraffic)))) log.Printf(" - Network data messages sent: %d total, %d nonqueueable. Network data bytes sent: %d total, %d nonqueueable.\n", globalStatus.NetworkDataMessagesSent, globalStatus.NetworkDataMessagesSentNonqueueable, globalStatus.NetworkDataBytesSent, globalStatus.NetworkDataBytesSentNonqueueable) if globalSettings.GPS_Enabled { log.Printf(" - Last GPS fix: %s, GPS solution type: %d using %d satellites (%d/%d seen/tracked), NACp: %d, est accuracy %.02f m\n", stratuxClock.HumanizeTime(mySituation.GPSLastFixLocalTime), mySituation.GPSFixQuality, mySituation.GPSSatellites, mySituation.GPSSatellitesSeen, mySituation.GPSSatellitesTracked, mySituation.GPSNACp, mySituation.GPSHorizontalAccuracy) log.Printf(" - GPS vertical velocity: %.02f ft/sec; GPS vertical accuracy: %v m\n", mySituation.GPSVerticalSpeed, mySituation.GPSVerticalAccuracy) } + sensorsOutput := make([]string, 0) if globalSettings.IMU_Sensor_Enabled { - log.Printf(" - Last IMU read: %s\n", stratuxClock.HumanizeTime(mySituation.AHRSLastAttitudeTime)) + sensorsOutput = append(sensorsOutput, fmt.Printf("Last IMU read: %s\n", stratuxClock.HumanizeTime(mySituation.AHRSLastAttitudeTime))) } if globalSettings.BMP_Sensor_Enabled { - log.Printf(" - Last BMP read: %s\n", stratuxClock.HumanizeTime(mySituation.BaroLastMeasurementTime)) + sensorsOutput = append(sensorsOutput, fmt.Printf(" - Last BMP read: %s\n", stratuxClock.HumanizeTime(mySituation.BaroLastMeasurementTime))) + } + if len(sensorsOutput) > 0 { + log.Printf("- " + strings.Join(sensorsOutput, ", ")) } // Check if we're using more than 95% of the free space. If so, throw a warning (only once). if !diskUsageWarning && usage.Usage() > 0.95 { From 2df716f2f6bafc43af3913747c73a266afb77152 Mon Sep 17 00:00:00 2001 From: cyoung Date: Wed, 11 Oct 2017 08:40:10 -0400 Subject: [PATCH 06/10] Remove unused 'CPULoad' status variable. --- main/gen_gdl90.go | 1 - notes/app-vendor-integration.md | 1 - web/plates/js/status.js | 1 - 3 files changed, 3 deletions(-) diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index 8be4385f..8e1fb6ee 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -1092,7 +1092,6 @@ type status struct { Uptime int64 UptimeClock time.Time CPUTemp float32 - CPULoad string NetworkDataMessagesSent uint64 NetworkDataMessagesSentNonqueueable uint64 NetworkDataBytesSent uint64 diff --git a/notes/app-vendor-integration.md b/notes/app-vendor-integration.md index b69ade30..bd41ad64 100644 --- a/notes/app-vendor-integration.md +++ b/notes/app-vendor-integration.md @@ -117,7 +117,6 @@ Stratux makes available a webserver to retrieve statistics which may be useful t "Uptime": 323020, "UptimeClock": "0001-01-01T00:05:23.02Z", "CPUTemp": 47.774, - "CPULoad": "", "NetworkDataMessagesSent": 0, "NetworkDataMessagesSentNonqueueable": 0, "NetworkDataBytesSent": 0, diff --git a/web/plates/js/status.js b/web/plates/js/status.js index f8d8819b..c96bb597 100644 --- a/web/plates/js/status.js +++ b/web/plates/js/status.js @@ -110,7 +110,6 @@ function StatusCtrl($rootScope, $scope, $state, $http, $interval) { $scope.UAT_PIREP_total = status.UAT_PIREP_total; $scope.UAT_NOTAM_total = status.UAT_NOTAM_total; $scope.UAT_OTHER_total = status.UAT_OTHER_total; - $scope.CPULoad = status.CPULoad; // Errors array. if (status.Errors.length > 0) { $scope.visible_errors = true; From 57c783d695277c7bde9774daaa3d39892afeb6f5 Mon Sep 17 00:00:00 2001 From: cyoung Date: Wed, 11 Oct 2017 08:56:30 -0400 Subject: [PATCH 07/10] Typo fix. --- main/gen_gdl90.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index 8e1fb6ee..b9651b67 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -1237,10 +1237,10 @@ func printStats() { } sensorsOutput := make([]string, 0) if globalSettings.IMU_Sensor_Enabled { - sensorsOutput = append(sensorsOutput, fmt.Printf("Last IMU read: %s\n", stratuxClock.HumanizeTime(mySituation.AHRSLastAttitudeTime))) + sensorsOutput = append(sensorsOutput, fmt.Sprintf("Last IMU read: %s\n", stratuxClock.HumanizeTime(mySituation.AHRSLastAttitudeTime))) } if globalSettings.BMP_Sensor_Enabled { - sensorsOutput = append(sensorsOutput, fmt.Printf(" - Last BMP read: %s\n", stratuxClock.HumanizeTime(mySituation.BaroLastMeasurementTime))) + sensorsOutput = append(sensorsOutput, fmt.Sprintf(" - Last BMP read: %s\n", stratuxClock.HumanizeTime(mySituation.BaroLastMeasurementTime))) } if len(sensorsOutput) > 0 { log.Printf("- " + strings.Join(sensorsOutput, ", ")) From 7ac2aa7478ed7bc98f89895608e38091d8ed750e Mon Sep 17 00:00:00 2001 From: cyoung Date: Wed, 11 Oct 2017 09:11:45 -0400 Subject: [PATCH 08/10] Move to cyoung/goflying, 'stratux_master' branch. --- .gitmodules | 2 +- goflying | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 97641a87..0833484b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://github.com/AvSquirrel/dump1090 [submodule "goflying"] path = goflying - url = https://github.com/westphae/goflying + url = https://github.com/cyoung/goflying diff --git a/goflying b/goflying index a9f32832..35a96ba2 160000 --- a/goflying +++ b/goflying @@ -1 +1 @@ -Subproject commit a9f32832e8fd8cac2b2e10cf673f0b79e1cec67d +Subproject commit 35a96ba2a547ffcbb587d9de8103d0481840040d From 3ef0c4b31a46fac8bd22fadacfeb611ce31148b5 Mon Sep 17 00:00:00 2001 From: cyoung Date: Wed, 11 Oct 2017 09:20:32 -0400 Subject: [PATCH 09/10] Update goflying. --- goflying | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goflying b/goflying index 35a96ba2..7eaaa911 160000 --- a/goflying +++ b/goflying @@ -1 +1 @@ -Subproject commit 35a96ba2a547ffcbb587d9de8103d0481840040d +Subproject commit 7eaaa911ea51bb055c97b7510784695d91d05be7 From 782f22cf54990d7fa904c651e2f9f337d0283a1e Mon Sep 17 00:00:00 2001 From: cyoung Date: Wed, 11 Oct 2017 09:22:15 -0400 Subject: [PATCH 10/10] Update goflying. --- goflying | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goflying b/goflying index 7eaaa911..0ba3e51b 160000 --- a/goflying +++ b/goflying @@ -1 +1 @@ -Subproject commit 7eaaa911ea51bb055c97b7510784695d91d05be7 +Subproject commit 0ba3e51be74b4848488e06ec0fee74ebaa7ef705