mirror of
https://github.com/OpenSolo/OpenSolo.git
synced 2025-04-29 14:14:30 +02:00
Shotmanager: Fix instantiation
This commit is contained in:
parent
ea763105fc
commit
4bc6c6c8d0
@ -542,21 +542,21 @@ class ShotManager():
|
||||
|
||||
# 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user