Fixed CAN data bus selection

* Fixed CAN data bus selection

* Made canChannel non-optional
This commit is contained in:
Stefan de Kraker 2023-10-30 21:42:52 -04:00 committed by rusefi
parent f5c03ce394
commit 4b64e0e087
4 changed files with 30 additions and 26 deletions

View File

@ -1246,14 +1246,16 @@ void canDashboardAim(CanCycle cycle) {
return;
}
transmitStruct<Aim5f0>(CanCategory::NBC, 0x5f0, false);
transmitStruct<Aim5f1>(CanCategory::NBC, 0x5f1, false);
transmitStruct<Aim5f2>(CanCategory::NBC, 0x5f2, false);
transmitStruct<Aim5f3>(CanCategory::NBC, 0x5f3, false);
transmitStruct<Aim5f4>(CanCategory::NBC, 0x5f4, false);
transmitStruct<Aim5f5>(CanCategory::NBC, 0x5f5, false);
transmitStruct<Aim5f6>(CanCategory::NBC, 0x5f6, false);
transmitStruct<Aim5f7>(CanCategory::NBC, 0x5f7, false);
auto canChannel = engineConfiguration->canBroadcastUseChannelTwo;
transmitStruct<Aim5f0>(CanCategory::NBC, 0x5f0, false, canChannel);
transmitStruct<Aim5f1>(CanCategory::NBC, 0x5f1, false, canChannel);
transmitStruct<Aim5f2>(CanCategory::NBC, 0x5f2, false, canChannel);
transmitStruct<Aim5f3>(CanCategory::NBC, 0x5f3, false, canChannel);
transmitStruct<Aim5f4>(CanCategory::NBC, 0x5f4, false, canChannel);
transmitStruct<Aim5f5>(CanCategory::NBC, 0x5f5, false, canChannel);
transmitStruct<Aim5f6>(CanCategory::NBC, 0x5f6, false, canChannel);
transmitStruct<Aim5f7>(CanCategory::NBC, 0x5f7, false, canChannel);
// there are more, but less important for us
// transmitStruct<Aim5f8>(0x5f8, false);

View File

@ -120,11 +120,12 @@ void canDashboardTS(CanCycle cycle) {
return;
}
transmitStruct<ms1512>(CanCategory::NBC, baseId + 0, false);
transmitStruct<ms1513>(CanCategory::NBC, baseId + 1, false);
transmitStruct<ms1514>(CanCategory::NBC, baseId + 2, false);
transmitStruct<ms1515>(CanCategory::NBC, baseId + 3, false);
transmitStruct<ms1516>(CanCategory::NBC, baseId + 4, false);
bool busIndex = 0;
transmitStruct<ms1512>(CanCategory::NBC, baseId + 0, false, busIndex);
transmitStruct<ms1513>(CanCategory::NBC, baseId + 1, false, busIndex);
transmitStruct<ms1514>(CanCategory::NBC, baseId + 2, false, busIndex);
transmitStruct<ms1515>(CanCategory::NBC, baseId + 3, false, busIndex);
transmitStruct<ms1516>(CanCategory::NBC, baseId + 4, false, busIndex);
}
#endif /* EFI_CAN_SUPPORT */

View File

@ -216,17 +216,18 @@ static void populateFrame(Odometry& msg) {
void sendCanVerbose() {
auto base = engineConfiguration->verboseCanBaseAddress;
auto isExt = engineConfiguration->rusefiVerbose29b;
auto canChannel = engineConfiguration->canBroadcastUseChannelTwo;
transmitStruct<Status> (CanCategory::VERBOSE, base + 0, isExt);
transmitStruct<Speeds> (CanCategory::VERBOSE, base + 1, isExt);
transmitStruct<PedalAndTps> (CanCategory::VERBOSE, base + CAN_PEDAL_TPS_OFFSET, isExt);
transmitStruct<Sensors1> (CanCategory::VERBOSE, base + CAN_SENSOR_1_OFFSET, isExt);
transmitStruct<Sensors2> (CanCategory::VERBOSE, base + 4, isExt);
transmitStruct<Fueling> (CanCategory::VERBOSE, base + 5, isExt);
transmitStruct<Fueling2> (CanCategory::VERBOSE, base + 6, isExt);
transmitStruct<Fueling3> (CanCategory::VERBOSE, base + 7, isExt);
transmitStruct<Cams> (CanCategory::VERBOSE, base + 8, isExt);
transmitStruct<Odometry> (CanCategory::VERBOSE, base + 9, isExt);
transmitStruct<Status> (CanCategory::VERBOSE, base + 0, isExt, canChannel);
transmitStruct<Speeds> (CanCategory::VERBOSE, base + 1, isExt, canChannel);
transmitStruct<PedalAndTps> (CanCategory::VERBOSE, base + CAN_PEDAL_TPS_OFFSET, isExt, canChannel);
transmitStruct<Sensors1> (CanCategory::VERBOSE, base + CAN_SENSOR_1_OFFSET, isExt, canChannel);
transmitStruct<Sensors2> (CanCategory::VERBOSE, base + 4, isExt, canChannel);
transmitStruct<Fueling> (CanCategory::VERBOSE, base + 5, isExt, canChannel);
transmitStruct<Fueling2> (CanCategory::VERBOSE, base + 6, isExt, canChannel);
transmitStruct<Fueling3> (CanCategory::VERBOSE, base + 7, isExt, canChannel);
transmitStruct<Cams> (CanCategory::VERBOSE, base + 8, isExt, canChannel);
transmitStruct<Odometry> (CanCategory::VERBOSE, base + 9, isExt, canChannel);
}
#endif // EFI_CAN_SUPPORT

View File

@ -94,7 +94,7 @@ class CanTxTyped final : public CanTxMessage
#endif // EFI_CAN_SUPPORT
public:
explicit CanTxTyped(CanCategory category, uint32_t id, bool isExtended) : CanTxMessage(category, id, sizeof(TData), isExtended) { }
explicit CanTxTyped(CanCategory category, uint32_t id, bool isExtended, bool canChannel) : CanTxMessage(category, id, sizeof(TData), isExtended) { }
#if EFI_CAN_SUPPORT
/**
@ -115,9 +115,9 @@ public:
};
template <typename TData>
void transmitStruct(CanCategory category, uint32_t id, bool isExtended)
void transmitStruct(CanCategory category, uint32_t id, bool isExtended, bool canChannel)
{
CanTxTyped<TData> frame(category, id, isExtended);
CanTxTyped<TData> frame(category, id, isExtended, canChannel);
// Destruction of an instance of CanTxMessage will transmit the message over the wire.
// see CanTxMessage::~CanTxMessage()
populateFrame(frame.get());