Skip to content

Commit

Permalink
Fix warning/error with use of max() and signed variable
Browse files Browse the repository at this point in the history
  • Loading branch information
noisymime committed Jan 13, 2024
1 parent cbf87fb commit f14edc6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion speeduino/speeduino.ino
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void loop(void)
//***********************************************************************************************
//BEGIN INJECTION TIMING
currentStatus.injAngle = table2D_getValue(&injectorAngleTable, currentStatus.RPMdiv100);
currentStatus.injAngle = max(currentStatus.injAngle, CRANK_ANGLE_MAX_INJ);
currentStatus.injAngle = max(currentStatus.injAngle, uint16_t(CRANK_ANGLE_MAX_INJ) );
unsigned int PWdivTimerPerDegree = timeToAngleDegPerMicroSec(currentStatus.PW1); //How many crank degrees the calculated PW will take at the current speed

injector1StartAngle = calculateInjectorStartAngle(PWdivTimerPerDegree, channel1InjDegrees, currentStatus.injAngle);
Expand Down

2 comments on commit f14edc6

@adbancroft
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noisymime Won't this set the injection angle to CRANK_ANGLE_MAX_INJ every time? Should it be min(currentStatus.injAngle, uint16_t(CRANK_ANGLE_MAX_INJ) );?

@noisymime
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noisymime Won't this set the injection angle to CRANK_ANGLE_MAX_INJ every time? Should it be min(currentStatus.injAngle, uint16_t(CRANK_ANGLE_MAX_INJ) );?

This has already been updated: https://github.com/noisymime/speeduino/blob/63a1a1c4f5ece413b46a18036428a20199b796ee/speeduino/speeduino.ino#L482

Please sign in to comment.