Move some MarlinCore and MarlinUI code (#20832)

This commit is contained in:
Scott Lahteine
2021-01-21 03:40:07 -06:00
committed by GitHub
parent ac82dc418a
commit c0870d417a
38 changed files with 178 additions and 206 deletions

View File

@ -25,7 +25,8 @@
#if DISABLED(EMERGENCY_PARSER)
#include "../gcode.h"
#include "../../MarlinCore.h" // for wait_for_heatup, kill, quickstop_stepper
#include "../../MarlinCore.h" // for wait_for_heatup, kill
#include "../../module/motion.h" // for quickstop_stepper
/**
* M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.

View File

@ -28,6 +28,8 @@
#include "../../MarlinCore.h" // for pin_is_protected and idle()
#include "../../module/stepper.h"
void protected_pin_err();
/**
* M226: Wait until the specified pin reaches the state required (M226 P<pin> S<state>)
*/

View File

@ -31,6 +31,10 @@
#include "../../module/temperature.h"
#endif
void protected_pin_err() {
SERIAL_ERROR_MSG(STR_ERR_PROTECTED_PIN);
}
/**
* M42: Change pin status via GCode
*

View File

@ -26,7 +26,7 @@
#include "../../gcode.h"
#include "../../../MarlinCore.h" // for i2c
#include "../../../feature/twibus.h"
/**
* M260: Send data to a I2C slave device

View File

@ -27,13 +27,10 @@
#include "../../gcode.h"
#include "../../parser.h"
#include "../../../feature/pause.h"
#include "../../../lcd/marlinui.h"
#include "../../../module/motion.h"
#include "../../../sd/cardreader.h"
#include "../../../module/printcounter.h"
#if HAS_LCD_MENU
#include "../../../lcd/marlinui.h"
#endif
#include "../../../sd/cardreader.h"
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../../feature/powerloss.h"
@ -76,7 +73,7 @@ void GcodeSuite::M125() {
const bool sd_printing = TERN0(SDSUPPORT, IS_SD_PRINTING());
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT));
ui.pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT);
// If possible, show an LCD prompt with the 'P' flag
const bool show_lcd = TERN0(HAS_LCD_MENU, parser.boolval('P'));

View File

@ -28,15 +28,12 @@
#include "../../../feature/pause.h"
#include "../../../module/motion.h"
#include "../../../module/printcounter.h"
#include "../../../lcd/marlinui.h"
#if HAS_MULTI_EXTRUDER
#include "../../../module/tool_change.h"
#endif
#if HAS_LCD_MENU
#include "../../../lcd/marlinui.h"
#endif
#if ENABLED(MMU2_MENUS)
#include "../../../lcd/menu/menu_mmu2.h"
#endif
@ -96,8 +93,8 @@ void GcodeSuite::M600() {
#endif
// Show initial "wait for start" message
#if HAS_LCD_MENU && DISABLED(MMU2_MENUS)
lcd_pause_show_message(PAUSE_MESSAGE_CHANGING, PAUSE_MODE_PAUSE_PRINT, target_extruder);
#if DISABLED(MMU2_MENUS)
ui.pause_show_message(PAUSE_MESSAGE_CHANGING, PAUSE_MODE_PAUSE_PRINT, target_extruder);
#endif
#if ENABLED(HOME_BEFORE_FILAMENT_CHANGE)

View File

@ -29,15 +29,12 @@
#include "../../../module/motion.h"
#include "../../../module/temperature.h"
#include "../../../feature/pause.h"
#include "../../../lcd/marlinui.h"
#if HAS_MULTI_EXTRUDER
#include "../../../module/tool_change.h"
#endif
#if HAS_LCD_MENU
#include "../../../lcd/marlinui.h"
#endif
#if HAS_PRUSA_MMU2
#include "../../../feature/mmu/mmu2.h"
#endif
@ -82,7 +79,7 @@ void GcodeSuite::M701() {
if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
// Show initial "wait for load" message
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder));
ui.pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder);
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Change toolhead if specified
@ -128,7 +125,7 @@ void GcodeSuite::M701() {
TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
// Show status screen
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
ui.pause_show_message(PAUSE_MESSAGE_STATUS);
}
/**
@ -180,7 +177,7 @@ void GcodeSuite::M702() {
if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
// Show initial "wait for unload" message
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder));
ui.pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder);
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Change toolhead if specified
@ -232,7 +229,7 @@ void GcodeSuite::M702() {
TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
// Show status screen
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
ui.pause_show_message(PAUSE_MESSAGE_STATUS);
}
#endif // ADVANCED_PAUSE_FEATURE

View File

@ -61,7 +61,7 @@ GcodeSuite gcode;
#include "../feature/password/password.h"
#endif
#include "../MarlinCore.h" // for idle()
#include "../MarlinCore.h" // for idle, kill
// Inactivity shutdown
millis_t GcodeSuite::previous_move_ms = 0,
@ -209,6 +209,31 @@ void GcodeSuite::dwell(millis_t time) {
*/
#if BOTH(HAS_LEVELING, G29_RETRY_AND_RECOVER)
void GcodeSuite::event_probe_recover() {
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying"), DISMISS_STR));
#ifdef ACTION_ON_G29_RECOVER
host_action(PSTR(ACTION_ON_G29_RECOVER));
#endif
#ifdef G29_RECOVER_COMMANDS
process_subcommands_now_P(PSTR(G29_RECOVER_COMMANDS));
#endif
}
void GcodeSuite::event_probe_failure() {
#ifdef ACTION_ON_G29_FAILURE
host_action(PSTR(ACTION_ON_G29_FAILURE));
#endif
#ifdef G29_FAILURE_COMMANDS
process_subcommands_now_P(PSTR(G29_FAILURE_COMMANDS));
#endif
#if ENABLED(G29_HALT_ON_FAILURE)
#ifdef ACTION_ON_CANCEL
host_action_cancel();
#endif
kill(GET_TEXT(MSG_LCD_PROBING_FAILED));
#endif
}
#ifndef G29_MAX_RETRIES
#define G29_MAX_RETRIES 0
#endif
@ -216,7 +241,10 @@ void GcodeSuite::dwell(millis_t time) {
void GcodeSuite::G29_with_retry() {
uint8_t retries = G29_MAX_RETRIES;
while (G29()) { // G29 should return true for failed probes ONLY
if (retries--) event_probe_recover();
if (retries) {
event_probe_recover();
--retries;
}
else {
event_probe_failure();
return;

View File

@ -452,6 +452,8 @@ private:
#if HAS_LEVELING
#if ENABLED(G29_RETRY_AND_RECOVER)
static void event_probe_failure();
static void event_probe_recover();
static void G29_with_retry();
#define G29_TYPE bool
#else

View File

@ -31,6 +31,7 @@ GCodeQueue queue;
#include "../lcd/marlinui.h"
#include "../sd/cardreader.h"
#include "../module/motion.h"
#include "../module/planner.h"
#include "../module/temperature.h"
#include "../MarlinCore.h"

View File

@ -44,7 +44,7 @@
#endif
#if HAS_LEDS_OFF_FLAG
#include "../../MarlinCore.h" // for wait_for_user_response
#include "../../MarlinCore.h" // for wait_for_user_response()
#include "../../feature/leds/printer_event_leds.h"
#endif