Skip to content

Commit

Permalink
Remove "print" from ACI Library
Browse files Browse the repository at this point in the history
  • Loading branch information
Circuitsoft committed Oct 10, 2017
1 parent bcaf2da commit 8aba3ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyaci/aci/AciEvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def __init__(self,pkt):
class HeartbeatMsg(object):
def __init__(self, data):
if len(data) != 18:
print(str.format("Error: expected 18 bytes, got %s" %(data)))
raise ValueError("Error: expected 18 bytes, got %s" % data)
(self.rssi, self.received_at, self.received_at_ms, self.local_clock_version, self.sensor_id, self.epoch_seconds, self.epoch_ms, self.clock_version) = unpack('<BiHHBiHH', bytearray(data))

def __repr__(self):
Expand Down
3 changes: 2 additions & 1 deletion pyaci/aci_serial/AciUart.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ def ProcessCommand(self, command):
logging.error('traceback: %s', traceback.format_exc())

def write_aci_cmd(self, cmd):
retval = None
if isinstance(cmd,AciCommand.AciCommandPkt):
self.WriteData(cmd.serialize())
retval = self.Wait(self)
print("Events received: %s" %retval)
if retval == None:
logging.info('cmd %s, timeout waiting for event' % (cmd.__class__.__name__))
else:
logging.error('The command provided is not valid: %s\nIt must be an instance of the AciCommandPkt class (or one of its subclasses)', str(cmd))
return retval



Expand Down
4 changes: 3 additions & 1 deletion pyaci/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def get_sensor_updates(self):

def run_app_command(self, command):
data = command.serialize()
return self.aci.write_aci_cmd(AciCommand.AciAppCommand(data=data,length=len(data)+1))
retval = self.aci.write_aci_cmd(AciCommand.AciAppCommand(data=data,length=len(data)+1))
print("Events received: %s" % retval)
return retval

def sync_time(self):
self.last_time_sync = time.time()
Expand Down

0 comments on commit 8aba3ae

Please sign in to comment.