Skip to content

Commit

Permalink
Latest changes in master rep (#7)
Browse files Browse the repository at this point in the history
* Add info to main status help page.

Fixes cyoung#728.

* Adds AU tail number decoding from ICAO addr.

Contribution by @armeniki. cyoung#736.

* update readme

Remove line about dangerzone and added kwikEFIS to the list of apps that support Stratux

* Revert 0d93623.

* Add SoftRF udev rules and "ping" code hack (temporary).
  • Loading branch information
tobo07 authored Sep 22, 2018
1 parent f47db90 commit 3af934b
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 13 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ Apps with stratux recognition/support:
* AvPlan EFB.
* iFly GPS 9.4+.
* DroidEFB 2.1.1+.

* kwikEFIS

Tested weather/traffic displays:
* Avare

Other EFBs? See the [app vendor integration guide](https://github.com/cyoung/stratux/blob/master/notes/app-vendor-integration.md).

Dangerzone builds (AHRS display):
* ForeFlight 7+ - weather, traffic, AHRS.

Questions? [See the FAQ](https://github.com/cyoung/stratux/wiki/FAQ)

http://stratux.me/
Expand Down
8 changes: 8 additions & 0 deletions image/10-stratux.rules
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="
# --set-bus-powered=no

SUBSYSTEMS=="usb", ATTRS{interface}=="Stratux Serialout", SYMLINK+="serialout%n"


# SoftRF.

# SoftRF Standalone (NodeMCU or DoIt ESP32 devkit with CP2102 chip)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{product}=="DIY SoftRF", SYMLINK+="softrf"
# TTGO T-Beam (ESP32 with OTP CP2104 chip)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{product}=="CP2104 USB to UART Bridge Controller", SYMLINK+="softrf"
12 changes: 6 additions & 6 deletions main/gps.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@ func initGPSSerial() bool {
glonass := []byte{0x06, 0x04, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x01} // this disables GLONASS
galileo := []byte{0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x01, 0x01} // this disables Galileo

//if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { // assume that any GPS connected to serial GPIO is ublox8 (RY835/6AI)
//log.Printf("UBX8 device detected on USB, or GPS serial connection in use. Attempting GLONASS and Galelio configuration.\n")
// glonass = []byte{0x06, 0x08, 0x0E, 0x00, 0x01, 0x00, 0x01, 0x01} // this enables GLONASS with 8-14 tracking channels
// galileo = []byte{0x02, 0x04, 0x08, 0x00, 0x01, 0x00, 0x01, 0x01} // this enables Galileo with 4-8 tracking channels
// updatespeed = []byte{0x06, 0x00, 0xF4, 0x01, 0x01, 0x00} // Nav speed 2Hz
// }
if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { // assume that any GPS connected to serial GPIO is ublox8 (RY835/6AI)
log.Printf("UBX8 device detected on USB, or GPS serial connection in use. Attempting GLONASS and Galelio configuration.\n")
glonass = []byte{0x06, 0x08, 0x0E, 0x00, 0x01, 0x00, 0x01, 0x01} // this enables GLONASS with 8-14 tracking channels
galileo = []byte{0x02, 0x04, 0x08, 0x00, 0x01, 0x00, 0x01, 0x01} // this enables Galileo with 4-8 tracking channels
updatespeed = []byte{0x06, 0x00, 0xF4, 0x01, 0x01, 0x00} // Nav speed 2Hz
}
cfgGnss = append(cfgGnss, gps...)
cfgGnss = append(cfgGnss, sbas...)
cfgGnss = append(cfgGnss, beidou...)
Expand Down
3 changes: 3 additions & 0 deletions main/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ func initPingSerial() bool {

if _, err := os.Stat("/dev/ping"); err == nil {
device = "/dev/ping"
} else if _, err := os.Stat("/dev/softrf"); err == nil {
device = "/dev/softrf"
baudrate = int(38400)
} else {
log.Printf("No suitable Ping device found.\n")
return false
Expand Down
31 changes: 29 additions & 2 deletions main/traffic.go
Original file line number Diff line number Diff line change
Expand Up @@ -1215,11 +1215,13 @@ func updateDemoTraffic(icao uint32, tail string, relAlt float32, gs float64, off
but are not used for aicraft on the civil registry. These could be
military, other public aircraft, or future use.
Values between C0CDF9 - C3FFFF are allocated to Canada,
but are not used for aicraft on the civil registry. These could be
military, other public aircraft, or future use.
Values between 7C0000 - 7FFFFF are allocated to Australia.
Output:
string: String containing the decoded tail number (if decoding succeeded),
"NON-NA" (for non-US / non Canada allocation), and "US-MIL" or "CA-MIL" for non-civil US / Canada allocation.
Expand All @@ -1240,9 +1242,11 @@ func icao2reg(icao_addr uint32) (string, bool) {
nation = "US"
} else if (icao_addr >= 0xC00001) && (icao_addr <= 0xC3FFFF) {
nation = "CA"
} else if (icao_addr >= 0x7C0000) && (icao_addr <= 0x7FFFFF) {
nation = "AU"
} else {
//TODO: future national decoding.
return "NON-NA", false
return "OTHER", false
}

if nation == "CA" { // Canada decoding
Expand Down Expand Up @@ -1273,6 +1277,29 @@ func icao2reg(icao_addr uint32) (string, bool) {
tail = fmt.Sprintf("C-%c%c%c%c", b_str[b], c+65, d+65, e+65)
}

if nation == "AU" { // Australia decoding

nationalOffset := uint32(0x7C0000)
offset := (icao_addr - nationalOffset)
i1 := offset / 1296
offset2 := offset % 1296
i2 := offset2 / 36
offset3 := offset2 % 36
i3 := offset3

var a_char, b_char, c_char string

a_char = fmt.Sprintf("%c", i1+65)
b_char = fmt.Sprintf("%c", i2+65)
c_char = fmt.Sprintf("%c", i3+65)

if i1 < 0 || i1 > 25 || i2 < 0 || i2 > 25 || i3 < 0 || i3 > 25 {
return "OTHER", false
}

tail = "VH-" + a_char + b_char + c_char
}

if nation == "US" { // FAA decoding
// First, discard addresses that are not assigned to aircraft on the civil registry
if icao_addr > 0xADF7C7 {
Expand Down
2 changes: 1 addition & 1 deletion web/plates/status-help.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
</ul>
<p class="text-warning">Devices must be manually enabled on the <strong>Settings</strong> page.</p>

<p>Additional statistics include the number of detected software-defined radios (SDRs), number of current DHCP network clients, uptime, temperature of the Raspberry Pi CPU, and the current clock settings on both the Raspberry Pi, and the total amount of available space on the micro SD card.</p>
<p>Additional statistics include the number of detected software-defined radios (SDRs), number of current DHCP network clients, uptime, temperature of the Raspberry Pi CPU (normal range 0°C to 70°C), and the total amount of available space on the micro SD card (normal range >100 MiB).</p>

0 comments on commit 3af934b

Please sign in to comment.