all bms comunicating with nucleo board and balancing

Dependencies:   CANnucleo mbed

Fork of Can_sniffer_BMS_GER by Joao Vieira

Revision:
45:906aa79b2701
Parent:
44:827c51673d33
Child:
46:8fc10f7a8739
--- a/main.cpp	Tue Nov 29 16:35:35 2016 +0000
+++ b/main.cpp	Wed Nov 30 15:10:05 2016 +0000
@@ -33,7 +33,7 @@
 //13|BMS3|Cell voltages
 //?|Charger|
 //
-//--------------------------------------------------------------------
+//-------------------------------------------------------------------
 
 
 
@@ -162,7 +162,7 @@
 void refresh()
 {
     //key_switch = !key_switch;
-    //led = controller_key_switch;
+    led = controller_key_switch;
     to_send=1;
     //printf("controller switch\r\n");
     // to_send = 1;
@@ -254,11 +254,11 @@
     can.attach(&onMsgReceived);                 // attach 'CAN receive-complete' interrupt handler
     refresher.attach(&refresh, 5);                 // turn on or off
     button.rise(&flip);    
-        //printer.attach(&cvprint, 20);                 // turn on o
-        //printer2.attach(&ctprint, 50);                 // turn on o
+        printer.attach(&cvprint, 20);                 // turn on o
+        printer2.attach(&ctprint, 50);                 // turn on o
         
     //led=key_switch;
-    //controller_key_switch=0;
+    controller_key_switch=0;
     led=controller_key_switch;
     
     timer.start();  // start timer
@@ -324,8 +324,7 @@
             txMsg.clear();
             txMsg.id = 9;     //BMS1=>ID:11; BMS2=>ID:12; BMS3=>ID:13.
             txMsg.len = 1;
-            //motostate = (0b00000001 & controller_key_switch)|((0b00000001 & charging)<<1);
-            motostate =0b00000001;
+            motostate = (0b00000001 & controller_key_switch)|((0b00000001 & charging)<<1);
             txMsg.data[0] = motostate;
             //------------------------------------------------