mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 13:56:24 +00:00
🎨 abs => ABS
This commit is contained in:
parent
14d40fb957
commit
84ca21edf7
@ -143,13 +143,13 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) {
|
||||
// Sanity check
|
||||
for (calib_idx = 0; calib_idx < measurements; ++calib_idx) {
|
||||
// Restrict the max. offset
|
||||
if (abs(data[calib_idx]) > 2000) {
|
||||
if (ABS(data[calib_idx]) > 2000) {
|
||||
SERIAL_ECHOLNPGM("!Invalid Z-offset detected (0-2).");
|
||||
clear_offsets(tsi);
|
||||
return false;
|
||||
}
|
||||
// Restrict the max. offset difference between two probings
|
||||
if (calib_idx > 0 && abs(data[calib_idx - 1] - data[calib_idx]) > 800) {
|
||||
if (calib_idx > 0 && ABS(data[calib_idx - 1] - data[calib_idx]) > 800) {
|
||||
SERIAL_ECHOLNPGM("!Invalid Z-offset between two probings detected (0-0.8).");
|
||||
clear_offsets(TSI_PROBE);
|
||||
return false;
|
||||
|
@ -130,7 +130,7 @@ void GcodeSuite::G35() {
|
||||
// Calculate adjusts
|
||||
LOOP_S_L_N(i, 1, G35_PROBE_COUNT) {
|
||||
const float diff = z_measured[0] - z_measured[i],
|
||||
adjust = abs(diff) < 0.001f ? 0 : diff / threads_factor[(screw_thread - 30) / 10];
|
||||
adjust = ABS(diff) < 0.001f ? 0 : diff / threads_factor[(screw_thread - 30) / 10];
|
||||
|
||||
const int full_turns = trunc(adjust);
|
||||
const float decimal_part = adjust - float(full_turns);
|
||||
@ -138,8 +138,8 @@ void GcodeSuite::G35() {
|
||||
|
||||
SERIAL_ECHOPGM("Turn ");
|
||||
SERIAL_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i]));
|
||||
SERIAL_ECHOPAIR(" ", (screw_thread & 1) == (adjust > 0) ? "CCW" : "CW", " by ", abs(full_turns), " turns");
|
||||
if (minutes) SERIAL_ECHOPAIR(" and ", abs(minutes), " minutes");
|
||||
SERIAL_ECHOPAIR(" ", (screw_thread & 1) == (adjust > 0) ? "CCW" : "CW", " by ", ABS(full_turns), " turns");
|
||||
if (minutes) SERIAL_ECHOPAIR(" and ", ABS(minutes), " minutes");
|
||||
if (ENABLED(REPORT_TRAMMING_MM)) SERIAL_ECHOPAIR(" (", -diff, "mm)");
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ ENCODER_DiffState Encoder_ReceiveAnalyze() {
|
||||
lastEncoderBits = newbutton;
|
||||
}
|
||||
|
||||
if (abs(temp_diff) >= ENCODER_PULSES_PER_STEP) {
|
||||
if (ABS(temp_diff) >= ENCODER_PULSES_PER_STEP) {
|
||||
if (temp_diff > 0) temp_diffState = ENCODER_DIFF_CW;
|
||||
else temp_diffState = ENCODER_DIFF_CCW;
|
||||
|
||||
|
@ -624,25 +624,25 @@ void DGUSScreenHandler::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_pt
|
||||
|
||||
switch (point_value) {
|
||||
case 0x0001:
|
||||
enqueue_corner_move(X_MIN_POS + abs(mks_corner_offsets[0].x),
|
||||
Y_MIN_POS + abs(mks_corner_offsets[0].y), level_speed);
|
||||
enqueue_corner_move(X_MIN_POS + ABS(mks_corner_offsets[0].x),
|
||||
Y_MIN_POS + ABS(mks_corner_offsets[0].y), level_speed);
|
||||
queue.enqueue_now_P(PSTR("G28Z"));
|
||||
break;
|
||||
case 0x0002:
|
||||
enqueue_corner_move(X_MAX_POS - abs(mks_corner_offsets[1].x),
|
||||
Y_MIN_POS + abs(mks_corner_offsets[1].y), level_speed);
|
||||
enqueue_corner_move(X_MAX_POS - ABS(mks_corner_offsets[1].x),
|
||||
Y_MIN_POS + ABS(mks_corner_offsets[1].y), level_speed);
|
||||
break;
|
||||
case 0x0003:
|
||||
enqueue_corner_move(X_MAX_POS - abs(mks_corner_offsets[2].x),
|
||||
Y_MAX_POS - abs(mks_corner_offsets[2].y), level_speed);
|
||||
enqueue_corner_move(X_MAX_POS - ABS(mks_corner_offsets[2].x),
|
||||
Y_MAX_POS - ABS(mks_corner_offsets[2].y), level_speed);
|
||||
break;
|
||||
case 0x0004:
|
||||
enqueue_corner_move(X_MIN_POS + abs(mks_corner_offsets[3].x),
|
||||
Y_MAX_POS - abs(mks_corner_offsets[3].y), level_speed);
|
||||
enqueue_corner_move(X_MIN_POS + ABS(mks_corner_offsets[3].x),
|
||||
Y_MAX_POS - ABS(mks_corner_offsets[3].y), level_speed);
|
||||
break;
|
||||
case 0x0005:
|
||||
enqueue_corner_move(abs(mks_corner_offsets[4].x),
|
||||
abs(mks_corner_offsets[4].y), level_speed);
|
||||
enqueue_corner_move(ABS(mks_corner_offsets[4].x),
|
||||
ABS(mks_corner_offsets[4].y), level_speed);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ float BaseMoveAxisScreen::getManualFeedrate(uint8_t axis, float increment_mm) {
|
||||
// being held down, this allows enough margin for the planner to
|
||||
// connect segments and even out the motion.
|
||||
constexpr xyze_feedrate_t max_manual_feedrate = MANUAL_FEEDRATE;
|
||||
return min(max_manual_feedrate[axis] / 60.0f, abs(increment_mm * (TOUCH_REPEATS_PER_SECOND) * 0.80f));
|
||||
return min(max_manual_feedrate[axis] / 60.0f, ABS(increment_mm * (TOUCH_REPEATS_PER_SECOND) * 0.80f));
|
||||
}
|
||||
|
||||
void BaseMoveAxisScreen::setManualFeedrate(ExtUI::axis_t axis, float increment_mm) {
|
||||
|
@ -93,9 +93,9 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||
has_adjust_z = 1;
|
||||
break;
|
||||
case ID_BABY_STEP_DIST:
|
||||
if (abs((int)(100 * babystep_dist)) == 1)
|
||||
if (ABS((int)(100 * babystep_dist)) == 1)
|
||||
babystep_dist = 0.05;
|
||||
else if (abs((int)(100 * babystep_dist)) == 5)
|
||||
else if (ABS((int)(100 * babystep_dist)) == 5)
|
||||
babystep_dist = 0.1;
|
||||
else
|
||||
babystep_dist = 0.01;
|
||||
|
@ -519,7 +519,7 @@ void filament_dialog_handle() {
|
||||
|
||||
if (uiCfg.filament_load_heat_flg) {
|
||||
const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
|
||||
if (abs(diff) < 2 || diff > 0) {
|
||||
if (ABS(diff) < 2 || diff > 0) {
|
||||
uiCfg.filament_load_heat_flg = false;
|
||||
lv_clear_dialog();
|
||||
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
|
||||
@ -535,7 +535,7 @@ void filament_dialog_handle() {
|
||||
|
||||
if (uiCfg.filament_unload_heat_flg) {
|
||||
const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
|
||||
if (abs(diff) < 2 || diff > 0) {
|
||||
if (ABS(diff) < 2 || diff > 0) {
|
||||
uiCfg.filament_unload_heat_flg = false;
|
||||
lv_clear_dialog();
|
||||
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
|
||||
|
@ -89,7 +89,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||
disp_extru_amount();
|
||||
break;
|
||||
case ID_E_STEP:
|
||||
switch (abs(uiCfg.extruStep)) {
|
||||
switch (ABS(uiCfg.extruStep)) {
|
||||
case 1: uiCfg.extruStep = 5; break;
|
||||
case 5: uiCfg.extruStep = 10; break;
|
||||
case 10: uiCfg.extruStep = 1; break;
|
||||
|
@ -50,7 +50,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||
switch (obj->mks_obj_id) {
|
||||
case ID_FILAMNT_IN:
|
||||
uiCfg.filament_load_heat_flg = true;
|
||||
if (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|
||||
if (ABS(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|
||||
|| gCfgItems.filament_limit_temp <= thermalManager.wholeDegHotend(uiCfg.extruderIndex)) {
|
||||
lv_clear_filament_change();
|
||||
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
|
||||
@ -67,7 +67,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||
case ID_FILAMNT_OUT:
|
||||
uiCfg.filament_unload_heat_flg = true;
|
||||
if (thermalManager.degTargetHotend(uiCfg.extruderIndex)
|
||||
&& (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|
||||
&& (ABS(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|
||||
|| thermalManager.wholeDegHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temp)
|
||||
) {
|
||||
lv_clear_filament_change();
|
||||
|
@ -75,7 +75,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||
|
||||
switch (obj->mks_obj_id) {
|
||||
case ID_M_STEP:
|
||||
if (abs(10 * (int)uiCfg.move_dist) == 100)
|
||||
if (ABS(10 * (int)uiCfg.move_dist) == 100)
|
||||
uiCfg.move_dist = 0.1;
|
||||
else
|
||||
uiCfg.move_dist *= 10.0f;
|
||||
|
@ -87,7 +87,7 @@ constexpr int lco[] = LEVEL_CORNERS_LEVELING_ORDER;
|
||||
constexpr bool level_corners_3_points = COUNT(lco) == 2;
|
||||
static_assert(level_corners_3_points || COUNT(lco) == 4, "LEVEL_CORNERS_LEVELING_ORDER must have exactly 2 or 4 corners.");
|
||||
|
||||
constexpr int lcodiff = abs(lco[0] - lco[1]);
|
||||
constexpr int lcodiff = ABS(lco[0] - lco[1]);
|
||||
static_assert(COUNT(lco) == 4 || lcodiff == 1 || lcodiff == 3, "The first two LEVEL_CORNERS_LEVELING_ORDER corners must be on the same edge.");
|
||||
|
||||
constexpr int nr_edge_points = level_corners_3_points ? 3 : 4;
|
||||
|
Loading…
Reference in New Issue
Block a user