Cleanup with updated macros
This commit is contained in:
parent
f03f76ecfb
commit
3d3d2a923b
|
@ -47,17 +47,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool leveling_is_valid() {
|
bool leveling_is_valid() {
|
||||||
return
|
return TERN1(MESH_BED_LEVELING, mbl.has_mesh())
|
||||||
#if ENABLED(MESH_BED_LEVELING)
|
&& TERN1(AUTO_BED_LEVELING_BILINEAR, !!bilinear_grid_spacing.x)
|
||||||
mbl.has_mesh()
|
&& TERN1(AUTO_BED_LEVELING_UBL, ubl.mesh_is_valid());
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
||||||
!!bilinear_grid_spacing.x
|
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
||||||
ubl.mesh_is_valid()
|
|
||||||
#else // 3POINT, LINEAR
|
|
||||||
true
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,11 +61,7 @@ bool leveling_is_valid() {
|
||||||
*/
|
*/
|
||||||
void set_bed_leveling_enabled(const bool enable/*=true*/) {
|
void set_bed_leveling_enabled(const bool enable/*=true*/) {
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
const bool can_change = TERN1(AUTO_BED_LEVELING_BILINEAR, !enable || leveling_is_valid());
|
||||||
const bool can_change = (!enable || leveling_is_valid());
|
|
||||||
#else
|
|
||||||
constexpr bool can_change = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (can_change && enable != planner.leveling_active) {
|
if (can_change && enable != planner.leveling_active) {
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,6 @@
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
#include "../../sd/cardreader.h"
|
#include "../../sd/cardreader.h"
|
||||||
#define IFSD(A,B) (A)
|
|
||||||
#else
|
|
||||||
#define IFSD(A,B) (B)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TRINAMIC_CONFIG
|
#if HAS_TRINAMIC_CONFIG
|
||||||
|
@ -164,8 +161,7 @@ namespace ExtUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
void yield() {
|
void yield() {
|
||||||
if (!flags.printer_killed)
|
if (!flags.printer_killed) thermalManager.manage_heater();
|
||||||
thermalManager.manage_heater();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableHeater(const extruder_t extruder) {
|
void enableHeater(const extruder_t extruder) {
|
||||||
|
@ -180,13 +176,9 @@ namespace ExtUI {
|
||||||
#if HEATER_IDLE_HANDLER
|
#if HEATER_IDLE_HANDLER
|
||||||
switch (heater) {
|
switch (heater) {
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
case BED:
|
case BED: thermalManager.reset_bed_idle_timer(); return;
|
||||||
thermalManager.reset_bed_idle_timer();
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
#if HAS_HEATED_CHAMBER
|
|
||||||
case CHAMBER: return; // Chamber has no idle timer
|
|
||||||
#endif
|
#endif
|
||||||
|
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return); // Chamber has no idle timer
|
||||||
default:
|
default:
|
||||||
TERN_(HAS_HOTEND, thermalManager.reset_hotend_idle_timer(heater - H0));
|
TERN_(HAS_HOTEND, thermalManager.reset_hotend_idle_timer(heater - H0));
|
||||||
break;
|
break;
|
||||||
|
@ -233,28 +225,21 @@ namespace ExtUI {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool isHeaterIdle(const extruder_t extruder) {
|
bool isHeaterIdle(const extruder_t extruder) {
|
||||||
return false
|
#if HAS_HOTEND && HEATER_IDLE_HANDLER
|
||||||
#if HAS_HOTEND && HEATER_IDLE_HANDLER
|
return thermalManager.hotend_idle[extruder - E0].timed_out
|
||||||
|| thermalManager.hotend_idle[extruder - E0].timed_out
|
#else
|
||||||
#else
|
UNUSED(extruder);
|
||||||
; UNUSED(extruder)
|
return false;
|
||||||
#endif
|
#endif
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isHeaterIdle(const heater_t heater) {
|
bool isHeaterIdle(const heater_t heater) {
|
||||||
#if HEATER_IDLE_HANDLER
|
#if HEATER_IDLE_HANDLER
|
||||||
switch (heater) {
|
switch (heater) {
|
||||||
TERN_(HAS_HEATED_BED, case BED: return thermalManager.bed_idle.timed_out);
|
TERN_(HAS_HEATED_BED, case BED: return thermalManager.bed_idle.timed_out);
|
||||||
#if HAS_HEATED_CHAMBER
|
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return false); // Chamber has no idle timer
|
||||||
case CHAMBER: return false; // Chamber has no idle timer
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
#if HAS_HOTEND
|
return TERN0(HAS_HOTEND, thermalManager.hotend_idle[heater - H0].timed_out);
|
||||||
return thermalManager.hotend_idle[heater - H0].timed_out;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UNUSED(heater);
|
UNUSED(heater);
|
||||||
|
@ -311,22 +296,13 @@ namespace ExtUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAxisPosition_mm(const axis_t axis) {
|
float getAxisPosition_mm(const axis_t axis) {
|
||||||
return
|
return TERN_(JOYSTICK, flags.jogging ? destination[axis] :) current_position[axis];
|
||||||
#if ENABLED(JOYSTICK)
|
|
||||||
flags.jogging ? destination[axis] :
|
|
||||||
#endif
|
|
||||||
current_position[axis];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAxisPosition_mm(const extruder_t extruder) {
|
float getAxisPosition_mm(const extruder_t extruder) {
|
||||||
const extruder_t old_tool = getActiveTool();
|
const extruder_t old_tool = getActiveTool();
|
||||||
setActiveTool(extruder, true);
|
setActiveTool(extruder, true);
|
||||||
const float epos = (
|
const float epos = TERN_(JOYSTICK, flags.jogging ? destination.e :) current_position.e;
|
||||||
#if ENABLED(JOYSTICK)
|
|
||||||
flags.jogging ? destination.e :
|
|
||||||
#endif
|
|
||||||
current_position.e
|
|
||||||
);
|
|
||||||
setActiveTool(old_tool, true);
|
setActiveTool(old_tool, true);
|
||||||
return epos;
|
return epos;
|
||||||
}
|
}
|
||||||
|
@ -1037,11 +1013,7 @@ namespace ExtUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileList::isAtRootDir() {
|
bool FileList::isAtRootDir() {
|
||||||
return (true
|
return IFSD(card.flag.workDirIsRoot, true);
|
||||||
#if ENABLED(SDSUPPORT)
|
|
||||||
&& card.flag.workDirIsRoot
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileList::upDir() {
|
void FileList::upDir() {
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SD_ORDER(N,C) (TERN(SDCARD_RATHERRECENTFIRST, C - 1 - (N), N))
|
#define SD_ORDER(N,C) (TERN(SDCARD_RATHERRECENTFIRST, C - 1 - (N), N))
|
||||||
|
#define IFSD(A,B) TERN(SDSUPPORT,A,B)
|
||||||
|
|
||||||
#define MAX_DIR_DEPTH 10 // Maximum folder depth
|
#define MAX_DIR_DEPTH 10 // Maximum folder depth
|
||||||
#define MAXDIRNAMELENGTH 8 // DOS folder name size
|
#define MAXDIRNAMELENGTH 8 // DOS folder name size
|
||||||
|
|
Loading…
Reference in a new issue