def onArmModules(self, eent): """ Call the Arduino and ask it to arm modules; will wait for a gien time to give the MC enough slack to finish all tasks required """ if self.portOpen and self.checkConnection: communicationProtocol.sendMessage(self.arduinoSerialConnection, self.armModulesCommand) line = self.arduinoSerialConnection.readline() readings = communicationProtocol.readMessage(line) try: delay = readings["setupDelay"] dialog = rovGuiArmDialog(float(delay) / 1000.0) dialog.ShowModal() except KeyError: wx.MessageBox("Something fell over while asking Arduino to arm!", "Error", wx.OK | wx.ICON_ERROR)
def updateSensorReadings(self): """ Go over each sensor and get its reading, updating the internally stored values """ if self.portOpen: # make sure the connection has not been broken if self.checkConnection(): pass # ask the Arduino nicely to return the current readings communicationProtocol.sendMessage(self.arduinoSerialConnection, self.sensorReadingsRequestObject) # get the most recent line from the serial port line = self.arduinoSerialConnection.readline() # pass on to the parser readings = communicationProtocol.readMessage(line) # update sensor and other readings for readingKey in readings: self.sensorParameters[readingKey] = float(readings[readingKey])
def onArmModules(self, eent): """ Call the Arduino and ask it to arm modules; will wait for a gien time to give the MC enough slack to finish all tasks required """ if self.portOpen and self.checkConnection: communicationProtocol.sendMessage(self.arduinoSerialConnection, self.armModulesCommand) line = self.arduinoSerialConnection.readline() readings = communicationProtocol.readMessage(line) try: delay = readings['setupDelay'] dialog = rovGuiArmDialog(float(delay) / 1000.) dialog.ShowModal() except KeyError: wx.MessageBox( 'Something fell over while asking Arduino to arm!', 'Error', wx.OK | wx.ICON_ERROR)
def updateSensorReadings(self): """ Go over each sensor and get its reading, updating the internally stored values """ if self.portOpen: # make sure the connection has not been broken if self.checkConnection(): pass # ask the Arduino nicely to return the current readings communicationProtocol.sendMessage( self.arduinoSerialConnection, self.sensorReadingsRequestObject) # get the most recent line from the serial port line = self.arduinoSerialConnection.readline() # pass on to the parser readings = communicationProtocol.readMessage(line) # update sensor and other readings for readingKey in readings: self.sensorParameters[readingKey] = float( readings[readingKey])