Merge branch 'Trex_2.0.x_Devel' of https://github.com/InsanityAutomation/Marlin into Trex_2.0.x_Devel

This commit is contained in:
InsanityAutomation
2024-06-26 10:53:20 -04:00
37 changed files with 6084 additions and 7005 deletions
+33
View File
@@ -1770,6 +1770,11 @@
//#define PROBE_TOOLCHANGE_NO_MOVE // Suppress motion on probe tool-change
#endif
#if ENABLED(TREX3)
#define NOZZLE_TO_PROBE_OFFSET { -3, 31, 0 }
#else
#define NOZZLE_TO_PROBE_OFFSET { -7, 29, 0 }
#endif
// Most probes should stay away from the edges of the bed, but
// with NOZZLE_AS_PROBE this can be negative for a wider probing area.
#define PROBING_MARGIN 10
@@ -2223,6 +2228,34 @@
#endif
#endif
#endif
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
// Override individually if the runout sensors vary
//#define FIL_RUNOUT1_PULLUP
//#define FIL_RUNOUT1_PULLDOWN
//#define FIL_RUNOUT2_PULLUP
//#define FIL_RUNOUT2_PULLDOWN
//#define FIL_RUNOUT3_PULLUP
//#define FIL_RUNOUT3_PULLDOWN
//#define FIL_RUNOUT4_PULLUP
//#define FIL_RUNOUT4_PULLDOWN
//#define FIL_RUNOUT5_PULLUP
//#define FIL_RUNOUT5_PULLDOWN
//#define FIL_RUNOUT6_PULLUP
//#define FIL_RUNOUT6_PULLDOWN
//#define FIL_RUNOUT7_PULLUP
//#define FIL_RUNOUT7_PULLDOWN
//#define FIL_RUNOUT8_PULLUP
//#define FIL_RUNOUT8_PULLDOWN
#endif
//===========================================================================
+1 -1
View File
@@ -2321,7 +2321,7 @@
#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
#define BABYSTEP_GFX_OVERLAY // Enable graphical overlay on Z-offset editor
#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor
#endif
#endif
+5 -5
View File
@@ -28,13 +28,13 @@
/**
* Marlin release version identifier
*/
//#define SHORT_BUILD_VERSION "bugfix-2.1.x"
#define SHORT_BUILD_VERSION "2.1.x-TR1"
/**
* Verbose version identifier which should contain a reference to the location
* from where the binary was downloaded or the source code was compiled.
*/
//#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION
#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " TM3D"
/**
* The STRING_DISTRIBUTION_DATE represents when the binary file was built,
@@ -46,7 +46,7 @@
/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
*/
//#define MACHINE_NAME "3D Printer"
#define MACHINE_NAME "TM3D Trex"
/**
* The SOURCE_CODE_URL is the location where users will find the Marlin Source
@@ -54,7 +54,7 @@
* has a distinct Github fork— the Source Code URL should just be the main
* Marlin repository.
*/
//#define SOURCE_CODE_URL "github.com/MarlinFirmware/Marlin"
#define SOURCE_CODE_URL "https://github.com/InsanityAutomation/Marlin/tree/TM_Trex2+_2.0.x"
/**
* Default generic printer UUID.
@@ -65,7 +65,7 @@
* The WEBSITE_URL is the location where users can get more information such as
* documentation about a specific Marlin release.
*/
//#define WEBSITE_URL "marlinfw.org"
#define WEBSITE_URL "tinymachines3d.com"
/**
* Set the vendor info the serial USB interface, if changable
+3 -9
View File
@@ -25,10 +25,6 @@
#include "../MarlinCore.h"
#include "../module/temperature.h"
#if ENABLED(MARLIN_DEV_MODE)
MarlinError marlin_error_number; // Error Number - Marlin can beep X times periodically, display, and emit...
#endif
void safe_delay(millis_t ms) {
while (ms > 50) {
ms -= 50;
@@ -80,8 +76,6 @@ void safe_delay(millis_t ms) {
TERN_(Z_PROBE_ALLEN_KEY, "Z_PROBE_ALLEN_KEY")
TERN_(SOLENOID_PROBE, "SOLENOID_PROBE")
TERN_(MAGLEV4, "MAGLEV4")
TERN_(BIQU_MICROPROBE_V1, "BIQU_MICROPROBE_V1")
TERN_(BIQU_MICROPROBE_V2, "BIQU_MICROPROBE_V2")
IF_DISABLED(PROBE_SELECTED, "NONE")
);
@@ -101,9 +95,9 @@ void safe_delay(millis_t ms) {
SERIAL_ECHOPGM(" (Aligned With");
if (probe.offset_xy.y > 0)
SERIAL_ECHO(F(TERN(IS_SCARA, "-Distal", "-Back")));
SERIAL_ECHOPGM(TERN(IS_SCARA, "-Distal", "-Back"));
else if (probe.offset_xy.y < 0)
SERIAL_ECHO(F(TERN(IS_SCARA, "-Proximal", "-Front")));
SERIAL_ECHOPGM(TERN(IS_SCARA, "-Proximal", "-Front"));
else if (probe.offset_xy.x != 0)
SERIAL_ECHOPGM("-Center");
@@ -111,7 +105,7 @@ void safe_delay(millis_t ms) {
#endif
SERIAL_ECHO(probe.offset.z < 0 ? F("Below") : probe.offset.z > 0 ? F("Above") : F("Same Z as"));
SERIAL_ECHOF(probe.offset.z < 0 ? F("Below") : probe.offset.z > 0 ? F("Above") : F("Same Z as"));
SERIAL_ECHOLNPGM(" Nozzle)");
#endif
+1 -1
View File
@@ -197,7 +197,7 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
#endif
#if HAS_FILAMENT_SENSOR
if (runout.filament_ran_out) { // Disable a triggered sensor
runout.enabled = false;
runout.enabled[active_extruder] = false;
runout.reset();
}
#endif
+97 -98
View File
@@ -76,7 +76,7 @@ MMU2 mmu2;
#define MMU2_NO_TOOL 99
#define MMU_BAUD 115200
bool MMU2::_enabled, MMU2::ready;
bool MMU2::_enabled, MMU2::ready, MMU2::mmu_print_saved;
#if HAS_PRUSA_MMU2S
bool MMU2::mmu2s_triggered;
#endif
@@ -84,6 +84,7 @@ uint8_t MMU2::cmd, MMU2::cmd_arg, MMU2::last_cmd, MMU2::extruder;
int8_t MMU2::state = 0;
volatile int8_t MMU2::finda = 1;
volatile bool MMU2::finda_runout_valid;
int16_t MMU2::version = -1, MMU2::buildnr = -1;
millis_t MMU2::prev_request, MMU2::prev_P0_request;
char MMU2::rx_buffer[MMU_RX_SIZE], MMU2::tx_buffer[MMU_TX_SIZE];
@@ -92,11 +93,14 @@ struct E_Step {
feedRate_t feedRate; //!< feed rate in mm/s
};
inline void unscaled_mmu2_e_move(const float &dist, const feedRate_t fr_mm_s, const bool sync=true) {
current_position.e += dist / planner.e_factor[active_extruder];
line_to_current_position(fr_mm_s);
if (sync) planner.synchronize();
}
static constexpr E_Step
ramming_sequence[] PROGMEM = { MMU2_RAMMING_SEQUENCE }
, load_to_nozzle_sequence[] PROGMEM = { MMU2_LOAD_TO_NOZZLE_SEQUENCE }
#if HAS_PRUSA_MMU2S
, can_load_sequence[] PROGMEM = { MMU2_CAN_LOAD_SEQUENCE }
, can_load_increment_sequence[] PROGMEM = { MMU2_CAN_LOAD_INCREMENT_SEQUENCE }
#endif
;
MMU2::MMU2() {
rx_buffer[0] = '\0';
@@ -132,12 +136,12 @@ void MMU2::reset() {
#endif
}
int8_t MMU2::get_current_tool() { return extruder == MMU2_NO_TOOL ? -1 : extruder; }
uint8_t MMU2::get_current_tool() {
return extruder == MMU2_NO_TOOL ? -1 : extruder;
}
#if ANY(HAS_PRUSA_MMU2S, MMU_EXTRUDER_SENSOR)
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
#else
#define FILAMENT_PRESENT() true
#if EITHER(HAS_PRUSA_MMU2S, MMU_EXTRUDER_SENSOR)
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != runout.out_state())
#endif
void mmu2_attn_buzz(const bool two=false) {
@@ -145,7 +149,6 @@ void mmu2_attn_buzz(const bool two=false) {
if (two) { BUZZ(10, 0); BUZZ(200, 404); }
}
// Avoiding sscanf significantly reduces build size
void MMU2::mmu_loop() {
switch (state) {
@@ -160,7 +163,7 @@ void MMU2::mmu_loop() {
MMU2_SEND("S1"); // Read Version
state = -2;
}
else if (ELAPSED(millis(), prev_request + 30000)) { // 30sec after reset disable MMU
else if (millis() > 30000) { // 30sec after reset disable MMU
SERIAL_ECHOLNPGM("MMU not responding - DISABLED");
state = 0;
}
@@ -168,7 +171,7 @@ void MMU2::mmu_loop() {
case -2:
if (rx_ok()) {
const uint16_t version = uint16_t(strtoul(rx_buffer, nullptr, 10));
sscanf(rx_buffer, "%huok\n", &version);
DEBUG_ECHOLNPGM("MMU => ", version, "\nMMU <= 'S2'");
MMU2_SEND("S2"); // Read Build Number
state = -3;
@@ -177,15 +180,17 @@ void MMU2::mmu_loop() {
case -3:
if (rx_ok()) {
const uint16_t buildnr = uint16_t(strtoul(rx_buffer, nullptr, 10));
sscanf(rx_buffer, "%huok\n", &buildnr);
DEBUG_ECHOLNPGM("MMU => ", buildnr);
check_version(buildnr);
check_version();
#if ENABLED(MMU2_MODE_12V)
DEBUG_ECHOLNPGM("MMU <= 'M1'");
MMU2_SEND("M1"); // Stealth Mode
state = -5;
#else
DEBUG_ECHOLNPGM("MMU <= 'P0'");
MMU2_SEND("P0"); // Read FINDA
@@ -195,21 +200,20 @@ void MMU2::mmu_loop() {
break;
#if ENABLED(MMU2_MODE_12V)
case -5:
// response to M1
if (rx_ok()) {
DEBUG_ECHOLNPGM("MMU => ok");
DEBUG_ECHOLNPGM("MMU <= 'P0'");
MMU2_SEND("P0"); // Read FINDA
state = -4;
}
break;
case -5:
// response to M1
if (rx_ok()) {
DEBUG_ECHOLNPGM("MMU => ok");
DEBUG_ECHOLNPGM("MMU <= 'P0'");
MMU2_SEND("P0"); // Read FINDA
state = -4;
}
break;
#endif
case -4:
if (rx_ok()) {
const uint8_t findex = uint8_t(rx_buffer[0] - '0');
if (findex <= 1) finda = findex;
sscanf(rx_buffer, "%hhuok\n", &finda);
DEBUG_ECHOLNPGM("MMU => ", finda, "\nMMU - ENABLED");
@@ -282,11 +286,10 @@ void MMU2::mmu_loop() {
case 2: // response to command P0
if (rx_ok()) {
const uint8_t findex = uint8_t(rx_buffer[0] - '0');
if (findex <= 1) finda = findex;
sscanf(rx_buffer, "%hhuok\n", &finda);
// This is super annoying. Only activate if necessary
//if (finda_runout_valid) DEBUG_ECHOLNPGM("MMU <= 'P0'\nMMU => ", p_float_t(finda, 6));
// if (finda_runout_valid) DEBUG_ECHOLNPAIR_F("MMU <= 'P0'\nMMU => ", finda, 6);
if (!finda && finda_runout_valid) filament_runout();
if (cmd == MMU_CMD_NONE) ready = true;
@@ -403,7 +406,7 @@ void MMU2::tx_str(FSTR_P fstr) {
void MMU2::tx_printf(FSTR_P format, int argument = -1) {
clear_rx_buffer();
const uint8_t len = sprintf_P(tx_buffer, FTOP(format), argument);
for (uint8_t i = 0; i < len; ++i) MMU2_SERIAL.write(tx_buffer[i]);
LOOP_L_N(i, len) MMU2_SERIAL.write(tx_buffer[i]);
prev_request = millis();
}
@@ -413,7 +416,7 @@ void MMU2::tx_printf(FSTR_P format, int argument = -1) {
void MMU2::tx_printf(FSTR_P format, int argument1, int argument2) {
clear_rx_buffer();
const uint8_t len = sprintf_P(tx_buffer, FTOP(format), argument1, argument2);
for (uint8_t i = 0; i < len; ++i) MMU2_SERIAL.write(tx_buffer[i]);
LOOP_L_N(i, len) MMU2_SERIAL.write(tx_buffer[i]);
prev_request = millis();
}
@@ -439,7 +442,7 @@ bool MMU2::rx_ok() {
/**
* Check if MMU has compatible firmware
*/
void MMU2::check_version(const uint16_t buildnr) {
void MMU2::check_version() {
if (buildnr < MMU_REQUIRED_FW_BUILDNR) {
SERIAL_ERROR_MSG("Invalid MMU2 firmware. Version >= " STRINGIFY(MMU_REQUIRED_FW_BUILDNR) " required.");
kill(GET_TEXT_F(MSG_KILL_MMU2_FIRMWARE));
@@ -455,19 +458,12 @@ static void mmu2_not_responding() {
BUZZ(100, 659);
}
inline void beep_bad_cmd() { BUZZ(400, 40); }
#if HAS_PRUSA_MMU2S
/**
* Load filament until the sensor at the gears is triggered
* and give up after a number of attempts set with MMU2_C0_RETRY.
* Each try has a timeout before returning a fail state.
*/
bool MMU2::load_to_gears() {
command(MMU_CMD_C0);
manage_response(true, true);
for (uint8_t i = 0; i < MMU2_C0_RETRY; ++i) { // Keep loading until filament reaches gears
LOOP_L_N(i, MMU2_C0_RETRY) { // Keep loading until filament reaches gears
if (mmu2s_triggered) break;
command(MMU_CMD_C0);
manage_response(true, true);
@@ -488,11 +484,6 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
set_runout_valid(false);
if (index != extruder) {
if (ENABLED(MMU_IR_UNLOAD_MOVE) && FILAMENT_PRESENT()) {
DEBUG_ECHOLNPGM("Unloading\n");
while (FILAMENT_PRESENT()) // Filament present? Keep unloading.
unscaled_mmu2_e_move(-0.25, MMM_TO_MMS(120)); // 0.25mm is a guessed value. Adjust to preference.
}
stepper.disable_extruder();
ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
@@ -529,9 +520,9 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
#if ENABLED(MMU2_MENUS)
const uint8_t index = mmu2_choose_filament();
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_to_nozzle(index);
load_filament_to_nozzle(index);
#else
beep_bad_cmd();
ERR_BUZZ();
#endif
} break;
@@ -550,13 +541,13 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
active_extruder = 0;
}
#else
beep_bad_cmd();
ERR_BUZZ();
#endif
} break;
case 'c': {
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_to_nozzle_sequence();
load_to_nozzle();
} break;
}
@@ -617,9 +608,9 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
#if ENABLED(MMU2_MENUS)
uint8_t index = mmu2_choose_filament();
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_to_nozzle(index);
load_filament_to_nozzle(index);
#else
beep_bad_cmd();
ERR_BUZZ();
#endif
} break;
@@ -639,14 +630,14 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
extruder = index;
active_extruder = 0;
#else
beep_bad_cmd();
ERR_BUZZ();
#endif
} break;
case 'c': {
DEBUG_ECHOLNPGM("case c\n");
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_to_nozzle_sequence();
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
} break;
}
@@ -732,9 +723,9 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
#if ENABLED(MMU2_MENUS)
uint8_t index = mmu2_choose_filament();
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_to_nozzle(index);
load_filament_to_nozzle(index);
#else
beep_bad_cmd();
ERR_BUZZ();
#endif
} break;
@@ -753,14 +744,14 @@ inline void beep_bad_cmd() { BUZZ(400, 40); }
extruder = index;
active_extruder = 0;
#else
beep_bad_cmd();
ERR_BUZZ();
#endif
} break;
case 'c': {
DEBUG_ECHOLNPGM("case c\n");
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_to_nozzle_sequence();
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
} break;
}
@@ -801,7 +792,8 @@ bool MMU2::get_response() {
void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
constexpr xyz_pos_t park_point = NOZZLE_PARK_POINT;
bool response = false, mmu_print_saved = false;
bool response = false;
mmu_print_saved = false;
xyz_pos_t resume_position;
celsius_t resume_hotend_temp = thermalManager.degTargetHotend(active_extruder);
@@ -823,7 +815,8 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
resume_hotend_temp = thermalManager.degTargetHotend(active_extruder);
resume_position = current_position;
if (move_axes && all_axes_homed()) nozzle.park(0, park_point);
if (move_axes && all_axes_homed())
nozzle.park(0, park_point /*= NOZZLE_PARK_POINT*/);
if (turn_off_nozzle) thermalManager.setTargetHotend(0, active_extruder);
@@ -831,12 +824,13 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
}
}
else if (mmu_print_saved) {
SERIAL_ECHOLNPGM("\nMMU starts responding");
SERIAL_ECHOLNPGM("MMU starts responding\n");
if (turn_off_nozzle && resume_hotend_temp) {
thermalManager.setTargetHotend(resume_hotend_temp, active_extruder);
LCD_MESSAGE(MSG_HEATING);
ERR_BUZZ();
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(1000);
}
@@ -849,6 +843,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
if (move_axes && all_axes_homed()) {
// Move XY to starting position, then Z
do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
// Move Z_AXIS to saved position
do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
}
@@ -883,24 +878,23 @@ void MMU2::filament_runout() {
}
// Slowly spin the extruder during C0
else {
while (planner.movesplanned() < 3)
unscaled_mmu2_e_move(0.25, MMM_TO_MMS(120), false);
while (planner.movesplanned() < 3) {
current_position.e += 0.25;
line_to_current_position(MMM_TO_MMS(120));
}
}
}
mmu2s_triggered = present;
}
bool MMU2::can_load() {
static const E_Step can_load_sequence[] PROGMEM = { MMU2_CAN_LOAD_SEQUENCE },
can_load_increment_sequence[] PROGMEM = { MMU2_CAN_LOAD_INCREMENT_SEQUENCE };
execute_extruder_sequence(can_load_sequence, COUNT(can_load_sequence));
execute_extruder_sequence((const E_Step *)can_load_sequence, COUNT(can_load_sequence));
int filament_detected_count = 0;
const int steps = (MMU2_CAN_LOAD_RETRACT) / (MMU2_CAN_LOAD_INCREMENT);
DEBUG_ECHOLNPGM("MMU can_load:");
for (uint8_t i = 0; i < steps; ++i) {
execute_extruder_sequence(can_load_increment_sequence, COUNT(can_load_increment_sequence));
LOOP_L_N(i, steps) {
execute_extruder_sequence((const E_Step *)can_load_increment_sequence, COUNT(can_load_increment_sequence));
check_filament(); // Don't trust the idle function
DEBUG_CHAR(mmu2s_triggered ? 'O' : 'o');
if (mmu2s_triggered) ++filament_detected_count;
@@ -918,7 +912,7 @@ void MMU2::filament_runout() {
#endif
// Load filament into MMU2
void MMU2::load_to_feeder(const uint8_t index) {
void MMU2::load_filament(const uint8_t index) {
if (!_enabled) return;
command(MMU_CMD_L0 + index);
@@ -929,7 +923,8 @@ void MMU2::load_to_feeder(const uint8_t index) {
/**
* Switch material and load to nozzle
*/
bool MMU2::load_to_nozzle(const uint8_t index) {
bool MMU2::load_filament_to_nozzle(const uint8_t index) {
if (!_enabled) return false;
if (thermalManager.tooColdToExtrude(active_extruder)) {
@@ -938,13 +933,6 @@ bool MMU2::load_to_nozzle(const uint8_t index) {
return false;
}
if (TERN0(MMU_IR_UNLOAD_MOVE, index != extruder) && FILAMENT_PRESENT()) {
DEBUG_ECHOLNPGM("Unloading\n");
ramming_sequence(); // Unloading instructions from printer side when operating LCD
while (FILAMENT_PRESENT()) // Filament present? Keep unloading.
unscaled_mmu2_e_move(-0.25, MMM_TO_MMS(120)); // 0.25mm is a guessed value. Adjust to preference.
}
stepper.disable_extruder();
command(MMU_CMD_T0 + index);
manage_response(true, true);
@@ -954,12 +942,23 @@ bool MMU2::load_to_nozzle(const uint8_t index) {
mmu_loop();
extruder = index;
active_extruder = 0;
load_to_nozzle_sequence();
load_to_nozzle();
mmu2_attn_buzz();
}
return success;
}
/**
* Load filament to nozzle of multimaterial printer
*
* This function is used only after T? (user select filament) and M600 (change filament).
* It is not used after T0 .. T4 command (select filament), in such case, G-code is responsible for loading
* filament to nozzle.
*/
void MMU2::load_to_nozzle() {
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
}
bool MMU2::eject_filament(const uint8_t index, const bool recover) {
if (!_enabled) return false;
@@ -972,17 +971,20 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
LCD_MESSAGE(MSG_MMU2_EJECTING_FILAMENT);
unscaled_mmu2_e_move(-(MMU2_FILAMENTCHANGE_EJECT_FEED), MMM_TO_MMS(2500));
stepper.enable_extruder();
current_position.e -= MMU2_FILAMENTCHANGE_EJECT_FEED;
line_to_current_position(MMM_TO_MMS(2500));
planner.synchronize();
command(MMU_CMD_E0 + index);
manage_response(false, false);
if (recover) {
LCD_MESSAGE(MSG_MMU2_REMOVE_AND_CLICK);
LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER);
mmu2_attn_buzz();
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_MMU2_EJECT_RECOVER)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_MMU2_EJECT_RECOVER)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover")));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
mmu2_attn_buzz();
mmu2_attn_buzz(true);
command(MMU_CMD_R0);
manage_response(false, false);
@@ -1016,7 +1018,7 @@ bool MMU2::unload() {
}
// Unload sequence to optimize shape of the tip of the unloaded filament
ramming_sequence();
execute_extruder_sequence((const E_Step *)ramming_sequence, sizeof(ramming_sequence) / sizeof(E_Step));
command(MMU_CMD_U0);
manage_response(false, true);
@@ -1031,26 +1033,23 @@ bool MMU2::unload() {
return true;
}
void MMU2::ramming_sequence() {
static const E_Step sequence[] PROGMEM = { MMU2_RAMMING_SEQUENCE };
execute_extruder_sequence(sequence, COUNT(sequence));
}
void MMU2::load_to_nozzle_sequence() {
static const E_Step sequence[] PROGMEM = { MMU2_LOAD_TO_NOZZLE_SEQUENCE };
execute_extruder_sequence(sequence, COUNT(sequence));
}
void MMU2::execute_extruder_sequence(const E_Step * sequence, int steps) {
planner.synchronize();
stepper.enable_extruder();
const E_Step *step = sequence;
const E_Step* step = sequence;
for (uint8_t i = 0; i < steps; ++i) {
LOOP_L_N(i, steps) {
const float es = pgm_read_float(&(step->extrude));
const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate));
DEBUG_ECHO_MSG("E step ", es, "/", fr_mm_m);
unscaled_mmu2_e_move(es, MMM_TO_MMS(fr_mm_m));
current_position.e += es;
line_to_current_position(MMM_TO_MMS(fr_mm_m));
planner.synchronize();
step++;
}
+54 -46
View File
@@ -23,8 +23,6 @@
/**
* feature/pause.cpp - Pause feature support functions
* This may be combined with related G-codes if features are consolidated.
*
* Note: Calls to ui.pause_show_message are passed to either ExtUI or MarlinUI.
*/
#include "../inc/MarlinConfigPre.h"
@@ -62,6 +60,8 @@
#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "../lcd/e3v2/proui/dwin.h"
#endif
#include "../lcd/marlinui.h"
@@ -89,11 +89,9 @@ static xyze_pos_t resume_position;
PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT;
#endif
#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
fil_change_settings_t fc_settings[EXTRUDERS];
#endif
fil_change_settings_t fc_settings[EXTRUDERS];
#if HAS_MEDIA
#if ENABLED(SDSUPPORT)
#include "../sd/cardreader.h"
#endif
@@ -148,7 +146,7 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder);
#endif
ui.pause_show_message(PAUSE_MESSAGE_HEATING, mode);
ui.pause_show_message(PAUSE_MESSAGE_HEATING, mode); UNUSED(mode);
if (wait) return thermalManager.wait_for_hotend(active_extruder);
@@ -203,7 +201,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true; // LCD click or M108 will clear this
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENTLOAD)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Load Filament")));
#if ENABLED(HOST_PROMPT_SUPPORT)
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
@@ -212,14 +210,23 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
while (wait_for_user) {
impatient_beep(max_beep_count);
#if ALL(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR)
#if BOTH(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR)
#if MULTI_FILAMENT_SENSOR
#define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break;
switch (active_extruder) {
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_INSERTED)
LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
pin_t pin;
switch (i) {
default: continue;
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break;
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT)
#undef _CASE_RUNOUT
}
const RunoutMode rm = runout.mode[i - 1];
if (rm != RM_NONE && rm != RM_MOTION_SENSOR && extDigitalRead(pin) != runout.out_state(i - 1))
wait_for_user = false;
}
#else
if (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE) wait_for_user = false;
if (READ(FIL_RUNOUT_PIN) != runout.out_state(active_extruder))
wait_for_user = false;
#endif
#endif
idle_no_sleep();
@@ -236,8 +243,6 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
TERN_(BELTPRINTER, do_blocking_move_to_xy(0.00, 50.00));
TERN_(MPCTEMP, MPC::e_paused = true);
// Slow Load filament
if (slow_load_length) unscaled_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE);
@@ -264,7 +269,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)));
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR)));
wait_for_user = true; // A click or M108 breaks the purge_length loop
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
@@ -288,8 +293,8 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
// Show "Purge More" / "Resume" menu and wait for reply
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = false;
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI)
ui.pause_show_message(PAUSE_MESSAGE_OPTION); // MarlinUI and MKS UI also set PAUSE_RESPONSE_WAIT_FOR
#if EITHER(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
ui.pause_show_message(PAUSE_MESSAGE_OPTION); // Also sets PAUSE_RESPONSE_WAIT_FOR
#else
pause_menu_response = PAUSE_RESPONSE_WAIT_FOR;
#endif
@@ -301,9 +306,6 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
} while (TERN0(M600_PURGE_MORE_RESUMABLE, pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE));
#endif
TERN_(MPCTEMP, MPC::e_paused = false);
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_end());
return true;
@@ -333,18 +335,18 @@ inline void disable_active_extruder() {
*/
bool unload_filament(const_float_t unload_length, const bool show_lcd/*=false*/,
const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
#if ALL(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
#if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
, const_float_t mix_multiplier/*=1.0*/
#endif
) {
DEBUG_SECTION(uf, "unload_filament", true);
DEBUG_ECHOLNPGM("... unloadlen:", unload_length, " showlcd:", show_lcd, " mode:", mode
#if ALL(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
#if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
, " mixmult:", mix_multiplier
#endif
);
#if !ALL(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
#if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
constexpr float mix_multiplier = 1.0f;
#endif
@@ -404,6 +406,8 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
DEBUG_SECTION(pp, "pause_print", true);
DEBUG_ECHOLNPGM("... park.x:", park_point.x, " y:", park_point.y, " z:", park_point.z, " unloadlen:", unload_length, " showlcd:", show_lcd DXC_SAY);
UNUSED(show_lcd);
if (did_pause_print) return false; // already paused
#if ENABLED(HOST_ACTION_COMMANDS)
@@ -415,12 +419,13 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
#endif
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
// Indicate that the printer is paused
++did_pause_print;
// Pause the print job and timer
#if HAS_MEDIA
#if ENABLED(SDSUPPORT)
const bool was_sd_printing = IS_SD_PRINTING();
if (was_sd_printing) {
card.pauseSDPrint();
@@ -445,7 +450,7 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
// Wait for buffered blocks to complete
planner.synchronize();
#if ALL(ADVANCED_PAUSE_FANS_PAUSE, HAS_FAN)
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && HAS_FAN
thermalManager.set_fans_paused(true);
#endif
@@ -465,7 +470,6 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
// If axes don't need to home then the nozzle can park
if (do_park) nozzle.park(0, park_point); // Park the nozzle by doing a Minimum Z Raise followed by an XY Move
if (!do_park) LCD_MESSAGE(MSG_PARK_FAILED);
#if ENABLED(DUAL_X_CARRIAGE)
const int8_t saved_ext = active_extruder;
@@ -477,7 +481,9 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
if (unload_length)
unload_filament(unload_length, show_lcd, PAUSE_MODE_CHANGE_FILAMENT);
TERN_(DUAL_X_CARRIAGE, set_duplication_enabled(saved_ext_dup_mode, saved_ext));
#if ENABLED(DUAL_X_CARRIAGE)
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
#endif
// Disable the Extruder for manual change
disable_active_extruder();
@@ -504,7 +510,7 @@ void show_continue_prompt(const bool is_reload) {
ui.pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING);
SERIAL_ECHO_START();
SERIAL_ECHO(is_reload ? F(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : F(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
SERIAL_ECHOF(is_reload ? F(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : F(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
}
void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {
@@ -530,7 +536,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
// Wait for filament insert by user and press button
KEEPALIVE_STATE(PAUSED_FOR_USER);
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_NOZZLE_PARKED)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_NOZZLE_PARKED), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_NOZZLE_PARKED)));
wait_for_user = true; // LCD click or M108 will clear this
while (wait_for_user) {
@@ -548,17 +554,15 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_REHEAT)));
#if ENABLED(TOUCH_UI_FTDI_EVE)
ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FTDI_HEATER_TIMEOUT));
#elif ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_HEATER_TIMEOUT));
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_HEATER_TIMEOUT)));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(0, true)); // Wait for LCD click or M108
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_INFO, GET_TEXT_F(MSG_REHEATING)));
LCD_MESSAGE(MSG_REHEATING);
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(GET_TEXT_F(MSG_REHEATING)));
TERN_(DWIN_LCD_PROUI, LCD_MESSAGE(MSG_REHEATING));
// Re-enable the heaters if they timed out
HOTEND_LOOP() thermalManager.reset_hotend_idle_timer(e);
@@ -574,12 +578,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_REHEATDONE)));
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_REHEATDONE));
#else
LCD_MESSAGE(MSG_REHEATDONE);
#endif
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_REHEATDONE)));
TERN_(DWIN_LCD_PROUI, LCD_MESSAGE(MSG_REHEATDONE));
IF_DISABLED(PAUSE_REHEAT_FAST_RESUME, wait_for_user = true);
@@ -588,7 +589,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
}
idle_no_sleep();
}
TERN_(DUAL_X_CARRIAGE, set_duplication_enabled(saved_ext_dup_mode, saved_ext));
#if ENABLED(DUAL_X_CARRIAGE)
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
#endif
}
/**
@@ -705,7 +708,7 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
// Resume the print job timer if it was running
if (print_job_timer.isPaused()) print_job_timer.start();
#if HAS_MEDIA
#if ENABLED(SDSUPPORT)
if (did_pause_print) {
--did_pause_print;
card.startOrResumeFilePrinting();
@@ -720,8 +723,13 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
ui.reset_status();
ui.return_to_status();
#if ENABLED(DWIN_LCD_PROUI)
DWIN_Print_Resume();
HMI_ReturnScreen();
#else
ui.reset_status();
ui.return_to_status();
#endif
}
#endif // ADVANCED_PAUSE_FEATURE
+29 -38
View File
@@ -32,28 +32,23 @@
FilamentMonitor runout;
bool FilamentMonitorBase::enabled = true,
FilamentMonitorBase::filament_ran_out; // = false
bool FilamentMonitorBase::enabled[NUM_RUNOUT_SENSORS], // Initialized by settings.load
FilamentMonitorBase::filament_ran_out; // = false
RunoutMode FilamentMonitorBase::mode[NUM_RUNOUT_SENSORS]; // Initialized by settings.load
#if ENABLED(HOST_ACTION_COMMANDS)
bool FilamentMonitorBase::host_handling; // = false
#endif
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
#define DEBUG_TOOLCHANGE_MIGRATION_FEATURE
#include "../module/tool_change.h"
#define DEBUG_OUT ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
#include "../core/debug_out.h"
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
countdown_t RunoutResponseDelayed::mm_countdown;
#if ENABLED(FILAMENT_MOTION_SENSOR)
uint8_t FilamentSensorEncoder::motion_detected;
#endif
#else
int8_t RunoutResponseDebounced::runout_count[NUM_RUNOUT_SENSORS]; // = 0
#endif
float RunoutResponseDelayed::runout_distance_mm[NUM_RUNOUT_SENSORS]; // Initialized by settings.load
volatile float RunoutResponseDelayed::runout_mm_countdown[NUM_RUNOUT_SENSORS];
uint8_t FilamentSensorCore::motion_detected;
//
// Filament Runout event handler
@@ -68,6 +63,8 @@ bool FilamentMonitorBase::enabled = true,
#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "../lcd/e3v2/proui/dwin.h"
#endif
void event_filament_runout(const uint8_t extruder) {
@@ -86,6 +83,7 @@ void event_filament_runout(const uint8_t extruder) {
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(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);
@@ -99,16 +97,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 {
@@ -125,27 +119,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), C(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
+163 -304
View File
@@ -30,8 +30,7 @@
#include "../module/planner.h"
#include "../module/stepper.h" // for block_t
#include "../gcode/queue.h"
#include "../feature/pause.h" // for did_pause_print
#include "../MarlinCore.h" // for printingIsActive()
#include "../feature/pause.h"
#include "../inc/MarlinConfig.h"
@@ -44,44 +43,41 @@
#define FILAMENT_RUNOUT_THRESHOLD 5
#endif
#if ENABLED(FILAMENT_MOTION_SENSOR)
#define HAS_FILAMENT_MOTION 1
#endif
#if DISABLED(FILAMENT_MOTION_SENSOR) || ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define HAS_FILAMENT_SWITCH 1
#endif
typedef Flags<
#if NUM_MOTION_SENSORS > NUM_RUNOUT_SENSORS
NUM_MOTION_SENSORS
#else
NUM_RUNOUT_SENSORS
#endif
> runout_flags_t;
void event_filament_runout(const uint8_t extruder);
inline bool should_monitor_runout() { return did_pause_print || printingIsActive(); }
template<class RESPONSE_T, class SENSOR_T>
class TFilamentMonitor;
class FilamentSensor;
class FilamentSensorCore;
class RunoutResponseDelayed;
class RunoutResponseDebounced;
/********************************* TEMPLATE SPECIALIZATION *********************************/
typedef TFilamentMonitor<
TERN(HAS_FILAMENT_RUNOUT_DISTANCE, RunoutResponseDelayed, RunoutResponseDebounced),
FilamentSensor
RunoutResponseDelayed,
FilamentSensorCore
> FilamentMonitor;
extern FilamentMonitor runout;
/*******************************************************************************************/
enum RunoutMode : uint8_t {
RM_NONE,
RM_OUT_ON_LOW,
RM_OUT_ON_HIGH,
RM_RESERVED3,
RM_RESERVED4,
RM_RESERVED5,
RM_RESERVED6,
RM_MOTION_SENSOR
};
class FilamentMonitorBase {
public:
static bool enabled, filament_ran_out;
static bool enabled[NUM_RUNOUT_SENSORS], filament_ran_out;
static RunoutMode mode[NUM_RUNOUT_SENSORS];
static uint8_t out_state(const uint8_t e=0) { return mode[e] == RM_OUT_ON_HIGH ? HIGH : LOW; }
#if ENABLED(HOST_ACTION_COMMANDS)
static bool host_handling;
@@ -111,24 +107,14 @@ class TFilamentMonitor : public FilamentMonitorBase {
// Call this method when filament is present,
// so the response can reset its counter.
static void filament_present(const uint8_t extruder) {
response.filament_present(extruder);
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
static void filament_motion_present(const uint8_t extruder) {
response.filament_motion_present(extruder);
}
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
static float& runout_distance() { return response.runout_distance_mm; }
static void set_runout_distance(const_float_t mm) { response.runout_distance_mm = mm; }
#endif
static void filament_present(const uint8_t e) { response.filament_present(e); }
static float& runout_distance(const uint8_t e=0) { return response.runout_distance_mm[e]; }
static void set_runout_distance(const_float_t mm, const uint8_t e=0) { response.runout_distance_mm[e] = mm; }
// Handle a block completion. RunoutResponseDelayed uses this to
// add up the length of filament moved while the filament is out.
static void block_completed(const block_t * const b) {
if (enabled) {
if (enabled[active_extruder]) {
response.block_completed(b);
sensor.block_completed(b);
}
@@ -136,33 +122,43 @@ class TFilamentMonitor : public FilamentMonitorBase {
// Give the response a chance to update its counter.
static void run() {
if (enabled && !filament_ran_out && should_monitor_runout()) {
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
if (enabled[active_extruder] && mode[active_extruder] != RM_NONE && !filament_ran_out && (printingIsActive() || did_pause_print)) {
cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here
response.run();
sensor.run();
const runout_flags_t runout_flags = response.has_run_out();
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, sei());
const uint8_t runout_flags = response.has_run_out();
sei();
#if MULTI_FILAMENT_SENSOR
#if ENABLED(WATCH_ALL_RUNOUT_SENSORS)
const bool ran_out = bool(runout_flags); // any sensor triggers
const bool ran_out = !!runout_flags; // any sensor triggers
uint8_t extruder = 0;
if (ran_out) while (!runout_flags.test(extruder)) extruder++;
if (ran_out) {
uint8_t bitmask = runout_flags;
while (!(bitmask & 1)) {
bitmask >>= 1;
extruder++;
}
}
#else
const bool ran_out = runout_flags[active_extruder]; // suppress non active extruders
const bool ran_out = TEST(runout_flags, active_extruder); // suppress non active extruders
uint8_t extruder = active_extruder;
#endif
#else
const bool ran_out = bool(runout_flags);
const bool ran_out = !!runout_flags;
uint8_t extruder = active_extruder;
#endif
if (ran_out) {
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
if (runout_flags) {
SERIAL_ECHOPGM("Runout Sensors: ");
for (uint8_t i = 0; i < 8; ++i) SERIAL_CHAR('0' + char(runout_flags[i]));
SERIAL_ECHOLNPGM(" -> ", extruder, " RUN OUT");
#endif
LOOP_L_N(i, 8) SERIAL_ECHO('0' + TEST(runout_flags, i));
SERIAL_ECHOPGM(" -> ", extruder);
if (ran_out) SERIAL_ECHOPGM(" RUN OUT");
SERIAL_EOL();
}
#endif
if (ran_out) {
filament_ran_out = true;
event_filament_runout(extruder);
planner.synchronize();
@@ -182,26 +178,39 @@ class FilamentSensorBase {
static void filament_present(const uint8_t extruder) {
runout.filament_present(extruder); // ...which calls response.filament_present(extruder)
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
static void filament_motion_present(const uint8_t extruder) {
runout.filament_motion_present(extruder); // ...which calls response.filament_motion_present(extruder)
}
#endif
public:
static void setup() {
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0);
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN);
REPEAT_1(NUM_RUNOUT_SENSORS, INIT_RUNOUT_PIN)
#undef INIT_RUNOUT_PIN
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define INIT_MOTION_PIN(N) _INIT_RUNOUT_PIN(FIL_MOTION##N##_PIN, FIL_MOTION##N##_STATE, FIL_MOTION##N##_PULLUP, FIL_MOTION##N##_PULLDOWN);
REPEAT_1(NUM_MOTION_SENSORS, INIT_MOTION_PIN)
#undef INIT_MOTION_PIN
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0)
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN)
#if NUM_RUNOUT_SENSORS >= 1
INIT_RUNOUT_PIN(1);
#endif
#if NUM_RUNOUT_SENSORS >= 2
INIT_RUNOUT_PIN(2);
#endif
#if NUM_RUNOUT_SENSORS >= 3
INIT_RUNOUT_PIN(3);
#endif
#if NUM_RUNOUT_SENSORS >= 4
INIT_RUNOUT_PIN(4);
#endif
#if NUM_RUNOUT_SENSORS >= 5
INIT_RUNOUT_PIN(5);
#endif
#if NUM_RUNOUT_SENSORS >= 6
INIT_RUNOUT_PIN(6);
#endif
#if NUM_RUNOUT_SENSORS >= 7
INIT_RUNOUT_PIN(7);
#endif
#if NUM_RUNOUT_SENSORS >= 8
INIT_RUNOUT_PIN(8);
#endif
#undef _INIT_RUNOUT_PIN
#undef INIT_RUNOUT_PIN
}
// Return a bitmask of runout pin states
static uint8_t poll_runout_pins() {
@@ -212,275 +221,125 @@ class FilamentSensorBase {
// Return a bitmask of runout flag states (1 bits always indicates runout)
static uint8_t poll_runout_states() {
#define _INVERT_BIT(N) | (FIL_RUNOUT##N##_STATE ? 0 : _BV(N - 1))
return poll_runout_pins() ^ uint8_t(0 REPEAT_1(NUM_RUNOUT_SENSORS, _INVERT_BIT));
#undef _INVERT_BIT
#define _OR_INVERT(N) | (runout.out_state(N-1) ? 0 : _BV(N-1))
return poll_runout_pins() ^ uint8_t(0 REPEAT_1(NUM_RUNOUT_SENSORS, _OR_INVERT));
#undef _OR_INVERT
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
// Return a bitmask of motion pin states
static uint8_t poll_motion_pins() {
#define _OR_MOTION(N) | (READ(FIL_MOTION##N##_PIN) ? _BV((N) - 1) : 0)
return (0 REPEAT_1(NUM_MOTION_SENSORS, _OR_MOTION));
#undef _OR_MOTION
}
// Return a bitmask of motion flag states (1 bits always indicates runout)
static uint8_t poll_motion_states() {
#define _OR_MOTION(N) | (FIL_MOTION##N##_STATE ? 0 : _BV(N - 1))
return poll_motion_pins() ^ uint8_t(0 REPEAT_1(NUM_MOTION_SENSORS, _OR_MOTION));
#undef _OR_MOTION
}
#endif
};
#if HAS_FILAMENT_MOTION
class FilamentSensorCore : public FilamentSensorBase {
private:
static uint8_t motion_detected;
/**
* This sensor uses a magnetic encoder disc and a Hall effect
* sensor (or a slotted disc and optical sensor). The state
* will toggle between 0 and 1 on filament movement. It can detect
* filament runout and stripouts or jams.
*/
class FilamentSensorEncoder : public FilamentSensorBase {
private:
static uint8_t motion_detected;
static bool poll_runout_state(const uint8_t extruder) {
const uint8_t runout_states = poll_runout_states();
#if MULTI_FILAMENT_SENSOR
if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())
&& !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
) return TEST(runout_states, extruder); // A specific extruder ran out
#else
UNUSED(extruder);
#endif
return !!runout_states; // Any extruder ran out
}
static void poll_motion_sensor() {
static uint8_t old_state;
const uint8_t new_state = TERN(FILAMENT_SWITCH_AND_MOTION, poll_motion_pins, poll_runout_pins)(),
change = old_state ^ new_state;
old_state = new_state;
static void poll_motion_sensor() {
static uint8_t old_state;
const uint8_t new_state = poll_runout_pins(),
change = old_state ^ new_state;
old_state = new_state;
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
if (change) {
SERIAL_ECHOPGM("Motion detected:");
for (uint8_t e = 0; e < TERN(FILAMENT_SWITCH_AND_MOTION, NUM_MOTION_SENSORS, NUM_RUNOUT_SENSORS); ++e)
if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e);
SERIAL_EOL();
}
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
if (change) {
SERIAL_ECHOPGM("Motion detected:");
LOOP_L_N(e, NUM_RUNOUT_SENSORS)
if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e);
SERIAL_EOL();
}
#endif
motion_detected |= change;
motion_detected |= change;
}
public:
static void block_completed(const block_t * const b) {
if (runout.mode[active_extruder] != RM_MOTION_SENSOR) return;
// If the sensor wheel has moved since the last call to
// this method reset the runout counter for the extruder.
if (TEST(motion_detected, b->extruder))
filament_present(b->extruder);
// Clear motion triggers for next block
motion_detected = 0;
}
static void run() {
if (runout.mode[active_extruder] == RM_MOTION_SENSOR) {
poll_motion_sensor();
}
public:
static void block_completed(const block_t * const b) {
// If the sensor wheel has moved since the last call to
// this method reset the runout counter for the extruder.
if (TEST(motion_detected, b->extruder))
TERN(FILAMENT_SWITCH_AND_MOTION, filament_motion_present, filament_present)(b->extruder);
// Clear motion triggers for next block
motion_detected = 0;
}
static void run() { poll_motion_sensor(); }
};
#endif // HAS_FILAMENT_MOTION
#if HAS_FILAMENT_SWITCH
/**
* This is a simple endstop switch in the path of the filament.
* It can detect filament runout, but not stripouts or jams.
*/
class FilamentSensorSwitch : public FilamentSensorBase {
private:
static bool poll_runout_state(const uint8_t extruder) {
const uint8_t runout_states = poll_runout_states();
#if MULTI_FILAMENT_SENSOR
if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())
&& !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
) return TEST(runout_states, extruder); // A specific extruder ran out
#else
UNUSED(extruder);
#endif
return !!runout_states; // Any extruder ran out
}
public:
static void block_completed(const block_t * const) {}
static void run() {
for (uint8_t s = 0; s < NUM_RUNOUT_SENSORS; ++s) {
else if (runout.mode[active_extruder] != RM_NONE) {
LOOP_L_N(s, NUM_RUNOUT_SENSORS) {
const bool out = poll_runout_state(s);
if (!out) filament_present(s);
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
static uint8_t was_out; // = 0
if (out != TEST(was_out, s)) {
TBI(was_out, s);
SERIAL_ECHOLN(F("Filament Sensor "), AS_DIGIT(s), out ? F(" OUT") : F(" IN"));
SERIAL_ECHOLNF(F("Filament Sensor "), AS_DIGIT(s), out ? F(" OUT") : F(" IN"));
}
#endif
}
}
};
}
};
#endif // HAS_FILAMENT_SWITCH
/**
* This is a simple endstop switch in the path of the filament.
* It can detect filament runout, but not stripouts or jams.
*/
class FilamentSensor : public FilamentSensorBase {
private:
TERN_(HAS_FILAMENT_MOTION, static FilamentSensorEncoder encoder_sensor);
TERN_(HAS_FILAMENT_SWITCH, static FilamentSensorSwitch switch_sensor);
public:
static void block_completed(const block_t * const b) {
TERN_(HAS_FILAMENT_MOTION, encoder_sensor.block_completed(b));
TERN_(HAS_FILAMENT_SWITCH, switch_sensor.block_completed(b));
}
static void run() {
TERN_(HAS_FILAMENT_MOTION, encoder_sensor.run());
TERN_(HAS_FILAMENT_SWITCH, switch_sensor.run());
}
};
/********************************* RESPONSE TYPE *********************************/
#if HAS_FILAMENT_RUNOUT_DISTANCE
// RunoutResponseDelayed triggers a runout event only if the length
// of filament specified by FIL_RUNOUT_DISTANCE_MM has been fed
// during a runout condition.
class RunoutResponseDelayed {
private:
static volatile float runout_mm_countdown[NUM_RUNOUT_SENSORS];
typedef struct {
float runout[NUM_RUNOUT_SENSORS];
Flags<NUM_RUNOUT_SENSORS> runout_reset; // Reset runout later
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
float motion[NUM_MOTION_SENSORS];
Flags<NUM_MOTION_SENSORS> motion_reset; // Reset motion later
#endif
} countdown_t;
public:
static float runout_distance_mm[NUM_RUNOUT_SENSORS];
// RunoutResponseDelayed triggers a runout event only if the length
// of filament specified by FILAMENT_RUNOUT_DISTANCE_MM has been fed
// during a runout condition.
class RunoutResponseDelayed {
private:
static countdown_t mm_countdown;
static void reset() {
LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(i);
}
public:
static float runout_distance_mm;
static void reset() {
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i);
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) filament_motion_present(i);
#endif
}
static void run() {
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
static millis_t t = 0;
const millis_t ms = millis();
if (ELAPSED(ms, t)) {
t = millis() + 1000UL;
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i)
SERIAL_ECHO(i ? F(", ") : F("Runout remaining mm: "), mm_countdown.runout[i]);
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i)
SERIAL_ECHO(i ? F(", ") : F("Motion remaining mm: "), mm_countdown.motion[i]);
#endif
SERIAL_EOL();
}
#endif
}
static runout_flags_t has_run_out() {
runout_flags_t runout_flags{0};
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (mm_countdown.runout[i] < 0) runout_flags.set(i);
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) if (mm_countdown.motion[i] < 0) runout_flags.set(i);
#endif
return runout_flags;
}
static void filament_present(const uint8_t extruder) {
if (mm_countdown.runout[extruder] < runout_distance_mm || did_pause_print) {
// Reset runout only if it is smaller than runout_distance or printing is paused.
// On Bowden systems retract may be larger than runout_distance_mm, so if retract
// was added leave it in place, or the following unretract will cause runout event.
mm_countdown.runout[extruder] = runout_distance_mm;
mm_countdown.runout_reset.clear(extruder);
}
else {
// If runout is larger than runout distance, we cannot reset right now, as Bowden and retract
// distance larger than runout_distance_mm leads to negative runout right after unretract.
// But we cannot ignore filament_present event. After unretract, runout will become smaller
// than runout_distance_mm and should be reset after that. So activate delayed reset.
mm_countdown.runout_reset.set(extruder);
}
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
static void filament_motion_present(const uint8_t extruder) {
// Same logic as filament_present
if (mm_countdown.motion[extruder] < runout_distance_mm || did_pause_print) {
mm_countdown.motion[extruder] = runout_distance_mm;
mm_countdown.motion_reset.clear(extruder);
}
else
mm_countdown.motion_reset.set(extruder);
static void run() {
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
static millis_t t = 0;
const millis_t ms = millis();
if (ELAPSED(ms, t)) {
t = millis() + 1000UL;
LOOP_L_N(i, NUM_RUNOUT_SENSORS)
SERIAL_ECHOF(i ? F(", ") : F("Remaining mm: "), runout_mm_countdown[i]);
SERIAL_EOL();
}
#endif
}
static void block_completed(const block_t * const b) {
const int32_t esteps = b->steps.e;
if (!esteps) return;
static uint8_t has_run_out() {
uint8_t runout_flags = 0;
LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_mm_countdown[i] < 0) SBI(runout_flags, i);
return runout_flags;
}
// No calculation unless paused or printing
if (!should_monitor_runout()) return;
static void filament_present(const uint8_t extruder) {
runout_mm_countdown[extruder] = runout_distance_mm[extruder];
}
// No need to ignore retract/unretract movement since they complement each other
static void block_completed(const block_t * const b) {
if (b->steps.x || b->steps.y || b->steps.z || did_pause_print) { // Allow pause purge move to re-trigger runout state
// Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
const uint8_t e = b->extruder;
const float mm = (b->direction_bits.e ? esteps : -esteps) * planner.mm_per_step[E_AXIS_N(e)];
if (e < NUM_RUNOUT_SENSORS) {
mm_countdown.runout[e] -= mm;
if (mm_countdown.runout_reset[e]) filament_present(e); // Reset pending. Try to reset.
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
if (e < NUM_MOTION_SENSORS) {
mm_countdown.motion[e] -= mm;
if (mm_countdown.motion_reset[e]) filament_motion_present(e); // Reset pending. Try to reset.
}
#endif
const int32_t steps = b->steps.e;
runout_mm_countdown[e] -= (TEST(b->direction_bits, E_AXIS) ? -steps : steps) * planner.mm_per_step[E_AXIS_N(e)];
}
};
#else // !HAS_FILAMENT_RUNOUT_DISTANCE
// RunoutResponseDebounced triggers a runout event after a runout
// condition has been detected runout_threshold times in a row.
class RunoutResponseDebounced {
private:
static constexpr int8_t runout_threshold = FILAMENT_RUNOUT_THRESHOLD;
static int8_t runout_count[NUM_RUNOUT_SENSORS];
public:
static void reset() {
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i);
}
static void run() {
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] >= 0) runout_count[i]--;
}
static runout_flags_t has_run_out() {
runout_flags_t runout_flags{0};
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] < 0) runout_flags.set(i);
return runout_flags;
}
static void block_completed(const block_t * const) { }
static void filament_present(const uint8_t extruder) {
runout_count[extruder] = runout_threshold;
}
};
#endif // !HAS_FILAMENT_RUNOUT_DISTANCE
}
};
+1 -1
View File
@@ -94,7 +94,7 @@ void GcodeSuite::M600() {
// In this case, for duplicating modes set DXC_ext to the extruder that ran out.
#if MULTI_FILAMENT_SENSOR
if (idex_is_duplicating())
DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT2_STATE) ? 1 : 0;
DXC_ext = (READ(FIL_RUNOUT2_PIN) == runout.out_state(1)) ? 1 : 0;
#else
DXC_ext = active_extruder;
#endif
-83
View File
@@ -1,83 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if HAS_FILAMENT_SENSOR
#include "../../gcode.h"
#include "../../../feature/runout.h"
/**
* M412: Enable / Disable filament runout detection
*
* Parameters
* R : Reset the runout sensor
* S<bool> : Reset and enable/disable the runout sensor
* H<bool> : Enable/disable host handling of filament runout
* D<linear> : Extra distance to continue after runout is triggered
*/
void GcodeSuite::M412() {
if (parser.seen("RS"
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, "D")
TERN_(HOST_ACTION_COMMANDS, "H")
)) {
#if ENABLED(HOST_ACTION_COMMANDS)
if (parser.seen('H')) runout.host_handling = parser.value_bool();
#endif
const bool seenR = parser.seen_test('R'), seenS = parser.seen('S');
if (seenR || seenS) runout.reset();
if (seenS) runout.enabled = parser.value_bool();
#if HAS_FILAMENT_RUNOUT_DISTANCE
if (parser.seenval('D')) runout.set_runout_distance(parser.value_linear_units());
#endif
}
else {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Filament runout ");
serialprint_onoff(runout.enabled);
#if HAS_FILAMENT_RUNOUT_DISTANCE
SERIAL_ECHOPGM(" ; Distance ", runout.runout_distance(), "mm");
#endif
#if ENABLED(HOST_ACTION_COMMANDS)
SERIAL_ECHOPGM(" ; Host handling ");
serialprint_onoff(runout.host_handling);
#endif
SERIAL_EOL();
}
}
void GcodeSuite::M412_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
report_heading_etc(forReplay, F(STR_FILAMENT_RUNOUT_SENSOR));
SERIAL_ECHOPGM(
" M412 S", runout.enabled
#if HAS_FILAMENT_RUNOUT_DISTANCE
, " D", LINEAR_UNIT(runout.runout_distance())
#endif
, " ; Sensor "
);
serialprintln_onoff(runout.enabled);
}
#endif // HAS_FILAMENT_SENSOR
+97
View File
@@ -0,0 +1,97 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if HAS_FILAMENT_SENSOR
#include "../../gcode.h"
#include "../../../feature/runout.h"
/**
* M591: Configure filament runout detection
*
* Parameters
* R : Reset the runout sensor
* S<bool> : Reset and enable/disable the runout sensor
* H<bool> : Enable/disable host handling of filament runout
* L<linear> : Extra distance to continue after runout is triggered or motion interval
* D<linear> : Alias for L
* P<index> : Mode 0 = NONE
* 1 = Switch NO (HIGH = filament present)
* 2 = Switch NC (LOW = filament present)
* 3 = Encoder / Motion Sensor
*/
void GcodeSuite::M591() {
if (parser.seen("RSDP" TERN_(HOST_ACTION_COMMANDS, "H"))) {
#if ENABLED(HOST_ACTION_COMMANDS)
if (parser.seen('H')) runout.host_handling = parser.value_bool();
#endif
const bool seenR = parser.seen_test('R'), seenS = parser.seen('S');
if (seenR || seenS) runout.reset();
const uint8_t tool = TERN0(MULTI_FILAMENT_SENSOR, parser.ushortval('E', active_extruder));
if (seenS) runout.enabled[tool] = parser.value_bool();
if (parser.seen('D') || parser.seen('L')) runout.set_runout_distance(parser.value_linear_units(), tool);
if (parser.seen('P')) {
const RunoutMode tmp_mode = (RunoutMode)parser.value_int();
switch (tmp_mode) {
case RM_NONE ... RM_OUT_ON_HIGH:
case RM_MOTION_SENSOR:
runout.mode[tool] = tmp_mode;
runout.setup();
default: break;
}
}
}
else {
#if DISABLED(SLIM_LCD_MENUS)
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Filament runout ");
serialprint_onoff(runout.enabled[active_extruder]);
SERIAL_ECHOPGM(" ; Distance ", runout.runout_distance(active_extruder), "mm");
SERIAL_ECHOPGM(" ; Mode ", runout.mode[active_extruder]);
#if ENABLED(HOST_ACTION_COMMANDS)
SERIAL_ECHOPGM(" ; Host handling ");
serialprint_onoff(runout.host_handling);
#endif
SERIAL_EOL();
#else
M591_report(false);
#endif
}
}
void GcodeSuite::M591_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, F(STR_FILAMENT_RUNOUT_SENSOR));
LOOP_S_L_N(e, 1, NUM_RUNOUT_SENSORS)
SERIAL_ECHOLNPGM(
" M591"
#if MULTI_FILAMENT_SENSOR
" E", e,
#endif
" S", runout.enabled[e]
, " D", LINEAR_UNIT(runout.runout_distance(e))
, " P", runout.mode[e]
);
}
#endif // HAS_FILAMENT_SENSOR
+60 -80
View File
@@ -75,14 +75,26 @@ GcodeSuite gcode;
millis_t GcodeSuite::previous_move_ms = 0,
GcodeSuite::max_inactive_time = 0;
#if HAS_DISABLE_IDLE_AXES
millis_t GcodeSuite::stepper_inactive_time = SEC_TO_MS(DEFAULT_STEPPER_TIMEOUT_SEC);
#if HAS_DISABLE_INACTIVE_AXIS
millis_t GcodeSuite::stepper_inactive_time = SEC_TO_MS(DEFAULT_STEPPER_DEACTIVE_TIME);
#endif
// Relative motion mode for each logical axis
relative_t GcodeSuite::axis_relative; // Init in constructor
static constexpr xyze_bool_t ar_init = AXIS_RELATIVE_MODES;
axis_bits_t GcodeSuite::axis_relative = 0 LOGICAL_AXIS_GANG(
| (ar_init.e << REL_E),
| (ar_init.x << REL_X),
| (ar_init.y << REL_Y),
| (ar_init.z << REL_Z),
| (ar_init.i << REL_I),
| (ar_init.j << REL_J),
| (ar_init.k << REL_K),
| (ar_init.u << REL_U),
| (ar_init.v << REL_V),
| (ar_init.w << REL_W)
);
#if ANY(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE)
#if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE)
bool GcodeSuite::autoreport_paused; // = false
#endif
@@ -105,7 +117,8 @@ void GcodeSuite::report_heading(const bool forReplay, FSTR_P const fstr, const b
if (forReplay) return;
if (fstr) {
SERIAL_ECHO_START();
SERIAL_ECHO(F("; "), fstr);
SERIAL_ECHOPGM("; ");
SERIAL_ECHOF(fstr);
}
if (eol) { SERIAL_CHAR(':'); SERIAL_EOL(); }
}
@@ -122,16 +135,14 @@ void GcodeSuite::say_units() {
* Return -1 if the T parameter is out of range
*/
int8_t GcodeSuite::get_target_extruder_from_command() {
#if HAS_TOOLCHANGE
if (parser.seenval('T')) {
const int8_t e = parser.value_byte();
if (e < EXTRUDERS) return e;
SERIAL_ECHO_START();
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
SERIAL_ECHOLNPGM(" " STR_INVALID_EXTRUDER " ", e);
return -1;
}
#endif
if (parser.seenval('T')) {
const int8_t e = parser.value_byte();
if (e < EXTRUDERS) return e;
SERIAL_ECHO_START();
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
SERIAL_ECHOLNPGM(" " STR_INVALID_EXTRUDER " ", e);
return -1;
}
return active_extruder;
}
@@ -155,7 +166,7 @@ int8_t GcodeSuite::get_target_e_stepper_from_command(const int8_t dval/*=-1*/) {
}
/**
* Set XYZ...E destination and feedrate from the current G-Code command
* Set XYZ...E destination and feedrate from the current GCode command
*
* - Set destination from included axis codes
* - Set to current for missing axis codes
@@ -205,13 +216,13 @@ void GcodeSuite::get_destination_from_command() {
TERN_(LASER_FEATURE, cutter.feedrate_mm_m = MMS_TO_MMM(feedrate_mm_s));
}
#if ALL(PRINTCOUNTER, HAS_EXTRUDERS)
#if BOTH(PRINTCOUNTER, HAS_EXTRUDERS)
if (!DEBUGGING(DRYRUN) && !skip_move)
print_job_timer.incFilamentUsed(destination.e - current_position.e);
#endif
// Get ABCDHI mixing factors
#if ALL(MIXING_EXTRUDER, DIRECT_MIXING_IN_G1)
#if BOTH(MIXING_EXTRUDER, DIRECT_MIXING_IN_G1)
M165();
#endif
@@ -443,7 +454,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 61: G61(); break; // G61: Apply/restore saved coordinates.
#endif
#if ALL(PTC_PROBE, PTC_BED)
#if BOTH(PTC_PROBE, PTC_BED)
case 76: G76(); break; // G76: Calibrate first layer compensation values
#endif
@@ -461,7 +472,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#endif
#if ENABLED(DEBUG_GCODE_PARSER)
case 800: parser.debug(); break; // G800: G-Code Parser Test for G
case 800: parser.debug(); break; // G800: GCode Parser Test for G
#endif
default: parser.unknown_command_warning(); break;
@@ -485,11 +496,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 7: M7(); break; // M7: Coolant Mist ON
#endif
#if ANY(AIR_ASSIST, COOLANT_FLOOD)
#if EITHER(AIR_ASSIST, COOLANT_FLOOD)
case 8: M8(); break; // M8: Air Assist / Coolant Flood ON
#endif
#if ANY(AIR_ASSIST, COOLANT_CONTROL)
#if EITHER(AIR_ASSIST, COOLANT_CONTROL)
case 9: M9(); break; // M9: Air Assist / Coolant OFF
#endif
@@ -508,7 +519,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 17: M17(); break; // M17: Enable all stepper motors
#if HAS_MEDIA
#if ENABLED(SDSUPPORT)
case 20: M20(); break; // M20: List SD card
case 21: M21(); break; // M21: Init SD card
case 22: M22(); break; // M22: Release SD card
@@ -529,12 +540,12 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 33: M33(); break; // M33: Get the long full path to a file or folder
#endif
#if ALL(SDCARD_SORT_ALPHA, SDSORT_GCODE)
#if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE)
case 34: M34(); break; // M34: Set SD card sorting options
#endif
case 928: M928(); break; // M928: Start SD write
#endif // HAS_MEDIA
#endif // SDSUPPORT
case 31: M31(); break; // M31: Report time since the start of SD print or last M109
@@ -570,7 +581,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 102: M102(); break; // M102: Configure Bed Distance Sensor
#endif
#if HAS_HOTEND
#if HAS_EXTRUDERS
case 104: M104(); break; // M104: Set hot end temperature
case 109: M109(); break; // M109: Wait for hotend temperature to reach target
#endif
@@ -629,7 +640,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 154: M154(); break; // M154: Set position auto-report interval
#endif
#if ALL(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)
#if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)
case 155: M155(); break; // M155: Set temperature auto-report interval
#endif
@@ -660,24 +671,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 82: M82(); break; // M82: Set E axis normal mode (same as other axes)
case 83: M83(); break; // M83: Set E axis relative mode
#endif
case 18: case 84: M18_M84(); break; // M18/M84: Disable Steppers / Set Timeout
case 85: M85(); break; // M85: Set inactivity stepper shutdown timeout
#if ENABLED(HOTEND_IDLE_TIMEOUT)
case 86: M86(); break; // M86: Set Hotend Idle Timeout
case 87: M87(); break; // M87: Cancel Hotend Idle Timeout
#endif
#if ENABLED(EDITABLE_STEPS_PER_UNIT)
case 92: M92(); break; // M92: Set the steps-per-unit for one or more axes
#endif
case 92: M92(); break; // M92: Set the steps-per-unit for one or more axes
case 114: M114(); break; // M114: Report current position
#if ENABLED(CAPABILITIES_REPORT)
case 115: M115(); break; // M115: Report capabilities
#endif
case 115: M115(); break; // M115: Report capabilities
case 117: TERN_(HAS_STATUS_MESSAGE, M117()); break; // M117: Set LCD message text, if possible
@@ -723,7 +721,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 204: M204(); break; // M204: Set acceleration
case 205: M205(); break; // M205: Set advanced settings
#if HAS_HOME_OFFSET
#if HAS_M206_COMMAND
case 206: M206(); break; // M206: Set home offsets
#endif
@@ -771,10 +769,6 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#if ENABLED(BABYSTEPPING)
case 290: M290(); break; // M290: Babystepping
#if ENABLED(EP_BABYSTEPPING)
case 293: IF_DISABLED(EMERGENCY_PARSER, M293()); break; // M293: Babystep up
case 294: IF_DISABLED(EMERGENCY_PARSER, M294()); break; // M294: Babystep down
#endif
#endif
#if HAS_SOUND
@@ -801,7 +795,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 250: M250(); break; // M250: Set LCD contrast
#endif
#if ENABLED(EDITABLE_DISPLAY_TIMEOUT)
#if HAS_GCODE_M255
case 255: M255(); break; // M255: Set LCD Sleep/Backlight Timeout (Minutes)
#endif
@@ -842,7 +836,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 364: if (M364()) return; break; // M364: SCARA Psi pos3 (90 deg to Theta)
#endif
#if ANY(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL)
#if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL)
case 380: M380(); break; // M380: Activate solenoid on active (or specified) extruder
case 381: M381(); break; // M381: Disable all solenoids or, if MANUAL_SOLENOID_CONTROL, active (or specified) solenoid
#endif
@@ -865,10 +859,6 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 407: M407(); break; // M407: Display measured filament diameter
#endif
#if HAS_FILAMENT_SENSOR
case 412: M412(); break; // M412: Enable/Disable filament runout detection
#endif
#if HAS_MULTI_LANGUAGE
case 414: M414(); break; // M414: Select multi language menu
#endif
@@ -889,7 +879,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 425: M425(); break; // M425: Tune backlash compensation
#endif
#if HAS_HOME_OFFSET
#if HAS_M206_COMMAND
case 428: M428(); break; // M428: Apply current_position to home_offset
#endif
@@ -901,10 +891,6 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 486: M486(); break; // M486: Identify and cancel objects
#endif
#if ENABLED(FT_MOTION)
case 493: M493(); break; // M493: Fixed-Time Motion control
#endif
case 500: M500(); break; // M500: Store settings in EEPROM
case 501: M501(); break; // M501: Read settings from EEPROM
case 502: M502(); break; // M502: Revert to default settings
@@ -925,7 +911,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#endif
#endif
#if HAS_MEDIA
#if ENABLED(SDSUPPORT)
case 524: M524(); break; // M524: Abort the current SD print job
#endif
@@ -943,19 +929,14 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 575: M575(); break; // M575: Set serial baudrate
#endif
#if ENABLED(NONLINEAR_EXTRUSION)
case 592: M592(); break; // M592: Nonlinear Extrusion control
#endif
#if HAS_ZV_SHAPING
case 593: M593(); break; // M593: Input Shaping control
#if HAS_FILAMENT_SENSOR
case 412: M412(); break; // Alias to M591
case 591: M591(); break; // M591 Configure filament runout detection
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
case 600: M600(); break; // M600: Pause for Filament Change
#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
case 603: M603(); break; // M603: Configure Filament Change
#endif
case 603: M603(); break; // M603: Configure Filament Change
#endif
#if HAS_DUPLICATION_MODE
@@ -966,7 +947,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 665: M665(); break; // M665: Set Kinematics parameters
#endif
#if ANY(DELTA, HAS_EXTRA_ENDSTOPS)
#if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS
case 666: M666(); break; // M666: Set delta or multiple endstop adjustment
#endif
@@ -1007,7 +988,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC)
case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes.
#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
#if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
case 908: M908(); break; // M908: Control digital trimpot directly.
#if HAS_MOTOR_CURRENT_DAC
case 909: M909(); break; // M909: Print digipot/DAC current value
@@ -1045,7 +1026,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#endif
#if ENABLED(DEBUG_GCODE_PARSER)
case 800: parser.debug(); break; // M800: G-Code Parser Test for M
case 800: parser.debug(); break; // M800: GCode Parser Test for M
#endif
#if ENABLED(GCODE_REPEAT_MARKERS)
@@ -1073,11 +1054,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 422: M422(); break; // M422: Set Z Stepper automatic alignment position using probe
#endif
#if ENABLED(OTA_FIRMWARE_UPDATE)
case 936: M936(); break; // M936: OTA update firmware.
#endif
#if SPI_FLASH_BACKUP
#if ALL(SPI_FLASH, SDSUPPORT, MARLIN_DEV_MODE)
case 993: M993(); break; // M993: Backup SPI Flash to SD
case 994: M994(); break; // M994: Load a Backup from SD to SPI Flash
#endif
@@ -1097,11 +1074,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 1000: M1000(); break; // M1000: [INTERNAL] Resume from power-loss
#endif
#if HAS_MEDIA
#if ENABLED(SDSUPPORT)
case 1001: M1001(); break; // M1001: [INTERNAL] Handle SD completion
#endif
#if DGUS_LCD_UI_MKS
#if ENABLED(DGUS_LCD_UI_MKS)
case 1002: M1002(); break; // M1002: [INTERNAL] Tool-change and Relative E Move
#endif
@@ -1140,7 +1117,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
if (!no_ok) queue.ok_to_send();
SERIAL_IMPL.msgDone(); // Call the msgDone serial hook to signal command processing done
SERIAL_OUT(msgDone); // Call the msgDone serial hook to signal command processing done
}
#if ENABLED(M100_FREE_MEMORY_DUMPER)
@@ -1187,7 +1164,10 @@ void GcodeSuite::process_subcommands_now(FSTR_P fgcode) {
for (;;) {
PGM_P const delim = strchr_P(pgcode, '\n'); // Get address of next newline
const size_t len = delim ? delim - pgcode : strlen_P(pgcode); // Get the command length
parser.parse(MString<MAX_CMD_SIZE>().setn_P(pgcode, len)); // Parse the command
char cmd[len + 1]; // Allocate a stack buffer
strncpy_P(cmd, pgcode, len); // Copy the command to the stack
cmd[len] = '\0'; // End with a nul
parser.parse(cmd); // Parse the command
process_parsed_command(true); // Process it (no "ok")
if (!delim) break; // Last command?
pgcode = delim + 1; // Get the next command
+4 -3
View File
@@ -234,7 +234,6 @@
* M406 - Disable Filament Sensor flow control. (Requires FILAMENT_WIDTH_SENSOR)
* M407 - Display measured filament diameter in millimeters. (Requires FILAMENT_WIDTH_SENSOR)
* M410 - Quickstop. Abort all planned moves.
* M412 - Enable / Disable Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR)
* M413 - Enable / Disable Power-Loss Recovery. (Requires POWER_LOSS_RECOVERY)
* M414 - Set language by index. (Requires LCD_LANGUAGE_2...)
* M420 - Enable/Disable Leveling (with current values) S1=enable S0=disable (Requires MESH_BED_LEVELING or ABL)
@@ -261,6 +260,7 @@
* M575 - Change the serial baud rate. (Requires BAUD_RATE_GCODE)
* M592 - Get or set nonlinear extrusion parameters. (Requires NONLINEAR_EXTRUSION)
* M593 - Get or set input shaping parameters. (Requires INPUT_SHAPING_[XY])
* M591 - Configure Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR)
* M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
* M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
* M605 - Set Dual X-Carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
@@ -1035,8 +1035,9 @@ private:
#endif
#if HAS_FILAMENT_SENSOR
static void M412();
static void M412_report(const bool forReplay=true);
static void M412() { M591(); }
static void M591();
static void M591_report(const bool forReplay=true);
#endif
#if HAS_MULTI_LANGUAGE
+1 -1
View File
@@ -154,7 +154,7 @@ void GcodeSuite::M115() {
// AUTOLEVEL (G29)
cap_line(F("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
// RUNOUT (M412, M600)
// RUNOUT (M591, M600)
cap_line(F("RUNOUT"), ENABLED(FILAMENT_RUNOUT_SENSOR));
// Z_PROBE (G30)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1448 -1402
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+47 -27
View File
@@ -23,8 +23,8 @@
/**
* DWIN Endstops diagnostic page for PRO UI
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 1.4.3
* Date: 2023/05/10
* Version: 1.2.2
* Date: 2022/02/24
*/
#include "../../../inc/MarlinConfigPre.h"
@@ -36,9 +36,13 @@
#if HAS_ESDIAG
#include "endstop_diag.h"
#include "../../../core/types.h"
#include "../../marlinui.h"
#include "dwin.h"
#include "dwin_lcd.h"
#include "dwinui.h"
#include "dwin_popup.h"
#include "dwin.h"
#if HAS_FILAMENT_SENSOR
#include "../../../feature/runout.h"
@@ -48,45 +52,61 @@
#include "../../../module/probe.h"
#endif
ESDiag esDiag;
ESDiagClass ESDiag;
void draw_es_label(FSTR_P const flabel=nullptr) {
DWINUI::cursor.x = 40;
if (flabel) DWINUI::drawString(F(flabel));
DWINUI::drawString(F(": "));
DWINUI::moveBy(0, 25);
if (flabel) DWINUI::Draw_String(F(flabel));
DWINUI::Draw_String(F(": "));
DWINUI::MoveBy(0, 25);
}
void draw_es_state(const bool is_hit) {
const uint8_t LM = 130;
DWINUI::cursor.x = LM;
dwinDrawRectangle(1, hmiData.colorPopupBg, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20);
is_hit ? DWINUI::drawString(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::drawString(RGB(16,63,16), F(STR_ENDSTOP_OPEN));
DWINUI::moveBy(0, 25);
DWIN_Draw_Rectangle(1, HMI_data.PopupBg_color, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20);
is_hit ? DWINUI::Draw_String(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::Draw_String(RGB(16,63,16), F(STR_ENDSTOP_OPEN));
DWINUI::MoveBy(0, 25);
}
void ESDiag::draw() {
title.showCaption(GET_TEXT_F(MSG_ENDSTOP_TEST));
DWINUI::clearMainArea();
drawPopupBkgd();
DWINUI::drawButton(BTN_Continue, 86, 250);
void ESDiagClass::Draw() {
Title.ShowCaption(F("End-stops Diagnostic"));
DWINUI::ClearMainArea();
Draw_Popup_Bkgd();
DWINUI::Draw_Button(BTN_Continue, 86, 250);
DWINUI::cursor.y = 80;
#define ES_LABEL(S) draw_es_label(F(STR_##S))
TERN_(USE_X_MIN, ES_LABEL(X_MIN)); TERN_(USE_X_MAX, ES_LABEL(X_MAX));
TERN_(USE_Y_MIN, ES_LABEL(Y_MIN)); TERN_(USE_Y_MAX, ES_LABEL(Y_MAX));
TERN_(USE_Z_MIN, ES_LABEL(Z_MIN)); TERN_(USE_Z_MAX, ES_LABEL(Z_MAX));
TERN_(HAS_FILAMENT_SENSOR, draw_es_label(F(STR_FILAMENT)));
update();
#if HAS_X_MIN
ES_LABEL(X_MIN);
#endif
#if HAS_Y_MIN
ES_LABEL(Y_MIN);
#endif
#if HAS_Z_MIN
ES_LABEL(Z_MIN);
#endif
#if HAS_FILAMENT_SENSOR
draw_es_label(F(STR_FILAMENT));
#endif
Update();
}
void ESDiag::update() {
void ESDiagClass::Update() {
DWINUI::cursor.y = 80;
#define ES_REPORT(S) draw_es_state(READ(S##_PIN) == S##_ENDSTOP_HIT_STATE)
TERN_(USE_X_MIN, ES_REPORT(X_MIN)); TERN_(USE_X_MAX, ES_REPORT(X_MAX));
TERN_(USE_Y_MIN, ES_REPORT(Y_MIN)); TERN_(USE_Y_MAX, ES_REPORT(Y_MAX));
TERN_(USE_Z_MIN, ES_REPORT(Z_MIN)); TERN_(USE_Z_MAX, ES_REPORT(Z_MAX));
TERN_(HAS_FILAMENT_SENSOR, draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE));
dwinUpdateLCD();
#define ES_REPORT(S) draw_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING)
#if HAS_X_MIN
ES_REPORT(X_MIN);
#endif
#if HAS_Y_MIN
ES_REPORT(Y_MIN);
#endif
#if HAS_Z_MIN
ES_REPORT(Z_MIN);
#endif
#if HAS_FILAMENT_SENSOR
draw_es_state(READ(FIL_RUNOUT1_PIN) != runout.out_state());
#endif
DWIN_UpdateLCD();
}
#endif // HAS_ESDIAG
@@ -33,7 +33,7 @@
#if ENABLED(ANYCUBIC_LCD_CHIRON)
#include "chiron_tft.h"
#include "../anycubic/Tunes.h"
#include "Tunes.h"
#include "FileNavigator.h"
#include "../../../gcode/queue.h"
@@ -42,13 +42,9 @@
#include "../../../libs/numtostr.h"
#include "../../../MarlinCore.h"
#define DEBUG_OUT ACDEBUGLEVEL
#include "../../../core/debug_out.h"
namespace Anycubic {
ChironTFT chiron;
ChironTFT Chiron;
#if AUTO_DETECT_CHIRON_TFT
panel_type_t ChironTFT::panel_type = AC_panel_unknown;
#endif
@@ -64,7 +60,7 @@ uint8_t ChironTFT::command_len;
float ChironTFT::live_Zoffset;
file_menu_t ChironTFT::file_menu;
void ChironTFT::startup() {
void ChironTFT::Startup() {
selectedfile[0] = '\0';
panel_command[0] = '\0';
command_len = 0;
@@ -76,9 +72,14 @@ void ChironTFT::startup() {
live_Zoffset = 0.0;
file_menu = AC_menu_file;
// Filament runout is handled by Marlin settings in Configuration.h
// opt_set FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present.
// opt_enable FIL_RUNOUT_PULLUP
// Setup pins for powerloss detection
// Two IO pins are connected on the Trigorilla Board
// On a power interruption the OUTAGECON_PIN goes low.
#if ENABLED(POWER_LOSS_RECOVERY)
OUT_WRITE(OUTAGECON_PIN, HIGH);
#endif
TFTSer.begin(115200);
// Wait for the TFT panel to initialize and finish the animation
@@ -88,76 +89,81 @@ void ChironTFT::startup() {
// So we need to know what we are working with.
// Panel type can be defined otherwise detect it automatically
switch (panel_type) {
case AC_panel_new: SERIAL_ECHOLN(AC_msg_new_panel_set); break;
case AC_panel_standard: SERIAL_ECHOLN(AC_msg_old_panel_set); break;
default: SERIAL_ECHOLN(AC_msg_auto_panel_detection);
detectPanelType();
case AC_panel_new:
SERIAL_ECHOLNF(AC_msg_new_panel_set);
break;
case AC_panel_standard:
SERIAL_ECHOLNF(AC_msg_old_panel_set);
break;
default:
SERIAL_ECHOLNF(AC_msg_auto_panel_detection);
DetectPanelType();
break;
}
// Signal Board has reset
tftSendLn(AC_msg_main_board_has_reset);
SendtoTFTLN(AC_msg_main_board_has_reset);
// Enable leveling and Disable end stops during print
// as Z home places nozzle above the bed so we need to allow it past the end stops
injectCommands(AC_cmnd_enable_leveling);
// startup tunes are defined in Tunes.h
playTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn));
// Startup tunes are defined in Tunes.h
PlayTune(BEEPER_PIN, TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1);
#if ACDEBUGLEVEL
DEBUG_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL);
SERIAL_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL);
#endif
tftSendLn(AC_msg_ready);
SendtoTFTLN(AC_msg_ready);
}
void ChironTFT::detectPanelType() {
void ChironTFT::DetectPanelType() {
#if AUTO_DETECT_CHIRON_TFT
// Send a query to the TFT
tftSendLn(AC_Test_for_OldPanel); // The panel will respond with 'SXY 480 320'
tftSendLn(AC_Test_for_NewPanel); // the panel will respond with '[0]=0 ' to '[19]=0 '
SendtoTFTLN(AC_Test_for_OldPanel); // The panel will respond with 'SXY 480 320'
SendtoTFTLN(AC_Test_for_NewPanel); // the panel will respond with '[0]=0 ' to '[19]=0 '
#endif
}
void ChironTFT::idleLoop() {
if (readTFTCommand()) {
processPanelRequest();
void ChironTFT::IdleLoop() {
if (ReadTFTCommand()) {
ProcessPanelRequest();
command_len = 0;
}
checkHeaters();
CheckHeaters();
}
void ChironTFT::printerKilled(FSTR_P const error, FSTR_P const component) {
tftSendLn(AC_msg_kill_lcd);
void ChironTFT::PrinterKilled(FSTR_P const error, FSTR_P const component) {
SendtoTFTLN(AC_msg_kill_lcd);
#if ACDEBUG(AC_MARLIN)
DEBUG_ECHOLNPGM("printerKilled()\nerror: ", error , "\ncomponent: ", component);
SERIAL_ECHOLNPGM("PrinterKilled()\nerror: ", error , "\ncomponent: ", component);
#endif
}
void ChironTFT::mediaEvent(media_event_t event) {
void ChironTFT::MediaEvent(media_event_t event) {
#if ACDEBUG(AC_MARLIN)
DEBUG_ECHOLNPGM("ProcessMediaStatus() ", event);
SERIAL_ECHOLNPGM("ProcessMediaStatus() ", event);
#endif
switch (event) {
case AC_media_inserted:
tftSendLn(AC_msg_sd_card_inserted);
SendtoTFTLN(AC_msg_sd_card_inserted);
break;
case AC_media_removed:
tftSendLn(AC_msg_sd_card_removed);
SendtoTFTLN(AC_msg_sd_card_removed);
break;
case AC_media_error:
last_error = AC_error_noSD;
tftSendLn(AC_msg_no_sd_card);
SendtoTFTLN(AC_msg_no_sd_card);
break;
}
}
void ChironTFT::timerEvent(timer_event_t event) {
void ChironTFT::TimerEvent(timer_event_t event) {
#if ACDEBUG(AC_MARLIN)
DEBUG_ECHOLNPGM("timerEvent() ", event);
DEBUG_ECHOLNPGM("Printer State: ", printer_state);
SERIAL_ECHOLNPGM("TimerEvent() ", event);
SERIAL_ECHOLNPGM("Printer State: ", printer_state);
#endif
switch (event) {
@@ -165,44 +171,44 @@ void ChironTFT::timerEvent(timer_event_t event) {
live_Zoffset = 0.0; // reset print offset
setSoftEndstopState(false); // disable endstops to print
printer_state = AC_printer_printing;
tftSendLn(AC_msg_print_from_sd_card);
SendtoTFTLN(AC_msg_print_from_sd_card);
} break;
case AC_timer_paused: {
printer_state = AC_printer_paused;
pause_state = AC_paused_idle;
tftSendLn(AC_msg_paused);
SendtoTFTLN(AC_msg_paused);
} break;
case AC_timer_stopped: {
if (printer_state != AC_printer_idle) {
printer_state = AC_printer_stopping;
tftSendLn(AC_msg_print_complete);
SendtoTFTLN(AC_msg_print_complete);
}
setSoftEndstopState(true); // enable endstops
} break;
}
}
void ChironTFT::filamentRunout() {
void ChironTFT::FilamentRunout() {
#if ACDEBUG(AC_MARLIN)
DEBUG_ECHOLNPGM("filamentRunout() printer_state ", printer_state);
SERIAL_ECHOLNPGM("FilamentRunout() printer_state ", printer_state);
#endif
// 1 Signal filament out
last_error = AC_error_filament_runout;
tftSendLn(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
playTune(FilamentOut);
SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
PlayTune(BEEPER_PIN, FilamentOut, 1);
}
void ChironTFT::confirmationRequest(const char * const msg) {
void ChironTFT::ConfirmationRequest(const char * const msg) {
// M108 continue
#if ACDEBUG(AC_MARLIN)
DEBUG_ECHOLNPGM("confirmationRequest() ", msg, " printer_state:", printer_state);
SERIAL_ECHOLNPGM("ConfirmationRequest() ", msg, " printer_state:", printer_state);
#endif
switch (printer_state) {
case AC_printer_pausing: {
if (strcmp_P(msg, MARLIN_msg_print_paused) == 0 || strcmp_P(msg, MARLIN_msg_nozzle_parked) == 0) {
tftSendLn(AC_msg_paused); // enable continue button
SendtoTFTLN(AC_msg_paused); // enable continue button
printer_state = AC_printer_paused;
}
} break;
@@ -213,18 +219,18 @@ void ChironTFT::confirmationRequest(const char * const msg) {
// Heater timeout, send acknowledgement
if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) {
pause_state = AC_paused_heater_timed_out;
tftSendLn(AC_msg_paused); // enable continue button
playTune(HeaterTimeout);
SendtoTFTLN(AC_msg_paused); // enable continue button
PlayTune(BEEPER_PIN,Heater_Timedout,1);
}
// Reheat finished, send acknowledgement
else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) {
pause_state = AC_paused_idle;
tftSendLn(AC_msg_paused); // enable continue button
SendtoTFTLN(AC_msg_paused); // enable continue button
}
// Filament Purging, send acknowledgement enter run mode
else if (strcmp_P(msg, MARLIN_msg_filament_purging) == 0) {
pause_state = AC_paused_purging_filament;
tftSendLn(AC_msg_paused); // enable continue button
SendtoTFTLN(AC_msg_paused); // enable continue button
}
} break;
default:
@@ -232,10 +238,10 @@ void ChironTFT::confirmationRequest(const char * const msg) {
}
}
void ChironTFT::statusChange(const char * const msg) {
void ChironTFT::StatusChange(const char * const msg) {
#if ACDEBUG(AC_MARLIN)
DEBUG_ECHOLNPGM("statusChange() ", msg);
DEBUG_ECHOLNPGM("printer_state:", printer_state);
SERIAL_ECHOLNPGM("StatusChange() ", msg);
SERIAL_ECHOLNPGM("printer_state:", printer_state);
#endif
bool msg_matched = false;
// The only way to get printer status is to parse messages
@@ -246,15 +252,15 @@ void ChironTFT::statusChange(const char * const msg) {
// Ignore the custom machine name
if (strcmp_P(msg + strlen(MACHINE_NAME), MARLIN_msg_ready) == 0) {
injectCommands(F("M500\nG27"));
tftSendLn(AC_msg_probing_complete);
SendtoTFTLN(AC_msg_probing_complete);
printer_state = AC_printer_idle;
msg_matched = true;
}
// If probing fails don't save the mesh raise the probe above the bad point
if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) {
playTune(BeepBeepBeeep);
PlayTune(BEEPER_PIN, BeepBeepBeeep, 1);
injectCommands(F("G1 Z50 F500"));
tftSendLn(AC_msg_probing_complete);
SendtoTFTLN(AC_msg_probing_complete);
printer_state = AC_printer_idle;
msg_matched = true;
}
@@ -262,14 +268,14 @@ void ChironTFT::statusChange(const char * const msg) {
case AC_printer_printing: {
if (strcmp_P(msg, MARLIN_msg_reheating) == 0) {
tftSendLn(AC_msg_paused); // enable continue button
SendtoTFTLN(AC_msg_paused); // enable continue button
msg_matched = true;
}
} break;
case AC_printer_pausing: {
if (strcmp_P(msg, MARLIN_msg_print_paused) == 0) {
tftSendLn(AC_msg_paused);
SendtoTFTLN(AC_msg_paused);
printer_state = AC_printer_paused;
pause_state = AC_paused_idle;
msg_matched = true;
@@ -278,7 +284,7 @@ void ChironTFT::statusChange(const char * const msg) {
case AC_printer_stopping: {
if (strcmp_P(msg, MARLIN_msg_print_aborted) == 0) {
tftSendLn(AC_msg_stop);
SendtoTFTLN(AC_msg_stop);
printer_state = AC_printer_idle;
msg_matched = true;
}
@@ -290,11 +296,11 @@ void ChironTFT::statusChange(const char * const msg) {
// If not matched earlier see if this was a heater message
if (!msg_matched) {
if (strcmp_P(msg, MARLIN_msg_extruder_heating) == 0) {
tftSendLn(AC_msg_nozzle_heating);
SendtoTFTLN(AC_msg_nozzle_heating);
hotend_state = AC_heater_temp_set;
}
else if (strcmp_P(msg, MARLIN_msg_bed_heating) == 0) {
tftSendLn(AC_msg_bed_heating);
SendtoTFTLN(AC_msg_bed_heating);
hotbed_state = AC_heater_temp_set;
}
else if (strcmp_P(msg, MARLIN_msg_EEPROM_version) == 0) {
@@ -303,33 +309,33 @@ void ChironTFT::statusChange(const char * const msg) {
}
}
void ChironTFT::powerLossRecovery() {
void ChironTFT::PowerLossRecovery() {
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
last_error = AC_error_powerloss;
playTune(SOS);
SERIAL_ECHOLN(AC_msg_powerloss_recovery);
PlayTune(BEEPER_PIN, SOS, 1);
SERIAL_ECHOLNF(AC_msg_powerloss_recovery);
}
void ChironTFT::printComplete() {
tftSend(AC_msg_print_complete);
void ChironTFT::PrintComplete() {
SendtoTFT(AC_msg_print_complete);
printer_state = AC_printer_idle;
setSoftEndstopState(true); // enable endstops
}
void ChironTFT::tftSend(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel
void ChironTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel
#if ACDEBUG(AC_SOME)
DEBUG_ECHO(fstr);
SERIAL_ECHOF(fstr);
#endif
PGM_P str = FTOP(fstr);
while (const char c = pgm_read_byte(str++)) TFTSer.write(c);
}
void ChironTFT::tftSendLn(FSTR_P const fstr/*=nullptr*/) {
void ChironTFT::SendtoTFTLN(FSTR_P const fstr/*=nullptr*/) {
if (fstr) {
#if ACDEBUG(AC_SOME)
DEBUG_ECHOPGM("> ");
SERIAL_ECHOPGM("> ");
#endif
tftSend(fstr);
SendtoTFT(fstr);
#if ACDEBUG(AC_SOME)
SERIAL_EOL();
#endif
@@ -337,7 +343,7 @@ void ChironTFT::tftSendLn(FSTR_P const fstr/*=nullptr*/) {
TFTSer.println();
}
bool ChironTFT::readTFTCommand() {
bool ChironTFT::ReadTFTCommand() {
bool command_ready = false;
while (TFTSer.available() > 0 && command_len < MAX_CMND_LEN) {
panel_command[command_len] = TFTSer.read();
@@ -351,29 +357,29 @@ bool ChironTFT::readTFTCommand() {
if (command_ready || command_len == MAX_CMND_LEN) {
panel_command[command_len] = '\0';
#if ACDEBUG(AC_ALL)
DEBUG_ECHOLNPGM("len(",command_len,") < ", panel_command);
SERIAL_ECHOLNPGM("len(",command_len,") < ", panel_command);
#endif
command_ready = true;
}
return command_ready;
}
int8_t ChironTFT::findToken(char c) {
int8_t ChironTFT::FindToken(char c) {
for (int8_t pos = 0; pos < command_len; pos++) {
if (panel_command[pos] == c) {
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Tpos:", pos, " ", c);
SERIAL_ECHOLNPGM("Tpos:", pos, " ", c);
#endif
return pos;
}
}
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Not found: ", c);
SERIAL_ECHOLNPGM("Not found: ", c);
#endif
return -1;
}
void ChironTFT::checkHeaters() {
void ChironTFT::CheckHeaters() {
uint8_t faultDuration = 0;
// if the hotend temp is abnormal, confirm state before signalling panel
@@ -381,7 +387,7 @@ void ChironTFT::checkHeaters() {
while (!WITHIN(temp, HEATER_0_MINTEMP, HEATER_0_MAXTEMP)) {
faultDuration++;
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) {
tftSendLn(AC_msg_nozzle_temp_abnormal);
SendtoTFTLN(AC_msg_nozzle_temp_abnormal);
last_error = AC_error_abnormal_temp_t0;
SERIAL_ECHOLNPGM("Extruder temp abnormal! : ", temp);
break;
@@ -396,7 +402,7 @@ void ChironTFT::checkHeaters() {
while (!WITHIN(temp, BED_MINTEMP, BED_MAXTEMP)) {
faultDuration++;
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) {
tftSendLn(AC_msg_nozzle_temp_abnormal);
SendtoTFTLN(AC_msg_nozzle_temp_abnormal);
last_error = AC_error_abnormal_temp_bed;
SERIAL_ECHOLNPGM("Bed temp abnormal! : ", temp);
break;
@@ -408,7 +414,7 @@ void ChironTFT::checkHeaters() {
// Update panel with hotend heater status
if (hotend_state != AC_heater_temp_reached) {
if (WITHIN(getActualTemp_celsius(E0) - getTargetTemp_celsius(E0), -(TEMP_WINDOW), TEMP_WINDOW)) {
tftSendLn(AC_msg_nozzle_heating_done);
SendtoTFTLN(AC_msg_nozzle_heating_done);
hotend_state = AC_heater_temp_reached;
}
}
@@ -416,84 +422,90 @@ void ChironTFT::checkHeaters() {
// Update panel with bed heater status
if (hotbed_state != AC_heater_temp_reached) {
if (WITHIN(getActualTemp_celsius(BED) - getTargetTemp_celsius(BED), -(TEMP_BED_WINDOW), TEMP_BED_WINDOW)) {
tftSendLn(AC_msg_bed_heating_done);
SendtoTFTLN(AC_msg_bed_heating_done);
hotbed_state = AC_heater_temp_reached;
}
}
}
void ChironTFT::sendFileList(int8_t startindex) {
void ChironTFT::SendFileList(int8_t startindex) {
// Respond to panel request for 4 files starting at index
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("## sendFileList ## ", startindex);
SERIAL_ECHOLNPGM("## SendFileList ## ", startindex);
#endif
tftSendLn(F("FN "));
SendtoTFTLN(F("FN "));
filenavigator.getFiles(startindex, panel_type, 4);
tftSendLn(F("END"));
SendtoTFTLN(F("END"));
}
void ChironTFT::selectFile() {
const size_t fnlen = command_len - 4 + (panel_type <= AC_panel_new);
strlcpy(selectedfile, panel_command + 4, fnlen + 1);
void ChironTFT::SelectFile() {
if (panel_type <= AC_panel_new) {
strncpy(selectedfile, panel_command + 4, command_len - 3);
selectedfile[command_len - 4] = '\0';
}
else {
strncpy(selectedfile, panel_command + 4, command_len - 4);
selectedfile[command_len - 5] = '\0';
}
#if ACDEBUG(AC_FILE)
DEBUG_ECHOLNPGM(" Selected File: ", selectedfile);
SERIAL_ECHOLNPGM(" Selected File: ",selectedfile);
#endif
switch (selectedfile[0]) {
case '/': // Valid file selected
tftSendLn(AC_msg_sd_file_open_success);
SendtoTFTLN(AC_msg_sd_file_open_success);
break;
case '<': // .. (go up folder level)
filenavigator.upDIR();
tftSendLn(AC_msg_sd_file_open_failed);
sendFileList( 0 );
SendtoTFTLN(AC_msg_sd_file_open_failed);
SendFileList( 0 );
break;
default: // enter subfolder
// For new panel remove the '.GCO' tag that was added to the end of the path
if (panel_type <= AC_panel_new) selectedfile[fnlen - 4] = '\0';
default: // enter sub folder
// for new panel remove the '.GCO' tag that was added to the end of the path
if (panel_type <= AC_panel_new)
selectedfile[strlen(selectedfile) - 4] = '\0';
filenavigator.changeDIR(selectedfile);
tftSendLn(AC_msg_sd_file_open_failed);
sendFileList( 0 );
SendtoTFTLN(AC_msg_sd_file_open_failed);
SendFileList( 0 );
break;
}
}
void ChironTFT::processPanelRequest() {
void ChironTFT::ProcessPanelRequest() {
// Break these up into logical blocks // as its easier to navigate than one huge switch case!
int8_t tpos = findToken('A');
int8_t tpos = FindToken('A');
// Panel request are 'A0' - 'A36'
if (tpos >= 0) {
const int8_t req = atoi(&panel_command[tpos + 1]);
// Information requests A0 - A8 and A33
if (req <= 8 || req == 33) panelInfo(req);
if (req <= 8 || req == 33) PanelInfo(req);
// Simple Actions A9 - A28
else if (req <= 28) panelAction(req);
else if (req <= 28) PanelAction(req);
// Process Initiation
else if (req <= 36) panelProcess(req);
else if (req <= 36) PanelProcess(req);
}
else {
#if AUTO_DETECT_CHIRON_TFT
// This may be a response to a panel type detection query
if (panel_type == AC_panel_unknown) {
tpos = findToken('S'); // old panel will respond to 'SIZE' with 'SXY 480 320'
tpos = FindToken('S'); // old panel will respond to 'SIZE' with 'SXY 480 320'
if (tpos >= 0) {
if (panel_command[tpos + 1] == 'X' && panel_command[tpos + 2] =='Y') {
panel_type = AC_panel_standard;
SERIAL_ECHOLN(AC_msg_old_panel_detected);
SERIAL_ECHOLNF(AC_msg_old_panel_detected);
}
}
else {
// new panel will respond to 'J200' with '[0]=0'
// it seems only after a power cycle so detection assumes a new panel
tpos = findToken('[');
tpos = FindToken('[');
if (tpos >= 0) {
if (panel_command[tpos + 1] == '0' && panel_command[tpos + 2] ==']') {
panel_type = AC_panel_new;
SERIAL_ECHOLN(AC_msg_new_panel_detected);
SERIAL_ECHOLNF(AC_msg_new_panel_detected);
}
}
}
@@ -501,94 +513,94 @@ void ChironTFT::processPanelRequest() {
}
#endif
tftSendLn(); // Ignore unknown requests
SendtoTFTLN(); // Ignore unknown requests
}
}
void ChironTFT::panelInfo(uint8_t req) {
void ChironTFT::PanelInfo(uint8_t req) {
// information requests A0-A8 and A33
switch (req) {
case 0: // A0 Get HOTEND Temp
tftSend(F("A0V "));
SendtoTFT(F("A0V "));
TFTSer.println(getActualTemp_celsius(E0));
break;
case 1: // A1 Get HOTEND Target Temp
tftSend(F("A1V "));
SendtoTFT(F("A1V "));
TFTSer.println(getTargetTemp_celsius(E0));
break;
case 2: // A2 Get BED Temp
tftSend(F("A2V "));
SendtoTFT(F("A2V "));
TFTSer.println(getActualTemp_celsius(BED));
break;
case 3: // A3 Get BED Target Temp
tftSend(F("A3V "));
SendtoTFT(F("A3V "));
TFTSer.println(getTargetTemp_celsius(BED));
break;
case 4: // A4 Get FAN Speed
tftSend(F("A4V "));
SendtoTFT(F("A4V "));
TFTSer.println(getActualFan_percent(FAN0));
break;
case 5: // A5 Get Current Coordinates
tftSend(F("A5V X: "));
SendtoTFT(F("A5V X: "));
TFTSer.print(getAxisPosition_mm(X));
tftSend(F(" Y: "));
SendtoTFT(F(" Y: "));
TFTSer.print(getAxisPosition_mm(Y));
tftSend(F(" Z: "));
SendtoTFT(F(" Z: "));
TFTSer.println(getAxisPosition_mm(Z));
break;
case 6: // A6 Get printing progress
if (isPrintingFromMedia()) {
tftSend(F("A6V "));
SendtoTFT(F("A6V "));
TFTSer.println(ui8tostr2(getProgress_percent()));
}
else
tftSendLn(F("A6V ---"));
SendtoTFTLN(F("A6V ---"));
break;
case 7: { // A7 Get Printing Time
uint32_t time = getProgress_seconds_elapsed() / 60;
tftSend(F("A7V "));
SendtoTFT(F("A7V "));
TFTSer.print(ui8tostr2(time / 60));
tftSend(F(" H "));
SendtoTFT(F(" H "));
TFTSer.print(ui8tostr2(time % 60));
tftSend(F(" M"));
SendtoTFT(F(" M"));
#if ACDEBUG(AC_ALL)
DEBUG_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60));
SERIAL_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60));
#endif
} break;
case 8: // A8 Get SD Card list A8 S0
if (!isMediaInserted()) safe_delay(500);
if (!isMediaInserted()) // Make sure the card is removed
tftSendLn(AC_msg_no_sd_card);
SendtoTFTLN(AC_msg_no_sd_card);
else if (panel_command[3] == 'S')
sendFileList( atoi( &panel_command[4] ) );
SendFileList( atoi( &panel_command[4] ) );
break;
case 33: // A33 Get firmware info
tftSend(F("J33 "));
SendtoTFT(F("J33 "));
// If there is an error recorded, show that instead of the FW version
if (!getLastError()) tftSendLn(F(SHORT_BUILD_VERSION));
if (!GetLastError()) SendtoTFTLN(F(SHORT_BUILD_VERSION));
break;
}
}
void ChironTFT::panelAction(uint8_t req) {
void ChironTFT::PanelAction(uint8_t req) {
switch (req) {
case 9: // A9 Pause SD print
if (isPrintingFromMedia()) {
tftSendLn(AC_msg_pause);
SendtoTFTLN(AC_msg_pause);
pausePrint();
printer_state = AC_printer_pausing;
}
else
tftSendLn(AC_msg_stop);
SendtoTFTLN(AC_msg_stop);
break;
case 10: // A10 Resume SD Print
@@ -606,7 +618,7 @@ void ChironTFT::panelAction(uint8_t req) {
else {
if (printer_state == AC_printer_resuming_from_power_outage)
injectCommands(F("M1000 C")); // Cancel recovery
tftSendLn(AC_msg_stop);
SendtoTFTLN(AC_msg_stop);
printer_state = AC_printer_idle;
}
break;
@@ -616,7 +628,7 @@ void ChironTFT::panelAction(uint8_t req) {
break;
case 13: // A13 Select file
selectFile();
SelectFile();
break;
case 14: // A14 Start Printing
@@ -625,9 +637,11 @@ void ChironTFT::panelAction(uint8_t req) {
injectCommands(F("M1000 C")); // Cancel recovery
printer_state = AC_printer_idle;
}
DEBUG_ECHOLNPGM("Print: ", selectedfile);
#if ACDebugLevel >= 1
SERIAL_ECHOLNPGM("Print: ", selectedfile);
#endif
printFile(selectedfile);
tftSendLn(AC_msg_print_from_sd_card);
SendtoTFTLN(AC_msg_print_from_sd_card);
break;
case 15: // A15 Resuming from outage
@@ -662,7 +676,7 @@ void ChironTFT::panelAction(uint8_t req) {
case 19: // A19 Motors off
if (!isPrinting()) {
stepper.disable_all_steppers();
tftSendLn(AC_msg_ready);
SendtoTFTLN(AC_msg_ready);
}
break;
@@ -670,7 +684,7 @@ void ChironTFT::panelAction(uint8_t req) {
if (panel_command[4] == 'S')
setFeedrate_percent(atoi(&panel_command[5]));
else {
tftSend(F("A20V "));
SendtoTFT(F("A20V "));
TFTSer.println(getFeedrate_percent());
}
break;
@@ -698,7 +712,7 @@ void ChironTFT::panelAction(uint8_t req) {
char MoveCmnd[30];
sprintf_P(MoveCmnd, PSTR("G91\nG0%s\nG90"), panel_command + 3);
#if ACDEBUG(AC_ACTION)
DEBUG_ECHOLNPGM("Move: ", MoveCmnd);
SERIAL_ECHOLNPGM("Move: ", MoveCmnd);
#endif
setSoftEndstopState(true); // enable endstops
injectCommands(MoveCmnd);
@@ -711,7 +725,7 @@ void ChironTFT::panelAction(uint8_t req) {
// Temps defined in configuration.h
setTargetTemp_celsius(PREHEAT_1_TEMP_BED, BED);
setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, E0);
tftSendLn();
SendtoTFTLN();
hotbed_state = AC_heater_temp_set;
hotend_state = AC_heater_temp_set;
}
@@ -722,7 +736,7 @@ void ChironTFT::panelAction(uint8_t req) {
if (!isPrinting()) {
setTargetTemp_celsius(PREHEAT_2_TEMP_BED, BED);
setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, E0);
tftSendLn();
SendtoTFTLN();
hotbed_state = AC_heater_temp_set;
hotend_state = AC_heater_temp_set;
}
@@ -733,7 +747,7 @@ void ChironTFT::panelAction(uint8_t req) {
if (!isPrinting()) {
setTargetTemp_celsius(0, E0);
setTargetTemp_celsius(0, BED);
tftSendLn(AC_msg_ready);
SendtoTFTLN(AC_msg_ready);
hotbed_state = AC_heater_off;
hotend_state = AC_heater_off;
}
@@ -752,21 +766,21 @@ void ChironTFT::panelAction(uint8_t req) {
case 28: // A28 Filament set A28 O/C
// Ignore request if printing
if (isPrinting()) break;
tftSendLn();
SendtoTFTLN();
break;
}
}
void ChironTFT::panelProcess(uint8_t req) {
void ChironTFT::PanelProcess(uint8_t req) {
switch (req) {
case 29: { // A29 Read Mesh Point A29 X1 Y1
xy_uint8_t pos;
float pos_z;
pos.x = atoi(&panel_command[findToken('X')+1]);
pos.y = atoi(&panel_command[findToken('Y')+1]);
pos.x = atoi(&panel_command[FindToken('X')+1]);
pos.y = atoi(&panel_command[FindToken('Y')+1]);
pos_z = getMeshPoint(pos);
tftSend(F("A29V "));
SendtoTFT(F("A29V "));
TFTSer.println(pos_z * 100);
if (!isPrinting()) {
setSoftEndstopState(true); // disable endstops
@@ -777,7 +791,7 @@ void ChironTFT::panelProcess(uint8_t req) {
if (isPositionKnown()) {
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Moving to mesh point at x: ", pos.x, " y: ", pos.y, " z: ", pos_z);
SERIAL_ECHOLNPGM("Moving to mesh point at x: ", pos.x, " y: ", pos.y, " z: ", pos_z);
#endif
// Go up before moving
setAxisPosition_mm(3.0,Z);
@@ -786,7 +800,7 @@ void ChironTFT::panelProcess(uint8_t req) {
setAxisPosition_mm(20 + (93 * pos.y), Y);
setAxisPosition_mm(0.0, Z);
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Current Z: ", getAxisPosition_mm(Z));
SERIAL_ECHOLNPGM("Current Z: ", getAxisPosition_mm(Z));
#endif
}
}
@@ -796,42 +810,42 @@ void ChironTFT::panelProcess(uint8_t req) {
} break;
case 30: // A30 Auto leveling
if (findToken('S') >= 0) { // Start probing New panel adds spaces..
if (FindToken('S') >= 0) { // Start probing New panel adds spaces..
// Ignore request if printing
if (isPrinting())
tftSendLn(AC_msg_probing_not_allowed); // forbid auto leveling
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
else {
tftSendLn(AC_msg_start_probing);
SendtoTFTLN(AC_msg_start_probing);
injectCommands(F("G28\nG29"));
printer_state = AC_printer_probing;
}
}
else
tftSendLn(AC_msg_start_probing); // Just enter levelling menu
SendtoTFTLN(AC_msg_start_probing); // Just enter levelling menu
break;
case 31: // A31 Adjust all Probe Points
// The tokens can occur in different places on the new panel so we need to find it.
if (findToken('C') >= 0) { // Restore and apply original offsets
if (FindToken('C') >= 0) { // Restore and apply original offsets
if (!isPrinting()) {
injectCommands(F("M501\nM420 S1"));
selectedmeshpoint.x = selectedmeshpoint.y = 99;
SERIAL_ECHOLN(AC_msg_mesh_changes_abandoned);
SERIAL_ECHOLNF(AC_msg_mesh_changes_abandoned);
}
}
else if (findToken('D') >= 0) { // Save Z Offset tables and restore leveling state
else if (FindToken('D') >= 0) { // Save Z Offset tables and restore leveling state
if (!isPrinting()) {
setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made
injectCommands(F("M500"));
SERIAL_ECHOLN(AC_msg_mesh_changes_saved);
SERIAL_ECHOLNF(AC_msg_mesh_changes_saved);
selectedmeshpoint.x = selectedmeshpoint.y = 99;
}
}
else if (findToken('G') >= 0) { // Get current offset
tftSend(F("A31V "));
else if (FindToken('G') >= 0) { // Get current offset
SendtoTFT(F("A31V "));
// When printing use the live z Offset position
// we will use babystepping to move the print head
if (isPrinting())
@@ -843,7 +857,7 @@ void ChironTFT::panelProcess(uint8_t req) {
}
else {
int8_t tokenpos = findToken('S');
int8_t tokenpos = FindToken('S');
if (tokenpos >= 0) { // Set offset (adjusts all points by value)
float Zshift = atof(&panel_command[tokenpos+1]);
setSoftEndstopState(false); // disable endstops
@@ -851,22 +865,22 @@ void ChironTFT::panelProcess(uint8_t req) {
// From the leveling panel use the all points UI to adjust the print pos.
if (isPrinting()) {
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Change Zoffset from:", live_Zoffset, " to ", live_Zoffset + Zshift);
SERIAL_ECHOLNPGM("Change Zoffset from:", live_Zoffset, " to ", live_Zoffset + Zshift);
#endif
if (isAxisPositionKnown(Z)) {
#if ACDEBUG(AC_INFO)
const float currZpos = getAxisPosition_mm(Z);
DEBUG_ECHOLNPGM("Nudge Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
SERIAL_ECHOLNPGM("Nudge Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
#endif
// Use babystepping to adjust the head position
int16_t steps = mmToWholeSteps(constrain(Zshift,-0.05,0.05), Z);
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Steps to move Z: ", steps);
SERIAL_ECHOLNPGM("Steps to move Z: ", steps);
#endif
babystepAxis_steps(steps, Z);
live_Zoffset += Zshift;
}
tftSend(F("A31V "));
SendtoTFT(F("A31V "));
TFTSer.println(live_Zoffset);
}
else {
@@ -875,23 +889,23 @@ void ChironTFT::panelProcess(uint8_t req) {
const float currval = getMeshPoint(pos);
setMeshPoint(pos, constrain(currval + Zshift, AC_LOWEST_MESHPOINT_VAL, 2));
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Change mesh point X", x," Y",y ," from ", currval, " to ", getMeshPoint(pos) );
SERIAL_ECHOLNPGM("Change mesh point X", x," Y",y ," from ", currval, " to ", getMeshPoint(pos) );
#endif
}
const float currZOffset = getZOffset_mm();
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Change probe offset from ", currZOffset, " to ", currZOffset + Zshift);
SERIAL_ECHOLNPGM("Change probe offset from ", currZOffset, " to ", currZOffset + Zshift);
#endif
setZOffset_mm(currZOffset + Zshift);
tftSend(F("A31V "));
SendtoTFT(F("A31V "));
TFTSer.println(getZOffset_mm());
if (isAxisPositionKnown(Z)) {
// Move Z axis
const float currZpos = getAxisPosition_mm(Z);
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
SERIAL_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
#endif
setAxisPosition_mm(currZpos+constrain(Zshift,-0.05,0.05),Z);
}
@@ -907,7 +921,7 @@ void ChironTFT::panelProcess(uint8_t req) {
//TFTSer.println();
break;
// A33 firmware info request see panelInfo()
// A33 firmware info request see PanelInfo()
case 34: // A34 Adjust single mesh point A34 C/S X1 Y1 V123
if (panel_command[3] == 'C') { // Restore original offsets
@@ -923,8 +937,8 @@ void ChironTFT::panelProcess(uint8_t req) {
float currmesh = getMeshPoint(pos);
float newval = atof(&panel_command[11])/100;
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Change mesh point x:", pos.x, " y:", pos.y);
DEBUG_ECHOLNPGM("from ", currmesh, " to ", newval);
SERIAL_ECHOLNPGM("Change mesh point x:", pos.x, " y:", pos.y);
SERIAL_ECHOLNPGM("from ", currmesh, " to ", newval);
#endif
// Update Meshpoint
setMeshPoint(pos,newval);
@@ -935,7 +949,7 @@ void ChironTFT::panelProcess(uint8_t req) {
setSoftEndstopState(false);
float currZpos = getAxisPosition_mm(Z);
#if ACDEBUG(AC_INFO)
DEBUG_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(newval - currmesh, -0.05, 0.05));
SERIAL_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(newval - currmesh, -0.05, 0.05));
#endif
setAxisPosition_mm(currZpos + constrain(newval - currmesh, -0.05, 0.05), Z);
}
@@ -944,19 +958,19 @@ void ChironTFT::panelProcess(uint8_t req) {
break;
case 36: // A36 Auto leveling for new TFT bet that was a typo in the panel code!
tftSendLn(AC_msg_start_probing);
SendtoTFTLN(AC_msg_start_probing);
break;
}
}
bool ChironTFT::getLastError() {
bool ChironTFT::GetLastError() {
switch (last_error) {
case AC_error_abnormal_temp_bed: tftSendLn(AC_msg_error_bed_temp); break;
case AC_error_abnormal_temp_t0: tftSendLn(AC_msg_error_hotend_temp); break;
case AC_error_noSD: tftSendLn(AC_msg_error_sd_card); break;
case AC_error_powerloss: tftSendLn(AC_msg_power_loss); break;
case AC_error_EEPROM: tftSendLn(AC_msg_eeprom_version); break;
case AC_error_filament_runout: tftSendLn(AC_msg_filament_out); break;
case AC_error_abnormal_temp_bed: SendtoTFTLN(AC_msg_error_bed_temp); break;
case AC_error_abnormal_temp_t0: SendtoTFTLN(AC_msg_error_hotend_temp); break;
case AC_error_noSD: SendtoTFTLN(AC_msg_error_sd_card); break;
case AC_error_powerloss: SendtoTFTLN(AC_msg_power_loss); break;
case AC_error_EEPROM: SendtoTFTLN(AC_msg_eeprom_version); break;
case AC_error_filament_runout: SendtoTFTLN(AC_msg_filament_out); break;
default: return false;
}
last_error = AC_error_none;
@@ -34,14 +34,13 @@ void FilamentRunoutScreen::onRedraw(draw_mode_t what) {
w.heading( GET_TEXT_F(MSG_FILAMENT));
w.toggle( 2, GET_TEXT_F(MSG_RUNOUT_SENSOR), getFilamentRunoutEnabled());
#if HAS_FILAMENT_RUNOUT_DISTANCE
w.heading(GET_TEXT_F(MSG_RUNOUT_DISTANCE_MM));
w.units(GET_TEXT_F(MSG_UNITS_MM));
w.precision(0);
w.color(e_axis);
w.adjuster( 10, FPSTR(NUL_STR), getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled());
w.increments();
#endif
w.heading(GET_TEXT_F(MSG_RUNOUT_DISTANCE_MM));
w.units(GET_TEXT_F(MSG_UNITS_MM));
w.precision(0);
w.color(e_axis);
w.adjuster( 10, FPSTR(NUL_STR), getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled());
w.increments();
}
bool FilamentRunoutScreen::onTouchHeld(uint8_t tag) {
@@ -51,10 +50,8 @@ bool FilamentRunoutScreen::onTouchHeld(uint8_t tag) {
#endif
switch (tag) {
case 2: setFilamentRunoutEnabled(!getFilamentRunoutEnabled()); break;
#if HAS_FILAMENT_RUNOUT_DISTANCE
case 10: UI_DECREMENT(FilamentRunoutDistance_mm); break;
case 11: UI_INCREMENT(FilamentRunoutDistance_mm); break;
#endif
case 10: UI_DECREMENT(FilamentRunoutDistance_mm); break;
case 11: UI_INCREMENT(FilamentRunoutDistance_mm); break;
default:
return false;
}
+4 -7
View File
@@ -722,15 +722,12 @@ namespace ExtUI {
}
#if HAS_FILAMENT_SENSOR
bool getFilamentRunoutEnabled() { return runout.enabled; }
void setFilamentRunoutEnabled(const bool value) { runout.enabled = value; }
bool getFilamentRunoutEnabled(const extruder_t extruder/*=E0*/) { return runout.enabled[extruder]; }
void setFilamentRunoutEnabled(const bool value, const extruder_t extruder/*=E0*/) { runout.enabled[extruder] = value; }
bool getFilamentRunoutState() { return runout.filament_ran_out; }
void setFilamentRunoutState(const bool value) { runout.filament_ran_out = value; }
#if HAS_FILAMENT_RUNOUT_DISTANCE
float getFilamentRunoutDistance_mm() { return runout.runout_distance(); }
void setFilamentRunoutDistance_mm(const_float_t value) { runout.set_runout_distance(constrain(value, 0, 999)); }
#endif
float getFilamentRunoutDistance_mm() { return runout.runout_distance(); }
void setFilamentRunoutDistance_mm(const_float_t value) { runout.set_runout_distance(constrain(value, 0, 999)); }
#endif
#if ENABLED(CASE_LIGHT_ENABLE)
+4 -7
View File
@@ -385,15 +385,12 @@ namespace ExtUI {
// Filament Runout Sensor
#if HAS_FILAMENT_SENSOR
bool getFilamentRunoutEnabled();
void setFilamentRunoutEnabled(const bool);
bool getFilamentRunoutEnabled(const extruder_t extruder=E0);
void setFilamentRunoutEnabled(const bool, const extruder_t extruder=E0);
bool getFilamentRunoutState();
void setFilamentRunoutState(const bool);
#if HAS_FILAMENT_RUNOUT_DISTANCE
float getFilamentRunoutDistance_mm();
void setFilamentRunoutDistance_mm(const_float_t);
#endif
float getFilamentRunoutDistance_mm();
void setFilamentRunoutDistance_mm(const_float_t);
#endif
// Case Light Control
+5
View File
@@ -719,6 +719,11 @@ namespace LanguageNarrow_en {
LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Nozzle: ");
LSTR MSG_RUNOUT_SENSOR = _UxGT("Runout Sensor");
LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("Runout Dist mm");
LSTR MSG_RUNOUT_MODE = _UxGT("Runout Mode");
LSTR MSG_RUNOUT_MODE_HIGH = _UxGT("Sensor High");
LSTR MSG_RUNOUT_MODE_LOW = _UxGT("Sensor Low");
LSTR MSG_RUNOUT_MODE_MOTION = _UxGT("Motion Encoder");
LSTR MSG_RUNOUT_MODE_NONE = _UxGT("No Sensor");
LSTR MSG_RUNOUT_ENABLE = _UxGT("Enable Runout");
LSTR MSG_RUNOUT_ACTIVE = _UxGT("Runout Active");
LSTR MSG_INVERT_EXTRUDER = _UxGT("Invert Extruder");
+51 -6
View File
@@ -45,7 +45,7 @@
#include "../../module/temperature.h"
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
#if HAS_FILAMENT_SENSOR
#include "../../feature/runout.h"
#endif
@@ -99,6 +99,54 @@ void menu_backlash();
#endif
#if HAS_FILAMENT_SENSOR && DISABLED(SLIM_LCD_MENUS)
void set_runout_mode_none(const uint8_t e) { runout.mode[e] = RM_NONE; runout.setup(); }
void set_runout_mode_high(const uint8_t e) { runout.mode[e] = RM_OUT_ON_HIGH; runout.setup(); }
void set_runout_mode_low(const uint8_t e) { runout.mode[e] = RM_OUT_ON_LOW; runout.setup(); }
void set_runout_mode_motion(const uint8_t e) { runout.mode[e] = RM_MOTION_SENSOR; runout.setup(); }
#define RUNOUT_EDIT_ITEMS(F) do{ \
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled[F]); \
ACTION_ITEM(MSG_RUNOUT_MODE_NONE, []{ set_runout_mode_none(F); }); \
ACTION_ITEM(MSG_RUNOUT_MODE_HIGH, []{ set_runout_mode_high(F); }); \
ACTION_ITEM(MSG_RUNOUT_MODE_LOW, []{ set_runout_mode_low(F); }); \
ACTION_ITEM(MSG_RUNOUT_MODE_MOTION, []{ set_runout_mode_motion(F); }); \
editable.decimal = runout.runout_distance(F); \
EDIT_ITEM_FAST(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 999, \
[]{ runout.set_runout_distance(editable.decimal, F); }, true \
); \
}while(0)
void menu_runout_config() {
START_MENU();
BACK_ITEM(MSG_CONFIGURATION);
RUNOUT_EDIT_ITEMS(0);
#if NUM_RUNOUT_SENSORS > 1
RUNOUT_EDIT_ITEMS(1);
#endif
#if NUM_RUNOUT_SENSORS > 2
RUNOUT_EDIT_ITEMS(2);
#endif
#if NUM_RUNOUT_SENSORS > 3
RUNOUT_EDIT_ITEMS(3);
#endif
#if NUM_RUNOUT_SENSORS > 4
RUNOUT_EDIT_ITEMS(4);
#endif
#if NUM_RUNOUT_SENSORS > 5
RUNOUT_EDIT_ITEMS(5);
#endif
#if NUM_RUNOUT_SENSORS > 6
RUNOUT_EDIT_ITEMS(6);
#endif
#if NUM_RUNOUT_SENSORS > 7
RUNOUT_EDIT_ITEMS(7);
#endif
END_MENU();
}
#endif
#if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
//
// Advanced Settings > Filament
@@ -152,11 +200,8 @@ void menu_backlash();
#endif
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
editable.decimal = runout.runout_distance();
EDIT_ITEM_FAST(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 999,
[]{ runout.set_runout_distance(editable.decimal); }, true
);
#if HAS_FILAMENT_SENSOR && DISABLED(SLIM_LCD_MENUS)
SUBMENU(MSG_RUNOUT_MODE, menu_runout_config);
#endif
END_MENU();
+1 -1
View File
@@ -634,7 +634,7 @@ void menu_configuration() {
#endif
#if HAS_FILAMENT_SENSOR
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset);
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled[active_extruder], runout.reset);
#endif
#if HAS_FANCHECK
+10 -13
View File
@@ -26,7 +26,7 @@
#include "../../inc/MarlinConfigPre.h"
#if ALL(HAS_MARLINUI_MENU, ADVANCED_PAUSE_FEATURE)
#if BOTH(HAS_MARLINUI_MENU, ADVANCED_PAUSE_FEATURE)
#include "menu_item.h"
#include "../../module/temperature.h"
@@ -96,7 +96,7 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
if (LCD_HEIGHT >= 4) STATIC_ITEM_F(change_filament_header(mode), SS_DEFAULT|SS_INVERT);
BACK_ITEM(MSG_BACK);
#if HAS_PREHEAT
for (uint8_t m = 0; m < PREHEAT_COUNT; ++m)
LOOP_L_N(m, PREHEAT_COUNT)
ACTION_ITEM_N_f(m, ui.get_preheat_label(m), MSG_PREHEAT_M, _change_filament_with_preset);
#endif
EDIT_ITEM_FAST_N(int3, extruder, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[extruder].target,
@@ -130,7 +130,7 @@ void menu_change_filament() {
#endif
START_MENU();
BACK_ITEM(MSG_MAIN_MENU);
BACK_ITEM(MSG_MAIN);
// Change filament
#if E_STEPPERS == 1
@@ -141,7 +141,7 @@ void menu_change_filament() {
GCODES_ITEM_F(fmsg, F("M600 B0"));
#else
FSTR_P const fmsg = GET_TEXT_F(MSG_FILAMENTCHANGE_E);
for (uint8_t s = 0; s < E_STEPPERS; ++s) {
LOOP_L_N(s, E_STEPPERS) {
if (thermalManager.targetTooColdToExtrude(s))
SUBMENU_N_F(s, fmsg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, MenuItemBase::itemIndex); });
else {
@@ -166,7 +166,7 @@ void menu_change_filament() {
GCODES_ITEM_F(msg_load, F("M701"));
#else
FSTR_P const msg_load = GET_TEXT_F(MSG_FILAMENTLOAD_E);
for (uint8_t s = 0; s < E_STEPPERS; ++s) {
LOOP_L_N(s, E_STEPPERS) {
if (thermalManager.targetTooColdToExtrude(s))
SUBMENU_N_F(s, msg_load, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, MenuItemBase::itemIndex); });
else {
@@ -194,7 +194,7 @@ void menu_change_filament() {
GCODES_ITEM(MSG_FILAMENTUNLOAD_ALL, F("M702"));
#endif
FSTR_P const msg_unload = GET_TEXT_F(MSG_FILAMENTUNLOAD_E);
for (uint8_t s = 0; s < E_STEPPERS; ++s) {
LOOP_L_N(s, E_STEPPERS) {
if (thermalManager.targetTooColdToExtrude(s))
SUBMENU_N_F(s, msg_unload, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, MenuItemBase::itemIndex); });
else {
@@ -250,12 +250,6 @@ static FSTR_P pause_header() {
}while(0)
void menu_pause_option() {
#if HAS_FILAMENT_SENSOR
const bool still_out = runout.filament_ran_out;
#else
constexpr bool still_out = false;
#endif
START_MENU();
#if LCD_HEIGHT > 2
STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER);
@@ -263,8 +257,11 @@ void menu_pause_option() {
ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_PURGE, []{ pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; });
#if HAS_FILAMENT_SENSOR
const bool still_out = runout.filament_ran_out;
if (still_out)
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset);
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled[active_extruder], runout.reset);
#else
constexpr bool still_out = false;
#endif
if (!still_out)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -122,7 +122,7 @@ Stepper stepper; // Singleton
#include "../feature/mixing.h"
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
#if HAS_FILAMENT_SENSOR
#include "../feature/runout.h"
#endif
@@ -2292,7 +2292,7 @@ hal_timer_t Stepper::block_phase_isr() {
PAGE_SEGMENT_UPDATE_POS(E);
}
#endif
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, runout.block_completed(current_block));
TERN_(HAS_FILAMENT_SENSOR, runout.block_completed(current_block));
discard_current_block();
}
else {
+9 -3
View File
@@ -69,7 +69,13 @@
#endif
#if HAS_MARLINUI_U8GLIB
#define BOARD_ST7920_DELAY_1 125
#define BOARD_ST7920_DELAY_2 125
#define BOARD_ST7920_DELAY_3 125
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 125
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 125
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 125
#endif
#endif
+10 -3
View File
@@ -182,7 +182,14 @@
#endif
#if HAS_MARLINUI_U8GLIB
#define BOARD_ST7920_DELAY_1 125
#define BOARD_ST7920_DELAY_2 125
#define BOARD_ST7920_DELAY_3 125
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 125
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 125
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 125
#endif
#endif
+4 -2
View File
@@ -12,8 +12,10 @@ opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \
# Not necessary to enable auto-fan for all extruders to hit problematic code paths
opt_set E0_AUTO_FAN_PIN PC10 E1_AUTO_FAN_PIN PC11 E2_AUTO_FAN_PIN PC12 NEOPIXEL_PIN PF13 \
X_DRIVER_TYPE TMC2208 Y_DRIVER_TYPE TMC2130 \
NUM_RUNOUT_SENSORS 8 FIL_RUNOUT_PIN 3 FIL_RUNOUT2_PIN 4 FIL_RUNOUT3_PIN 5 FIL_RUNOUT4_PIN 6 FIL_RUNOUT5_PIN 7 \
FIL_RUNOUT6_PIN 8 FIL_RUNOUT7_PIN 9 FIL_RUNOUT8_PIN 10 FIL_RUNOUT4_STATE HIGH FIL_RUNOUT8_STATE HIGH \
FIL_RUNOUT_ENABLED '{ true, true, true, true, true, true, true, true }' \
FIL_RUNOUT_MODE '{ 1, 1, 1, 1, 1, 1, 1, 1 }' \
FIL_RUNOUT_DISTANCE_MM '{ 0, 1, 5, 10, 5, 5, 5, 5 }' \
FIL_RUNOUT_PIN 3 FIL_RUNOUT2_PIN 4 FIL_RUNOUT3_PIN 5 FIL_RUNOUT4_PIN 6 FIL_RUNOUT5_PIN 7 FIL_RUNOUT6_PIN 8 FIL_RUNOUT7_PIN 9 FIL_RUNOUT8_PIN 10 \
FILAMENT_RUNOUT_SCRIPT '"M600 T%c"'
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER BLTOUCH NEOPIXEL_LED Z_SAFE_HOMING NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE \
FILAMENT_RUNOUT_SENSOR FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP FILAMENT_CHANGE_RESUME_ON_INSERT PAUSE_REHEAT_FAST_RESUME \
@@ -16,7 +16,7 @@ opt_enable SDSUPPORT USB_FLASH_DRIVE_SUPPORT USE_OTG_USB_HOST \
opt_set E0_AUTO_FAN_PIN PC10 E1_AUTO_FAN_PIN PC11 E2_AUTO_FAN_PIN PC12 NEOPIXEL_PIN PF13 \
X_DRIVER_TYPE TMC2208 Y_DRIVER_TYPE TMC2130 \
FIL_RUNOUT_PIN 3 FIL_RUNOUT2_PIN 4 FIL_RUNOUT3_PIN 5 FIL_RUNOUT4_PIN 6 FIL_RUNOUT5_PIN 7 FIL_RUNOUT6_PIN 8 FIL_RUNOUT7_PIN 9 FIL_RUNOUT8_PIN 10 \
FIL_RUNOUT4_STATE HIGH FIL_RUNOUT8_STATE HIGH
FIL_RUNOUT_MODE '{ 2, 2, 2, 1, 2, 2, 2, 1 }' FIL_RUNOUT_DISTANCE_MM '{ 0, 1, 5, 10, 5, 5, 5, 5 }'
opt_enable FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP
exec_test $1 $2 "GTT GTR | OTG USB Flash Drive | 8 Extruders | Auto-Fan | Mixed TMC Drivers | Runout Sensors (distinct)" "$3"
+1 -1
View File
@@ -20,7 +20,7 @@ opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS GCODE_MACROS \
EEPROM_SETTINGS SDSUPPORT BINARY_FILE_TRANSFER \
BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN \
NEOPIXEL_LED NEOPIXEL_PIN CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_USE_RGB_LED CASE_LIGHT_MENU \
NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_DISTANCE_MM FILAMENT_RUNOUT_SENSOR \
NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_SENSOR FIL_RUNOUT_DISTANCE_MM \
AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE CALIBRATION_GCODE \
BACKLASH_COMPENSATION BACKLASH_GCODE BAUD_RATE_GCODE BEZIER_CURVE_SUPPORT \
+33 -49
View File
@@ -26,14 +26,13 @@ ci_src_filter -y
use_example_configs AnimationExample
opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO LCD_LANGUAGE fr SAVED_POSITIONS 4 DEFAULT_EJERK 10 \
EXTRUDERS 5 TEMP_SENSOR_1 1 TEMP_SENSOR_2 5 TEMP_SENSOR_3 20 TEMP_SENSOR_4 1000 TEMP_SENSOR_BED 1
opt_enable AUTO_BED_LEVELING_UBL AVOID_OBSTACLES RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT SKEW_CORRECTION \
opt_enable AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT SKEW_CORRECTION \
REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI STATUS_MESSAGE_SCROLLING SHOW_CUSTOM_BOOTSCREEN BOOT_MARLIN_LOGO_SMALL \
SDSUPPORT SDCARD_SORT_ALPHA USB_FLASH_DRIVE_SUPPORT AUTO_REPORT_SD_STATUS SCROLL_LONG_FILENAMES MEDIA_MENU_AT_TOP \
EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_MENU_MAIN FREEZE_FEATURE CANCEL_OBJECTS SOUND_MENU_ITEM \
EMERGENCY_PARSER MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE ADVANCE_K_EXTRA QUICK_HOME \
MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE ADVANCE_K_EXTRA QUICK_HOME \
SET_PROGRESS_MANUALLY SET_PROGRESS_PERCENT PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME \
ENCODER_NOISE_FILTER BABYSTEPPING BABYSTEP_XY NANODLP_Z_SYNC I2C_POSITION_ENCODERS M114_DETAIL
opt_disable ENCODER_RATE_MULTIPLIER
exec_test $1 $2 "Azteeg X3 Pro | EXTRUDERS 5 | RRDFGSC | UBL | LIN_ADVANCE ..." "$3"
#
@@ -45,8 +44,7 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO LCD_LANGUAGE jp_kana DEFAULT_EJERK 10 \
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI SHOW_CUSTOM_BOOTSCREEN BOOT_MARLIN_LOGO_SMALL \
SET_PROGRESS_MANUALLY SET_PROGRESS_PERCENT PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME STATUS_MESSAGE_SCROLLING SCROLL_LONG_FILENAMES \
SDSUPPORT LONG_FILENAME_WRITE_SUPPORT SDCARD_SORT_ALPHA NO_SD_AUTOSTART USB_FLASH_DRIVE_SUPPORT CANCEL_OBJECTS \
Z_PROBE_SLED AUTO_BED_LEVELING_UBL UBL_HILBERT_CURVE UBL_TILT_ON_MESH_POINTS UBL_TILT_ON_MESH_POINTS_3POINT \
RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT \
Z_PROBE_SLED AUTO_BED_LEVELING_UBL UBL_HILBERT_CURVE RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT \
EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_MENU_MAIN \
MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE QUICK_HOME \
NANODLP_Z_SYNC I2C_POSITION_ENCODERS M114_DETAIL \
@@ -55,50 +53,36 @@ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI SHOW_CUS
opt_disable SEGMENT_LEVELED_MOVES
exec_test $1 $2 "Azteeg X3 Pro | EXTRUDERS 5 | RRDFGSC | UBL | LIN_ADVANCE | Sled Probe | Skew | JP-Kana | Babystep offsets ..." "$3"
#
# 5 runout sensors with distinct states
#
restore_configs
opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO NUM_SERVOS 1 \
EXTRUDERS 4 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 TEMP_SENSOR_3 1 TEMP_SENSOR_4 1 FAN_KICKSTART_TIME 500 \
NUM_RUNOUT_SENSORS 4 FIL_RUNOUT2_PIN 44 FIL_RUNOUT3_PIN 45 FIL_RUNOUT4_PIN 46 FIL_RUNOUT5_PIN 47 \
FIL_RUNOUT3_STATE HIGH FILAMENT_RUNOUT_SCRIPT '"M600 T%c"'
EXTRUDERS 5 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 TEMP_SENSOR_3 1 TEMP_SENSOR_4 1 \
NUM_RUNOUT_SENSORS 5 FIL_RUNOUT2_PIN 44 FIL_RUNOUT3_PIN 45 FIL_RUNOUT4_PIN 46 FIL_RUNOUT5_PIN 47 \
FIL_RUNOUT_ENABLED '{ true, true, true, true, true }' FIL_RUNOUT_MODE '{ 1, 2, 7, 0, 1 }' FIL_RUNOUT_DISTANCE_MM '{ 15, 15, 15, 15, 15 }'
opt_enable VIKI2 BOOT_MARLIN_LOGO_ANIMATED SDSUPPORT AUTO_REPORT_SD_STATUS \
Z_PROBE_SERVO_NR Z_SERVO_ANGLES Z_SERVO_MEASURE_ANGLE DEACTIVATE_SERVOS_AFTER_MOVE Z_SERVO_DEACTIVATE_AFTER_STOW \
AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE PROBE_PT_1 PROBE_PT_2 PROBE_PT_3 \
Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE \
EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL AUTO_REPORT_POSITION \
NO_VOLUMETRICS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP G38_PROBE_TARGET JOYSTICK \
DIRECT_STEPPING DETECT_BROKEN_ENDSTOP \
FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE Z_SAFE_HOMING FIL_RUNOUT3_PULLUP
exec_test $1 $2 "Azteeg X3 Pro | EXTRUDERS 4 | VIKI2 | Servo Probe | Multiple runout sensors (x4)" "$3"
exec_test $1 $2 "Multiple runout sensors (x5) | Distinct runout states" "$3"
#
# Extruder Only. No XYZ axes at all.
# Mixing Extruder with 5 steppers, Greek
#
restore_configs
opt_set DEFAULT_AXIS_STEPS_PER_UNIT '{ 4000 }' \
DEFAULT_MAX_FEEDRATE '{ 5 }' \
DEFAULT_MAX_ACCELERATION '{ 100 }' \
MANUAL_FEEDRATE '{ 4*60 }' \
AXIS_RELATIVE_MODES '{ false }' \
HOMING_BUMP_MM '{}' HOMING_BUMP_DIVISOR '{}' HOMING_FEEDRATE_MM_M '{}'
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
opt_disable X_DRIVER_TYPE Y_DRIVER_TYPE Z_DRIVER_TYPE
exec_test $1 $2 "E Axis Only | DOGM MarlinUI" "$3"
#
# Mixing Extruder with 5 steppers, Russian
#
restore_configs
opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru \
NUM_RUNOUT_SENSORS E_STEPPERS TEMP_SENSOR_BED 0 REDUNDANT_PART_COOLING_FAN 1 \
FIL_RUNOUT2_PIN 16 FIL_RUNOUT3_PIN 17 FIL_RUNOUT4_PIN 4 FIL_RUNOUT5_PIN 5
opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru REDUNDANT_PART_COOLING_FAN 1 \
FIL_RUNOUT2_PIN 16 FIL_RUNOUT3_PIN 17 FIL_RUNOUT4_PIN 4 FIL_RUNOUT5_PIN 5 \
FIL_RUNOUT_ENABLED '{ true, true, true, true, true }' FIL_RUNOUT_MODE '{ 1, 2, 7, 0, 1 }' FIL_RUNOUT_DISTANCE_MM '{ 15, 15, 15, 15, 15 }'
opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \
USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \
XY_AFTER_HOMING EVENT_GCODE_AFTER_HOMING \
FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE INPUT_SHAPING_X INPUT_SHAPING_Y
opt_disable DISABLE_OTHER_EXTRUDERS
exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Input Shaping | Russian" "$3"
FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE
opt_disable DISABLE_INACTIVE_EXTRUDER
exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Greek" "$3"
#
# Test SPEAKER with BOARD_BQ_ZUM_MEGA_3D and BQ_LCD_SMART_CONTROLLER
@@ -142,7 +126,7 @@ exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Input Shaping
#opt_set MOTHERBOARD BOARD_RIGIDBOARD_V2
#opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT BABYSTEPPING DAC_MOTOR_CURRENT_DEFAULT
#exec_test $1 $2 "Stuff" "$3"
#
# #
# G3D_PANEL with SDCARD_SORT_ALPHA and STATUS_MESSAGE_SCROLLING
#
#restore_configs
@@ -193,9 +177,9 @@ exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Input Shaping
#opt_enable LCM1602
#exec_test $1 $2 "Stuff" "$3"
#
# Test Laser features with 12864 LCD
#
# #
# # Test Laser features with 12864 LCD
# #
# restore_configs
# opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_COOLER 1 TEMP_SENSOR_1 0 SERIAL_PORT_2 2 \
# DEFAULT_AXIS_STEPS_PER_UNIT '{ 80, 80, 400 }' \
@@ -207,9 +191,9 @@ exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Input Shaping
# LASER_FEATURE LASER_SAFETY_TIMEOUT_MS LASER_COOLANT_FLOW_METER AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN LASER_SYNCHRONOUS_M106_M107
# exec_test $1 $2 "MEGA2560 RAMPS | Laser Options | 12864 | Meatpack | Fan Sync | SERIAL_PORT_2 " "$3"
#
# Test Laser features with 44780 LCD
#
# #
# # Test Laser features with 44780 LCD
# #
# restore_configs
# opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_COOLER 1 TEMP_SENSOR_1 0 \
# DEFAULT_AXIS_STEPS_PER_UNIT '{ 80, 80, 400 }' \
@@ -221,9 +205,9 @@ exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Input Shaping
# LASER_FEATURE LASER_SAFETY_TIMEOUT_MS LASER_COOLANT_FLOW_METER AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN
# exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Laser Safety Timeout | Flowmeter | 44780 LCD " "$3"
#
# Test redundant temperature sensors + MAX TC + Backlight Timeout
#
# #
# # Test redundant temperature sensors + MAX TC + Backlight Timeout
# #
# restore_configs
# opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 1 \
# TEMP_SENSOR_0 -2 TEMP_SENSOR_REDUNDANT -2 \
@@ -234,9 +218,9 @@ exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Input Shaping
# opt_disable PIDTEMP
# exec_test $1 $2 "MEGA2560 RAMPS | Redundant temperature sensor | 2x MAX6675 | BL Timeout" "$3"
#
# Polargraph Config
#
# #
# # Polargraph Config
# #
# use_example_configs Polargraph
# exec_test $1 $2 "RUMBA | POLARGRAPH | RRD LCD" "$3"
@@ -284,12 +268,12 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER \
SET_PROGRESS_MANUALLY SET_PROGRESS_PERCENT SET_REMAINING_TIME SET_INTERACTION_TIME M73_REPORT \
SHOW_PROGRESS_PERCENT SHOW_ELAPSED_TIME SHOW_REMAINING_TIME SHOW_INTERACTION_TIME PRINT_PROGRESS_SHOW_DECIMALS
exec_test $1 $2 "MEGA2560 RAMPS | 128x64 | progress rotation" "$3"
exec_test $1 $2 "MEGA2560 RAMPS | 12864 | progress rotation" "$3"
opt_enable LIGHTWEIGHT_UI
exec_test $1 $2 "MEGA2560 RAMPS | 128x64 LIGHTWEIGHT_UI | progress rotation" "$3"
exec_test $1 $2 "MEGA2560 RAMPS | 12864 LIGHTWEIGHT_UI | progress rotation" "$3"
opt_disable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER
exec_test $1 $2 "MEGA2560 RAMPS | HD44780 | progress rotation" "$3"
exec_test $1 $2 "MEGA2560 RAMPS | 44780 | progress rotation" "$3"
# clean up
restore_configs