Remove some runtime float conversions with explicit casts

pull/141/head
Yuri D'Elia 2022-09-14 01:15:07 +02:00 committed by DRracer
parent 30e440e829
commit 1f2085e8c6
3 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ void logic::FeedToBondtech::GoToPushToNozzle() {
}
void FeedToBondtech::UpdateBowdenLength(int32_t measuredBowdenLength) {
if (measuredBowdenLength < config::maximumBowdenLength.v) { // is the measured length any valid/acceptable?
if (measuredBowdenLength < (int32_t)config::maximumBowdenLength.v) { // is the measured length any valid/acceptable?
static_assert(config::maximumBowdenLength.v <= 65535, "Max bowden length too long");
int16_t mbl = (int16_t)measuredBowdenLength;
int16_t difference = abs(mbl - mps::BowdenLength::Get(mg::globals.ActiveSlot()));

View File

@ -37,7 +37,7 @@ void Idler::PlanHomingMoveBack() {
bool Idler::FinishHomingAndPlanMoveToParkPos() {
// check the axis' length
int32_t axisEnd = mm::axisUnitToTruncatedUnit<config::U_deg>(mm::motion.CurPosition<mm::Idler>());
if (abs(axisEnd - axisStart) < (config::idlerLimits.lenght.v - 10)) { //@@TODO is 10 degrees ok?
if (abs(axisEnd - axisStart) < (int32_t)(config::idlerLimits.lenght.v - 10)) { //@@TODO is 10 degrees ok?
return false; // we couldn't home correctly, we cannot set the Idler's position
}

View File

@ -36,7 +36,7 @@ void Selector::PlanHomingMoveBack() {
bool Selector::FinishHomingAndPlanMoveToParkPos() {
// check the axis' length
int32_t axisEnd = mm::axisUnitToTruncatedUnit<config::U_mm>(mm::motion.CurPosition<mm::Selector>());
if (abs(axisEnd - axisStart) < (config::selectorLimits.lenght.v - 3)) { //@@TODO is 3mm ok?
if (abs(axisEnd - axisStart) < (int32_t)(config::selectorLimits.lenght.v - 3)) { //@@TODO is 3mm ok?
return false; // we couldn't home correctly, we cannot set the Selector's position
}