Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci-build-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
- Opulo_Lumen_REV3
- rumba32
- STM32F401RC_creality
- STM32F401RE_creality
- STM32F407VE_black
- I3DBEEZ9_V1

Expand Down
10 changes: 10 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3182,6 +3182,12 @@
//
//#define CR10_STOCKDISPLAY

// Resistive touch screen
//#define CREALITY_RTS

// Creality Cloud-based Printing
//#define CREALITY_CLOUD

//
// Ender-2 OEM display, a variant of the MKS_MINI_12864
//
Expand Down Expand Up @@ -3768,3 +3774,7 @@

// Disable servo with M282 to reduce power consumption, noise, and heat when not in use
//#define SERVO_DETACH_GCODE

// Creality WiFi
//#define CREALITY_WIFI
//#define MENU_RESET_WIFI
3 changes: 3 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,9 @@
#define BLTOUCH_HS_EXTRA_CLEARANCE 7 // Extra Z Clearance
#endif

// Add a Z limit
//#define BLTOUCH_AND_Z_LIMIT

#endif // BLTOUCH

// @section calibrate
Expand Down
62 changes: 54 additions & 8 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

#include "MarlinCore.h"

#define DEBUG_OUT ENABLED(MARLIN_DEV_MODE)
#include "core/debug_out.h"

#include "HAL/shared/Delay.h"
#include "HAL/shared/esp_wifi.h"
#include "HAL/shared/cpu_exception/exception_hook.h"
Expand Down Expand Up @@ -84,6 +87,10 @@
#endif
#endif

#if ENABLED(CREALITY_RTS)
#include "lcd/rts/lcd_rts.h"
#endif

#if HAS_ETHERNET
#include "feature/ethernet.h"
#endif
Expand Down Expand Up @@ -397,7 +404,11 @@ void Marlin::startOrResumeJob() {
TERN_(POWER_LOSS_RECOVERY, recovery.purge());

#ifdef EVENT_GCODE_SD_ABORT
queue.inject(F(EVENT_GCODE_SD_ABORT));
DEBUG_ECHOLNPGM("abortSDPrinting");
//queue.inject(F(EVENT_GCODE_SD_ABORT));
queue.enqueue_now(F(EVENT_GCODE_SD_ABORT));
report_current_position();
TERN_(CREALITY_RTS, RTS_UpdatePosition());
#endif

TERN_(PASSWORD_AFTER_SD_PRINT_ABORT, password.lock_machine());
Expand Down Expand Up @@ -442,7 +453,7 @@ void Marlin::manage_inactivity(const bool no_stepper_sleep/*=false*/) {
if (gcode.stepper_max_timed_out(ms)) {
SERIAL_ERROR_START();
SERIAL_ECHOLN(F(STR_KILL_PRE), F(STR_KILL_INACTIVE_TIME), parser.command_ptr);
kill();
TERN(CREALITY_RTS, RTS_StepperTimeout(), kill());
}

const bool has_blocks = planner.has_blocks_queued(); // Any moves in the planner?
Expand Down Expand Up @@ -473,8 +484,10 @@ void Marlin::manage_inactivity(const bool no_stepper_sleep/*=false*/) {
TERN_(AUTO_BED_LEVELING_UBL, bedlevel.steppers_were_disabled());
}
}
else
else {
// if (!parked_or_ignoring && gcode.stepper_inactive_timeout() && !card.isPrinting() && !card.isPaused()) // rock_20220815
already_shutdown_steppers = false;
}
}
#endif

Expand Down Expand Up @@ -832,7 +845,10 @@ void Marlin::idle(const bool no_stepper_sleep/*=false*/) {
#endif

// Handle SD Card insert / remove
TERN_(HAS_MEDIA, card.manage_media());
#if HAS_MEDIA
if (TERN1(CREALITY_RTS, !HMI_lcd_flag.home_flag && !G29_flag)) // Avoid the problem of leveling and returning to zero, plugging and unplugging the card will affect the probe and report error 203
card.manage_media();
#endif

// Announce Host Keepalive state (if any)
TERN_(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive());
Expand All @@ -844,12 +860,16 @@ void Marlin::idle(const bool no_stepper_sleep/*=false*/) {
TERN_(HAS_BEEPER, buzzer.tick());

// Handle UI input / draw events
#if ENABLED(SOVOL_SV06_RTS)
#if ANY(SOVOL_SV06_RTS, CREALITY_RTS)
RTS_Update();
#else
ui.update();
#endif

#if ENABLED(PROBE_ACTIVATION_SWITCH)
endstops.enable_z_probe(TERN1(CREALITY_RTS, (HMI_lcd_flag.home_flag || G29_flag)) && (LOW == READ(PROBE_ACTIVATION_SWITCH_PIN)));
#endif

// Run i2c Position Encoders
#if ENABLED(I2C_POSITION_ENCODERS)
{
Expand Down Expand Up @@ -893,6 +913,22 @@ void Marlin::idle(const bool no_stepper_sleep/*=false*/) {
// Direct Stepping
TERN_(DIRECT_STEPPING, page_manager.write_responses());

#if ENABLED(MENU_RESET_WIFI)
static millis_t wifi_record_ms = 0;
if (rts_wifi_state == PRESSED) {
rts_wifi_state = RECORDTIME;
wifi_record_ms = millis() + 7000UL;
}
else if (rts_wifi_state == RECORDTIME) {
if (wifi_record_ms && ELAPSED(millis(), wifi_record_ms)) {
OUT_WRITE(RESET_WIFI_PIN, HIGH);
rts_wifi_state = INITIAL;
SERIAL_ECHOPGM("wifi is reset");
wifi_record_ms = 0;
}
}
#endif

// Update the LVGL interface
TERN_(HAS_TFT_LVGL_UI, LV_TASK_HANDLER());

Expand Down Expand Up @@ -1316,13 +1352,13 @@ void setup() {

// Identify myself as Marlin x.x.x
SERIAL_ECHOLNPGM("Marlin " SHORT_BUILD_VERSION);
#ifdef STRING_DISTRIBUTION_DATE
#if defined(STRING_DISTRIBUTION_DATE) && (DISABLED(CREALITY_RTS) || defined(STRING_CONFIG_H_AUTHOR))
SERIAL_ECHO_MSG(
" Last Updated: " STRING_DISTRIBUTION_DATE
" | Author: " STRING_CONFIG_H_AUTHOR
);
#endif
SERIAL_ECHO_MSG(" Compiled: " __DATE__);
SERIAL_ECHO_MSG(" Compiled: " __DATE__ " " __TIME__);
SERIAL_ECHO_MSG(STR_FREE_MEMORY, hal.freeMemory(), STR_PLANNER_BUFFER_BYTES, sizeof(block_t) * (BLOCK_BUFFER_SIZE));

// Some HAL need precise delay adjustment
Expand Down Expand Up @@ -1650,7 +1686,7 @@ void setup() {

#if ENABLED(DWIN_CREALITY_LCD)
SETUP_RUN(dwinInitScreen());
#elif ENABLED(SOVOL_SV06_RTS)
#elif ANY(SOVOL_SV06_RTS, CREALITY_RTS)
SETUP_RUN(rts.init());
#endif

Expand Down Expand Up @@ -1758,3 +1794,13 @@ void loop() {

} while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
}

//void HardFault_Handler(void) {
// SERIAL_ECHO_MSG("HardFault_Handler");
// OUT_WRITE(E0_AUTO_FAN_PIN, LOW);
// OUT_WRITE(FAN_PIN, LOW);
// for (int i = 0; i < 0xFFFF; i++) OUT_WRITE(FAN_PIN, HIGH);
// OUT_WRITE(E0_AUTO_FAN_PIN, HIGH);
// OUT_WRITE(FAN_PIN, HIGH);
// while(1);
//}
72 changes: 54 additions & 18 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@

#include "../lcd/marlinui.h"

#if ENABLED(CREALITY_RTS)
#include "../lcd/rts/lcd_rts.h"
#endif

#if HAS_SOUND
#include "../libs/buzzer.h"
#endif
Expand Down Expand Up @@ -159,11 +163,13 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P

if (wait) return thermalManager.wait_for_hotend(active_extruder);

// Allow interruption by Emergency Parser M108
marlin.wait_for_heatup = TERN1(PREVENT_COLD_EXTRUSION, !thermalManager.allow_cold_extrude);
while (marlin.is_heating() && ABS(thermalManager.wholeDegHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > (TEMP_WINDOW))
marlin.idle();
marlin.heatup_done();
#if DISABLED(CREALITY_RTS)
// Allow interruption by Emergency Parser M108
marlin.wait_for_heatup = TERN1(PREVENT_COLD_EXTRUSION, !thermalManager.allow_cold_extrude);
while (marlin.is_heating() && ABS(thermalManager.wholeDegHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > (TEMP_WINDOW))
marlin.idle();
marlin.wait_for_heatup = false;
#endif

#if ENABLED(PREVENT_COLD_EXTRUSION)
// A user can cancel wait-for-heating with M108
Expand Down Expand Up @@ -431,6 +437,7 @@ bool pause_print(const float retract, const xyz_pos_t &park_point, const bool sh
#endif

TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
TERN_(CREALITY_RTS, RTS_PausedPrint());

// Indicate that the printer is paused
++did_pause_print;
Expand Down Expand Up @@ -479,25 +486,49 @@ bool pause_print(const float retract, const xyz_pos_t &park_point, const bool sh
TERN_(AUTO_BED_LEVELING_UBL, set_bed_leveling_enabled(leveling_was_enabled)); // restore leveling
}

// 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(CREALITY_RTS)

while (planner.movesplanned() < 2 && destination != current_position)
marlin.idle();

queue.clear();
delay(20);
if (!planner.has_blocks_queued()) {
if (axis_is_trusted(X_AXIS) && axis_is_trusted(Y_AXIS)) {
//if (!axes_need_homing())
nozzle.park(0, park_point);
}
}

#else

// 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);

#endif

TERN_(DWIN_LCD_PROUI, if (!do_park) ui.set_status(GET_TEXT_F(MSG_PARK_FAILED)));

#if ENABLED(DUAL_X_CARRIAGE)
const int8_t saved_ext = active_extruder;
const bool saved_ext_dup_mode = extruder_duplication_enabled;
set_duplication_enabled(false, DXC_ext);
#endif

// Unload the filament, if specified
if (unload_length)
unload_filament(unload_length, show_lcd, PAUSE_MODE_CHANGE_FILAMENT);
#if DISABLED(CREALITY_RTS)
// Unload the filament, if specified
if (unload_length)
unload_filament(unload_length, show_lcd, PAUSE_MODE_CHANGE_FILAMENT);
#endif

TERN_(DUAL_X_CARRIAGE, set_duplication_enabled(saved_ext_dup_mode, saved_ext));

// Disable the Extruder for manual change
disable_active_extruder();

TERN_(CREALITY_RTS, RTS_ReheatHotend(170));

return true;
}

Expand Down Expand Up @@ -611,6 +642,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
nozzle_timed_out = false;
first_impatient_beep(max_beep_count);
}
TERN_(CREALITY_RTS, marlin.wait_for_user = false);
marlin.idle_no_sleep();
}
TERN_(DUAL_X_CARRIAGE, set_duplication_enabled(saved_ext_dup_mode, saved_ext));
Expand Down Expand Up @@ -696,13 +728,17 @@ void resume_print(
unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));

if (!axes_should_home()) {
// Move XY back to saved position
destination.set(resume_position.x, resume_position.y, current_position.z, current_position.e);
prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);

// Move Z back to saved position
destination.z = resume_position.z;
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
#if ENABLED(CREALITY_RTS)
destination.set(resume_position.x, resume_position.y, resume_position.z, current_position.e);
#else
// Move XY back to saved position
destination.set(resume_position.x, resume_position.y, current_position.z, current_position.e);
prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);

// Move Z back to saved position
destination.z = resume_position.z;
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
#endif
}

#if ENABLED(AUTO_BED_LEVELING_UBL)
Expand Down
Loading
Loading