Ultima versão da banca de ensaios ECU Fev2017
Fork of Can_sniffer_BMS4 by
Diff: main.cpp
- Revision:
- 27:21239801cfd3
- Parent:
- 26:3ac15dfbb66b
- Child:
- 28:2329d581e394
--- a/main.cpp Mon Oct 24 13:11:40 2016 +0000 +++ b/main.cpp Mon Oct 24 20:55:53 2016 +0000 @@ -112,6 +112,8 @@ float f[2]; } data; +bool to_charge_or_not_to_charge=true; // false = discharge + int main() { @@ -152,14 +154,23 @@ } if(to_send) { to_send = 0; - txMsg.clear(); + + + //------------------------------------------------ + //ECU to BMS State - txMsg.id = 9; - txMsg << key_switch; + //motostate: (0|0|0|0|0|0|to_charge_or_not_to_charge|key_switch) + txMsg.clear(); + txMsg.id = 9; //BMS1=>ID:11; BMS2=>ID:12; BMS3=>ID:13. + txMsg.len = 1; + // txMsg.data[0] = (0b00000001 & key_switch)|((0b00000001 & to_charge_or_not_to_charge)<<1); +txMsg.data[0] = 0b00000000; + //------------------------------------------------ + if(can.write(txMsg)) { printf("sent message\r\n"); } else { - static char count = 0; + static char count = 0; //desta maneira o count é sempre zero e assim nunca chega a 3?? count++; printf("transmission error\n\r overflow: %x\n\r", count); if(count == 3) {