Skip to content

Commit

Permalink
Fix ExtUI invalid speed, timer (MarlinFirmware#15031)
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanityAutomation authored and thinkyhead committed Aug 25, 2019
1 parent 1557656 commit f218405
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 34 deletions.
4 changes: 2 additions & 2 deletions Marlin/src/feature/babystep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Babystep babystep;

volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1];

#if HAS_LCD_MENU
#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
int16_t Babystep::accum;
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];
Expand Down Expand Up @@ -75,7 +75,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {

if (!CAN_BABYSTEP(axis)) return;

#if HAS_LCD_MENU
#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
accum += distance; // Count up babysteps for the UI
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
axis_total[BS_TOTAL_AXIS(axis)] += distance;
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/babystep.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define BS_TODO_AXIS(A) 0
#endif

#if HAS_LCD_MENU && ENABLED(BABYSTEP_DISPLAY_TOTAL)
#if (HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)) && ENABLED(BABYSTEP_DISPLAY_TOTAL)
#if ENABLED(BABYSTEP_XY)
#define BS_TOTAL_AXIS(A) A
#else
Expand All @@ -41,7 +41,7 @@
class Babystep {
public:
static volatile int16_t todo[BS_TODO_AXIS(Z_AXIS) + 1];
#if HAS_LCD_MENU
#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
static int16_t accum; // Total babysteps in current edit
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; // Total babysteps since G28
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
host_action_prompt_show();
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStatusChanged(PSTR("Load Filament"));
ExtUI::onUserConfirmRequired(PSTR("Load Filament"));
#endif
while (wait_for_user) {
#if HAS_BUZZER
Expand Down Expand Up @@ -243,7 +243,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Continuous Purge Running..."), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStatusChanged(PSTR("Continuous Purge Running..."));
ExtUI::onUserConfirmRequired(PSTR("Continuous Purge Running..."));
#endif
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
do_pause_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
Expand Down Expand Up @@ -524,7 +524,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Nozzle Parked"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStatusChanged(PSTR("Nozzle Parked"));
ExtUI::onUserConfirmRequired(PSTR("Nozzle Parked"));
#endif
while (wait_for_user) {
#if HAS_BUZZER
Expand All @@ -548,7 +548,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
#endif

#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStatusChanged(PSTR("HeaterTimeout"));
ExtUI::onUserConfirmRequired(PSTR("HeaterTimeout"));
#endif

// Wait for LCD click or M108
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/prusa_MMU2/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ void MMU2::filament_runout() {
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStatusChanged(PSTR("MMU2 Eject Recover"));
ExtUI::onUserConfirmRequired(PSTR("MMU2 Eject Recover"));
#endif
while (wait_for_user) idle();
BUZZ(200, 404);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/config/M43.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ void GcodeSuite::M43() {
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStatusChanged(PSTR("M43 Wait Called"));
ExtUI::onUserConfirmRequired(PSTR("M43 Wait Called"));
#endif
#endif

Expand Down
6 changes: 1 addition & 5 deletions Marlin/src/gcode/lcd/M0_M1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void GcodeSuite::M0_M1() {
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M0/1 Break Called"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStatusChanged(PSTR("M0/1 Break Called"));
ExtUI::onUserConfirmRequired(PSTR("M0/1 Break Called"));
#endif

if (ms > 0) {
Expand All @@ -108,10 +108,6 @@ void GcodeSuite::M0_M1() {
else
while (wait_for_user) idle();

#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(nullptr);
#endif

#if HAS_LEDS_OFF_FLAG
printerEventLEDs.onResumeAfterWait();
#endif
Expand Down
3 changes: 0 additions & 3 deletions Marlin/src/gcode/stats/M75-M78.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
*/
void GcodeSuite::M75() {
print_job_timer.start();
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onPrintTimerStarted();
#endif
}

/**
Expand Down
29 changes: 19 additions & 10 deletions Marlin/src/lcd/extensible_ui/ui_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ namespace ExtUI {
#endif

constexpr float max_manual_feedrate[XYZE] = MANUAL_FEEDRATE;
setFeedrate_mm_s(max_manual_feedrate[axis]);
setFeedrate_mm_s(MMM_MMS(max_manual_feedrate[axis]));

if (!flags.manual_motion) set_destination_from_current();
destination[axis] = clamp(position, min, max);
Expand All @@ -331,7 +331,7 @@ namespace ExtUI {
setActiveTool(extruder, true);

constexpr float max_manual_feedrate[XYZE] = MANUAL_FEEDRATE;
setFeedrate_mm_s(max_manual_feedrate[E_AXIS]);
setFeedrate_mm_s(MMM_MMS(max_manual_feedrate[E_AXIS]));
if (!flags.manual_motion) set_destination_from_current();
destination[E_AXIS] = position;
flags.manual_motion = true;
Expand Down Expand Up @@ -714,17 +714,26 @@ namespace ExtUI {
}
#endif

#if HAS_BED_PROBE
float getZOffset_mm() {
float getZOffset_mm() {
#if HAS_BED_PROBE
return zprobe_zoffset;
}
#elif ENABLED(BABYSTEP_DISPLAY_TOTAL)
return babystep.axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];
#else
return 0.0;
#endif
}

void setZOffset_mm(const float value) {
if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
void setZOffset_mm(const float value) {
#if HAS_BED_PROBE
if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
zprobe_zoffset = value;
}
}
#endif // HAS_BED_PROBE
#elif ENABLED(BABYSTEP_DISPLAY_TOTAL)
babystep.add_mm(Z_AXIS, (value - babystep.axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]));
#else
UNUSED(value);
#endif
}

#if HAS_HOTEND_OFFSET

Expand Down
6 changes: 2 additions & 4 deletions Marlin/src/lcd/extensible_ui/ui_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,8 @@ namespace ExtUI {
void normalizeNozzleOffset(const axis_t axis);
#endif

#if HAS_BED_PROBE
float getZOffset_mm();
void setZOffset_mm(const float);
#endif
float getZOffset_mm();
void setZOffset_mm(const float);

#if ENABLED(BACKLASH_GCODE)
float getAxisBacklash_mm(const axis_t);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_delta_calibrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void _man_probe_pt(const float &rx, const float &ry) {
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Delta Calibration in progress"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStatusChanged(PSTR("Delta Calibration in progress"));
ExtUI::onUserConfirmRequired(PSTR("Delta Calibration in progress"));
#endif
while (wait_for_user) idle();
ui.goto_previous_screen_no_defer();
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/libs/stopwatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ bool Stopwatch::start() {
Stopwatch::debug(PSTR("start"));
#endif

#if ENABLED(EXTENSIBLE_UI)
ExtUI::onPrintTimerStarted();
#endif

if (!isRunning()) {
if (isPaused()) accumulator = duration();
else reset();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStatusChanged(PSTR("Stow Probe"));
ExtUI::onUserConfirmRequired(PSTR("Stow Probe"));
#endif
while (wait_for_user) idle();
ui.reset_status();
Expand Down

0 comments on commit f218405

Please sign in to comment.