Revert runout changes

This commit is contained in:
InsanityAutomation
2023-08-22 20:55:40 -04:00
parent 59dffb5f1c
commit 953ea9f16e
4 changed files with 30 additions and 36 deletions
+20 -27
View File
@@ -82,7 +82,7 @@ void event_filament_runout(const uint8_t extruder) {
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder)));
TERN_(DWIN_LCD_PROUI, dwinFilamentRunout(extruder));
TERN_(DWIN_LCD_PROUI, DWIN_FilamentRunout(extruder));
#if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR)
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder);
@@ -96,16 +96,12 @@ void event_filament_runout(const uint8_t extruder) {
const bool run_runout_script = !runout.host_handling;
#if ENABLED(HOST_ACTION_COMMANDS)
const bool park_or_pause = (false
#ifdef FILAMENT_RUNOUT_SCRIPT
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M600")
if (run_runout_script
&& ( strstr(FILAMENT_RUNOUT_SCRIPT, "M600")
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M125")
|| TERN0(ADVANCED_PAUSE_FEATURE, strstr(FILAMENT_RUNOUT_SCRIPT, "M25"))
#endif
);
if (run_runout_script && park_or_pause) {
)
) {
hostui.paused(false);
}
else {
@@ -122,27 +118,24 @@ void event_filament_runout(const uint8_t extruder) {
SERIAL_ECHOPGM(" " ACTION_REASON_ON_FILAMENT_RUNOUT " ");
SERIAL_CHAR(tool);
SERIAL_EOL();
#endif // HOST_ACTION_COMMANDS
#ifdef FILAMENT_RUNOUT_SCRIPT
if (run_runout_script) {
#if MULTI_FILAMENT_SENSOR
MString<strlen(FILAMENT_RUNOUT_SCRIPT)> script;
script.setf(F(FILAMENT_RUNOUT_SCRIPT), AS_CHAR(tool));
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
SERIAL_ECHOLNPGM("Runout Command: ", &script);
#endif
queue.inject(&script);
#else
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
SERIAL_ECHOPGM("Runout Command: ");
SERIAL_ECHOLNPGM(FILAMENT_RUNOUT_SCRIPT);
#endif
queue.inject(F(FILAMENT_RUNOUT_SCRIPT));
if (run_runout_script) {
#if MULTI_FILAMENT_SENSOR
char script[strlen(FILAMENT_RUNOUT_SCRIPT) + 1];
sprintf_P(script, PSTR(FILAMENT_RUNOUT_SCRIPT), tool);
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
SERIAL_ECHOLNPGM("Runout Command: ", script);
#endif
}
#endif
queue.inject(script);
#else
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
SERIAL_ECHOPGM("Runout Command: ");
SERIAL_ECHOLNPGM(FILAMENT_RUNOUT_SCRIPT);
#endif
queue.inject(F(FILAMENT_RUNOUT_SCRIPT));
#endif
}
}
#endif // HAS_FILAMENT_SENSOR
+2 -1
View File
@@ -30,7 +30,8 @@
#include "../module/planner.h"
#include "../module/stepper.h" // for block_t
#include "../gcode/queue.h"
#include "../feature/pause.h"
#include "../feature/pause.h" // for did_pause_print
#include "../MarlinCore.h" // for printingIsActive()
#include "../inc/MarlinConfig.h"
+1 -1
View File
@@ -997,7 +997,7 @@ G29_TYPE GcodeSuite::G29() {
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_LevelingDone());
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
TERN_(HAS_MULTI_HOTEND, if (abl.tool_index != 0) tool_change(abl.tool_index));
TERN_(HAS_MULTI_HOTEND, if (active_extruder != 0) tool_change(0));
probe.use_probing_tool(false);
report_current_position();
+7 -7
View File
@@ -41,8 +41,8 @@
// Check the integrity of data offsets.
// Can be disabled for production build.
//#define DEBUG_EEPROM_READWRITE
//#define DEBUG_EEPROM_OBSERVE
#define DEBUG_EEPROM_READWRITE
#define DEBUG_EEPROM_OBSERVE
#include "settings.h"
@@ -895,9 +895,9 @@ void MarlinSettings::postprocess() {
#if HAS_FILAMENT_SENSOR
{
_FIELD_TEST(runout_enabled);
for(int e; e<NUM_RUNOUT_SENSORS; e++) EEPROM_WRITE(runout.enabled[e]);
for(int e; e<NUM_RUNOUT_SENSORS; e++) EEPROM_WRITE(runout.runout_distance(e));
for(int e; e<NUM_RUNOUT_SENSORS; e++) EEPROM_WRITE(runout.mode[e]);
for(uint8_t e=0; e<NUM_RUNOUT_SENSORS; ++e) EEPROM_WRITE(runout.enabled[e]);
for(uint8_t e=0; e<NUM_RUNOUT_SENSORS; ++e) EEPROM_WRITE(runout.runout_distance(e));
for(uint8_t e=0; e<NUM_RUNOUT_SENSORS; ++e) EEPROM_WRITE(runout.mode[e]);
}
#endif
@@ -1915,7 +1915,7 @@ void MarlinSettings::postprocess() {
EEPROM_READ(runout_mode);
if (!validating) {
for(int e; e < NUM_RUNOUT_SENSORS; e++) {
for(uint8_t e=0; e < NUM_RUNOUT_SENSORS; ++e) {
runout.enabled[e] = runout_enabled[e];
runout.set_runout_distance(runout_distance_mm[e], e);
runout.mode[e] = runout_mode[e];
@@ -3126,7 +3126,7 @@ void MarlinSettings::reset() {
static_assert(COUNT(frd) == NUM_RUNOUT_SENSORS, "FIL_RUNOUT_DISTANCE_MM must have NUM_RUNOUT_SENSORS values.");
COPY(runout.enabled, fred);
COPY(runout.mode, frm);
for(int e; e<NUM_RUNOUT_SENSORS; e++) runout.set_runout_distance(frd[e], e);
for(uint8_t e = 0; e < NUM_RUNOUT_SENSORS; ++e) runout.set_runout_distance(frd[e], e);
runout.reset();
#endif