TEDü Getac Changes

This commit is contained in:
Tim-Erik Düntzsch
2024-10-05 19:01:02 +02:00
parent 661e1a2274
commit d362fdd639
6 changed files with 110 additions and 16 deletions

View File

@ -11,10 +11,12 @@ FT_2018_STW_CAN.cpp
CAN_FRAME can_0_msg;
// can_1_msg.id = 0x110;
int can_0_temp_data = 0;
int leds[] = {led1, led2, led3, led4, led5, led6, led7, led8,
led9, led10, led11, led12, led13, led14, led15, led16};
void Init_Can_0() {
Can0.begin(1000000); // set CAN0 baud to 1kbit/s and don`t use enable pin!
Can0.setNumTXBoxes(1); // reserves mailbox 0 for tx only 8 mailboxes are
// available (the other 7 mailboxes are for rx)
@ -23,6 +25,7 @@ void Init_Can_0() {
// allow us to receive BCU_APS_BRAKE, BCU_ETC and BCU_SHIFT_CTRL in the same
// mailbox. It will also let through 0x506, but that shouldn't be much of an
// issue.
/*
Can0.watchFor(CAN_ID_BCU_APS_BRAKE & CAN_ID_BCU_ETC & CAN_ID_BCU_SHIFT_CTRL,
0x7F9);
Can0.watchFor(CAN_ID_BCU_TIRES);
@ -33,6 +36,7 @@ void Init_Can_0() {
Can0.watchFor(CAN_ID_MS4_STATES_TEMP_PRESS);
Can0.setGeneralCallback(Receive_Can_0);
*/
Timer3.attachInterrupt(Send_0x110); // set send interrupt
Timer3.start(10000); // Calls every 10ms
@ -72,6 +76,7 @@ void Receive_Can_0(CAN_FRAME *temp_message) {
Vehicle_data.p_brake_front = temp_message->data.byte[1];
Vehicle_data.p_brake_rear = temp_message->data.byte[2];
Vehicle_data.drs_active = ((temp_message->data.byte[0] >> 7) & 0b00000001);
Vehicle_data.autoshift = ((temp_message->data.byte[7] >> 0) & 0b00000001);
break;
}
case CAN_ID_BCU_ETC: { // eDrossel error bit
@ -139,6 +144,7 @@ void Receive_Can_0(CAN_FRAME *temp_message) {
}
}
void update_LED() {
// Copyright Michael Dietzel
// m.dietzel@fasttube.de
@ -162,6 +168,39 @@ void update_LED() {
bool rev_lim = Vehicle_data.rev_lim;
uint16_t rev = Vehicle_data.revol;
//uint16_t clearcounter = 1;
// if (clearcounter>= 5000){
//Can0.begin(1000000); // set CAN0 baud to 1kbit/s and don`t use enable pin!
//Can0.setNumTXBoxes(1); // reserves mailbox 0 for tx only 8 mailboxes are
// available (the other 7 mailboxes are for rx)
// We only have 7 mailboxes, but want to receive 9 messages. This trick should
// allow us to receive BCU_APS_BRAKE, BCU_ETC and BCU_SHIFT_CTRL in the same
// mailbox. It will also let through 0x506, but that shouldn't be much of an
// issue.
/* 10.09.2024 - auskommentiert, weil wieso hier nochmal watchfor? */
Can0.watchFor(CAN_ID_BCU_APS_BRAKE & CAN_ID_BCU_ETC & CAN_ID_BCU_SHIFT_CTRL, 0x7F9);
Can0.watchFor(CAN_ID_BCU_TIRES);
Can0.watchFor(CAN_ID_BCU_LAP_TIME);
Can0.watchFor(CAN_ID_MS4_IGN_REV_ATH);
Can0.watchFor(CAN_ID_MS4_SPEED);
Can0.watchFor(CAN_ID_MS4_ETC);
Can0.watchFor(CAN_ID_MS4_STATES_TEMP_PRESS);
//Can0.setGeneralCallback(Receive_Can_0);
//Timer3.attachInterrupt(Send_0x110); // set send interrupt
// Timer3.start(10000); // Calls every 10ms
// clearcounter = 0; //clearen des display nach definierter Zeit
// }
// clearcounter+=1;
/*if(Vehicle_data.rev_lim){
for (int j = 0; j < 10; j++){