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
|
||||
CXXSTANDARD = -std=gnu++11
|
||||
CDEBUG = -g$(DEBUG)
|
||||
CWARN = -Wall -Wstrict-prototypes -Wno-packed-bitfield-compat -Wno-pragmas
|
||||
CXXWARN = -Wall -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 -Wunused-parameter
|
||||
CTUNING = -fsigned-char -funsigned-bitfields -fpack-struct -fno-exceptions \
|
||||
-fshort-enums -ffunction-sections -fdata-sections
|
||||
ifneq ($(HARDWARE_MOTHERBOARD),)
|
||||
|
@ -68,6 +68,9 @@ public:
|
||||
#endif
|
||||
0
|
||||
);
|
||||
#if DISABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
UNUSED(e);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool has_measurement(const uint8_t e) {
|
||||
@ -76,6 +79,9 @@ public:
|
||||
|| (measured_count[e] > 0)
|
||||
#endif
|
||||
);
|
||||
#if DISABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
UNUSED(e);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool has_any_measurement() {
|
||||
|
@ -985,7 +985,7 @@
|
||||
st.TCOOLTHRS(0xFFFFF);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -411,9 +411,13 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
|
||||
SERIAL_ECHOLNPGM("Nozzle Tip Outer Dimensions:");
|
||||
#if HAS_X_CENTER
|
||||
SERIAL_ECHOLNPAIR(" X", m.nozzle_outer_dimension[X_AXIS]);
|
||||
#else
|
||||
UNUSED(m);
|
||||
#endif
|
||||
#if HAS_Y_CENTER
|
||||
SERIAL_ECHOLNPAIR(" Y", m.nozzle_outer_dimension[Y_AXIS]);
|
||||
#else
|
||||
UNUSED(m);
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
}
|
||||
@ -518,6 +522,8 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const
|
||||
|
||||
#if HOTENDS > 1
|
||||
set_nozzle(m, extruder);
|
||||
#else
|
||||
UNUSED(extruder);
|
||||
#endif
|
||||
|
||||
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_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)]));
|
||||
}
|
||||
#else
|
||||
UNUSED(e);
|
||||
#endif
|
||||
|
||||
UNUSED_E(e);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,6 +89,13 @@ GCodeQueue::GCodeQueue() {
|
||||
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
|
||||
*/
|
||||
@ -154,6 +161,8 @@ bool GCodeQueue::enqueue_one(const char* cmd) {
|
||||
|
||||
/**
|
||||
* Process the next "immediate" command.
|
||||
* Return 'true' if any commands were processed,
|
||||
* or remain to process.
|
||||
*/
|
||||
bool GCodeQueue::process_injected_command() {
|
||||
if (injected_commands_P == nullptr) return false;
|
||||
@ -161,19 +170,16 @@ bool GCodeQueue::process_injected_command() {
|
||||
char c;
|
||||
size_t i = 0;
|
||||
while ((c = pgm_read_byte(&injected_commands_P[i])) && c != '\n') i++;
|
||||
if (!i) return false;
|
||||
|
||||
char cmd[i + 1];
|
||||
memcpy_P(cmd, injected_commands_P, i);
|
||||
cmd[i] = '\0';
|
||||
if (i) {
|
||||
char cmd[i + 1];
|
||||
memcpy_P(cmd, injected_commands_P, i);
|
||||
cmd[i] = '\0';
|
||||
|
||||
parser.parse(cmd);
|
||||
PORT_REDIRECT(SERIAL_PORT);
|
||||
gcode.process_parsed_command();
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@ -183,17 +189,13 @@ bool GCodeQueue::process_injected_command() {
|
||||
* Aborts the current queue, if any.
|
||||
* Note: process_injected_command() will be called to drain any commands afterwards
|
||||
*/
|
||||
void GCodeQueue::inject_P(PGM_P const pgcode) {
|
||||
injected_commands_P = pgcode;
|
||||
}
|
||||
void GCodeQueue::inject_P(PGM_P const pgcode) { injected_commands_P = pgcode; }
|
||||
|
||||
/**
|
||||
* Enqueue and return only when commands are actually enqueued.
|
||||
* Never call this from a G-code handler!
|
||||
*/
|
||||
void GCodeQueue::enqueue_one_now(const char* cmd) {
|
||||
while (!enqueue_one(cmd)) idle();
|
||||
}
|
||||
void GCodeQueue::enqueue_one_now(const char* cmd) { while (!enqueue_one(cmd)) idle(); }
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
@ -451,10 +451,12 @@
|
||||
#if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
|
||||
#define XYZE_N (XYZ + E_STEPPERS)
|
||||
#define E_AXIS_N(E) AxisEnum(E_AXIS + E)
|
||||
#define UNUSED_E(E) NOOP
|
||||
#else
|
||||
#undef DISTINCT_E_FACTORS
|
||||
#define XYZE_N XYZE
|
||||
#define E_AXIS_N(E) E_AXIS
|
||||
#define UNUSED_E(E) UNUSED(E)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -242,18 +242,28 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
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];
|
||||
}
|
||||
|
||||
@ -353,6 +363,9 @@ namespace ExtUI {
|
||||
if (e != active_extruder) tool_change(e, no_move);
|
||||
#endif
|
||||
active_extruder = e;
|
||||
#else
|
||||
UNUSED(extruder);
|
||||
UNUSED(no_move);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -506,6 +519,7 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
float getAxisSteps_per_mm(const extruder_t extruder) {
|
||||
UNUSED_E(extruder);
|
||||
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) {
|
||||
UNUSED_E(extruder);
|
||||
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) {
|
||||
UNUSED_E(extruder);
|
||||
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) {
|
||||
UNUSED_E(extruder);
|
||||
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) {
|
||||
UNUSED_E(extruder);
|
||||
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) {
|
||||
UNUSED_E(extruder);
|
||||
planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)] = value;
|
||||
}
|
||||
|
||||
@ -589,7 +608,7 @@ namespace ExtUI {
|
||||
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];
|
||||
}
|
||||
|
||||
@ -597,7 +616,7 @@ namespace ExtUI {
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
@ -780,12 +799,16 @@ namespace ExtUI {
|
||||
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) {
|
||||
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 isMachineHomed() { return all_axes_homed(); }
|
||||
|
||||
@ -814,8 +837,13 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
void setTargetFan_percent(const float value, const fan_t fan) {
|
||||
if (fan < FAN_COUNT)
|
||||
thermalManager.set_fan_speed(fan - FAN0, map(clamp(value, 0, 100), 0, 100, 0, 255));
|
||||
#if FAN_COUNT > 0
|
||||
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) {
|
||||
|
@ -93,7 +93,7 @@ inline void sdcard_start_selected_file() {
|
||||
|
||||
class MenuItem_sdfile {
|
||||
public:
|
||||
static void action(CardReader &theCard) {
|
||||
static void action(CardReader &) {
|
||||
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
||||
// Save menu state for the selected file
|
||||
sd_encoder_position = ui.encoderPosition;
|
||||
|
Loading…
Reference in New Issue
Block a user