Skip to content

Commit

Permalink
Shotmanager: Fix instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedals2Paddles committed Jan 10, 2020
1 parent ea76310 commit 4bc6c6c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions shotmanager/shotManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,21 +542,21 @@ def checkBatteryHealth(self):

# Warn if battery cell is low, differential too high, or capacity sucks
if self.batt_cell_min < BATT_CELL_LOW_WARN and self.vehicle.system_status not in ['CRITICAL', 'EMERGENCY'] and self.batt_cell_low_warned == False:
str_BattHealth = "Warning, Low battery cell voltage: %1.2fV" % round((self.batt_cell_min * 0.001),2)
self.str_BattHealth = "Warning, Low battery cell voltage: %1.2fV" % round((self.batt_cell_min * 0.001),2)
self.batt_cell_low_warned = True
self.batt_last_warned = time.time()
elif self.batt_cell_diff > BATT_CELL_DIFF_WARN and self.batt_cell_diff_warned == False:
str_BattHealth = "Warning, Battery cell differential: %dmV" % self.batt_cell_diff
self.str_BattHealth = "Warning, Battery cell differential: %dmV" % self.batt_cell_diff
self.batt_cell_diff_warned = True
self.batt_last_warned = time.time()
elif self.batt_capacity > 0 and self.batt_capacity < BATT_CAPACITY_WARN and self.batt_capacity_warned == False:
str_BattHealth = "Warning, Battery capacity unhealthy: %dmAh" % self.batt_capacity
self.str_BattHealth = "Warning, Battery capacity unhealthy: %dmAh" % self.batt_capacity
self.batt_capacity_warned = True
self.batt_last_warned = time.time()

if str_BattHealth is not None:
logger.log(str_BattHealth)
packet = struct.pack('<II%ds' % (len(str_BattHealth)), app_packet.SOLO_MESSAGE_SHOTMANAGER_ERROR, len(str_BattHealth), str_BattHealth)
if self.str_BattHealth is not None:
logger.log(self.str_BattHealth)
packet = struct.pack('<II%ds' % (len(self.str_BattHealth)), app_packet.SOLO_MESSAGE_SHOTMANAGER_ERROR, len(self.str_BattHealth), self.str_BattHealth)
self.appMgr.sendPacket(packet)
time.sleep(0.4)
str_BattHealth = None
self.str_BattHealth = None

0 comments on commit 4bc6c6c

Please sign in to comment.