Skip to content

Commit

Permalink
Enable editing of GPS serial port
Browse files Browse the repository at this point in the history
  • Loading branch information
EarToEarOak committed Jul 10, 2015
1 parent e479b42 commit df2e25d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/cli.py
Expand Up @@ -167,7 +167,7 @@ def __init__(self, pool, args):
print "Done"

def __gps_wait(self):
print '\nWaiting for GPS: {}'.format(self.settings.devicesGps[0].get_serial_desc())
print '\nWaiting for GPS fix: {}'.format(self.settings.devicesGps[0].get_serial_desc())

while True:
if not self.queueLocation.empty():
Expand Down Expand Up @@ -241,6 +241,7 @@ def __process_event(self, queue, pool):
arg2[2])
elif status == Event.LOC_ERR:
print '{}'.format(arg2)
exit(1)

return status

Expand Down
16 changes: 8 additions & 8 deletions src/dialogs_devices.py
Expand Up @@ -494,16 +494,16 @@ def __select_row(self, index):
class DialogGPSSerial(wx.Dialog):
def __init__(self, parent, device):
self.device = device
self.ports = get_serial_ports()
ports = get_serial_ports()
ports.append(device.resource)
self.ports = list(set(ports))

wx.Dialog.__init__(self, parent=parent, title='Serial port settings')

textPort = wx.StaticText(self, label='Port')
self.choicePort = wx.Choice(self, choices=self.ports)
sel = 0
if device.resource in self.ports:
sel = self.ports.index(device.resource)
self.choicePort.SetSelection(sel)
self.comboPort = wx.ComboBox(self, choices=self.ports,
style=wx.TE_PROCESS_ENTER)
self.comboPort.SetSelection(self.ports.index(device.resource))

textBaud = wx.StaticText(self, label='Baud rate')
self.choiceBaud = wx.Choice(self,
Expand Down Expand Up @@ -534,7 +534,7 @@ def __init__(self, parent, device):

grid = wx.GridBagSizer(10, 10)
grid.Add(textPort, pos=(0, 0), flag=wx.ALL)
grid.Add(self.choicePort, pos=(0, 1), flag=wx.ALL)
grid.Add(self.comboPort, pos=(0, 1), flag=wx.ALL)
grid.Add(textBaud, pos=(1, 0), flag=wx.ALL)
grid.Add(self.choiceBaud, pos=(1, 1), flag=wx.ALL)
grid.Add(textByte, pos=(2, 0), flag=wx.ALL)
Expand All @@ -553,7 +553,7 @@ def __init__(self, parent, device):
self.SetSizerAndFit(box)

def __on_ok(self, _event):
self.device.resource = self.ports[self.choicePort.GetSelection()]
self.device.resource = self.comboPort.GetValue()
self.device.baud = self.device.get_bauds()[self.choiceBaud.GetSelection()]
self.device.bytes = DeviceGPS.BYTES[self.choiceBytes.GetSelection()]
self.device.parity = DeviceGPS.PARITIES[self.choiceParity.GetSelection()]
Expand Down
1 change: 1 addition & 0 deletions src/location.py
Expand Up @@ -332,6 +332,7 @@ def __post_location(self, lat, lon, alt):
def run(self):
if self._device.type in [DeviceGPS.NMEA_SERIAL, DeviceGPS.NMEA_TCP]:
if not self.__nmea_open():
self.__nmea_close()
return
else:
if not self.__gpsd_open():
Expand Down
2 changes: 1 addition & 1 deletion src/version-timestamp
@@ -1 +1 @@
1436448401
1436540466

0 comments on commit df2e25d

Please sign in to comment.