Move CAN buffers into the relevant comms files rather than boards
This should resolve #1116
This commit is contained in:
parent
cd3b4dfeaa
commit
329a5278a7
|
@ -386,9 +386,6 @@ void ignitionSchedule8Interrupt(HardwareTimer*);
|
|||
#include <src/STM32_CAN/STM32_CAN.h>
|
||||
//This activates CAN1 interface on STM32, but it's named as Can0, because that's how Teensy implementation is done
|
||||
extern STM32_CAN Can0;
|
||||
|
||||
static CAN_message_t outMsg;
|
||||
static CAN_message_t inMsg;
|
||||
#endif
|
||||
|
||||
#endif //CORE_STM32
|
||||
|
|
|
@ -163,8 +163,6 @@
|
|||
extern FlexCAN_T4<CAN0, RX_SIZE_256, TX_SIZE_16> Can0;
|
||||
extern FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can1;
|
||||
#endif
|
||||
static CAN_message_t outMsg;
|
||||
static CAN_message_t inMsg;
|
||||
#define NATIVE_CAN_AVAILABLE
|
||||
#endif //CORE_TEENSY
|
||||
#endif //TEENSY35_H
|
||||
|
|
|
@ -172,8 +172,6 @@
|
|||
extern FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can0;
|
||||
extern FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_16> Can1;
|
||||
extern FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_16> Can2;
|
||||
static CAN_message_t outMsg;
|
||||
static CAN_message_t inMsg;
|
||||
//#define NATIVE_CAN_AVAILABLE //Disable for now as it causes lockup
|
||||
|
||||
#endif //CORE_TEENSY
|
||||
|
|
|
@ -13,6 +13,9 @@ This is for handling the data broadcasted to various CAN dashes and instrument c
|
|||
#include "comms_CAN.h"
|
||||
#include "utilities.h"
|
||||
|
||||
CAN_message_t inMsg;
|
||||
CAN_message_t outMsg;
|
||||
|
||||
// Forward declare
|
||||
void DashMessage(uint16_t DashMessageID);
|
||||
|
||||
|
@ -126,7 +129,7 @@ void can_Command(void)
|
|||
{
|
||||
//int currentcanCommand = inMsg.id;
|
||||
// currentStatus.canin[12] = (inMsg.id);
|
||||
if ( (inMsg.id == uint16_t(configPage9.obd_address + 0x100)) || (inMsg.id == 0x7DF))
|
||||
if ( (inMsg.id == uint16_t(configPage9.obd_address + TS_CAN_OFFSET)) || (inMsg.id == 0x7DF))
|
||||
{
|
||||
// The address is the speeduino specific ecu canbus address
|
||||
// or the 0x7df(2015 dec) broadcast address
|
||||
|
@ -145,7 +148,7 @@ void can_Command(void)
|
|||
Can0.write(outMsg); // send the 8 bytes of obd data
|
||||
}
|
||||
}
|
||||
if (inMsg.id == uint16_t(configPage9.obd_address + 0x100))
|
||||
if (inMsg.id == uint16_t(configPage9.obd_address + TS_CAN_OFFSET))
|
||||
{
|
||||
// The address is only the speeduino specific ecu canbus address
|
||||
if (inMsg.buf[1] == 0x09)
|
||||
|
@ -513,7 +516,7 @@ void readAuxCanBus()
|
|||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if (inMsg.id == (configPage9.caninput_source_can_address[i] + 0x100)) //Filters frame ID
|
||||
if (inMsg.id == (configPage9.caninput_source_can_address[i] + TS_CAN_OFFSET)) //Filters frame ID
|
||||
{
|
||||
|
||||
if (!BIT_CHECK(configPage9.caninput_source_num_bytes, i))
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#define CAN_VAG_RPM 0x280
|
||||
#define CAN_VAG_VSS 0x5A0
|
||||
|
||||
#define TS_CAN_OFFSET 0x100
|
||||
|
||||
void sendBMWCluster();
|
||||
void sendVAGCluster();
|
||||
void DashMessages(uint16_t DashMessageID);
|
||||
|
@ -21,5 +23,8 @@ void can_Command(void);
|
|||
void obd_response(uint8_t therequestedPID , uint8_t therequestedPIDlow, uint8_t therequestedPIDhigh);
|
||||
void readAuxCanBus();
|
||||
|
||||
extern CAN_message_t outMsg;
|
||||
extern CAN_message_t inMsg;
|
||||
|
||||
#endif
|
||||
#endif // COMMS_CAN_H
|
||||
|
|
|
@ -119,7 +119,6 @@ void loop(void)
|
|||
}
|
||||
#endif
|
||||
#if defined (NATIVE_CAN_AVAILABLE)
|
||||
//currentStatus.canin[12] = configPage9.enable_intcan;
|
||||
if (configPage9.enable_intcan == 1) // use internal can module
|
||||
{
|
||||
//check local can module
|
||||
|
@ -128,9 +127,6 @@ void loop(void)
|
|||
{
|
||||
can_Command();
|
||||
readAuxCanBus();
|
||||
//Can0.read(inMsg);
|
||||
//currentStatus.canin[12] = inMsg.buf[5];
|
||||
//currentStatus.canin[13] = inMsg.id;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue