Improve ExtUI, fix compiler errors, warnings (#14441)

This commit is contained in:
Marcio Teixeira
2019-06-28 23:23:57 -06:00
committed by Scott Lahteine
parent 14fb683682
commit e6cf7860e8
10 changed files with 80 additions and 31 deletions

View File

@ -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) {

View File

@ -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;