Skip to content

Commit

Permalink
[FIX] hw_scale: don't crash if the serial connection gets broken
Browse files Browse the repository at this point in the history
bzr revid: fva@openerp.com-20140428095246-w6pyo8y7rrhsvsjl
  • Loading branch information
fvdsn committed Apr 28, 2014
1 parent c0d6279 commit a57f443
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addons/hw_scale/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ def read_weight(self):
answer = answer[1:-1]
if 'N' in answer:
answer = answer[0:-1]
self.weight = float(''.join(answer))
try:
self.weight = float(''.join(answer))
except ValueError as v:
self.set_status('error','No data Received, please power-cycle the scale');
self.device = None

except Exception as e:
self.set_status('error',str(e))
Expand Down

0 comments on commit a57f443

Please sign in to comment.