-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed FOME CAN data bus selection #275
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,17 +216,18 @@ static void populateFrame(Odometry& msg) { | |
void sendCanVerbose() { | ||
auto base = engineConfiguration->verboseCanBaseAddress; | ||
auto isExt = engineConfiguration->rusefiVerbose29b; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. omg the tabs! 😆 |
||
transmitStruct<Status> (base + 0, isExt); | ||
transmitStruct<Speeds> (base + 1, isExt); | ||
transmitStruct<PedalAndTps> (base + CAN_PEDAL_TPS_OFFSET, isExt); | ||
transmitStruct<Sensors1> (base + CAN_SENSOR_1_OFFSET, isExt); | ||
transmitStruct<Sensors2> (base + 4, isExt); | ||
transmitStruct<Fueling> (base + 5, isExt); | ||
transmitStruct<Fueling2> (base + 6, isExt); | ||
transmitStruct<Fueling3> (base + 7, isExt); | ||
transmitStruct<Cams> (base + 8, isExt); | ||
transmitStruct<Odometry> (base + 9, isExt); | ||
auto canChannel = engineConfiguration->canBroadcastUseChannelTwo; | ||
|
||
transmitStruct<Status> (base + 0, isExt, canChannel); | ||
transmitStruct<Speeds> (base + 1, isExt, canChannel); | ||
transmitStruct<PedalAndTps> (base + CAN_PEDAL_TPS_OFFSET, isExt, canChannel); | ||
transmitStruct<Sensors1> (base + CAN_SENSOR_1_OFFSET, isExt, canChannel); | ||
transmitStruct<Sensors2> (base + 4, isExt, canChannel); | ||
transmitStruct<Fueling> (base + 5, isExt, canChannel); | ||
transmitStruct<Fueling2> (base + 6, isExt, canChannel); | ||
transmitStruct<Fueling3> (base + 7, isExt, canChannel); | ||
transmitStruct<Cams> (base + 8, isExt, canChannel); | ||
transmitStruct<Odometry> (base + 9, isExt, canChannel); | ||
} | ||
|
||
#endif // EFI_CAN_SUPPORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,7 @@ class CanTxTyped final : public CanTxMessage | |
#endif // EFI_CAN_SUPPORT | ||
|
||
public: | ||
explicit CanTxTyped(uint32_t id, bool isExtended) : CanTxMessage(id, sizeof(TData), isExtended) { } | ||
explicit CanTxTyped(uint32_t id, bool isExtended, bool canChannel) : CanTxMessage(id, sizeof(TData), canChannel, isExtended) { } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bool to size_t conversion heh? |
||
|
||
#if EFI_CAN_SUPPORT | ||
/** | ||
|
@@ -112,9 +112,9 @@ class CanTxTyped final : public CanTxMessage | |
}; | ||
|
||
template <typename TData> | ||
void transmitStruct(uint32_t id, bool isExtended) | ||
void transmitStruct(uint32_t id, bool isExtended, bool canChannel) | ||
{ | ||
CanTxTyped<TData> frame(id, isExtended); | ||
CanTxTyped<TData> frame(id, isExtended, canChannel); | ||
// Destruction of an instance of CanTxMessage will transmit the message over the wire. | ||
// see CanTxMessage::~CanTxMessage() | ||
populateFrame(frame.get()); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not "canChannel" a less than ideal name for "use second channel"? also what if soon more than two buses would be supported? A few of stm32f7 have three CAN buses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now
canBroadcastUseChannelTwo
is a Bool, CAN 2 is atrue / 1
so when more CAN buses are added we can switch to a int which keeps the logic the same.0 -> CAN1
1 -> CAN2
2 -> CAN3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why not "size_t busIndex = engineConfiguration->canBroadcastUseChannelTwo;" to keep the... technical debt most localized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, that was going to be my next comment, we should really be doing
size_t busIndex = engineConfiguration->canBroadcastUseChannelTwo ? 1 : 0