Fixing compilation error in some platforms due to invalid conversion in setNormalOneShotMode() #130
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.
Pull request #128 gave compilation errors on some platforms, an invalid conversion in setNormalOneShotMode()
In Arduino 2.3.5 with Preferences->Compiler Warnings->All did not complain at all
In Arduino 1.8.19 with Preferences->Compiler Warnings->All throws that same message as a warning, not an error.
The error is here:
MCP2515::ERROR MCP2515::setNormalOneShotMode()
{
return setMode(CANCTRL_REQOP_NORMAL | CANCTRL_OSM);
}
The setMode function expects a (CANCTRL_REQOP_MODE) where the | operand returns an int
Since CANCTRL_REQOP_NORMAL is defined as 0x00; this error can be fixed by adding CANCTRL_REQOP_OSM to the CANCTRL_REQOP_MODE enum.
in mcp2515.h
and changing in mcp2515.cpp
MCP2515::ERROR MCP2515::setNormalOneShotMode()
{
return setMode(CANCTRL_REQOP_OSM);
}
Now it compiles without warnings/errors.