-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serial Output Settings #281
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,11 +36,13 @@ var netMutex *sync.Mutex // netMutex needs to be locked before acce | |
var totalNetworkMessagesSent uint32 | ||
|
||
const ( | ||
NETWORK_DISABLED = 0 | ||
NETWORK_GDL90_STANDARD = 1 | ||
NETWORK_AHRS_FFSIM = 2 | ||
NETWORK_AHRS_GDL90 = 4 | ||
NETWORK_FLARM_NMEA = 8 | ||
NETWORK_POSITION_FFSIM = 16 | ||
NETWORK_RESERVED_FEA32 = 32 | ||
dhcp_lease_file = "/var/lib/misc/dnsmasq.leases" | ||
dhcp_lease_dir = "/var/lib/misc/" | ||
extra_hosts_file = "/etc/stratux-static-hosts.conf" | ||
|
@@ -139,6 +141,8 @@ func serialOutWatcher() { | |
for i := 0; i < 10; i++ { | ||
serialDevs = append(serialDevs, fmt.Sprintf("/dev/serialout%d", i)) | ||
serialDevs = append(serialDevs, fmt.Sprintf("/dev/serialout_nmea%d", i)) | ||
// Improved Serial Output support for different devices | ||
serialDevs = append(serialDevs, fmt.Sprintf("/dev/ttyUSB%d", i)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about this.. this is kinda a catch-all for a lot of devices, including stuff that is intended to be a GPS and not a serialout chip.. |
||
} | ||
|
||
for { | ||
|
@@ -150,7 +154,14 @@ func serialOutWatcher() { | |
|
||
// Master is globalSettings.SerialOutputs. Once we connect to one, it will be copied to the active connections map | ||
if val, ok := globalSettings.SerialOutputs[serialDev]; !ok { | ||
proto := uint8(NETWORK_GDL90_STANDARD) | ||
// Improved Serial Output support for different devices | ||
// Step 1: Let's the user decide using Web Settings | ||
proto := uint8(NETWORK_DISABLED) | ||
// Step 2: Existing installation with serialout | ||
if strings.Contains(serialDev, "serialout") { | ||
proto = NETWORK_GDL90_STANDARD | ||
} | ||
// Step 3: nmea output | ||
if strings.Contains(serialDev, "_nmea") { | ||
proto = NETWORK_FLARM_NMEA | ||
} | ||
|
@@ -165,13 +176,18 @@ func serialOutWatcher() { | |
} else { | ||
config = val | ||
if config.Capability == 0 { | ||
config.Capability = NETWORK_GDL90_STANDARD // Fix old serial conns that didn't have protocol set | ||
// Obsolete: using the new Web Settings the user can easily manage and change this | ||
//config.Capability = NETWORK_GDL90_STANDARD // Fix old serial conns that didn't have protocol set | ||
} | ||
} | ||
|
||
netMutex.Lock() | ||
|
||
needsConnect := true | ||
// Disabled Serial Interface | ||
if config.Capability == 0 { | ||
needsConnect = false | ||
} | ||
if activeConn, ok := clientConnections[serialDev]; ok { | ||
if !activeConn.IsSleeping() { | ||
needsConnect = false | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please try to follow the coding style here? No () around if-conditions if it's not needed, spaces around operators, ...