diff --git a/.idea/BMS View.iml b/.idea/BMS View.iml
index 0e67efc..04f1fe3 100644
--- a/.idea/BMS View.iml
+++ b/.idea/BMS View.iml
@@ -4,7 +4,7 @@
-
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index ba812f0..030e88f 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/Main.py b/Main.py
index 97c329a..16e02f2 100644
--- a/Main.py
+++ b/Main.py
@@ -2,13 +2,26 @@ import Messages
import time
from PCANBasic import *
-
-PCAN = PCANBasic()
+cV = []
+PCAN = PCANBasic() # type: PCANBasic
res = PCAN.Initialize(PCAN_USBBUS1, PCAN_BAUD_500K)
while True:
- PCAN.Write(PCAN_USBBUS1, Messages.rCellVinit)
+ PCAN.Write(PCAN_USBBUS1, Messages.rCellVInit)
time.sleep(.050)
+ cellMessage = False # type: bool
+ # Keep reading messages until a cell voltage message is received
+ while (cellMessage == False):
+ MSG = PCAN.Read(PCAN_USBBUS1)
+ if MSG.ID == 0x7bb:
+ cellMessage = True
+ v1 = "%s%s" % (MSG.DATA[4], MSG.DATA[5])
+ v2 = "%s%s" % (MSG.DATA[6], MSG.DATA[7])
+ v1 = int(v1, 16)
+ v2 = int(v2, 16)
+ print(v1)
+ print(v2)
+
for i in range(18):
PCAN.Write(PCAN_USBBUS1, Messages.rCellV)
- time.sleep(.050)
\ No newline at end of file
+ time.sleep(.050);
\ No newline at end of file