optimisation: compare uint16_t against uint16_t

AxisDistance returns uint16_t type and is currently compared with long double axis length. The axis lengths fit easily into uint16_t:

selectorLimits.lenght = 75
idlerLimits.lenght = 225

Change in memory:
Flash: -122 bytes
SRAM: 0 bytes
pull/335/head
Guðni Már Gilbert 2024-12-22 01:28:30 +00:00
parent 0a205e41ff
commit 362e56aaf0
2 changed files with 2 additions and 2 deletions

View File

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

View File

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