Improve ExtUI, fix compiler errors, warnings (#14441)
This commit is contained in:
parent
14fb683682
commit
e6cf7860e8
@ -666,8 +666,8 @@ LIBWARN = -w -Wno-packed-bitfield-compat
|
|||||||
CSTANDARD = -std=gnu99
|
CSTANDARD = -std=gnu99
|
||||||
CXXSTANDARD = -std=gnu++11
|
CXXSTANDARD = -std=gnu++11
|
||||||
CDEBUG = -g$(DEBUG)
|
CDEBUG = -g$(DEBUG)
|
||||||
CWARN = -Wall -Wstrict-prototypes -Wno-packed-bitfield-compat -Wno-pragmas
|
CWARN = -Wall -Wstrict-prototypes -Wno-packed-bitfield-compat -Wno-pragmas -Wunused-parameter
|
||||||
CXXWARN = -Wall -Wno-packed-bitfield-compat -Wno-pragmas
|
CXXWARN = -Wall -Wno-packed-bitfield-compat -Wno-pragmas -Wunused-parameter
|
||||||
CTUNING = -fsigned-char -funsigned-bitfields -fpack-struct -fno-exceptions \
|
CTUNING = -fsigned-char -funsigned-bitfields -fpack-struct -fno-exceptions \
|
||||||
-fshort-enums -ffunction-sections -fdata-sections
|
-fshort-enums -ffunction-sections -fdata-sections
|
||||||
ifneq ($(HARDWARE_MOTHERBOARD),)
|
ifneq ($(HARDWARE_MOTHERBOARD),)
|
||||||
|
@ -68,6 +68,9 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
#if DISABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||||
|
UNUSED(e);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool has_measurement(const uint8_t e) {
|
static inline bool has_measurement(const uint8_t e) {
|
||||||
@ -76,6 +79,9 @@ public:
|
|||||||
|| (measured_count[e] > 0)
|
|| (measured_count[e] > 0)
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
#if DISABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||||
|
UNUSED(e);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool has_any_measurement() {
|
static inline bool has_any_measurement() {
|
||||||
|
@ -985,7 +985,7 @@
|
|||||||
st.TCOOLTHRS(0xFFFFF);
|
st.TCOOLTHRS(0xFFFFF);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void tmc_disable_stallguard(TMC2209Stepper &st, const bool restore_stealth) {
|
void tmc_disable_stallguard(TMC2209Stepper &st, const bool restore_stealth _UNUSED) {
|
||||||
st.TCOOLTHRS(0);
|
st.TCOOLTHRS(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,9 +411,13 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
|
|||||||
SERIAL_ECHOLNPGM("Nozzle Tip Outer Dimensions:");
|
SERIAL_ECHOLNPGM("Nozzle Tip Outer Dimensions:");
|
||||||
#if HAS_X_CENTER
|
#if HAS_X_CENTER
|
||||||
SERIAL_ECHOLNPAIR(" X", m.nozzle_outer_dimension[X_AXIS]);
|
SERIAL_ECHOLNPAIR(" X", m.nozzle_outer_dimension[X_AXIS]);
|
||||||
|
#else
|
||||||
|
UNUSED(m);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_Y_CENTER
|
#if HAS_Y_CENTER
|
||||||
SERIAL_ECHOLNPAIR(" Y", m.nozzle_outer_dimension[Y_AXIS]);
|
SERIAL_ECHOLNPAIR(" Y", m.nozzle_outer_dimension[Y_AXIS]);
|
||||||
|
#else
|
||||||
|
UNUSED(m);
|
||||||
#endif
|
#endif
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
}
|
}
|
||||||
@ -518,6 +522,8 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const
|
|||||||
|
|
||||||
#if HOTENDS > 1
|
#if HOTENDS > 1
|
||||||
set_nozzle(m, extruder);
|
set_nozzle(m, extruder);
|
||||||
|
#else
|
||||||
|
UNUSED(extruder);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
probe_sides(m, uncertainty);
|
probe_sides(m, uncertainty);
|
||||||
|
@ -40,9 +40,9 @@ void report_M92(const bool echo=true, const int8_t e=-1) {
|
|||||||
SERIAL_ECHOPAIR(" M92 T", (int)i);
|
SERIAL_ECHOPAIR(" M92 T", (int)i);
|
||||||
SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)]));
|
SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)]));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
UNUSED(e);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
UNUSED_E(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,6 +89,13 @@ GCodeQueue::GCodeQueue() {
|
|||||||
for (uint8_t i = 0; i < COUNT(send_ok); i++) send_ok[i] = true;
|
for (uint8_t i = 0; i < COUNT(send_ok); i++) send_ok[i] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether there are any commands yet to be executed
|
||||||
|
*/
|
||||||
|
bool GCodeQueue::has_commands_queued() {
|
||||||
|
return queue.length || injected_commands_P;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the Marlin command queue
|
* Clear the Marlin command queue
|
||||||
*/
|
*/
|
||||||
@ -154,6 +161,8 @@ bool GCodeQueue::enqueue_one(const char* cmd) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the next "immediate" command.
|
* Process the next "immediate" command.
|
||||||
|
* Return 'true' if any commands were processed,
|
||||||
|
* or remain to process.
|
||||||
*/
|
*/
|
||||||
bool GCodeQueue::process_injected_command() {
|
bool GCodeQueue::process_injected_command() {
|
||||||
if (injected_commands_P == nullptr) return false;
|
if (injected_commands_P == nullptr) return false;
|
||||||
@ -161,19 +170,16 @@ bool GCodeQueue::process_injected_command() {
|
|||||||
char c;
|
char c;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while ((c = pgm_read_byte(&injected_commands_P[i])) && c != '\n') i++;
|
while ((c = pgm_read_byte(&injected_commands_P[i])) && c != '\n') i++;
|
||||||
if (!i) return false;
|
if (i) {
|
||||||
|
char cmd[i + 1];
|
||||||
char cmd[i + 1];
|
memcpy_P(cmd, injected_commands_P, i);
|
||||||
memcpy_P(cmd, injected_commands_P, i);
|
cmd[i] = '\0';
|
||||||
cmd[i] = '\0';
|
|
||||||
|
|
||||||
|
parser.parse(cmd);
|
||||||
|
PORT_REDIRECT(SERIAL_PORT);
|
||||||
|
gcode.process_parsed_command();
|
||||||
|
}
|
||||||
injected_commands_P = c ? injected_commands_P + i + 1 : nullptr;
|
injected_commands_P = c ? injected_commands_P + i + 1 : nullptr;
|
||||||
|
|
||||||
parser.parse(cmd);
|
|
||||||
PORT_REDIRECT(SERIAL_PORT);
|
|
||||||
gcode.process_parsed_command();
|
|
||||||
PORT_RESTORE();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,17 +189,13 @@ bool GCodeQueue::process_injected_command() {
|
|||||||
* Aborts the current queue, if any.
|
* Aborts the current queue, if any.
|
||||||
* Note: process_injected_command() will be called to drain any commands afterwards
|
* Note: process_injected_command() will be called to drain any commands afterwards
|
||||||
*/
|
*/
|
||||||
void GCodeQueue::inject_P(PGM_P const pgcode) {
|
void GCodeQueue::inject_P(PGM_P const pgcode) { injected_commands_P = pgcode; }
|
||||||
injected_commands_P = pgcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueue and return only when commands are actually enqueued.
|
* Enqueue and return only when commands are actually enqueued.
|
||||||
* Never call this from a G-code handler!
|
* Never call this from a G-code handler!
|
||||||
*/
|
*/
|
||||||
void GCodeQueue::enqueue_one_now(const char* cmd) {
|
void GCodeQueue::enqueue_one_now(const char* cmd) { while (!enqueue_one(cmd)) idle(); }
|
||||||
while (!enqueue_one(cmd)) idle();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueue from program memory and return only when commands are actually enqueued
|
* Enqueue from program memory and return only when commands are actually enqueued
|
||||||
|
@ -84,6 +84,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void enqueue_now_P(PGM_P const cmd);
|
static void enqueue_now_P(PGM_P const cmd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether there are any commands yet to be executed
|
||||||
|
*/
|
||||||
|
static bool has_commands_queued();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next command in the queue, optionally log it to SD, then dispatch it
|
* Get the next command in the queue, optionally log it to SD, then dispatch it
|
||||||
*/
|
*/
|
||||||
|
@ -451,10 +451,12 @@
|
|||||||
#if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
|
#if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
|
||||||
#define XYZE_N (XYZ + E_STEPPERS)
|
#define XYZE_N (XYZ + E_STEPPERS)
|
||||||
#define E_AXIS_N(E) AxisEnum(E_AXIS + E)
|
#define E_AXIS_N(E) AxisEnum(E_AXIS + E)
|
||||||
|
#define UNUSED_E(E) NOOP
|
||||||
#else
|
#else
|
||||||
#undef DISTINCT_E_FACTORS
|
#undef DISTINCT_E_FACTORS
|
||||||
#define XYZE_N XYZE
|
#define XYZE_N XYZE
|
||||||
#define E_AXIS_N(E) E_AXIS
|
#define E_AXIS_N(E) E_AXIS
|
||||||
|
#define UNUSED_E(E) UNUSED(E)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -242,18 +242,28 @@ namespace ExtUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float getTargetFan_percent(const fan_t fan) {
|
float getTargetFan_percent(const fan_t fan) {
|
||||||
return thermalManager.fanPercent(thermalManager.fan_speed[fan - FAN0]);
|
#if FAN_COUNT > 0
|
||||||
|
return thermalManager.fanPercent(thermalManager.fan_speed[fan - FAN0]);
|
||||||
|
#else
|
||||||
|
UNUSED(fan);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
float getActualFan_percent(const fan_t fan) {
|
float getActualFan_percent(const fan_t fan) {
|
||||||
return thermalManager.fanPercent(thermalManager.scaledFanSpeed(fan - FAN0));
|
#if FAN_COUNT > 0
|
||||||
|
return thermalManager.fanPercent(thermalManager.scaledFanSpeed(fan - FAN0));
|
||||||
|
#else
|
||||||
|
UNUSED(fan);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAxisPosition_mm(const axis_t axis) {
|
float getAxisPosition_mm(const axis_t axis) {
|
||||||
return flags.manual_motion ? destination[axis] : current_position[axis];
|
return flags.manual_motion ? destination[axis] : current_position[axis];
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAxisPosition_mm(const extruder_t extruder) {
|
float getAxisPosition_mm(const extruder_t) {
|
||||||
return flags.manual_motion ? destination[E_AXIS] : current_position[E_AXIS];
|
return flags.manual_motion ? destination[E_AXIS] : current_position[E_AXIS];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,6 +363,9 @@ namespace ExtUI {
|
|||||||
if (e != active_extruder) tool_change(e, no_move);
|
if (e != active_extruder) tool_change(e, no_move);
|
||||||
#endif
|
#endif
|
||||||
active_extruder = e;
|
active_extruder = e;
|
||||||
|
#else
|
||||||
|
UNUSED(extruder);
|
||||||
|
UNUSED(no_move);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,6 +519,7 @@ namespace ExtUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float getAxisSteps_per_mm(const extruder_t extruder) {
|
float getAxisSteps_per_mm(const extruder_t extruder) {
|
||||||
|
UNUSED_E(extruder);
|
||||||
return planner.settings.axis_steps_per_mm[E_AXIS_N(extruder - E0)];
|
return planner.settings.axis_steps_per_mm[E_AXIS_N(extruder - E0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,6 +528,7 @@ namespace ExtUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setAxisSteps_per_mm(const float value, const extruder_t extruder) {
|
void setAxisSteps_per_mm(const float value, const extruder_t extruder) {
|
||||||
|
UNUSED_E(extruder);
|
||||||
planner.settings.axis_steps_per_mm[E_AXIS_N(axis - E0)] = value;
|
planner.settings.axis_steps_per_mm[E_AXIS_N(axis - E0)] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,6 +537,7 @@ namespace ExtUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float getAxisMaxFeedrate_mm_s(const extruder_t extruder) {
|
float getAxisMaxFeedrate_mm_s(const extruder_t extruder) {
|
||||||
|
UNUSED_E(extruder);
|
||||||
return planner.settings.max_feedrate_mm_s[E_AXIS_N(axis - E0)];
|
return planner.settings.max_feedrate_mm_s[E_AXIS_N(axis - E0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,6 +546,7 @@ namespace ExtUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setAxisMaxFeedrate_mm_s(const float value, const extruder_t extruder) {
|
void setAxisMaxFeedrate_mm_s(const float value, const extruder_t extruder) {
|
||||||
|
UNUSED_E(extruder);
|
||||||
planner.settings.max_feedrate_mm_s[E_AXIS_N(axis - E0)] = value;
|
planner.settings.max_feedrate_mm_s[E_AXIS_N(axis - E0)] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,6 +555,7 @@ namespace ExtUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float getAxisMaxAcceleration_mm_s2(const extruder_t extruder) {
|
float getAxisMaxAcceleration_mm_s2(const extruder_t extruder) {
|
||||||
|
UNUSED_E(extruder);
|
||||||
return planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)];
|
return planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,6 +564,7 @@ namespace ExtUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setAxisMaxAcceleration_mm_s2(const float value, const extruder_t extruder) {
|
void setAxisMaxAcceleration_mm_s2(const float value, const extruder_t extruder) {
|
||||||
|
UNUSED_E(extruder);
|
||||||
planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)] = value;
|
planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,7 +608,7 @@ namespace ExtUI {
|
|||||||
return planner.max_jerk[axis];
|
return planner.max_jerk[axis];
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAxisMaxJerk_mm_s(const extruder_t extruder) {
|
float getAxisMaxJerk_mm_s(const extruder_t) {
|
||||||
return planner.max_jerk[E_AXIS];
|
return planner.max_jerk[E_AXIS];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,7 +616,7 @@ namespace ExtUI {
|
|||||||
planner.max_jerk[axis] = value;
|
planner.max_jerk[axis] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAxisMaxJerk_mm_s(const float value, const extruder_t extruder) {
|
void setAxisMaxJerk_mm_s(const float value, const extruder_t) {
|
||||||
planner.max_jerk[E_AXIS] = value;
|
planner.max_jerk[E_AXIS] = value;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -780,12 +799,16 @@ namespace ExtUI {
|
|||||||
queue.inject_P(gcode);
|
queue.inject_P(gcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool commandsInQueue() { return (planner.movesplanned() || queue.length); }
|
bool commandsInQueue() { return (planner.movesplanned() || queue.has_commands_queued()); }
|
||||||
|
|
||||||
bool isAxisPositionKnown(const axis_t axis) {
|
bool isAxisPositionKnown(const axis_t axis) {
|
||||||
return TEST(axis_known_position, axis);
|
return TEST(axis_known_position, axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isAxisPositionKnown(const extruder_t) {
|
||||||
|
return TEST(axis_known_position, E_AXIS);
|
||||||
|
}
|
||||||
|
|
||||||
bool isPositionKnown() { return all_axes_known(); }
|
bool isPositionKnown() { return all_axes_known(); }
|
||||||
bool isMachineHomed() { return all_axes_homed(); }
|
bool isMachineHomed() { return all_axes_homed(); }
|
||||||
|
|
||||||
@ -814,8 +837,13 @@ namespace ExtUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setTargetFan_percent(const float value, const fan_t fan) {
|
void setTargetFan_percent(const float value, const fan_t fan) {
|
||||||
if (fan < FAN_COUNT)
|
#if FAN_COUNT > 0
|
||||||
thermalManager.set_fan_speed(fan - FAN0, map(clamp(value, 0, 100), 0, 100, 0, 255));
|
if (fan < FAN_COUNT)
|
||||||
|
thermalManager.set_fan_speed(fan - FAN0, map(clamp(value, 0, 100), 0, 100, 0, 255));
|
||||||
|
#else
|
||||||
|
UNUSED(value);
|
||||||
|
UNUSED(fan);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFeedrate_percent(const float value) {
|
void setFeedrate_percent(const float value) {
|
||||||
|
@ -93,7 +93,7 @@ inline void sdcard_start_selected_file() {
|
|||||||
|
|
||||||
class MenuItem_sdfile {
|
class MenuItem_sdfile {
|
||||||
public:
|
public:
|
||||||
static void action(CardReader &theCard) {
|
static void action(CardReader &) {
|
||||||
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
||||||
// Save menu state for the selected file
|
// Save menu state for the selected file
|
||||||
sd_encoder_position = ui.encoderPosition;
|
sd_encoder_position = ui.encoderPosition;
|
||||||
|
Loading…
Reference in New Issue
Block a user