CAN category (#4148)

Co-authored-by: rusefillc <sdfsdfqsf2334234234>
This commit is contained in:
rusefillc 2022-05-09 16:49:23 -04:00 committed by GitHub
parent 7f5672aaec
commit 683a723d2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 112 additions and 102 deletions

View File

@ -40,7 +40,7 @@ static CanTsListener listener;
int CanStreamerState::sendFrame(const IsoTpFrameHeader & header, const uint8_t *data, int num, can_sysinterval_t timeout) { int CanStreamerState::sendFrame(const IsoTpFrameHeader & header, const uint8_t *data, int num, can_sysinterval_t timeout) {
int dlc = 8; // standard 8 bytes int dlc = 8; // standard 8 bytes
CanTxMessage txmsg(CAN_ECU_SERIAL_TX_ID, dlc, false); CanTxMessage txmsg(CanCategory::SERIAL, CAN_ECU_SERIAL_TX_ID, dlc, false);
// fill the frame data according to the CAN-TP protocol (ISO 15765-2) // fill the frame data according to the CAN-TP protocol (ISO 15765-2)
txmsg[0] = (uint8_t)((header.frameType & 0xf) << 4); txmsg[0] = (uint8_t)((header.frameType & 0xf) << 4);

View File

@ -143,17 +143,17 @@ void canDashboardBMW(CanCycle cycle) {
if (cycle.isInterval(CI::_50ms)) { if (cycle.isInterval(CI::_50ms)) {
{ {
CanTxMessage msg(CAN_BMW_E46_SPEED); CanTxMessage msg(CanCategory::NBC, CAN_BMW_E46_SPEED);
msg.setShortValue(10 * 8, 1); msg.setShortValue(10 * 8, 1);
} }
{ {
CanTxMessage msg(CAN_BMW_E46_RPM); CanTxMessage msg(CanCategory::NBC, CAN_BMW_E46_RPM);
msg.setShortValue((int) (Sensor::getOrZero(SensorType::Rpm) * 6.4), 2); msg.setShortValue((int) (Sensor::getOrZero(SensorType::Rpm) * 6.4), 2);
} }
{ {
CanTxMessage msg(CAN_BMW_E46_DME2); CanTxMessage msg(CanCategory::NBC, CAN_BMW_E46_DME2);
msg.setShortValue((int) ((Sensor::getOrZero(SensorType::Clt) + 48.373) / 0.75), 1); msg.setShortValue((int) ((Sensor::getOrZero(SensorType::Clt) + 48.373) / 0.75), 1);
} }
} }
@ -163,12 +163,12 @@ void canDashboardBMW(CanCycle cycle) {
void canMazdaRX8(CanCycle cycle) { void canMazdaRX8(CanCycle cycle) {
if (cycle.isInterval(CI::_50ms)) { if (cycle.isInterval(CI::_50ms)) {
{ {
CanTxMessage msg(CAN_MAZDA_RX_STEERING_WARNING); CanTxMessage msg(CanCategory::NBC, CAN_MAZDA_RX_STEERING_WARNING);
// todo: something needs to be set here? see http://rusefi.com/wiki/index.php?title=Vehicle:Mazda_Rx8_2004 // todo: something needs to be set here? see http://rusefi.com/wiki/index.php?title=Vehicle:Mazda_Rx8_2004
} }
{ {
CanTxMessage msg(CAN_MAZDA_RX_RPM_SPEED); CanTxMessage msg(CanCategory::NBC, CAN_MAZDA_RX_RPM_SPEED);
float kph = Sensor::getOrZero(SensorType::VehicleSpeed); float kph = Sensor::getOrZero(SensorType::VehicleSpeed);
@ -179,7 +179,7 @@ void canMazdaRX8(CanCycle cycle) {
} }
{ {
CanTxMessage msg(CAN_MAZDA_RX_STATUS_1); CanTxMessage msg(CanCategory::NBC, CAN_MAZDA_RX_STATUS_1);
msg[0] = 0xFE; //Unknown msg[0] = 0xFE; //Unknown
msg[1] = 0xFE; //Unknown msg[1] = 0xFE; //Unknown
msg[2] = 0xFE; //Unknown msg[2] = 0xFE; //Unknown
@ -191,7 +191,7 @@ void canMazdaRX8(CanCycle cycle) {
} }
{ {
CanTxMessage msg(CAN_MAZDA_RX_STATUS_2); CanTxMessage msg(CanCategory::NBC, CAN_MAZDA_RX_STATUS_2);
auto clt = Sensor::get(SensorType::Clt); auto clt = Sensor::get(SensorType::Clt);
msg[0] = (uint8_t)(clt.value_or(0) + 69); //temp gauge //~170 is red, ~165 last bar, 152 centre, 90 first bar, 92 second bar msg[0] = (uint8_t)(clt.value_or(0) + 69); //temp gauge //~170 is red, ~165 last bar, 152 centre, 90 first bar, 92 second bar
// TODO: fixme! // TODO: fixme!
@ -220,7 +220,7 @@ void canDashboardFiat(CanCycle cycle) {
if (cycle.isInterval(CI::_50ms)) { if (cycle.isInterval(CI::_50ms)) {
{ {
//Fiat Dashboard //Fiat Dashboard
CanTxMessage msg(CAN_FIAT_MOTOR_INFO); CanTxMessage msg(CanCategory::NBC, CAN_FIAT_MOTOR_INFO);
msg.setShortValue((int) (Sensor::getOrZero(SensorType::Clt) - 40), 3); //Coolant Temp msg.setShortValue((int) (Sensor::getOrZero(SensorType::Clt) - 40), 3); //Coolant Temp
msg.setShortValue(Sensor::getOrZero(SensorType::Rpm) / 32, 6); //RPM msg.setShortValue(Sensor::getOrZero(SensorType::Rpm) / 32, 6); //RPM
} }
@ -231,24 +231,24 @@ void canDashboardVAG(CanCycle cycle) {
if (cycle.isInterval(CI::_10ms)) { if (cycle.isInterval(CI::_10ms)) {
{ {
//VAG Dashboard //VAG Dashboard
CanTxMessage msg(CAN_VAG_Motor_1); CanTxMessage msg(CanCategory::NBC, CAN_VAG_Motor_1);
msg.setShortValue(Sensor::getOrZero(SensorType::Rpm) * 4, 2); //RPM msg.setShortValue(Sensor::getOrZero(SensorType::Rpm) * 4, 2); //RPM
} }
float clt = Sensor::getOrZero(SensorType::Clt); float clt = Sensor::getOrZero(SensorType::Clt);
{ {
CanTxMessage msg(CAN_VAG_Motor_2); CanTxMessage msg(CanCategory::NBC, CAN_VAG_Motor_2);
msg.setShortValue((int) ((clt + 48.373) / 0.75), 1); //Coolant Temp msg.setShortValue((int) ((clt + 48.373) / 0.75), 1); //Coolant Temp
} }
{ {
CanTxMessage msg(CAN_VAG_CLT_V2); CanTxMessage msg(CanCategory::NBC, CAN_VAG_CLT_V2);
msg.setShortValue((int) ((clt + 48.373) / 0.75), 4); //Coolant Temp msg.setShortValue((int) ((clt + 48.373) / 0.75), 4); //Coolant Temp
} }
{ {
CanTxMessage msg(CAN_VAG_IMMO); CanTxMessage msg(CanCategory::NBC, CAN_VAG_IMMO);
msg.setShortValue(0x80, 1); msg.setShortValue(0x80, 1);
} }
} }
@ -257,7 +257,7 @@ void canDashboardVAG(CanCycle cycle) {
void canDashboardW202(CanCycle cycle) { void canDashboardW202(CanCycle cycle) {
if (cycle.isInterval(CI::_20ms)) { if (cycle.isInterval(CI::_20ms)) {
{ {
CanTxMessage msg(W202_STAT_1); CanTxMessage msg(CanCategory::NBC, W202_STAT_1);
uint16_t tmp = Sensor::getOrZero(SensorType::Rpm); uint16_t tmp = Sensor::getOrZero(SensorType::Rpm);
msg[0] = 0x08; // Unknown msg[0] = 0x08; // Unknown
msg[1] = (tmp >> 8); //RPM msg[1] = (tmp >> 8); //RPM
@ -272,7 +272,7 @@ void canDashboardW202(CanCycle cycle) {
if (cycle.isInterval(CI::_100ms)) { if (cycle.isInterval(CI::_100ms)) {
{ {
CanTxMessage msg(W202_STAT_2); //dlc 7 CanTxMessage msg(CanCategory::NBC, W202_STAT_2); //dlc 7
msg[0] = (int)(Sensor::getOrZero(SensorType::Clt) + 40); // CLT -40 offset msg[0] = (int)(Sensor::getOrZero(SensorType::Clt) + 40); // CLT -40 offset
msg[1] = 0x3D; // TBD msg[1] = 0x3D; // TBD
msg[2] = 0x63; // Const msg[2] = 0x63; // Const
@ -286,7 +286,7 @@ void canDashboardW202(CanCycle cycle) {
if (cycle.isInterval(CI::_200ms)) { if (cycle.isInterval(CI::_200ms)) {
{ {
CanTxMessage msg(W202_ALIVE); CanTxMessage msg(CanCategory::NBC, W202_ALIVE);
msg[0] = 0x0A; // Const msg[0] = 0x0A; // Const
msg[1] = 0x18; // Const msg[1] = 0x18; // Const
msg[2] = 0x00; // Const msg[2] = 0x00; // Const
@ -298,7 +298,7 @@ void canDashboardW202(CanCycle cycle) {
} }
{ {
CanTxMessage msg(W202_STAT_3); CanTxMessage msg(CanCategory::NBC, W202_STAT_3);
msg[0] = 0x00; // Const msg[0] = 0x00; // Const
msg[1] = 0x00; // Const msg[1] = 0x00; // Const
msg[2] = 0x6D; // TBD msg[2] = 0x6D; // TBD
@ -316,13 +316,13 @@ static int rollingId = 0;
void canDashboardGenesisCoupe(CanCycle cycle) { void canDashboardGenesisCoupe(CanCycle cycle) {
if (cycle.isInterval(CI::_50ms)) { if (cycle.isInterval(CI::_50ms)) {
{ {
CanTxMessage msg(GENESIS_COUPLE_RPM_316, 8); CanTxMessage msg(CanCategory::NBC, GENESIS_COUPLE_RPM_316, 8);
int rpm8 = Sensor::getOrZero(SensorType::Rpm) * 4; int rpm8 = Sensor::getOrZero(SensorType::Rpm) * 4;
msg[3] = rpm8 >> 8; msg[3] = rpm8 >> 8;
msg[4] = rpm8 & 0xFF; msg[4] = rpm8 & 0xFF;
} }
{ {
CanTxMessage msg(GENESIS_COUPLE_COOLANT_329, 8); CanTxMessage msg(CanCategory::NBC, GENESIS_COUPLE_COOLANT_329, 8);
int clt = Sensor::getOrZero(SensorType::Clt) * 2; int clt = Sensor::getOrZero(SensorType::Clt) * 2;
msg[1] = clt; msg[1] = clt;
} }
@ -332,7 +332,7 @@ void canDashboardGenesisCoupe(CanCycle cycle) {
void canDashboardNissanVQ(CanCycle cycle) { void canDashboardNissanVQ(CanCycle cycle) {
if (cycle.isInterval(CI::_50ms)) { if (cycle.isInterval(CI::_50ms)) {
{ {
CanTxMessage msg(NISSAN_RPM_1F9, 8); CanTxMessage msg(CanCategory::NBC, NISSAN_RPM_1F9, 8);
msg[0] = 0x20; msg[0] = 0x20;
int rpm8 = (int)(Sensor::getOrZero(SensorType::Rpm) * 8); int rpm8 = (int)(Sensor::getOrZero(SensorType::Rpm) * 8);
msg[2] = rpm8 >> 8; msg[2] = rpm8 >> 8;
@ -340,7 +340,7 @@ void canDashboardNissanVQ(CanCycle cycle) {
} }
{ {
CanTxMessage msg(NISSAN_CLT_551, 8); CanTxMessage msg(CanCategory::OBD, NISSAN_CLT_551, 8);
int clt = Sensor::getOrZero(SensorType::Clt); int clt = Sensor::getOrZero(SensorType::Clt);
msg[0] = clt + 45; msg[0] = clt + 45;
@ -348,7 +348,7 @@ void canDashboardNissanVQ(CanCycle cycle) {
{ {
CanTxMessage msg(NISSAN_RPM_CLT, 8); CanTxMessage msg(CanCategory::NBC, NISSAN_RPM_CLT, 8);
rollingId = (rollingId + 1) % 4; rollingId = (rollingId + 1) % 4;
const uint8_t magicByte[4] = {0x03, 0x23, 0x42, 0x63}; const uint8_t magicByte[4] = {0x03, 0x23, 0x42, 0x63};
@ -374,13 +374,13 @@ void canDashboardVagMqb(CanCycle cycle) {
if (cycle.isInterval(CI::_50ms)) { if (cycle.isInterval(CI::_50ms)) {
{ // 'turn-on' { // 'turn-on'
CanTxMessage msg(0x3C0, 4); CanTxMessage msg(CanCategory::NBC, 0x3C0, 4);
// ignition ON // ignition ON
msg[2] = 3; msg[2] = 3;
} }
{ //RPM { //RPM
CanTxMessage msg(0x107, 8); CanTxMessage msg(CanCategory::NBC, 0x107, 8);
msg[3] = ((int)(Sensor::getOrZero(SensorType::Rpm) / 3.5)) & 0xFF; msg[3] = ((int)(Sensor::getOrZero(SensorType::Rpm) / 3.5)) & 0xFF;
msg[4] = ((int)(Sensor::getOrZero(SensorType::Rpm) / 3.5)) >> 8; msg[4] = ((int)(Sensor::getOrZero(SensorType::Rpm) / 3.5)) >> 8;
} }
@ -393,7 +393,7 @@ void canDashboardBMWE90(CanCycle cycle)
if (cycle.isInterval(CI::_50ms)) { if (cycle.isInterval(CI::_50ms)) {
{ //T15 'turn-on' { //T15 'turn-on'
CanTxMessage msg(E90_T15, 5); CanTxMessage msg(CanCategory::NBC, E90_T15, 5);
msg[0] = 0x45; msg[0] = 0x45;
msg[1] = 0x41; msg[1] = 0x41;
msg[2] = 0x61; msg[2] = 0x61;
@ -402,7 +402,7 @@ void canDashboardBMWE90(CanCycle cycle)
} }
{ //Ebrake light { //Ebrake light
CanTxMessage msg(E90_EBRAKE, 2); CanTxMessage msg(CanCategory::OBD, E90_EBRAKE, 2);
msg[0] = 0xFD; msg[0] = 0xFD;
msg[1] = 0xFF; msg[1] = 0xFF;
} }
@ -411,7 +411,7 @@ void canDashboardBMWE90(CanCycle cycle)
rpmcounter++; rpmcounter++;
if (rpmcounter > 0xFE) if (rpmcounter > 0xFE)
rpmcounter = 0xF0; rpmcounter = 0xF0;
CanTxMessage msg(E90_RPM, 3); CanTxMessage msg(CanCategory::OBD, E90_RPM, 3);
msg[0] = rpmcounter; msg[0] = rpmcounter;
msg[1] = ((int)(Sensor::getOrZero(SensorType::Rpm)) * 4) & 0xFF; msg[1] = ((int)(Sensor::getOrZero(SensorType::Rpm)) * 4) & 0xFF;
msg[2] = ((int)(Sensor::getOrZero(SensorType::Rpm)) * 4) >> 8; msg[2] = ((int)(Sensor::getOrZero(SensorType::Rpm)) * 4) >> 8;
@ -421,7 +421,7 @@ void canDashboardBMWE90(CanCycle cycle)
tmp_cnt++; tmp_cnt++;
if (tmp_cnt >= 0x0F) if (tmp_cnt >= 0x0F)
tmp_cnt = 0x00; tmp_cnt = 0x00;
CanTxMessage msg(E90_TEMP, 8); CanTxMessage msg(CanCategory::OBD, E90_TEMP, 8);
msg[0] = (int)(Sensor::getOrZero(SensorType::Clt) + e90_temp_offset); //coolant msg[0] = (int)(Sensor::getOrZero(SensorType::Clt) + e90_temp_offset); //coolant
msg[1] = (int)(Sensor::getOrZero(SensorType::AuxTemp1) + e90_temp_offset); //oil (AuxTemp1) msg[1] = (int)(Sensor::getOrZero(SensorType::AuxTemp1) + e90_temp_offset); //oil (AuxTemp1)
msg[2] = tmp_cnt; msg[2] = tmp_cnt;
@ -439,7 +439,7 @@ void canDashboardBMWE90(CanCycle cycle)
seatbeltcnt++; seatbeltcnt++;
if (seatbeltcnt > 0xFE) if (seatbeltcnt > 0xFE)
seatbeltcnt = 0x00; seatbeltcnt = 0x00;
CanTxMessage msg(E90_SEATBELT_COUNTER, 2); CanTxMessage msg(CanCategory::NBC, E90_SEATBELT_COUNTER, 2);
msg[0] = seatbeltcnt; msg[0] = seatbeltcnt;
msg[1] = 0xFF; msg[1] = 0xFF;
} }
@ -452,7 +452,7 @@ void canDashboardBMWE90(CanCycle cycle)
brakecnt_1 = 0x0F; brakecnt_1 = 0x0F;
if (brakecnt_2 > 0xF0) if (brakecnt_2 > 0xF0)
brakecnt_2 = 0xA0; brakecnt_2 = 0xA0;
CanTxMessage msg(E90_BRAKE_COUNTER, 8); CanTxMessage msg(CanCategory::NBC, E90_BRAKE_COUNTER, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0xE0; msg[1] = 0xE0;
msg[2] = brakecnt_1; msg[2] = brakecnt_1;
@ -467,13 +467,13 @@ void canDashboardBMWE90(CanCycle cycle)
abscounter++; abscounter++;
if (abscounter > 0xFE) if (abscounter > 0xFE)
abscounter = 0xF0; abscounter = 0xF0;
CanTxMessage msg(E90_ABS_COUNTER, 2); CanTxMessage msg(CanCategory::NBC, E90_ABS_COUNTER, 2);
msg[0] = abscounter; msg[0] = abscounter;
msg[1] = 0xFF; msg[1] = 0xFF;
} }
{ //Fuel gauge { //Fuel gauge
CanTxMessage msg(E90_FUEL, 5); //fuel gauge CanTxMessage msg(CanCategory::NBC, E90_FUEL, 5); //fuel gauge
msg[0] = 0x76; msg[0] = 0x76;
msg[1] = 0x0F; msg[1] = 0x0F;
msg[2] = 0xBE; msg[2] = 0xBE;
@ -485,7 +485,7 @@ void canDashboardBMWE90(CanCycle cycle)
gear_cnt++; gear_cnt++;
if (gear_cnt >= 0x0F) if (gear_cnt >= 0x0F)
gear_cnt = 0x00; gear_cnt = 0x00;
CanTxMessage msg(E90_GEAR, 6); CanTxMessage msg(CanCategory::NBC, E90_GEAR, 6);
msg[0] = 0x78; msg[0] = 0x78;
msg[1] = 0x0F; msg[1] = 0x0F;
msg[2] = 0xFF; msg[2] = 0xFF;
@ -505,7 +505,7 @@ void canDashboardBMWE90(CanCycle cycle)
if(mph_counter >= 0xFFF0) if(mph_counter >= 0xFFF0)
mph_counter = 0xF000; mph_counter = 0xF000;
mph_timer = TIME_I2MS(chVTGetSystemTime()); mph_timer = TIME_I2MS(chVTGetSystemTime());
CanTxMessage msg(E90_SPEED, 8); CanTxMessage msg(CanCategory::NBC, E90_SPEED, 8);
msg[0] = mph_2a & 0xFF; msg[0] = mph_2a & 0xFF;
msg[1] = mph_2a >> 8; msg[1] = mph_2a >> 8;
msg[2] = mph_2a & 0xFF; msg[2] = mph_2a & 0xFF;
@ -521,7 +521,7 @@ void canDashboardBMWE90(CanCycle cycle)
if (!cluster_time_set) { if (!cluster_time_set) {
struct tm timp; struct tm timp;
date_get_tm(&timp); date_get_tm(&timp);
CanTxMessage msg(E90_TIME, 8); CanTxMessage msg(CanCategory::NBC, E90_TIME, 8);
msg[0] = timp.tm_hour; msg[0] = timp.tm_hour;
msg[1] = timp.tm_min; msg[1] = timp.tm_min;
msg[2] = timp.tm_sec; msg[2] = timp.tm_sec;
@ -542,7 +542,7 @@ void canDashboardHaltech(CanCycle cycle) {
if (cycle.isInterval(CI::_20ms)) { if (cycle.isInterval(CI::_20ms)) {
/* 0x360 - 50Hz rate */ /* 0x360 - 50Hz rate */
{ {
CanTxMessage msg(0x360, 8); CanTxMessage msg(CanCategory::NBC, 0x360, 8);
tmp = Sensor::getOrZero(SensorType::Rpm); tmp = Sensor::getOrZero(SensorType::Rpm);
/* RPM */ /* RPM */
msg[0] = (tmp >> 8); msg[0] = (tmp >> 8);
@ -562,7 +562,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x361 - 50Hz rate */ /* 0x361 - 50Hz rate */
{ {
CanTxMessage msg(0x361, 8); CanTxMessage msg(CanCategory::NBC, 0x361, 8);
/* Fuel pressure */ /* Fuel pressure */
tmp = (uint16_t)(Sensor::getOrZero(SensorType::FuelPressureLow)); tmp = (uint16_t)(Sensor::getOrZero(SensorType::FuelPressureLow));
msg[0] = (tmp >> 8); msg[0] = (tmp >> 8);
@ -582,7 +582,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x362 - 50Hz rate */ /* 0x362 - 50Hz rate */
{ {
CanTxMessage msg(0x362, 6); CanTxMessage msg(CanCategory::NBC, 0x362, 6);
/* Injection Stage 1 Duty Cycle - y = x/10 */ /* Injection Stage 1 Duty Cycle - y = x/10 */
uint16_t rpm = Sensor::getOrZero(SensorType::Rpm); uint16_t rpm = Sensor::getOrZero(SensorType::Rpm);
tmp = (uint16_t)( getInjectorDutyCycle(rpm) * 10) ; tmp = (uint16_t)( getInjectorDutyCycle(rpm) * 10) ;
@ -600,7 +600,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3E5 = 50Hz rate */ /* todo: 0x3E5 = 50Hz rate */
{ {
CanTxMessage msg(0x3E5, 8); CanTxMessage msg(CanCategory::NBC, 0x3E5, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -613,7 +613,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3EA = 50Hz rate */ /* todo: 0x3EA = 50Hz rate */
{ {
CanTxMessage msg(0x3EA, 8); CanTxMessage msg(CanCategory::NBC, 0x3EA, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -626,7 +626,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3EB = 50Hz rate */ /* todo: 0x3EB = 50Hz rate */
{ {
CanTxMessage msg(0x3EB, 8); CanTxMessage msg(CanCategory::NBC, 0x3EB, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -639,7 +639,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3EC = 50Hz rate */ /* todo: 0x3EC = 50Hz rate */
{ {
CanTxMessage msg(0x3EC, 8); CanTxMessage msg(CanCategory::NBC, 0x3EC, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -652,14 +652,14 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3ED = 50Hz rate */ /* todo: 0x3ED = 50Hz rate */
{ {
CanTxMessage msg(0x3ED, 2); CanTxMessage msg(CanCategory::NBC, 0x3ED, 2);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
} }
/* todo: 0x471 = 50Hz rate */ /* todo: 0x471 = 50Hz rate */
{ {
CanTxMessage msg(0x471, 2); CanTxMessage msg(CanCategory::NBC, 0x471, 2);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -671,7 +671,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x363 - 20Hz rate */ /* 0x363 - 20Hz rate */
{ {
CanTxMessage msg(0x363, 4); CanTxMessage msg(CanCategory::NBC, 0x363, 4);
/* Wheel Slip */ /* Wheel Slip */
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -682,7 +682,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x368 - 20Hz rate */ /* 0x368 - 20Hz rate */
{ {
CanTxMessage msg(0x368, 8); CanTxMessage msg(CanCategory::NBC, 0x368, 8);
/* Wideband Sensor 1 */ /* Wideband Sensor 1 */
tmp = (uint16_t)(Sensor::getOrZero(SensorType::Lambda1)) * 1000; tmp = (uint16_t)(Sensor::getOrZero(SensorType::Lambda1)) * 1000;
msg[0] = (tmp >> 8); msg[0] = (tmp >> 8);
@ -702,7 +702,7 @@ void canDashboardHaltech(CanCycle cycle) {
#if EFI_SHAFT_POSITION_INPUT #if EFI_SHAFT_POSITION_INPUT
/* 0x369 - 20Hz rate */ /* 0x369 - 20Hz rate */
{ {
CanTxMessage msg(0x369, 8); CanTxMessage msg(CanCategory::NBC, 0x369, 8);
/* Trigger System Error Count */ /* Trigger System Error Count */
tmp = engine->triggerCentral.triggerState.totalTriggerErrorCounter; tmp = engine->triggerCentral.triggerState.totalTriggerErrorCounter;
msg[0] = (tmp >> 8); msg[0] = (tmp >> 8);
@ -723,7 +723,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x36A - 20Hz rate */ /* 0x36A - 20Hz rate */
/* todo: one day we should split this */ /* todo: one day we should split this */
{ {
CanTxMessage msg(0x36A, 4); CanTxMessage msg(CanCategory::NBC, 0x36A, 4);
/* Knock Level 1 */ /* Knock Level 1 */
tmp = (engine->outputChannels.knockLevel * 100); tmp = (engine->outputChannels.knockLevel * 100);
msg[0] = (tmp >> 8); msg[0] = (tmp >> 8);
@ -735,7 +735,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x36B - 20Hz rate */ /* 0x36B - 20Hz rate */
{ {
CanTxMessage msg(0x36B, 8); CanTxMessage msg(CanCategory::NBC, 0x36B, 8);
/* Break Pressure */ /* Break Pressure */
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -752,7 +752,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x36C = 20Hz rate */ /* 0x36C = 20Hz rate */
{ {
CanTxMessage msg(0x36C, 8); CanTxMessage msg(CanCategory::NBC, 0x36C, 8);
/* Wheel Speed Front Left */ /* Wheel Speed Front Left */
auto vehicleSpeed = Sensor::getOrZero(SensorType::VehicleSpeed); auto vehicleSpeed = Sensor::getOrZero(SensorType::VehicleSpeed);
tmp = (vehicleSpeed * 10 ); tmp = (vehicleSpeed * 10 );
@ -771,7 +771,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x36D = 20Hz rate */ /* 0x36D = 20Hz rate */
{ {
CanTxMessage msg(0x36D, 8); CanTxMessage msg(CanCategory::NBC, 0x36D, 8);
/* Unused */ /* Unused */
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -787,7 +787,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x36E = 20Hz rate */ /* 0x36E = 20Hz rate */
{ {
CanTxMessage msg(0x36E, 8); CanTxMessage msg(CanCategory::NBC, 0x36E, 8);
/* Engine Limiting Active 0 = off/1=on*/ /* Engine Limiting Active 0 = off/1=on*/
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -804,7 +804,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x36F = 20Hz rate */ /* 0x36F = 20Hz rate */
{ {
CanTxMessage msg(0x36F, 4); CanTxMessage msg(CanCategory::NBC, 0x36F, 4);
/* Generic Output 1 Duty Cycle */ /* Generic Output 1 Duty Cycle */
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -815,7 +815,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x370 = 20Hz rate */ /* 0x370 = 20Hz rate */
{ {
CanTxMessage msg(0x370, 8); CanTxMessage msg(CanCategory::NBC, 0x370, 8);
/* Vehicle Speed */ /* Vehicle Speed */
auto vehicleSpeed = Sensor::getOrZero(SensorType::VehicleSpeed); auto vehicleSpeed = Sensor::getOrZero(SensorType::VehicleSpeed);
tmp = (vehicleSpeed * 10 ); tmp = (vehicleSpeed * 10 );
@ -834,7 +834,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3E6 = 20Hz rate */ /* todo: 0x3E6 = 20Hz rate */
{ {
CanTxMessage msg(0x3E6, 8); CanTxMessage msg(CanCategory::NBC, 0x3E6, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -847,7 +847,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3E7 = 20Hz rate */ /* todo: 0x3E7 = 20Hz rate */
{ {
CanTxMessage msg(0x3E7, 8); CanTxMessage msg(CanCategory::NBC, 0x3E7, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -860,7 +860,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3E8 = 20Hz rate */ /* todo: 0x3E8 = 20Hz rate */
{ {
CanTxMessage msg(0x3E8, 8); CanTxMessage msg(CanCategory::NBC, 0x3E8, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -873,7 +873,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3E9 = 20Hz rate */ /* todo: 0x3E9 = 20Hz rate */
{ {
CanTxMessage msg(0x3E9, 8); CanTxMessage msg(CanCategory::NBC, 0x3E9, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -886,7 +886,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3EE = 20Hz rate */ /* todo: 0x3EE = 20Hz rate */
{ {
CanTxMessage msg(0x3EE, 8); CanTxMessage msg(CanCategory::NBC, 0x3EE, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -899,7 +899,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3EF = 20Hz rate */ /* todo: 0x3EF = 20Hz rate */
{ {
CanTxMessage msg(0x3EF, 8); CanTxMessage msg(CanCategory::NBC, 0x3EF, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -912,7 +912,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x470 = 20Hz rate */ /* todo: 0x470 = 20Hz rate */
{ {
CanTxMessage msg(0x470, 8); CanTxMessage msg(CanCategory::NBC, 0x470, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -925,7 +925,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x472 = 20Hz rate */ /* todo: 0x472 = 20Hz rate */
{ {
CanTxMessage msg(0x472, 8); CanTxMessage msg(CanCategory::NBC, 0x472, 8);
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
msg[2] = 0x00; msg[2] = 0x00;
@ -941,7 +941,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x371 = 10Hz rate */ /* 0x371 = 10Hz rate */
{ {
CanTxMessage msg(0x371, 4); CanTxMessage msg(CanCategory::NBC, 0x371, 4);
/* Fuel Flow */ /* Fuel Flow */
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -952,7 +952,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x372 = 10Hz rate */ /* 0x372 = 10Hz rate */
{ {
CanTxMessage msg(0x372, 8); CanTxMessage msg(CanCategory::NBC, 0x372, 8);
/* Battery Voltage */ /* Battery Voltage */
tmp = (uint16_t)(Sensor::getOrZero(SensorType::BatteryVoltage) * 10); tmp = (uint16_t)(Sensor::getOrZero(SensorType::BatteryVoltage) * 10);
msg[0] = (tmp >> 8); msg[0] = (tmp >> 8);
@ -971,7 +971,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x373 = 10Hz rate */ /* 0x373 = 10Hz rate */
{ {
CanTxMessage msg(0x373, 8); CanTxMessage msg(CanCategory::NBC, 0x373, 8);
/* EGT1 */ /* EGT1 */
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -988,7 +988,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x374 = 10Hz rate */ /* 0x374 = 10Hz rate */
{ {
CanTxMessage msg(0x374, 8); CanTxMessage msg(CanCategory::NBC, 0x374, 8);
/* EGT5 */ /* EGT5 */
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -1005,7 +1005,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x375 = 10Hz rate */ /* 0x375 = 10Hz rate */
{ {
CanTxMessage msg(0x375, 8); CanTxMessage msg(CanCategory::NBC, 0x375, 8);
/* EGT9 */ /* EGT9 */
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -1022,7 +1022,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x376 = 10Hz rate */ /* 0x376 = 10Hz rate */
{ {
CanTxMessage msg(0x376, 8); CanTxMessage msg(CanCategory::NBC, 0x376, 8);
/* Ambient Air Temperature */ /* Ambient Air Temperature */
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -1041,7 +1041,7 @@ void canDashboardHaltech(CanCycle cycle) {
if (cycle.isInterval(CI::_200ms)) { if (cycle.isInterval(CI::_200ms)) {
/* 0x3E0 = 5Hz rate */ /* 0x3E0 = 5Hz rate */
{ {
CanTxMessage msg(0x3E0, 8); CanTxMessage msg(CanCategory::NBC, 0x3E0, 8);
/* Coolant temperature in K y = x/10 */ /* Coolant temperature in K y = x/10 */
tmp = ((Sensor::getOrZero(SensorType::Clt) + 273.15) * 10); tmp = ((Sensor::getOrZero(SensorType::Clt) + 273.15) * 10);
msg[0] = (tmp >> 8); msg[0] = (tmp >> 8);
@ -1060,7 +1060,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x3E1 = 5Hz rate */ /* 0x3E1 = 5Hz rate */
{ {
CanTxMessage msg(0x3E1, 6); CanTxMessage msg(CanCategory::NBC, 0x3E1, 6);
/* Gearbox Oil Temperature */ /* Gearbox Oil Temperature */
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -1074,7 +1074,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x3E2 = 5Hz rate */ /* 0x3E2 = 5Hz rate */
{ {
CanTxMessage msg(0x3E2, 2); CanTxMessage msg(CanCategory::NBC, 0x3E2, 2);
/* Fuel Level in Liters */ /* Fuel Level in Liters */
tmp = (Sensor::getOrZero(SensorType::FuelLevel)* 10); tmp = (Sensor::getOrZero(SensorType::FuelLevel)* 10);
msg[0] = (tmp >> 8); msg[0] = (tmp >> 8);
@ -1083,7 +1083,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* 0x3E3 = 5Hz rate */ /* 0x3E3 = 5Hz rate */
{ {
CanTxMessage msg(0x3E3, 8); CanTxMessage msg(CanCategory::NBC, 0x3E3, 8);
/* Fuel Trim Short Term Bank 1*/ /* Fuel Trim Short Term Bank 1*/
msg[0] = 0x00; msg[0] = 0x00;
msg[1] = 0x00; msg[1] = 0x00;
@ -1100,7 +1100,7 @@ void canDashboardHaltech(CanCycle cycle) {
/* todo: 0x3E4 = 5Hz rate */ /* todo: 0x3E4 = 5Hz rate */
{ {
CanTxMessage msg(0x3E4, 8); CanTxMessage msg(CanCategory::NBC, 0x3E4, 8);
msg[0] = 0x00; //unused msg[0] = 0x00; //unused
/* Switch status */ /* Switch status */
msg[1] = 0x00; msg[1] = 0x00;
@ -1247,14 +1247,14 @@ void canDashboardAim(CanCycle cycle) {
return; return;
} }
transmitStruct<Aim5f0>(0x5f0, false); transmitStruct<Aim5f0>(CanCategory::NBC, 0x5f0, false);
transmitStruct<Aim5f1>(0x5f1, false); transmitStruct<Aim5f1>(CanCategory::NBC, 0x5f1, false);
transmitStruct<Aim5f2>(0x5f2, false); transmitStruct<Aim5f2>(CanCategory::NBC, 0x5f2, false);
transmitStruct<Aim5f3>(0x5f3, false); transmitStruct<Aim5f3>(CanCategory::NBC, 0x5f3, false);
transmitStruct<Aim5f4>(0x5f4, false); transmitStruct<Aim5f4>(CanCategory::NBC, 0x5f4, false);
transmitStruct<Aim5f5>(0x5f5, false); transmitStruct<Aim5f5>(CanCategory::NBC, 0x5f5, false);
transmitStruct<Aim5f6>(0x5f6, false); transmitStruct<Aim5f6>(CanCategory::NBC, 0x5f6, false);
transmitStruct<Aim5f7>(0x5f7, false); transmitStruct<Aim5f7>(CanCategory::NBC, 0x5f7, false);
// there are more, but less important for us // there are more, but less important for us
// transmitStruct<Aim5f8>(0x5f8, false); // transmitStruct<Aim5f8>(0x5f8, false);

View File

@ -151,13 +151,13 @@ void sendCanVerbose() {
auto base = engineConfiguration->verboseCanBaseAddress; auto base = engineConfiguration->verboseCanBaseAddress;
auto isExt = engineConfiguration->rusefiVerbose29b; auto isExt = engineConfiguration->rusefiVerbose29b;
transmitStruct<Status> (base + 0, isExt); transmitStruct<Status> (CanCategory::VERBOSE, base + 0, isExt);
transmitStruct<Speeds> (base + 1, isExt); transmitStruct<Speeds> (CanCategory::VERBOSE, base + 1, isExt);
transmitStruct<PedalAndTps> (base + CAN_PEDAL_TPS_OFFSET, isExt); transmitStruct<PedalAndTps> (CanCategory::VERBOSE, base + CAN_PEDAL_TPS_OFFSET, isExt);
transmitStruct<Sensors1> (base + CAN_SENSOR_1_OFFSET, isExt); transmitStruct<Sensors1> (CanCategory::VERBOSE, base + CAN_SENSOR_1_OFFSET, isExt);
transmitStruct<Sensors2> (base + 4, isExt); transmitStruct<Sensors2> (CanCategory::VERBOSE, base + 4, isExt);
transmitStruct<Fueling> (base + 5, isExt); transmitStruct<Fueling> (CanCategory::VERBOSE, base + 5, isExt);
transmitStruct<Fueling2> (base + 6, isExt); transmitStruct<Fueling2> (CanCategory::VERBOSE, base + 6, isExt);
} }
#endif // EFI_CAN_SUPPORT #endif // EFI_CAN_SUPPORT

View File

@ -57,7 +57,7 @@ static const int16_t supportedPids4160[] = {
}; };
static void obdSendPacket(int mode, int PID, int numBytes, uint32_t iValue) { static void obdSendPacket(int mode, int PID, int numBytes, uint32_t iValue) {
CanTxMessage resp(OBD_TEST_RESPONSE); CanTxMessage resp(CanCategory::OBD, OBD_TEST_RESPONSE);
// write number of bytes // write number of bytes
resp[0] = (uint8_t)(2 + numBytes); resp[0] = (uint8_t)(2 + numBytes);

View File

@ -43,7 +43,7 @@ void updateWidebandFirmware() {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
{ {
// Send bootloader entry command // Send bootloader entry command
CanTxMessage m(0xEF0'0000, 0, true); CanTxMessage m(CanCategory::WBO_SERVICE, 0xEF0'0000, 0, true);
} }
if (!waitAck()) { if (!waitAck()) {
@ -59,7 +59,7 @@ void updateWidebandFirmware() {
{ {
// Erase flash - opcode 1, magic value 0x5A5A // Erase flash - opcode 1, magic value 0x5A5A
CanTxMessage m(0xEF1'5A5A, 0, true); CanTxMessage m(CanCategory::WBO_SERVICE, 0xEF1'5A5A, 0, true);
} }
if (!waitAck()) { if (!waitAck()) {
@ -74,7 +74,7 @@ void updateWidebandFirmware() {
// Send flash data 8 bytes at a time // Send flash data 8 bytes at a time
for (size_t i = 0; i < totalSize; i += 8) { for (size_t i = 0; i < totalSize; i += 8) {
{ {
CanTxMessage m(0xEF2'0000 + i, 8, true); CanTxMessage m(CanCategory::WBO_SERVICE, 0xEF2'0000 + i, 8, true);
memcpy(&m[0], build_wideband_image_bin + i, 8); memcpy(&m[0], build_wideband_image_bin + i, 8);
} }
@ -88,7 +88,7 @@ void updateWidebandFirmware() {
{ {
// Reboot to firmware! // Reboot to firmware!
CanTxMessage m(0xEF3'0000, 0, true); CanTxMessage m(CanCategory::WBO_SERVICE, 0xEF3'0000, 0, true);
} }
waitAck(); waitAck();
@ -109,7 +109,7 @@ void setWidebandOffset(uint8_t index) {
efiPrintf("Setting all connected widebands to index %d...", index); efiPrintf("Setting all connected widebands to index %d...", index);
{ {
CanTxMessage m(0xEF4'0000, 1, true); CanTxMessage m(CanCategory::WBO_SERVICE, 0xEF4'0000, 1, true);
m[0] = index; m[0] = index;
} }
@ -121,7 +121,7 @@ void setWidebandOffset(uint8_t index) {
} }
void sendWidebandInfo() { void sendWidebandInfo() {
CanTxMessage m(0xEF5'0000, 2, true); CanTxMessage m(CanCategory::WBO_SERVICE, 0xEF5'0000, 2, true);
float vbatt = Sensor::getOrZero(SensorType::BatteryVoltage) * 10; float vbatt = Sensor::getOrZero(SensorType::BatteryVoltage) * 10;

View File

@ -175,7 +175,7 @@ static int lua_txCan(lua_State* l) {
} }
// conform ext parameter to true/false // conform ext parameter to true/false
CanTxMessage msg(id, 8, ext == 0 ? false : true); CanTxMessage msg(CanCategory::LUA, id, 8, ext == 0 ? false : true);
msg.busIndex = channel - HUMAN_OFFSET; msg.busIndex = channel - HUMAN_OFFSET;
// Unfortunately there is no way to inspect the length of a table, // Unfortunately there is no way to inspect the length of a table,

View File

@ -82,7 +82,7 @@ public:
CanListener* request() override { CanListener* request() override {
{ {
CanTxMessage msg(OBD_TEST_REQUEST); CanTxMessage msg(CanCategory::OBD, OBD_TEST_REQUEST);
msg[0] = _OBD_2; msg[0] = _OBD_2;
msg[1] = OBD_CURRENT_DATA; msg[1] = OBD_CURRENT_DATA;
msg[2] = PID; msg[2] = PID;

View File

@ -22,7 +22,7 @@
} }
#endif // EFI_CAN_SUPPORT #endif // EFI_CAN_SUPPORT
CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc, bool isExtended) { CanTxMessage::CanTxMessage(CanCategory category, uint32_t eid, uint8_t dlc, bool isExtended) {
#if HAL_USE_CAN || EFI_UNIT_TEST #if HAL_USE_CAN || EFI_UNIT_TEST
#ifndef STM32H7XX #ifndef STM32H7XX
// ST bxCAN device // ST bxCAN device

View File

@ -15,6 +15,16 @@
#include "os_access.h" #include "os_access.h"
#include "can.h" #include "can.h"
enum class CanCategory : uint16_t {
NBC = 0,
VERBOSE = 1,
LUA = 2,
DOWNSTREAM_FLASHING = 3,
SERIAL = 4,
WBO_SERVICE = 5,
OBD = 6,
};
/** /**
* Represent a message to be transmitted over CAN. * Represent a message to be transmitted over CAN.
* *
@ -29,7 +39,7 @@ public:
/** /**
* Create a new CAN message, with the specified extended ID. * Create a new CAN message, with the specified extended ID.
*/ */
explicit CanTxMessage(uint32_t eid, uint8_t dlc = 8, bool isExtended = false); explicit CanTxMessage(CanCategory category, uint32_t eid, uint8_t dlc = 8, bool isExtended = false);
/** /**
* Destruction of an instance of CanTxMessage will transmit the message over the wire. * Destruction of an instance of CanTxMessage will transmit the message over the wire.
@ -90,7 +100,7 @@ class CanTxTyped final : public CanTxMessage
#endif // EFI_CAN_SUPPORT #endif // EFI_CAN_SUPPORT
public: public:
explicit CanTxTyped(uint32_t id, bool isExtended) : CanTxMessage(id, sizeof(TData), isExtended) { } explicit CanTxTyped(CanCategory category, uint32_t id, bool isExtended) : CanTxMessage(category, id, sizeof(TData), isExtended) { }
#if EFI_CAN_SUPPORT #if EFI_CAN_SUPPORT
/** /**
@ -111,9 +121,9 @@ public:
}; };
template <typename TData> template <typename TData>
void transmitStruct(uint32_t id, bool isExtended) void transmitStruct(CanCategory category, uint32_t id, bool isExtended)
{ {
CanTxTyped<TData> frame(id, isExtended); CanTxTyped<TData> frame(category, id, isExtended);
// Destruction of an instance of CanTxMessage will transmit the message over the wire. // Destruction of an instance of CanTxMessage will transmit the message over the wire.
// see CanTxMessage::~CanTxMessage() // see CanTxMessage::~CanTxMessage()
populateFrame(frame.get()); populateFrame(frame.get());