mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-03-10 08:32:54 +00:00
🎨 Use LIMIT macro
This commit is contained in:
parent
c4ac8a2573
commit
071d54ec70
5 changed files with 8 additions and 16 deletions
Marlin/src
|
@ -4229,8 +4229,7 @@ void CrealityDWINClass::Value_Control() {
|
|||
if (funcpointer) funcpointer();
|
||||
return;
|
||||
}
|
||||
NOLESS(tempvalue, (valuemin * valueunit));
|
||||
NOMORE(tempvalue, (valuemax * valueunit));
|
||||
LIMIT(tempvalue, valuemin * valueunit, valuemax * valueunit);
|
||||
Draw_Float(tempvalue / valueunit, selection - scrollpos, true, valueunit);
|
||||
DWIN_UpdateLCD();
|
||||
if (active_menu == Move && livemove) {
|
||||
|
@ -4272,8 +4271,7 @@ void CrealityDWINClass::Option_Control() {
|
|||
DWIN_UpdateLCD();
|
||||
return;
|
||||
}
|
||||
NOLESS(tempvalue, valuemin);
|
||||
NOMORE(tempvalue, valuemax);
|
||||
LIMIT(tempvalue, valuemin, valuemax);
|
||||
Draw_Option(tempvalue, static_cast<const char * const *>(valuepointer), selection - scrollpos, true);
|
||||
DWIN_UpdateLCD();
|
||||
}
|
||||
|
|
|
@ -117,13 +117,11 @@ void BrickoutGame::game_screen() {
|
|||
}
|
||||
else if (diff <= 3) {
|
||||
bdat.ballh += fixed_t(random(-64, 0));
|
||||
NOLESS(bdat.ballh, BTOF(-2));
|
||||
NOMORE(bdat.ballh, BTOF(2));
|
||||
LIMIT(bdat.ballh, BTOF(-2), BTOF(2));
|
||||
}
|
||||
else if (diff >= PADDLE_W-1 - 3) {
|
||||
bdat.ballh += fixed_t(random( 0, 64));
|
||||
NOLESS(bdat.ballh, BTOF(-2));
|
||||
NOMORE(bdat.ballh, BTOF(2));
|
||||
LIMIT(bdat.ballh, BTOF(-2), BTOF(2));
|
||||
}
|
||||
|
||||
// Paddle hit after clearing the board? Reset the board.
|
||||
|
|
|
@ -50,8 +50,7 @@
|
|||
if (ui.encoderPosition) {
|
||||
zvar += float(int32_t(ui.encoderPosition)) * 0.1;
|
||||
ui.encoderPosition = 0;
|
||||
NOLESS(zvar, 0);
|
||||
NOMORE(zvar, Z_MAX_POS);
|
||||
LIMIT(zvar, 0, Z_MAX_POS);
|
||||
}
|
||||
|
||||
if (ui.should_draw()) {
|
||||
|
|
|
@ -113,10 +113,8 @@ void Touch::idle() {
|
|||
if (x != 0 && y != 0) {
|
||||
if (current_control) {
|
||||
if (WITHIN(x, current_control->x - FREE_MOVE_RANGE, current_control->x + current_control->width + FREE_MOVE_RANGE) && WITHIN(y, current_control->y - FREE_MOVE_RANGE, current_control->y + current_control->height + FREE_MOVE_RANGE)) {
|
||||
NOLESS(x, current_control->x);
|
||||
NOMORE(x, current_control->x + current_control->width);
|
||||
NOLESS(y, current_control->y);
|
||||
NOMORE(y, current_control->y + current_control->height);
|
||||
LIMIT(x, current_control->x, current_control->x + current_control->width);
|
||||
LIMIT(y, current_control->y, current_control->y + current_control->height);
|
||||
touch(current_control);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -3441,8 +3441,7 @@ void Planner::set_max_feedrate(const AxisEnum axis, float inMaxFeedrateMMS) {
|
|||
// Doesn't matter because block_buffer_runtime_us is already too small an estimation.
|
||||
bbru >>= 10;
|
||||
// limit to about a minute.
|
||||
NOMORE(bbru, 0x0000FFFFUL);
|
||||
return bbru;
|
||||
return _MIN(bbru, 0x0000FFFFUL);
|
||||
}
|
||||
|
||||
void Planner::clear_block_buffer_runtime() {
|
||||
|
|
Loading…
Add table
Reference in a new issue