This commit is contained in:
Scott Lahteine 2026-01-16 04:44:45 -06:00 committed by GitHub
commit 7fe8a0d5c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 5839 additions and 65 deletions

View file

@ -124,6 +124,7 @@ jobs:
- Opulo_Lumen_REV3
- rumba32
- STM32F401RC_creality
- STM32F401RE_creality
- STM32F407VE_black
- I3DBEEZ9_V1

View file

@ -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
//
@ -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

View file

@ -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

View file

@ -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"
@ -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
@ -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());
@ -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?
@ -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
@ -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());
@ -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)
{
@ -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());
@ -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
@ -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
@ -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);
//}

View file

@ -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
@ -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
@ -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;
@ -479,9 +486,29 @@ 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;
@ -489,15 +516,19 @@ bool pause_print(const float retract, const xyz_pos_t &park_point, const bool sh
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;
}
@ -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));
@ -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);
#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);
// 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)

View file

@ -53,6 +53,11 @@ uint32_t PrintJobRecovery::cmd_sdpos, // = 0
bool PrintJobRecovery::ui_flag_resume; // = false
#endif
#if ENABLED(CREALITY_RTS)
bool PrintJobRecovery::recovery_flag; // = false
#include "../lcd/rts/lcd_rts.h"
#endif
#include "../sd/cardreader.h"
#include "../lcd/marlinui.h"
#include "../gcode/queue.h"
@ -96,6 +101,20 @@ PrintJobRecovery recovery;
gcode.process_subcommands_now(cmd); \
}while(0)
#if ENABLED(CREALITY_RTS)
// Feed action before pausing and resuming。rock_20220914
#define FEEDING_DEF_DISTANCE 5 // in material: default distance of feeding material
#define FEEDING_DEF_SPEED 5 // in material: default feedrate
static void pause_resume_feedstock(uint16_t _distance, uint16_t _feedRate) {
current_position.e += _distance;
line_to_current_position(feedRate_t(_feedRate));
current_position.e -= _distance;
gcode.process_subcommands_now(TS(F("G92.9 E"), p_float_t(current_position.e, 3)));
// Resume the feedrate
gcode.process_subcommands_now(TS(F("G1 F%s"), p_float_t(MMS_TO_MMM(feedrate_mm_s), 3)));
}
#endif
/**
* Clear the recovery info
*/
@ -216,6 +235,11 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
// Machine state
// info.sdpos and info.current_position are pre-filled from the Stepper ISR
#if ENABLED(CREALITY_RTS)
//report_current_position(); //rock_0328
//info.current_position = current_position;
#endif
info.feedrate = uint16_t(MMS_TO_MMM(feedrate_mm_s));
info.feedrate_percentage = feedrate_percentage;
COPY(info.flow_percentage, planner.flow_percentage);
@ -270,7 +294,11 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
info.flag.dryrun = !!(marlin_debug_flags & MARLIN_DEBUG_DRYRUN);
info.flag.allow_cold_extrusion = TERN0(PREVENT_COLD_EXTRUSION, thermalManager.allow_cold_extrude);
TERN_(CREALITY_RTS, recovery_flag = PoweroffContinue);
write();
DEBUG_ECHO_MSG("current_position.z:", current_position.z);
}
}
@ -441,6 +469,8 @@ void PrintJobRecovery::resume() {
const float z_raised = z_print + info.zraise;
#endif
DEBUG_ECHO_MSG(">>> z_print:", z_print, ", z_raised:", z_raised, ", info.flag.raised:", info.flag.raised);
//
// Home the axes that can safely be homed, and
// establish the current position as best we can.
@ -486,21 +516,27 @@ void PrintJobRecovery::resume() {
#if HOMING_Z_DOWN
// Move to a safe XY position and home Z while avoiding the print.
const xy_pos_t p = xy_pos_t(POWER_LOSS_ZHOME_POS) TERN_(HOMING_Z_WITH_PROBE, - probe.offset_xy);
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F1000X"), p_float_t(p.x, 3), 'Y', p_float_t(p.y, 3), F("\nG28HZ")));
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F1000X"), p_float_t(p.x, 3), 'Y', p_float_t(p.y, 3), F("\nG28ZH" TERN_(CREALITY_RTS, "R0"))));
#endif
// Mark all axes as having been homed (no effect on current_position)
set_all_homed();
DEBUG_ECHO_MSG(">>> homed current_position.z:", current_position.z);
#if HAS_LEVELING
// Restore Z fade and possibly re-enable bed leveling compensation.
// Leveling may already be enabled due to the ENABLE_LEVELING_AFTER_G28 option.
// TODO: Add a G28 parameter to leave leveling disabled.
PROCESS_SUBCOMMANDS_NOW(TS(F("M420S"), '0' + (char)info.flag.leveling, 'Z', p_float_t(info.fade, 1)));
#if DISABLED(CREALITY_RTS)
PROCESS_SUBCOMMANDS_NOW(TS(F("M420S"), '0' + (char)info.flag.leveling, 'Z', p_float_t(info.fade, 1)));
#endif
#if !HOMING_Z_DOWN
// The physical Z was adjusted at power-off so undo the M420S1 correction to Z with G92.9.
PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9Z"), p_float_t(z_now, 3)));
#if DISABLED(CREALITY_RTS)
PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9Z"), p_float_t(z_now, 3)));
#endif
#endif
#endif
@ -576,13 +612,37 @@ void PrintJobRecovery::resume() {
PROCESS_SUBCOMMANDS_NOW(F("G12"));
#endif
#if ENABLED(CREALITY_RTS)
PROCESS_SUBCOMMANDS_NOW(F("M420 S0 Z0")); // rock_20220326
// Restore E position with G92.9 Rock_20220913
// If there is a layer-changing and retracting action in GCODE,
// first extrude the material and then return to the origin
PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9E"), p_float_t(info.current_position.e, 3)));
// rock_20220914 - To solve the problem of faults in the printed small model,
// the purpose is to fill the hollow section of the throat.
pause_resume_feedstock(FEEDING_DEF_DISTANCE, FEEDING_DEF_SPEED);
#endif
// Move back over to the saved XY
PROCESS_SUBCOMMANDS_NOW(TS(
F("G1F3000X"), p_float_t(resume_pos.x, 3), 'Y', p_float_t(resume_pos.y, 3)
));
// Move back down to the saved Z for printing
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F600Z"), p_float_t(z_print, 3)));
#if ENABLED(CREALITY_RTS)
MString<20> cmd(F("G1F600Z"), p_float_t(z_print, 3));
PROCESS_SUBCOMMANDS_NOW(cmd);
DEBUG_ECHOLN(&cmd);
DEBUG_ECHO_MSG(">>> z_print:", z_print, "current_position.z:", current_position.z);
PROCESS_SUBCOMMANDS_NOW(F("M114"));
//safe_delay(10000);
#else
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F600Z"), p_float_t(z_print, 3)));
#endif
// Restore the feedrate and percentage
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F"), info.feedrate));
@ -591,8 +651,20 @@ void PrintJobRecovery::resume() {
// Flowrate percentage
EXTRUDER_LOOP() planner.set_flow(e, info.flow_percentage[e]);
#if ALL(CREALITY_RTS, HAS_LEVELING)
// Restore Z fade and possibly re-enable bed leveling compensation.
// Leveling may already be enabled due to the ENABLE_LEVELING_AFTER_G28 option.
// TODO: Add a G28 parameter to leave leveling disabled.
PROCESS_SUBCOMMANDS_NOW(TS(F("M420S"), '0' + char(info.flag.leveling), 'Z', p_float_t(info.fade, 1)));
// Restore Z position with G92.9
PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9Z"), p_float_t(z_print, 3)));
#endif
// Restore E position with G92.9
PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9E"), p_float_t(resume_pos.e, 3)));
#if DISABLED(CREALITY_RTS)
PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9E"), p_float_t(resume_pos.e, 3)));
#endif
#if ENABLED(CANCEL_OBJECTS)
cancelable.state = info.cancel_state;
@ -743,6 +815,9 @@ void PrintJobRecovery::resume() {
#if HAS_VOLUMETRIC_EXTRUSION
DEBUG_ECHOLNPGM("flag.volumetric_enabled: ", AS_DIGIT(info.flag.volumetric_enabled));
#endif
#if ENABLED(CREALITY_RTS)
DEBUG_ECHOLNPGM("recovery_flag: ", AS_DIGIT(recovery_flag));
#endif
}
else
DEBUG_ECHOLNPGM("INVALID DATA");

View file

@ -166,6 +166,10 @@ class PrintJobRecovery {
static bool ui_flag_resume; //!< Flag the UI to show a dialog to Resume (M1000) or Cancel (M1000C)
#endif
#if ENABLED(CREALITY_RTS)
static bool recovery_flag;
#endif
static void init();
static void prepare();

View file

@ -30,6 +30,10 @@
#include "runout.h"
#if ENABLED(CREALITY_RTS)
#include "../lcd/rts/lcd_rts.h"
#endif
FilamentMonitor runout;
bool FilamentMonitorBase::enabled = true,
@ -75,6 +79,7 @@ bool FilamentMonitorBase::enabled = true,
#endif
void event_filament_runout(const uint8_t extruder) {
if (TERN0(CREALITY_RTS, G29_flag || home_flag)) return;
runout.init_for_restart(false); // Reset and disable
@ -104,6 +109,8 @@ void event_filament_runout(const uint8_t extruder) {
const bool run_runout_script = !runout.host_handling;
TERN_(CREALITY_RTS, RTS_FilamentRanOut());
#if ENABLED(HOST_ACTION_COMMANDS)
const bool park_or_pause = (false

View file

@ -35,6 +35,12 @@
#include "../../../module/probe.h"
#include "../../../module/temperature.h"
#include "../../queue.h"
#include "../../../module/settings.h"
#include "../../../sd/cardreader.h"
#if ENABLED(CREALITY_RTS)
#include "../../../lcd/rts/lcd_rts.h"
#endif
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
#include "../../../libs/least_squares_fit.h"
@ -108,6 +114,10 @@ public:
bool dryrun,
reenable;
#if ENABLED(CREALITY_RTS)
uint8_t showcount;
#endif
#if ANY(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR)
int abl_probe_index;
#endif
@ -155,6 +165,124 @@ public:
constexpr grid_count_t G29_State::abl_points;
#endif
#if ALL(HAS_MESH, CREALITY_RTS)
void apply_mesh_correction(bed_mesh_t &z_values) {
float grok[3][5][5] = { 0 };
// lower left corner
grok[0][0][0] = -((z_values[0][4] - z_values[0][3]) + (z_values[0][3] - z_values[0][2]) + (z_values[0][2] - z_values[0][1])) / 3.0f + z_values[0][1];
grok[1][0][0] = -((z_values[4][0] - z_values[3][0]) + (z_values[3][0] - z_values[2][0]) + (z_values[2][0] - z_values[1][0])) / 3.0f + z_values[1][0];
grok[2][0][0] = -((z_values[4][4] - z_values[3][3]) + (z_values[3][3] - z_values[2][2]) + (z_values[2][2] - z_values[1][1])) / 3.0f + z_values[1][1];
grok[0][0][1] = -((z_values[0][4] - z_values[0][3]) + (z_values[0][3] - z_values[0][2])) / 2.0f + z_values[0][2];
grok[1][0][1] = -((z_values[4][1] - z_values[3][1]) + (z_values[3][1] - z_values[2][1]) + (z_values[2][1] - z_values[1][1])) / 3.0f + z_values[1][1];
grok[2][0][1] = -((z_values[3][4] - z_values[2][3]) + (z_values[2][3] - z_values[1][2])) / 2.0f + z_values[1][2];
grok[0][1][0] = -((z_values[1][4] - z_values[1][3]) + (z_values[1][3] - z_values[1][2]) + (z_values[1][2] - z_values[1][1])) / 3.0f + z_values[1][1];
grok[1][1][0] = -((z_values[4][0] - z_values[3][0]) + (z_values[3][0] - z_values[2][0])) / 2.0f + z_values[2][0];
grok[2][1][0] = -((z_values[4][3] - z_values[3][2]) + (z_values[3][2] - z_values[2][1])) / 2.0f + z_values[2][1];
grok[0][1][1] = -((z_values[1][4] - z_values[1][3]) + (z_values[1][3] - z_values[1][2])) / 2.0f + z_values[1][2];
grok[1][1][1] = -((z_values[4][1] - z_values[3][1]) + (z_values[3][1] - z_values[2][1])) / 2.0f + z_values[2][1];
grok[2][1][1] = -((z_values[4][4] - z_values[3][3]) + (z_values[3][3] - z_values[2][2])) / 2.0f + z_values[2][2];
// upper left corner
grok[0][0][4] = -((z_values[4][4] - z_values[3][4]) + (z_values[3][4] - z_values[2][4]) + (z_values[2][4] - z_values[1][4])) / 3.0f + z_values[1][4];
grok[1][0][4] = -((z_values[0][0] - z_values[0][1]) + (z_values[0][1] - z_values[0][2]) + (z_values[0][2] - z_values[0][3])) / 3.0f + z_values[0][3];
grok[2][0][4] = -((z_values[4][0] - z_values[3][1]) + (z_values[3][1] - z_values[2][2]) + (z_values[2][2] - z_values[1][3])) / 3.0f + z_values[1][3];
grok[0][0][3] = -((z_values[4][3] - z_values[3][3]) + (z_values[3][3] - z_values[2][3]) + (z_values[2][3] - z_values[1][3])) / 3.0f + z_values[1][3];
grok[1][0][3] = -((z_values[0][0] - z_values[0][1]) + (z_values[0][1] - z_values[0][2])) / 2.0f + z_values[0][2];
grok[2][0][3] = -((z_values[3][0] - z_values[2][1]) + (z_values[2][1] - z_values[1][2])) / 2.0f + z_values[1][2];
grok[0][1][4] = -((z_values[1][0] - z_values[1][1]) + (z_values[1][1] - z_values[1][2]) + (z_values[1][2] - z_values[1][3])) / 3.0f + z_values[1][3];
grok[1][1][4] = -((z_values[4][4] - z_values[3][4]) + (z_values[3][4] - z_values[2][4])) / 2.0f + z_values[2][4];
grok[2][1][4] = -((z_values[4][1] - z_values[3][2]) + (z_values[3][2] - z_values[2][3])) / 2.0f + z_values[2][3];
grok[0][1][3] = -((z_values[4][3] - z_values[3][3]) + (z_values[3][3] - z_values[2][3])) / 2.0f + z_values[2][3];
grok[1][1][3] = -((z_values[1][0] - z_values[1][1]) + (z_values[1][1] - z_values[1][2])) / 2.0f + z_values[1][2];
grok[2][1][3] = -((z_values[4][0] - z_values[3][1]) + (z_values[3][1] - z_values[2][2])) / 2.0f + z_values[2][2];
// upper right corner
grok[0][4][4] = -((z_values[0][4] - z_values[1][4]) + (z_values[1][4] - z_values[2][4]) + (z_values[2][4] - z_values[3][4])) / 3.0f + z_values[3][4];
grok[1][4][4] = -((z_values[4][0] - z_values[4][1]) + (z_values[4][1] - z_values[4][2]) + (z_values[4][2] - z_values[4][3])) / 3.0f + z_values[4][3];
grok[2][4][4] = -((z_values[0][0] - z_values[1][1]) + (z_values[1][1] - z_values[2][2]) + (z_values[2][2] - z_values[3][3])) / 3.0f + z_values[3][3];
grok[0][3][4] = -((z_values[3][0] - z_values[3][1]) + (z_values[3][1] - z_values[3][2]) + (z_values[3][2] - z_values[3][3])) / 3.0f + z_values[3][3];
grok[1][3][4] = -((z_values[0][4] - z_values[1][4]) + (z_values[1][4] - z_values[2][4])) / 2.0f + z_values[2][4];
grok[2][3][4] = -((z_values[0][1] - z_values[1][2]) + (z_values[1][2] - z_values[2][3])) / 2.0f + z_values[2][3];
grok[0][4][3] = -((z_values[0][3] - z_values[1][3]) + (z_values[1][3] - z_values[2][3]) + (z_values[2][3] - z_values[3][3])) / 3.0f + z_values[3][3];
grok[1][4][3] = -((z_values[4][0] - z_values[4][1]) + (z_values[4][1] - z_values[4][2])) / 2.0f + z_values[4][2];
grok[2][4][3] = -((z_values[1][0] - z_values[2][1]) + (z_values[2][1] - z_values[3][2])) / 2.0f + z_values[3][2];
grok[0][3][3] = -((z_values[0][3] - z_values[1][3]) + (z_values[1][3] - z_values[2][3])) / 2.0f + z_values[2][3];
grok[1][3][3] = -((z_values[3][0] - z_values[3][1]) + (z_values[3][1] - z_values[3][2])) / 2.0f + z_values[3][2];
grok[2][3][3] = -((z_values[0][0] - z_values[1][1]) + (z_values[1][1] - z_values[2][2])) / 2.0f + z_values[2][2];
// lower right corner
grok[0][4][0] = -((z_values[4][4] - z_values[4][3]) + (z_values[4][3] - z_values[4][2]) + (z_values[4][2] - z_values[4][1])) / 3.0f + z_values[4][1];
grok[1][4][0] = -((z_values[0][0] - z_values[1][0]) + (z_values[1][0] - z_values[2][0]) + (z_values[2][0] - z_values[3][0])) / 3.0f + z_values[3][0];
grok[2][4][0] = -((z_values[0][4] - z_values[1][3]) + (z_values[1][3] - z_values[2][2]) + (z_values[2][2] - z_values[3][1])) / 3.0f + z_values[3][1];
grok[0][3][0] = -((z_values[3][4] - z_values[3][3]) + (z_values[3][3] - z_values[3][2]) + (z_values[3][2] - z_values[3][1])) / 3.0f + z_values[3][1];
grok[1][3][0] = -((z_values[0][0] - z_values[1][0]) + (z_values[1][0] - z_values[2][0])) / 2.0f + z_values[2][0];
grok[2][3][0] = -((z_values[0][3] - z_values[1][2]) + (z_values[1][2] - z_values[2][1])) / 2.0f + z_values[2][1];
grok[0][4][1] = -((z_values[0][1] - z_values[1][1]) + (z_values[1][1] - z_values[2][1]) + (z_values[2][1] - z_values[3][1])) / 3.0f + z_values[3][1];
grok[1][4][1] = -((z_values[4][4] - z_values[4][3]) + (z_values[4][3] - z_values[4][2])) / 2.0f + z_values[4][2];
grok[2][4][1] = -((z_values[1][4] - z_values[2][3]) + (z_values[2][3] - z_values[3][2])) / 2.0f + z_values[3][2];
grok[0][3][1] = -((z_values[3][4] - z_values[3][3]) + (z_values[3][3] - z_values[3][2])) / 2.0f + z_values[3][2];
grok[1][3][1] = -((z_values[0][1] - z_values[1][1]) + (z_values[1][1] - z_values[2][1])) / 2.0f + z_values[2][1];
grok[2][3][1] = -((z_values[0][4] - z_values[1][3]) + (z_values[1][3] - z_values[2][2])) / 2.0f + z_values[2][2];
// Calculate mean
z_values[0][0] = (grok[0][0][0] + grok[1][0][0] + grok[2][0][0]) / 3.0f;
z_values[0][1] = (grok[0][0][1] + grok[1][0][1] + grok[2][0][1] + z_values[0][1]) / 4.0f;
z_values[1][0] = (grok[0][1][0] + grok[1][1][0] + grok[2][1][0] + z_values[1][0]) / 4.0f;
z_values[1][1] = (grok[0][1][1] + grok[1][1][1] + grok[2][1][1] + z_values[1][1]) / 4.0f;
z_values[0][4] = (grok[0][0][4] + grok[1][0][4] + grok[2][0][4] + z_values[0][4]) / 4.0f;
z_values[0][3] = (grok[0][0][3] + grok[1][0][3] + grok[2][0][3] + z_values[0][3]) / 4.0f;
z_values[1][4] = (grok[0][1][4] + grok[1][1][4] + grok[2][1][4] + z_values[1][4]) / 4.0f;
z_values[1][3] = (grok[0][1][3] + grok[1][1][3] + grok[2][1][3] + z_values[1][3]) / 4.0f;
z_values[4][4] = (grok[0][4][4] + grok[1][4][4] + grok[2][4][4] + z_values[4][4]) / 4.0f;
z_values[3][4] = (grok[0][3][4] + grok[1][3][4] + grok[2][3][4] + z_values[3][4]) / 4.0f;
z_values[4][3] = (grok[0][4][3] + grok[1][4][3] + grok[2][4][3] + z_values[4][3]) / 4.0f;
z_values[3][3] = (grok[0][3][3] + grok[1][3][3] + grok[2][3][3] + z_values[3][3]) / 4.0f;
z_values[4][0] = (grok[0][4][0] + grok[1][4][0] + grok[2][4][0] + z_values[4][0]) / 4.0f;
z_values[3][0] = (grok[0][3][0] + grok[1][3][0] + grok[2][3][0] + z_values[3][0]) / 4.0f;
z_values[4][1] = (grok[0][4][1] + grok[1][4][1] + grok[2][4][1] + z_values[4][1]) / 4.0f;
z_values[3][1] = (grok[0][3][1] + grok[1][3][1] + grok[2][3][1] + z_values[3][1]) / 4.0f;
// weighted calculation method
//z_values[0][0] = (grok[0][0][0] + grok[1][0][0] + grok[2][0][0]) / 3.0f * 0.4f + z_values[0][0] * 0.6;
//z_values[0][1] = (grok[0][0][1] + grok[1][0][1] + grok[2][0][1]) / 3.0f * 0.4f + z_values[0][1] * 0.6;
//z_values[1][0] = (grok[0][1][0] + grok[1][1][0] + grok[2][1][0]) / 3.0f * 0.4f + z_values[1][0] * 0.6;
//z_values[1][1] = (grok[0][1][1] + grok[1][1][1] + grok[2][1][1]) / 3.0f * 0.4f + z_values[1][1] * 0.6;
//z_values[0][4] = (grok[0][0][4] + grok[1][0][4] + grok[2][0][4]) / 3.0f * 0.4f + z_values[0][4] * 0.6;
//z_values[0][3] = (grok[0][0][3] + grok[1][0][3] + grok[2][0][3]) / 3.0f * 0.4f + z_values[0][3] * 0.6;
//z_values[1][4] = (grok[0][1][4] + grok[1][1][4] + grok[2][1][4]) / 3.0f * 0.4f + z_values[1][4] * 0.6;
//z_values[1][3] = (grok[0][1][3] + grok[1][1][3] + grok[2][1][3]) / 3.0f * 0.4f + z_values[1][3] * 0.6;
//z_values[4][4] = (grok[0][4][4] + grok[1][4][4] + grok[2][4][4]) / 3.0f * 0.4f + z_values[4][4] * 0.6;
//z_values[3][4] = (grok[0][3][4] + grok[1][3][4] + grok[2][3][4]) / 3.0f * 0.4f + z_values[3][4] * 0.6;
//z_values[4][3] = (grok[0][4][3] + grok[1][4][3] + grok[2][4][3]) / 3.0f * 0.4f + z_values[4][3] * 0.6;
//z_values[3][3] = (grok[0][3][3] + grok[1][3][3] + grok[2][3][3]) / 3.0f * 0.4f + z_values[3][3] * 0.6;
//z_values[4][0] = (grok[0][4][0] + grok[1][4][0] + grok[2][4][0]) / 3.0f * 0.4f + z_values[4][0] * 0.6;
//z_values[3][0] = (grok[0][3][0] + grok[1][3][0] + grok[2][3][0]) / 3.0f * 0.4f + z_values[3][0] * 0.6;
//z_values[4][1] = (grok[0][4][1] + grok[1][4][1] + grok[2][4][1]) / 3.0f * 0.4f + z_values[4][1] * 0.6;
//z_values[3][1] = (grok[0][3][1] + grok[1][3][1] + grok[2][3][1]) / 3.0f * 0.4f + z_values[3][1] * 0.6;
}
#endif // HAS_MESH && CREALITY_RTS
/**
* G29: Bed Leveling
*
@ -233,6 +361,14 @@ G29_TYPE GcodeSuite::G29() {
// Keep powered steppers from timing out
reset_stepper_timeout();
reset_bed_level(); // not 0 but NaN
#if ENABLED(CREALITY_RTS)
G29_flag = true;
RTS_ProbingPauseHotend();
RTS_ProbingPauseFans();
#endif
// Q = Query leveling and G29 state
const bool seenQ = ANY(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) && parser.seen_test('Q');
@ -621,6 +757,7 @@ G29_TYPE GcodeSuite::G29() {
// Is there a next point to move to?
if (abl.abl_probe_index < abl.abl_points) {
//abl.probePos.y -= probe.offset.y;
_manual_goto_xy(abl.probePos); // Can be used here too!
// Disable software endstops to allow manual adjustment
// If G29 is not completed, they will not be re-enabled
@ -677,6 +814,7 @@ G29_TYPE GcodeSuite::G29() {
// Outer loop is X with PROBE_Y_FIRST enabled
// Outer loop is Y with PROBE_Y_FIRST disabled
TERN_(CREALITY_RTS, abl.showcount = 0);
for (PR_OUTER_VAR = 0; PR_OUTER_VAR < PR_OUTER_SIZE && !isnan(abl.measured_z); PR_OUTER_VAR++) {
int8_t inStart, inStop, inInc;
@ -793,6 +931,7 @@ G29_TYPE GcodeSuite::G29() {
const float z = abl.measured_z + abl.Z_offset;
abl.z_values[abl.meshCount.x][abl.meshCount.y] = z;
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(abl.meshCount, z));
TERN_(CREALITY_RTS, RTS_LevelingUpdate(abl.showcount, abl.abl_points));
#if ENABLED(SOVOL_SV06_RTS)
if (pt_index <= GRID_MAX_POINTS) rts.sendData(pt_index, AUTO_BED_LEVEL_ICON_VP);
@ -808,6 +947,28 @@ G29_TYPE GcodeSuite::G29() {
} // inner
} // outer
// Leveling data compensation interface
//for (uint8_t index = 0; index <= 3; ++index) {
// //bedlevel.z_values[3][index] *= 1.3f;
// //bedlevel.z_values[2][index] *= 1.3f;
// //bedlevel.z_values[2][index] += bedlevel.z_values[1][index] * 0.3f;
// //bedlevel.z_values[0][index] *= 1.3f;
// bedlevel.z_values[index][1] *= 0.8f;
// bedlevel.z_values[index][2] *= 0.8f;
// bedlevel.z_values[index][3] *= 0.8f;
// bedlevel.z_values[index][0] *= 0.8f;
//}
TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.print_leveling_grid()); // print raw data
// Force smoothing of the bottom left corner data
//float bedlevel.z_valuesTemp = 0;
//bedlevel.z_valuesTemp = (bedlevel.z_values[0][0] + bedlevel.z_values[0][1] + bedlevel.z_values[1][0]) / 3.0f;
//bedlevel.z_values[0][0] -= 0.08f;
//bedlevel.z_values[0][1] -= 0.05f;
//bedlevel.z_values[1][0] -= 0.05f;
//bedlevel.z_values[1][1] -= 0.02f;
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// Probe at 3 arbitrary points
@ -837,6 +998,10 @@ G29_TYPE GcodeSuite::G29() {
#endif // AUTO_BED_LEVELING_3POINT
#if ALL(HAS_MESH, CREALITY_RTS)
apply_mesh_correction(bedlevel.z_values);
#endif
ui.reset_status();
// Stow the probe. No raise for FIX_MOUNTED_PROBE.
@ -1021,9 +1186,23 @@ G29_TYPE GcodeSuite::G29() {
probe.use_probing_tool(false);
#if ENABLED(Z_SAFE_HOMING)
do_blocking_move_to_xy(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT);
//do_blocking_move_to_xy(Z_SAFE_HOMING_X_POINT-2, Z_SAFE_HOMING_Y_POINT+44.5);//rock_20220610 将Z轴复位后的终点改成平台中心
#endif
settings.save();
report_current_position();
#if ENABLED(CREALITY_RTS)
RTS_LevelingDone();
RTS_ProbingResumeFans();
RTS_ProbingResumeHotend();
#endif
G29_RETURN(isnan(abl.measured_z), true);
}
#endif // HAS_ABL_NOT_UBL

View file

@ -0,0 +1,45 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 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 ENABLED(CREALITY_RTS)
#include "../../gcode.h"
#include "../../../feature/bedlevel/bedlevel.h"
#include "../../../lcd/rts/lcd_rts.h"
#define DIMLFAC1 (0.8f)
#define DIMLFAC2 ((1.0f - DIMLFAC1) / 2.0f) // 0.1
/**
* M2900: Report Bed Leveling Grid and test result
*/
void GcodeSuite::M2900() {
bedlevel.print_leveling_grid();
const float z_valuesTest = DIMLFAC1 * bedlevel.z_values[0][0]
+ DIMLFAC2 * ( (bedlevel.z_values[0][1] + bedlevel.z_values[1][0]) * 2.0f
- (bedlevel.z_values[0][2] + bedlevel.z_values[2][0]) );
SERIAL_ECHOLNPGM("z_valuesTest = ", z_valuesTest, " algorithm");
}
#endif // CREALITY_RTS

View file

@ -66,6 +66,10 @@
#include "../../lcd/sovol_rts/sovol_rts.h"
#endif
#if ENABLED(CREALITY_RTS)
#include "../../lcd/rts/lcd_rts.h"
#endif
#if ENABLED(LASER_FEATURE)
#include "../../feature/spindle_laser.h"
#endif
@ -254,6 +258,7 @@ void GcodeSuite::G28() {
#endif
TERN_(DWIN_CREALITY_LCD, dwinHomingStart());
TERN_(CREALITY_RTS, home_flag = true);
TERN_(EXTENSIBLE_UI, ExtUI::onHomingStart());
planner.synchronize(); // Wait for planner moves to finish!
@ -578,6 +583,15 @@ void GcodeSuite::G28() {
TERN_(DWIN_CREALITY_LCD, dwinHomingDone());
TERN_(EXTENSIBLE_UI, ExtUI::onHomingDone());
#if ENABLED(CREALITY_RTS)
home_flag = false;
RTS_MoveAxisHoming();
//DEBUG_ECHOLNPGM(" leveling_flag=: ", leveling_flag);
// If it is in leveling, the automatic compensation function will not be restored
//process_subcommands_now_P(leveling_flag ? PSTR("M420 S0") : PSTR("M420 S1 Z10"));
st_bedNozzleHeightCal.goHomeSta = GO_HOME_DONE;
#endif
report_current_position();
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(old_grblstate));

View file

@ -22,6 +22,9 @@
#include "../gcode.h"
#include "../../module/motion.h"
#if ENABLED(CREALITY_RTS)
#include "../../lcd/rts/lcd_rts.h"
#endif
/**
* M220: Set Feedrate Percentage
@ -46,4 +49,5 @@ void GcodeSuite::M220() {
if (parser.seen_test('B')) backup_feedrate_percentage = now_feedrate_perc;
if (parser.seenval('S')) feedrate_percentage = parser.value_int();
TERN_(CREALITY_RTS, RTS_UpdateFeedrate(feedrate_percentage));
}

View file

@ -42,6 +42,10 @@
#include "../../MarlinCore.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../feature/powerloss.h"
#endif
#if ENABLED(PSU_CONTROL)
/**
@ -127,4 +131,6 @@ void GcodeSuite::M81() {
#elif HAS_SUICIDE
marlin.suicide();
#endif
//OUT_WRITE(SHUTDOWN_PIN, LOW); delay(2000);
}

View file

@ -0,0 +1,40 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 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 ENABLED(CREALITY_RTS)
#include "../../gcode.h"
#include "../../../lcd/rts/lcd_rts.h"
/**
* M224: LED On
*/
void GcodeSuite::M224() { RTS_SetLED(true); }
/**
* M225: LED Off
*/
void GcodeSuite::M225() { RTS_SetLED(false); }
#endif // CREALITY_RTS

View file

@ -562,6 +562,13 @@ void GcodeSuite::process_parsed_command(bool no_ok/*=false*/) {
case 48: M48(); break; // M48: Z probe repeatability test
#endif
#if ENABLED(CREALITY_RTS)
#if HAS_MEDIA
case 72: M72(); break; // M72: Cloud print filename
#endif
case 79: M79(); break; // M79: Cloud print statistics
#endif
#if ENABLED(SET_PROGRESS_MANUALLY)
case 73: M73(); break; // M73: Set progress percentage
#endif
@ -765,6 +772,11 @@ void GcodeSuite::process_parsed_command(bool no_ok/*=false*/) {
case 221: M221(); break; // M221: Set Flow Percentage
#endif
#if ENABLED(CREALITY_RTS)
case 224: M224(); break; // M224: LED On
case 225: M225(); break; // M225: LED Off
#endif
#if ENABLED(DIRECT_PIN_CONTROL)
case 226: M226(); break; // M226: Wait until a pin reaches a state
#endif
@ -1132,6 +1144,11 @@ void GcodeSuite::process_parsed_command(bool no_ok/*=false*/) {
case 997: M997(); break; // M997: Perform in-application firmware update
#endif
#if ENABLED(CREALITY_WIFI)
case 930: M930(); break; // M930: Support Creality WIFI Box
case 194: M194(); break;
#endif
case 999: M999(); break; // M999: Restart after being Stopped
#if ENABLED(POWER_LOSS_RECOVERY)
@ -1155,6 +1172,10 @@ void GcodeSuite::process_parsed_command(bool no_ok/*=false*/) {
case 1004: M1004(); break; // M1004: UBL Mesh Wizard
#endif
#if ENABLED(CREALITY_RTS)
case 2900: M2900(); break; // M2900: Report Bed Leveling Grid and test result
#endif
#if ENABLED(MAX7219_GCODE)
case 7219: M7219(); break; // M7219: Set LEDs, columns, and rows
#endif
@ -1259,6 +1280,10 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
#if ENABLED(HOST_KEEPALIVE_FEATURE)
#if ENABLED(CREALITY_RTS)
extern int change_page_font;
#endif
/**
* Output a "busy" message at regular intervals
* while the machine is not accepting commands.
@ -1276,7 +1301,7 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_position_moving());
break;
case PAUSED_FOR_USER:
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_USER);
if (TERN1(CREALITY_RTS, change_page_font == 7)) SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_USER);
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_HOLD));
break;
case PAUSED_FOR_INPUT:

View file

@ -114,11 +114,13 @@
* M43 - Display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins (Requires PINS_DEBUGGING)
* M48 - Measure Z Probe repeatability: M48 P<points> X<pos> Y<pos> V<level> E<engage> L<legs> S<chizoid>. (Requires Z_MIN_PROBE_REPEATABILITY_TEST)
*
* M72 - Cloud print filename;
* M73 - Set the progress percentage. (Requires SET_PROGRESS_MANUALLY)
* M75 - Start the print job timer.
* M76 - Pause the print job timer.
* M77 - Stop the print job timer.
* M78 - Show statistical information about the print jobs. (Requires PRINTCOUNTER)
* M79 - Cloud print statistics.S0:cloud connect; S1:cloud print start; S2:cloud print pause; S3:cloud print resume; S4:cloud print stop; S5:cloud print complete
*
* M80 - Turn on Power Supply. (Requires PSU_CONTROL)
* M81 - Turn off Power Supply. (Requires PSU_CONTROL)
@ -204,6 +206,8 @@
* M220 - Set Feedrate Percentage: 'M220 S<percent>' (i.e., "FR" on the LCD)
* Use 'M220 B' to back up the Feedrate Percentage and 'M220 R' to restore it. (Requires an MMU_MODEL version 2 or 2S)
* M221 - Set Flow Percentage: 'M221 S<percent>' (Requires an extruder)
* M224 - LED On
* M225 - LED Off
* M226 - Wait until a pin is in a given state: 'M226 P<pin> S<state>' (Requires DIRECT_PIN_CONTROL)
* M240 - Trigger a camera to take a photograph. (Requires PHOTO_GCODE)
* M250 - Set LCD contrast: 'M250 C<contrast>' (0-63). (Requires LCD support)
@ -324,6 +328,7 @@
* M919 - Set / Report motor Chopper Times (time_off, hysteresis_end, hysteresis_start) using axis codes XYZE, etc.
* If no parameters are given, report. (Requires *_DRIVER_TYPE TMC(2130|2160|5130|5160|2208|2209|2240|2660))
* M920 - Set Homing Current. (Requires distinct *_CURRENT_HOME settings)
* M930 - Wi-Fi ON/OFF status.
* M936 - OTA update firmware. (Requires OTA_FIRMWARE_UPDATE)
* M951 - Set Magnetic Parking Extruder parameters. (Requires MAGNETIC_PARKING_EXTRUDER)
* M3426 - Read MCP3426 ADC over I2C. (Requires HAS_MCP3426_ADC)
@ -730,6 +735,13 @@ private:
static void M48();
#endif
#if ENABLED(CREALITY_RTS)
#if HAS_MEDIA
static void M72();
#endif
static void M79();
#endif
#if ENABLED(SET_PROGRESS_MANUALLY)
static void M73();
#endif
@ -950,6 +962,11 @@ private:
static void M221();
#endif
#if ENABLED(CREALITY_RTS)
static void M224();
static void M225();
#endif
#if ENABLED(DIRECT_PIN_CONTROL)
static void M226();
#endif
@ -1313,6 +1330,11 @@ private:
static void M928();
#endif
#if ENABLED(CREALITY_WIFI)
static void M930();
static void M194();
#endif
#if ENABLED(OTA_FIRMWARE_UPDATE)
static void M936();
#endif
@ -1363,6 +1385,10 @@ private:
static void M1004();
#endif
#if ENABLED(CREALITY_RTS)
static void M2900();
#endif
#if ENABLED(HAS_MCP3426_ADC)
static void M3426();
#endif

View file

@ -39,6 +39,10 @@
#include "../../libs/hex_print.h"
#endif
#if ENABLED(CREALITY_RTS)
#include "../../lcd/rts/lcd_rts.h"
#endif
//#define MINIMAL_CAP_LINES // Don't even mention the disabled capabilities
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
@ -46,11 +50,14 @@
#if ENABLED(MINIMAL_CAP_LINES)
if (ena) SERIAL_ECHOLNPGM("Cap:", name, ":1");
#else
SERIAL_ECHOPGM("Cap:", name);
SERIAL_CHAR(':', '0' + ena);
SERIAL_EOL();
SERIAL_ECHOLN(F("Cap:"), name, C(':'), C('0' + ena));
#endif
}
#if ENABLED(CREALITY_RTS)
inline void cap_line_uchar(FSTR_P const name, const uint8_t ena) {
SERIAL_ECHOLN(F("Cap:"), name, C(':'), C('0' + ena));
}
#endif
#endif
/**
@ -135,6 +142,11 @@ void GcodeSuite::M115() {
// BINARY_FILE_TRANSFER (M28 B1)
cap_line(F("BINARY_FILE_TRANSFER"), ENABLED(BINARY_FILE_TRANSFER)); // TODO: Use SERIAL_IMPL.has_feature(port, SerialFeature::BinaryFileTransfer) once implemented
#if ENABLED(CREALITY_RTS)
// Creality New Cloud Print Information
cap_line_uchar(F("IS_PLR"), g_cloudPLRStatusValue); // Send status to continue print after power failure
#endif
// EEPROM (M500, M501)
cap_line(F("EEPROM"), ENABLED(EEPROM_SETTINGS));
@ -247,6 +259,9 @@ void GcodeSuite::M115() {
// CONFIG_EXPORT
cap_line(F("CONFIG_EXPORT"), ENABLED(CONFIGURATION_EMBEDDING));
// Creality WiFi
TERN_(CREALITY_RTS, cap_line(F("WIFI"), wifi_enable_flag));
// Machine Geometry
#if ENABLED(M115_GEOMETRY_REPORT)
constexpr xyz_pos_t bmin{0},

View file

@ -0,0 +1,46 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 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/MarlinConfigPre.h"
#if ENABLED(MENU_RESET_WIFI)
#include "../gcode.h"
#include "../../MarlinCore.h"
#if ENABLED(CREALITY_RTS)
#include "../../../src/lcd/rts/lcd_rts.h"
#endif
/**
* M194: Reset WiFi Module
*/
void GcodeSuite::M194() {
TERN_(CREALITY_RTS, if (parser.seen('S')) wifi_enable_flag = parser.boolval('S'));
// record pressed state and output low level
rts_wifi_state = PRESSED;
OUT_WRITE(RESET_WIFI_PIN, LOW);
SERIAL_ECHOLNPGM(STR_OK " wifi is resetting");
}
#endif // MENU_RESET_WIFI

View file

@ -36,6 +36,9 @@
#include "../../lcd/extui/ui_api.h"
#endif
#if ENABLED(CREALITY_RTS)
#include "../../lcd/rts/lcd_rts.h"
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
#include "../../feature/host_actions.h"
#endif
@ -45,6 +48,9 @@
* M1: Conditional stop - Wait for user button press on LCD
*/
void GcodeSuite::M0_M1() {
TERN_(CREALITY_RTS, RTS_CommandPause());
millis_t ms = 0;
if (parser.seenval('P')) ms = parser.value_millis(); // Milliseconds to wait
if (parser.seenval('S')) ms = parser.value_millis_from_seconds(); // Seconds to wait

View file

@ -22,6 +22,9 @@
#include "../gcode.h"
#include "../../module/motion.h"
#if ENABLED(CREALITY_RTS)
#include "../../lcd/rts/lcd_rts.h"
#endif
#include "../../MarlinCore.h"
@ -122,5 +125,7 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
#endif
TERN_(SOVOL_SV06_RTS, RTS_PauseMoveAxisPage());
#if ANY(SOVOL_SV06_RTS, CREALITY_RTS)
RTS_PauseMoveAxisPage();
#endif
}

View file

@ -26,6 +26,10 @@
#include "../gcode.h"
#include "../../libs/BL24CXX.h"
#if ENABLED(CREALITY_RTS)
#include "../../lcd/rts/lcd_rts.h"
#endif
#define OTA_FLAG_EEPROM 90
//#define DEBUG_OUT 1
@ -43,11 +47,21 @@ void GcodeSuite::M936() {
// Set the OTA board firmware upgrade flag ahead of reboot.
ota_update_flag = 0x01;
DEBUG_ECHOLNPGM("Motherboard upgrade flag set");
TERN_(CREALITY_RTS, RTS_Error(Error_205));
break;
#if ENABLED(CREALITY_RTS)
case 3:
// Set the OTA screen firmware upgrade flag ahead of reboot.
ota_update_flag = 0x02;
DEBUG_ECHOLNPGM("DWIN upgrade flag set");
TERN_(CREALITY_RTS, RTS_Error(Error_206));
break;
#endif
}
switch (ota) {
case 2:
case 2: TERN_(CREALITY_RTS, case 3:)
BL24CXX::write(OTA_FLAG_EEPROM, &ota_update_flag, sizeof(ota_update_flag));
safe_delay(100);
hal.reboot();

View file

@ -37,6 +37,10 @@ GCodeQueue queue;
#include "../MarlinCore.h"
#include "../core/bug_on.h"
#if ENABLED(CREALITY_RTS)
#include "../lcd/rts/lcd_rts.h"
#endif
#if ENABLED(BINARY_FILE_TRANSFER)
#include "../feature/binary_stream.h"
#endif
@ -112,7 +116,10 @@ void GCodeQueue::RingBuffer::commit_command(const bool skip_ok
bool GCodeQueue::RingBuffer::enqueue(const char *cmd, const bool skip_ok/*=true*/
OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind/*=-1*/)
) {
if (*cmd == ';' || length >= BUFSIZE) return false;
// SERIAL_ECHOLNPGM(" length=: ",length);
// SERIAL_ECHOLNPGM(" index_r=: ", index_r);
// SERIAL_ECHOLNPGM(" index_w=: ", index_w);
if (*cmd == ';' || length >= BUFSIZE) return false; //这里的会导致主板一直选项idle();
strcpy(commands[index_w].buffer, cmd);
commit_command(skip_ok OPTARG(HAS_MULTI_SERIAL, serial_ind));
return true;
@ -191,7 +198,13 @@ bool GCodeQueue::process_injected_command() {
* Enqueue and return only when commands are actually enqueued.
* Never call this from a G-code handler!
*/
void GCodeQueue::enqueue_one_now(const char * const cmd) { while (!enqueue_one(cmd)) marlin.idle(); }
void GCodeQueue::enqueue_one_now(const char * const cmd) {
uint16_t count = 0;
while (!enqueue_one(cmd)) {
marlin.idle();
if (count++ > 500) { SERIAL_ECHO_MSG("_full"); break; }
}
}
void GCodeQueue::enqueue_one_now(FSTR_P const fcmd) { while (!enqueue_one(fcmd)) marlin.idle(); }
/**
@ -216,6 +229,7 @@ bool GCodeQueue::enqueue_one(FSTR_P const fcmd) {
void GCodeQueue::enqueue_now_P(PGM_P const pgcode) {
size_t i = 0;
PGM_P p = pgcode;
if (TERN0(CREALITY_RTS, ring_buffer.full())) return; // rock——20220815
for (;;) {
char c;
while ((c = pgm_read_byte(&p[i])) && c != '\n') i++;
@ -564,18 +578,40 @@ void GCodeQueue::get_serial_commands() {
* always receives complete command-lines, they can go directly
* into the main command queue.
*/
uint16_t SD_ReadTimeout = 0;
bool SD_Card_status = true;
bool sd_printing_autopause = false;
inline void GCodeQueue::get_sdcard_commands() {
static uint8_t sd_input_state = PS_NORMAL;
// Get commands if there are more in the file
if (!card.isStillFetching()) return;
if (!card.isStillFetching() || !card.isSDCardInserted()) return;
int sd_count = 0;
while (!ring_buffer.full() && !card.eof()) {
bool card_eof = card.eof();
while (!ring_buffer.full() && !card.eof() && card.isSDCardInserted()) {
const int16_t n = card.get();
const bool card_eof = card.eof();
if (n < 0 && !card_eof) { SERIAL_ERROR_MSG(STR_SD_ERR_READ); continue; }
card_eof = card.eof();
if (n < 0 && !card_eof) {
SERIAL_ERROR_MSG(STR_SD_ERR_READ); continue;
}
// if (n < 0 && !card_eof) {
// if (SD_ReadTimeout > 50) {
// if (SD_Card_status) {
// SERIAL_ERROR_MSG(STR_SD_ERR_READ);
// // SD Read Error Auto print pause;
// if (!sd_printing_autopause) {
// sd_printing_autopause = true;
// queue.inject_P(PSTR("M25"));
// }
// }
// SD_Card_status = false;
// SD_ReadTimeout = 0;
// break;
// }
// SD_ReadTimeout++;
// }
// else
// SD_ReadTimeout = 0;
CommandLine &command = ring_buffer.commands[ring_buffer.index_w];
const char sd_char = (char)n;
const bool is_eol = ISEOL(sd_char);
@ -602,10 +638,15 @@ void GCodeQueue::get_serial_commands() {
TERN_(POWER_LOSS_RECOVERY, recovery.cmd_sdpos = card.getIndex());
}
if (card.eof()) card.fileHasFinished(); // Handle end of file reached
if (card.eof()) {
// Handle end of file reached
card.fileHasFinished();
TERN_(CREALITY_RTS, RTS_FileHasFinished());
}
}
else
else {
process_stream_char(sd_char, sd_input_state, command.buffer, sd_count);
}
}
}
@ -637,8 +678,7 @@ void GCodeQueue::exhaust() {
* Get the next command in the queue, optionally log it to SD, then dispatch it
*/
void GCodeQueue::advance() {
// Process immediate commands
// Process immediate commands //有立即执行的指令
if (process_injected_command_P() || process_injected_command()) return;
// Return if the G-code buffer is empty

View file

@ -27,6 +27,9 @@
#include "../gcode.h"
#include "../../sd/cardreader.h"
#include "../../lcd/marlinui.h"
#if ENABLED(CREALITY_RTS)
#include "../../lcd/rts/lcd_rts.h"
#endif
/**
* M23: Select File
@ -44,6 +47,7 @@ void GcodeSuite::M23() {
card.openFileRead(parser.string_arg);
TERN_(SET_PROGRESS_PERCENT, ui.set_progress(0));
TERN_(CREALITY_RTS, RTS_OpenFileCloud());
}
#endif // HAS_MEDIA

View file

@ -28,6 +28,9 @@
#include "../../sd/cardreader.h"
#include "../../module/printcounter.h"
#include "../../lcd/marlinui.h"
#if ENABLED(CREALITY_RTS)
#include "../../lcd/rts/lcd_rts.h"
#endif
#if ENABLED(PARK_HEAD_ON_PAUSE)
#include "../../feature/pause.h"
@ -86,6 +89,8 @@ void GcodeSuite::M24() {
#endif
ui.reset_status();
TERN_(CREALITY_RTS, RTS_PrintStartedSD());
}
/**

View file

@ -0,0 +1,52 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 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 ALL(HAS_MEDIA, CREALITY_RTS)
#include "../gcode.h"
#include "../../sd/cardreader.h"
#include "../../lcd/marlinui.h"
#include "../../lcd/rts/lcd_rts.h"
#if HAS_FILAMENT_SENSOR
#include "../../feature/runout.h"
#endif
/**
* M72: Open a file
*
* The path is relative to the root directory
*/
void GcodeSuite::M72() {
// Simplify3D includes the size, so zero out all spaces (#7227)
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
card.openFileRead(parser.string_arg);
RTS_OpenFileCloud();
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(0));
}
#endif // HAS_MEDIA && CREALITY_RTS

View file

@ -0,0 +1,41 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 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 ENABLED(CREALITY_RTS)
#include "../gcode.h"
#include "../../lcd/rts/lcd_rts.h"
/**
* M79: cloud print statistics
*/
void GcodeSuite::M79() {
if (parser.seenval('S')) RTS_CloudCommand(cloudCommand_t(parser.value_int()));
if (parser.seenval('T')) RTS_SetStatsFR(parser.value_feedrate());
if (parser.seenval('C')) RTS_SetStatsTime(parser.value_celsius());
if (parser.seenval('D')) RTS_SetStatsRemain(parser.value_celsius());
}
#endif // CREALITY_RTS

View file

@ -38,6 +38,10 @@
#include "../../MarlinCore.h" // for startOrResumeJob, etc.
#if ENABLED(CREALITY_RTS)
#include "../../lcd/rts/lcd_rts.h"
#endif
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
#include "../../module/printcounter.h"
#if ENABLED(CANCEL_OBJECTS)
@ -110,6 +114,8 @@ void GcodeSuite::M104_M109(const bool isM109) {
#endif
thermalManager.setTargetHotend(temp, target_extruder);
TERN_(CREALITY_RTS, temphot = temp);
#if ENABLED(DUAL_X_CARRIAGE)
if (idex_is_duplicating() && target_extruder == 0)
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);

View file

@ -0,0 +1,58 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 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 ENABLED(CREALITY_WIFI)
#include "../gcode.h"
#include "../../lcd/rts/lcd_rts.h"
/**
* M930: WIFI Box Function
*/
void GcodeSuite::M930() {
if (parser.boolval('F')) {
switch (parser.intval('S')) {
case 1:
if (flag_counter_wifi_reset) {
flag_counter_wifi_reset = false;
rts.sendData(ExchangePageBase + 33, ExchangepageAddr);
change_page_font = 33;
}
rts.sendData(1, WIFI_CONNECTED_DISPLAY_ICON_VP);
break;
case 2:
rts.sendData(0, ADV_SETTING_WIFI_ICON_VP);
rts.sendData(1, WIFI_CONNECTED_DISPLAY_ICON_VP);
break;
case 3:
rts.sendData(1, ADV_SETTING_WIFI_ICON_VP);
rts.sendData(0, WIFI_CONNECTED_DISPLAY_ICON_VP);
break;
}
}
}
#endif // CREALITY_WIFI

View file

@ -667,7 +667,7 @@
#if !HAS_MARLINUI_HD44780
#undef LCD_INFO_SCREEN_STYLE
#endif
#if NONE(HAS_MARLINUI_HD44780, HAS_MARLINUI_U8GLIB, HAS_TFT_LVGL_UI, TFT_COLOR_UI, DGUS_LCD_UI_E3S1PRO)
#if NONE(HAS_MARLINUI_HD44780, HAS_MARLINUI_U8GLIB, HAS_TFT_LVGL_UI, TFT_COLOR_UI, DGUS_LCD_UI_E3S1PRO, CREALITY_RTS)
#undef LCD_LANGUAGE
#endif
#if DISABLED(MPC_AUTOTUNE)

View file

@ -1075,7 +1075,7 @@
#if ANY(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
#define HAS_SOFTWARE_ENDSTOPS 1
#endif
#if ANY(EXTENSIBLE_UI, IS_NEWPANEL, EMERGENCY_PARSER, HAS_ADC_BUTTONS, HAS_DWIN_E3V2)
#if ANY(EXTENSIBLE_UI, IS_NEWPANEL, EMERGENCY_PARSER, HAS_ADC_BUTTONS, HAS_DWIN_E3V2, CREALITY_RTS)
#define HAS_RESUME_CONTINUE 1
#endif

View file

@ -3178,7 +3178,7 @@
#define HAS_TEMPERATURE 1
#endif
#if HAS_TEMPERATURE && ANY(HAS_MARLINUI_MENU, HAS_DWIN_E3V2, HAS_DGUS_LCD_CLASSIC)
#if HAS_TEMPERATURE && ANY(HAS_MARLINUI_MENU, HAS_DWIN_E3V2, HAS_DGUS_LCD_CLASSIC, CREALITY_RTS)
#ifdef PREHEAT_10_LABEL
#define PREHEAT_COUNT 10
#elif defined(PREHEAT_9_LABEL)
@ -3328,7 +3328,7 @@
* Advanced Pause - Filament Change
*/
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI, SOVOL_SV06_RTS) || ALL(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI, SOVOL_SV06_RTS, CREALITY_RTS) || ALL(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
#define M600_PURGE_MORE_RESUMABLE 1 // UI provides some way to Purge More / Resume
#endif
#ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH

View file

@ -96,11 +96,17 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#endif
#if HAS_MULTI_LANGUAGE
#if ENABLED(CREALITY_RTS)
#include "rts/lcd_rts.h"
#endif
uint8_t MarlinUI::language; // Initialized by settings.load
void MarlinUI::set_language(const uint8_t lang) {
if (lang < NUM_LANGUAGES) {
language = lang;
TERN_(HAS_MARLINUI_U8GLIB, update_language_font());
TERN_(CREALITY_RTS, rts.updateLanguageDisplay());
return_to_status();
refresh();
}

View file

@ -223,6 +223,8 @@ public:
#if HAS_MULTI_LANGUAGE
static uint8_t language;
static void set_language(const uint8_t lang);
#else
static constexpr uint8_t language = 0;
#endif
#if HAS_MARLINUI_U8GLIB

File diff suppressed because it is too large Load diff

701
Marlin/src/lcd/rts/lcd_rts.h Executable file
View file

@ -0,0 +1,701 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 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/>.
*
*/
#pragma once
/**
* Resistive Touch Screen
* Copyright (c) 2023 Creality3D
*/
#include "../../inc/MarlinConfig.h"
extern bool power_off_type_yes;
/*********************************/
#define FHONE (0x5A)
#define FHTWO (0xA5)
#define FHLENG (0x06)
#define TEXTBYTELEN 20
#define MaxFileNumber 20
#define VALUE_INVALID 0xFFFF
#define VALUE_INVALID_8BIT 0xFF
#define AUTO_BED_LEVEL_PREHEAT 120
#define FileNum MaxFileNumber
#define FileNameLen TEXTBYTELEN
#define RTS_UPDATE_INTERVAL 2000
#define RTS_UPDATE_VALUE RTS_UPDATE_INTERVAL
#define RTS_DATA_SIZE 26
/*************Register and Variable addr*****************/
#define RegAddr_W 0x80
#define RegAddr_R 0x81
#define VarAddr_W 0x82
#define VarAddr_R 0x83
#define ExchangePageBase ((unsigned long)0x5A010000)
#define StartSoundSet ((unsigned long)0x060480A0)
/*Error value*/
#define Error_06 "E06" // Nozzle heat escape
#define Error_07 "E07" // Nozzle heating failed
#define Error_08 "E08" // Nozzle thermal abnormality
#define Error_09 "E09" // Bed heat escape
#define Error_10 "E10" // Bed heating failed
#define Error_11 "E11" // Bed thermal abnormality
#define Error_201 "E201" // The command too much inactive time
#define Error_202 "E202" // Homing Failed
#define Error_203 "E203" // Probing Failed
#define Error_204 "E204" // SD Read Error
#define Error_205 "OTA update mainboard wait 180s" // OTA update mainboard wait 180s
#define Error_206 "OTA update screen wait 2400s" // OTA update touch screen wait 2400s
/*variable addr*/
#define ExchangepageAddr 0x0084
#define SoundAddr 0x00A0
#define START_PROCESS_ICON_VP 0x1000
#define PRINT_SPEED_RATE_VP 0x1006
#define PRINT_PROCESS_ICON_VP 0x100E
#define PRINT_TIME_HOUR_VP 0x1010
#define PRINT_TIME_MIN_VP 0x1012
#define PRINT_PROCESS_VP 0x1016
#define PRINTER_FANOPEN_TITLE_VP 0x101E
#define PRINTER_LEDOPEN_TITLE_VP 0x101F
//#define PRINTER_AUTO_SHUTDOWN_ICON_VP 0x1020
#define ADV_SETTING_WIFI_ICON_VP 0x1021
#define AUTO_BED_LEVEL_ZOFFSET_VP 0x1026
#define HEAD_SET_TEMP_VP 0x1034
#define HEAD_CURRENT_TEMP_VP 0x1036
#define BED_SET_TEMP_VP 0x103A
#define BED_CURRENT_TEMP_VP 0x103C
#define AXIS_X_COORD_VP 0x1048
#define AXIS_Y_COORD_VP 0x104A
#define AXIS_Z_COORD_VP 0x104C
#define HEAD_FILAMENT_LOAD_DATA_VP 0x1052
#define HEAD_FILAMENT_UNLOAD_DATA_VP 0x1054
#define AUTO_BED_PREHEAT_HEAD_DATA_VP 0x108A
#define AUTO_BED_LEVEL_TITLE_VP 0x108D
#define FILAMENT_LOAD_ICON_VP 0x108E
#define PREHEAT_PLA_SET_NOZZLE_TEMP_VP 0x1090
#define PREHEAT_PLA_SET_BED_TEMP_VP 0x1092
#define PREHEAT_ABS_SET_NOZZLE_TEMP_VP 0x1094
#define PREHEAT_ABS_SET_BED_TEMP_VP 0x1096
#define FAN_SPEED_CONTROL_DATA_VP 0x109A
#define AUTO_LEVELING_PERCENT_DATA_VP 0x109C
#define MAX_VELOCITY_XAXIS_DATA_VP 0x109E
#define MAX_VELOCITY_YAXIS_DATA_VP 0x10A0
#define MAX_VELOCITY_ZAXIS_DATA_VP 0x10A2
#define MAX_VELOCITY_EAXIS_DATA_VP 0x10A4
#define MAX_ACCEL_XAXIS_DATA_VP 0x10A6
#define MAX_ACCEL_YAXIS_DATA_VP 0x10A8
#define MAX_ACCEL_ZAXIS_DATA_VP 0x10AA
#define MAX_ACCEL_EAXIS_DATA_VP 0x10AC
#define MAX_JERK_XAXIS_DATA_VP 0x10AE
#define MAX_JERK_YAXIS_DATA_VP 0x10B0
#define MAX_JERK_ZAXIS_DATA_VP 0x10B2
#define MAX_JERK_EAXIS_DATA_VP 0x10B4
#define MAX_STEPSMM_XAXIS_DATA_VP 0x10B6
#define MAX_STEPSMM_YAXIS_DATA_VP 0x10B8
#define MAX_STEPSMM_ZAXIS_DATA_VP 0x10BA
#define MAX_STEPSMM_EAXIS_DATA_VP 0x10BC
#define NOZZLE_TEMP_P_DATA_VP 0x10BE
#define NOZZLE_TEMP_I_DATA_VP 0x10C0
#define NOZZLE_TEMP_D_DATA_VP 0x10C2
#define HOTBED_TEMP_P_DATA_VP 0x10C4
#define HOTBED_TEMP_I_DATA_VP 0x10C6
#define HOTBED_TEMP_D_DATA_VP 0x10C8
#define PRINT_CURRENT_PAGE_DATA_VP 0x10CA
#define PRINT_COUNT_PAGE_DATA_VP 0x10CC
#define WIFI_CONNECTED_DISPLAY_ICON_VP 0x10CE
#define WIFI_RESET_REMAIN_TIME_DATA_VP 0x10D0
#define PRINT_REMAIN_TIME_HOUR_VP 0x10D2
#define PRINT_REMAIN_TIME_MIN_VP 0x10D4
#define AUTO_BED_LEVEL_1POINT_VP 0x1100
#define AUTO_BED_LEVEL_2POINT_VP 0x1102
#define AUTO_BED_LEVEL_3POINT_VP 0x1104
#define AUTO_BED_LEVEL_4POINT_VP 0x1106
#define AUTO_BED_LEVEL_5POINT_VP 0x1108
#define AUTO_BED_LEVEL_6POINT_VP 0x110A
#define AUTO_BED_LEVEL_7POINT_VP 0x110C
#define AUTO_BED_LEVEL_8POINT_VP 0x110E
#define AUTO_BED_LEVEL_9POINT_VP 0x1110
#define AUTO_BED_LEVEL_10POINT_VP 0x1112
#define AUTO_BED_LEVEL_11POINT_VP 0x1114
#define AUTO_BED_LEVEL_12POINT_VP 0x1116
#define AUTO_BED_LEVEL_13POINT_VP 0x1118
#define AUTO_BED_LEVEL_14POINT_VP 0x111A
#define AUTO_BED_LEVEL_15POINT_VP 0x111C
#define AUTO_BED_LEVEL_16POINT_VP 0x111E
#define AUTO_BED_LEVEL_17POINT_VP 0x110E
#define AUTO_BED_LEVEL_18POINT_VP 0x1110
#define AUTO_BED_LEVEL_19POINT_VP 0x1112
#define AUTO_BED_LEVEL_20POINT_VP 0x1114
#define AUTO_BED_LEVEL_21POINT_VP 0x1116
#define AUTO_BED_LEVEL_22POINT_VP 0x1118
#define AUTO_BED_LEVEL_23POINT_VP 0x111A
#define AUTO_BED_LEVEL_24POINT_VP 0x111C
#define AUTO_BED_LEVEL_25POINT_VP 0x111E
#define CHANGE_SDCARD_ICON_VP 0x1168
#define MOVEAXIS_UNIT_ICON_VP 0x116A
#define PREHAEAT_NOZZLE_ICON_VP 0x116B
#define PREHAEAT_HOTBED_ICON_VP 0x116C
#define FILAMENT_CONTROL_ICON_VP 0x116D
#define POWERCONTINUE_CONTROL_ICON_VP 0x116E
#define MOTOR_FREE_ICON_VP 0x1200
#define FILE1_SELECT_ICON_VP 0x1221
#define FILE2_SELECT_ICON_VP 0x1222
#define FILE3_SELECT_ICON_VP 0x1223
#define FILE4_SELECT_ICON_VP 0x1224
#define FILE5_SELECT_ICON_VP 0x1225
#define FILE6_SELECT_ICON_VP 0x1226
#define FILE7_SELECT_ICON_VP 0x1227
#define FILE8_SELECT_ICON_VP 0x1228
#define FILE9_SELECT_ICON_VP 0x1229
#define FILE10_SELECT_ICON_VP 0x122A
#define FILE11_SELECT_ICON_VP 0x122B
#define FILE12_SELECT_ICON_VP 0x122C
#define FILE13_SELECT_ICON_VP 0x122D
#define FILE14_SELECT_ICON_VP 0x122E
#define FILE15_SELECT_ICON_VP 0x122F
#define FILE16_SELECT_ICON_VP 0x1230
#define FILE17_SELECT_ICON_VP 0x1231
#define FILE18_SELECT_ICON_VP 0x1232
#define FILE19_SELECT_ICON_VP 0x1233
#define FILE20_SELECT_ICON_VP 0x1234
#define FILE1_TEXT_VP 0x200A
#define FILE2_TEXT_VP 0x201E
#define FILE3_TEXT_VP 0x2032
#define FILE4_TEXT_VP 0x2046
#define FILE5_TEXT_VP 0x205A
#define FILE6_TEXT_VP 0x206E
#define FILE7_TEXT_VP 0x2082
#define FILE8_TEXT_VP 0x2096
#define FILE9_TEXT_VP 0x20AA
#define FILE10_TEXT_VP 0x20BE
#define FILE11_TEXT_VP 0x20D2
#define FILE12_TEXT_VP 0x20E6
#define FILE13_TEXT_VP 0x20FA
#define FILE14_TEXT_VP 0x210E
#define FILE15_TEXT_VP 0x2122
#define FILE16_TEXT_VP 0x2136
#define FILE17_TEXT_VP 0x214A
#define FILE18_TEXT_VP 0x215E
#define FILE19_TEXT_VP 0x2172
#define FILE20_TEXT_VP 0x2186
#define SELECT_FILE_TEXT_VP 0x219A
#define PRINT_FILE_TEXT_VP 0x21C0
#define ABNORMAL_PAGE_TEXT_VP 0x21D4
#define MAIN_PAGE_BLUE_TITLE_VP 0x1300
#define SELECT_FILE_BLUE_TITLE_VP 0x1301
#define PREPARE_PAGE_BLUE_TITLE_VP 0x1302
#define SETTING_PAGE_BLUE_TITLE_VP 0x1303
#define MAIN_PAGE_BLACK_TITLE_VP 0x1304
#define SELECT_FILE_BLACK_TITLE_VP 0x1305
#define PREPARE_PAGE_BLACK_TITLE_VP 0x1306
#define SETTING_PAGE_BLACK_TITLE_VP 0x1307
#define PRINT_ADJUST_MENT_TITLE_VP 0x130D
#define PRINT_SPEED_TITLE_VP 0x130E
#define HEAD_SET_TITLE_VP 0x130F
#define BED_SET_TITLE_VP 0x1310
#define LEVEL_ZOFFSET_TITLE_VP 0x1311
#define FAN_CONTROL_TITLE_VP 0x1312
#define LED_CONTROL_TITLE_VP 0x1313
#define MOVE_AXIS_ENTER_GREY_TITLE_VP 0x1314
#define CHANGE_FILAMENT_GREY_TITLE_VP 0x1315
#define PREHEAT_PAGE_GREY_TITLE_VP 0x1316
#define MOVE_AXIS_ENTER_BLACK_TITLE_VP 0x1317
#define CHANGE_FILAMENT_BLACK_TITLE_VP 0x1318
#define PREHEAT_PAGE_BLACK_TITLE_VP 0x1319
#define PREHEAT_PLA_BUTTON_TITLE_VP 0x131A
#define PREHEAT_ABS_BUTTON_TITLE_VP 0x131B
#define COOL_DOWN_BUTTON_TITLE_VP 0x131C
#define FILAMENT_LOAD_BUTTON_TITLE_VP 0x1321
#define FILAMENT_UNLOAD_BUTTON_TITLE_VP 0x1322
#define LANGUAGE_SELECT_ENTER_VP 0x1323
#define FACTORY_DEFAULT_ENTER_TITLE_VP 0x1324
#define LEVELING_PAGE_TITLE_VP 0x1325
#define PRINTER_DEVICE_GREY_TITLE_VP 0x1326
#define PRINTER_ADVINFO_GREY_TITLE_VP 0x1327
#define PRINTER_INFO_ENTER_GREY_TITLE_VP 0x1328
#define PRINTER_DEVICE_BLACK_TITLE_VP 0x1329
#define PRINTER_ADVINFO_BLACK_TITLE_VP 0x132A
#define PRINTER_INFO_ENTER_BLACK_TITLE_VP 0x132B
#define PREHEAT_PLA_SET_TITLE_VP 0x132D
#define PREHEAT_ABS_SET_TITLE_VP 0x132E
#define STORE_MEMORY_CONFIRM_TITLE_VP 0x1332
#define STORE_MEMORY_CANCEL_TITLE_VP 0x1333
#define FILAMENT_UNLOAD_IGNORE_TITLE_VP 0x133E
#define FILAMENT_USEUP_TITLE_VP 0x133F
#define BUTTON_CHECK_CONFIRM_TITLE_VP 0x1340
#define BUTTON_CHECK_CANCEL_TITLE_VP 0x1341
#define FILAMENT_LOAD_TITLE_VP 0x1342
#define FILAMENT_LOAD_RESUME_TITLE_VP 0x1343
#define PAUSE_PRINT_POP_TITLE_VP 0x1344
#define STOP_PRINT_POP_TITLE_VP 0x1347
#define POWERCONTINUE_POP_TITLE_VP 0x1348
#define AUTO_HOME_WAITING_POP_TITLE_VP 0x1349
#define BEDLEVELING_WAIT_TITLE_VP 0x134B
#define RESTORE_FACTORY_TITLE_VP 0x134D
#define RESET_WIFI_SETTING_TITLE_VP 0x134E
#define KILL_THERMAL_RUNAWAY_TITLE_VP 0x134F
#define KILL_HEATING_FAIL_TITLE_VP 0x1350
#define KILL_THERMISTOR_ERROR_TITLE_VP 0x1351
#define WIND_AUTO_SHUTDOWN_TITLE_VP 0x1352
#define RESET_WIFI_SETTING_BUTTON_VP 0x1353
#define PRINTER_AUTO_SHUTDOWN_TITLE_VP 0x1354
#define WIND_AUTO_SHUTDOWN_PAGE_VP 0x1355
#define AUTO_LEVELING_START_TITLE_VP 0x1356
#define AUX_LEVELING_GREY_TITLE_VP 0x1357
#define AUTO_LEVELING_GREY_TITLE_VP 0x1358
#define AUX_LEVELING_BLACK_TITLE_VP 0x1359
#define AUTO_LEVELING_BLACK_TITLE_VP 0x135A
#define LANGUAGE_SELECT_PAGE_TITLE_VP 0x135B
#define ADV_SETTING_MOTION_TITLE_VP 0x135C
#define ADV_SETTING_PID_TITLE_VP 0x135D
#define ADV_SETTING_WIFI_TITLE_VP 0x135E
#define MOTION_SETTING_TITLE_VP 0x135F
#define MOTION_SETTING_STEPSMM_TITLE_VP 0x1360
#define MOTION_SETTING_ACCEL_TITLE_VP 0x1361
#define MOTION_SETTING_JERK_TITLE_VP 0x1362
#define MOTION_SETTING_VELOCITY_TITLE_VP 0x1363
#define MAX_VELOCITY_SETTING_TITLE_VP 0x1364
#define MAX_VELOCITY_XAXIS_TITLE_VP 0x1365
#define MAX_VELOCITY_YAXIS_TITLE_VP 0x1366
#define MAX_VELOCITY_ZAXIS_TITLE_VP 0x1367
#define MAX_VELOCITY_EAXIS_TITLE_VP 0x1368
#define MAX_ACCEL_SETTING_TITLE_VP 0x1369
#define MAX_ACCEL_XAXIS_TITLE_VP 0x136A
#define MAX_ACCEL_YAXIS_TITLE_VP 0x136B
#define MAX_ACCEL_ZAXIS_TITLE_VP 0x136C
#define MAX_ACCEL_EAXIS_TITLE_VP 0x136D
#define MAX_JERK_SETTING_TITLE_VP 0x136E
#define MAX_JERK_XAXIS_TITLE_VP 0x136F
#define MAX_JERK_YAXIS_TITLE_VP 0x1370
#define MAX_JERK_ZAXIS_TITLE_VP 0x1371
#define MAX_JERK_EAXIS_TITLE_VP 0x1372
#define MAX_STEPSMM_SETTING_TITLE_VP 0x1373
#define MAX_STEPSMM_XAXIS_TITLE_VP 0x1374
#define MAX_STEPSMM_YAXIS_TITLE_VP 0x1375
#define MAX_STEPSMM_ZAXIS_TITLE_VP 0x1376
#define MAX_STEPSMM_EAXIS_TITLE_VP 0x1377
#define TEMP_PID_SETTING_TITLE_VP 0x1378
#define NOZZLE_TEMP_P_TITLE_VP 0x1379
#define NOZZLE_TEMP_I_TITLE_VP 0x137A
#define NOZZLE_TEMP_D_TITLE_VP 0x137B
#define HOTBED_TEMP_P_TITLE_VP 0x137C
#define HOTBED_TEMP_I_TITLE_VP 0x137D
#define HOTBED_TEMP_D_TITLE_VP 0x137E
#define FILAMENT_CONTROL_TITLE_VP 0x137F
#define POWERCONTINUE_CONTROL_TITLE_VP 0x1380
#define PLA_SETTINGS_TITLE_VP 0x1382 //新增PLA设置词条
#define ABS_SETTINGS_TITLE_VP 0x1384 //新增ABS设置词条
#define LEVELING_WAY_TITLE_VP 0x1386 //新增调平方式侧跳
#define MACHINE_TYPE_ABOUT_CHAR_VP 0x1400
#define FIRMWARE_VERSION_ABOUT_CHAR_VP 0x1401
#define PRINTER_DISPLAY_VERSION_TITLE_VP 0x1402
#define HARDWARE_VERSION_ABOUT_TITLE_VP 0x1403
#define WIFI_DN_CODE_CHAR_VP 0x1404
#define WEBSITE_ABOUT_CHAR_VP 0x1405
#define PRINTER_PRINTSIZE_TITLE_VP 0x1406
#define LANGUAGE_CHINESE_TITLE_VP 0x1411
#define LANGUAGE_ENGLISH_TITLE_VP 0x1412
#define LANGUAGE_GERMAN_TITLE_VP 0x1413
#define LANGUAGE_SPANISH_TITLE_VP 0x1414
#define LANGUAGE_FRENCH_TITLE_VP 0x1415
#define LANGUAGE_ITALIAN_TITLE_VP 0x1416
#define LANGUAGE_PORTUGUESE_TITLE_VP 0x1417
#define LANGUAGE_RUSSIAN_TITLE_VP 0x1418
#define LANGUAGE_TURKISH_TITLE_VP 0x1419
#define MACHINE_NAME_ABOUT_TEXT_VP 0x17B0
#define FIRMWARE_VERSION_ABOUT_TEXT_VP 0x17C4
#define PRINTER_DISPLAY_VERSION_TEXT_VP 0x17D8
#define HARDWARE_VERSION_ABOUT_TEXT_VP 0x17EC
#define PRINTER_PRINTSIZE_TEXT_VP 0x1800
#define WEBSITE_ABOUT_TEXT_VP 0x1814
#define FilenameNature 0x6003
#define LCD_LED_CONFIG_REGISTER 0x0082
#define LCD_TP_STATUS_REGISTER 0x0016
#define LCD_SHUTDOWN_LIGHT_LEVEL 0x0A
#define LCD_OPEN_LIGHT_LEVEL 0x64
#define TIME_PRINT_OVER_SHUTDOWN 300
#define TIME_WIFI_RESET_BACKPAGE 60
#define ABNORMAL_PAGE_TEXT_VP_SIZE 30
/************struct**************/
typedef struct DataBuf {
unsigned char len;
unsigned char head[2];
unsigned char command;
unsigned long addr;
unsigned long bytelen;
unsigned short data[32];
unsigned char reserv[4];
} DB;
typedef struct CardRecord {
int recordcount;
int Filesum;
unsigned long addr[FileNum];
char Cardshowfilename[FileNum][FileNameLen];
char Cardfilename[FileNum][FileNameLen];
bool selectFlag;
} CRec;
extern CRec CardRecbuf;
typedef struct {
bool pause_flag:1;
bool pause_action:1;
bool print_finish:1;
bool done_confirm_flag:1;
bool select_flag:1;
bool home_flag:1;
bool heat_flag:1; // 0: heating done 1: during heating
bool remove_card_flag:1;
} HMI_LCD_Flag_t;
extern HMI_LCD_Flag_t HMI_lcd_flag;
class RTS {
public:
RTS();
static float zCoordinateOffset; // Z-axis space coordinate difference
// Leveling-related functions
static bool levelStepHeightMeasure();
static void setZCoordinateOffset(const float _offset) { // Set the difference between the two coordinates
zCoordinateOffset = _offset; // (the lower limit of Z and the coordinate system established by BLTouch)
}
static void eachMomentUpdate();
static int receiveData();
static void sdCardInit();
static bool sdDetected();
static void sdCardUpate();
static void updateLanguageDisplay();
static void sendData();
//static void sendData(const String &, unsigned long, unsigned char=VarAddr_W);
static void sendData(const char[], unsigned long, unsigned char=VarAddr_W);
static void sendData(char, unsigned long, unsigned char=VarAddr_W);
static void sendData(unsigned char*, unsigned long, unsigned char=VarAddr_W);
static void sendData(int, unsigned long, unsigned char=VarAddr_W);
static void sendData(float, unsigned long, unsigned char=VarAddr_W);
static void sendData(unsigned int, unsigned long, unsigned char=VarAddr_W);
static void sendData(long, unsigned long, unsigned char=VarAddr_W);
static void sendData(unsigned long, unsigned long, unsigned char=VarAddr_W);
static void sdCardStop();
static void handleData();
static void init();
static void sendText(const char string[], unsigned long addr, uint8_t textSize=30);
static DB recdat;
static DB snddat;
private:
static unsigned char databuf[RTS_DATA_SIZE];
};
extern RTS rts;
/******* Definitions related to leveling (beginning) ********/
#define Z_MEASURE_PLANTFORM 10 // When measuring the platform, the height of the z-axis lift
#define Z_MEASURE_FEEDRATE_FAST Z_PROBE_FEEDRATE_FAST*4 // Detect maximum speed
#define Z_MEASURE_FEEDRATE_SLOW Z_PROBE_FEEDRATE_SLOW // Probe minimum speed
#if ENABLED(MENU_RESET_WIFI)
typedef enum : uint8_t { INITIAL = 0, PRESSED, RECORDTIME } wifi_state_t;
extern wifi_state_t rts_wifi_state;
#endif
typedef enum PROC_COM : int8_t {
NoKey = -1,
MainEnterKey = 0,
AdjustEnterKey = 1,
PrintSpeedEnterKey = 2,
StopPrintKey = 3,
PausePrintKey = 4,
ResumePrintKey = 5,
ZoffsetEnterKey = 6,
TempControlKey = 7,
CoolDownKey = 8,
HeaterTempEnterKey = 9,
HotBedTempEnterKey = 10,
PrepareEnterKey = 11,
BedLevelKey = 12,
AutoHomeKey = 13,
XaxismoveKey = 14,
YaxismoveKey = 15,
ZaxismoveKey = 16,
HeaterLoadEnterKey = 17,
HeaterUnLoadEnterKey = 18,
HeaterLoadStartKey = 19,
SelectLanguageKey = 20,
PowerContinuePrintKey = 21,
PLAHeadSetEnterKey = 22,
PLABedSetEnterKey = 23,
ABSHeadSetEnterKey = 24,
ABSBedSetEnterKey = 25,
StoreMemoryKey = 26,
FanSpeedEnterKey = 27,
VelocityXaxisEnterKey = 28,
VelocityYaxisEnterKey = 29,
VelocityZaxisEnterKey = 30,
VelocityEaxisEnterKey = 31,
AccelXaxisEnterKey = 32,
AccelYaxisEnterKey = 33,
AccelZaxisEnterKey = 34,
AccelEaxisEnterKey = 35,
JerkXaxisEnterKey = 36,
JerkYaxisEnterKey = 37,
JerkZaxisEnterKey = 38,
JerkEaxisEnterKey = 39,
StepsmmXaxisEnterKey = 40,
StepsmmYaxisEnterKey = 41,
StepsmmZaxisEnterKey = 42,
StepsmmEaxisEnterKey = 43,
NozzlePTempEnterKey = 44,
NozzleITempEnterKey = 45,
NozzleDTempEnterKey = 46,
HotbedPTempEnterKey = 47,
HotbedITempEnterKey = 48,
HotbedDTempEnterKey = 49,
ChangePageKey = 50,
ErrorKey = 51,
StartFileKey = 52,
SelectFileKey = 53
} proc_command_t;
const unsigned long Addrbuf[] = {
0x1002,
0x1004,
0x1006,
0x1008,
0x100A, // 4
0x100C,
0x1026,
0x1030,
0x1032,
0x1034, // 9
0x103A,
0x103E,
0x1044,
0x1046,
0x1048, // 14
0x104A,
0x104C,
0x1052,
0x1054,
0x1056, // 19
0x105C,
0x105F,
0x1090,
0x1092,
0x1094, // 24
0x1096,
0x1098,
0x109A,
0x109E,
0x10A0, // 29
0x10A2,
0x10A4,
0x10A6,
0x10A8,
0x10AA, // 34
0x10AC,
0x10AE,
0x10B0,
0x10B2,
0x10B4, // 39
0x10B6,
0x10B8,
0x10BA,
0x10BC,
0x10BE, // 44
0x10C0,
0x10C2,
0x10C4,
0x10C6,
0x10C8, // 49
0x110E,
0x111A,
0x2198,
0x2199,
0
};
void ErrorHanding();
void RTS_Update();
extern int16_t temphot;
extern int change_page_font;
extern bool wifi_enable_flag;
extern int update_time_value;
extern bool PoweroffContinue;
extern bool G29_flag;
extern bool flag_counter_wifi_reset;
extern bool leveling_flag;
void RTS_PauseMoveAxisPage();
void RTS_AutoBedLevelPage();
void RTS_MoveAxisHoming();
void RTS_MoveParkNozzle();
void RTS_CommandPause();
typedef enum {
GO_HOME_IDLE, // idle status
GO_HOME_DOING, // now homing
GO_HOME_DONE, // at home
} AutoGoHomeSta_t;
// Cloud printing flag
enum CloudPowerContinuePrintState {
CLOUD_PLR_NULL_STATE,
CLOUD_PLR_CHOOSE_STATE,
CLOUD_PLR_YES_STATE,
CLOUD_PLR_NO_STATE
};
// Cloud Print Status Flag Status
typedef enum {
COULD_PRINT_STATE_OFF,
COULD_PRINT_STATE_RUNNING,
COULD_PRINT_STATE_PAUSE,
COULD_PRINT_STATE_STOP,
COULD_PRINT_STATE_MAX
} CLOUD_PRINT_STATE_ENUM;
extern int32_t g_couldPrintState;
typedef struct {
// data
bool isBedLeveling;
unsigned char bedNozzleHeightState;
bool bedNozzleHeightCalFinishFlag;
unsigned char goHomeSta;
/**
* Z-axis coordinate offset: use bltouch to detect the origin and use the
* limit switch to detect the coordinates of the origin offset, this value
* is used to compensate for this offset.
*/
float zCoordinateOffset;
} BedNozzleHeightCalSt;
extern BedNozzleHeightCalSt st_bedNozzleHeightCal; // Platform and Nozzle Height Measuring Structure
extern float bedNozzleHeightCalZ; // Platform nozzle Z-axis measurement variable
extern int8_t g_cloudPLRStatusValue;
void AutoUIBedNozzleHeightCali();
void LcdAutoUIMoveXYBlock(float _posX, float _posY);
void LcdAutoUIMoveZBlock(float _posZ);
/////////////////////////////////////////////////////////////////
void RTS_Error(const char * const err);
void RTS_UpdateWifi();
void RTS_OpenFileCloud();
void RTS_OpenedFileSD();
void RTS_PrintStartedSD();
void RTS_FileHasFinished();
void RTS_SDFileCompleted(); // Called from CardReader::fileHasFinished
void RTS_UpdatePosition();
void RTS_UpdateFeedrate(const int16_t frp);
void RTS_PausedPrint();
void RTS_StepperTimeout();
void RTS_ReheatHotend(const celsius_t c=170);
void RTS_FilamentRanOut();
void RTS_ProbingPauseHotend();
void RTS_ProbingResumeHotend();
void RTS_ProbingPauseFans();
void RTS_ProbingResumeFans();
void RTS_LevelingUpdate(uint8_t &count, const uint8_t total);
void RTS_LevelingDone();
void RTS_ProbingFailed();
// Cloud Commands
typedef enum CloudCommand : uint8_t {
CC_Connect = 0,
CC_Start,
CC_Pause,
CC_Resume,
CC_Stop,
CC_Complete,
CC_Continue
} cloudCommand_t;
void RTS_CloudCommand(const cloudCommand_t cloud_cmd);
void RTS_SetStatsFR(const feedRate_t fr_mm_s);
void RTS_SetStatsTime(const millis_t time);
void RTS_SetStatsRemain(const millis_t remain);
void RTS_SetLED(const bool on);

View file

@ -110,7 +110,6 @@ float axis_unit = 10;
int16_t update_time_value = 0;
bool poweroff_continue = false;
char commandbuf[30];
static SovolPage change_page_number = ID_Startup;

View file

@ -381,8 +381,6 @@ extern void RTS_Init();
extern int16_t update_time_value;
extern bool poweroff_continue;
extern bool sdcard_pause_check;
extern bool sd_printing_autopause;
extern bool pause_flag;
void RTS_AutoBedLevelPage();

View file

@ -33,6 +33,8 @@
#if ENABLED(SOVOL_SV06_RTS)
#include "../lcd/sovol_rts/sovol_rts.h"
#elif ENABLED(CREALITY_RTS)
#include "../lcd/rts/lcd_rts.h"
#endif
#if ENABLED(FT_MOTION)
@ -235,6 +237,7 @@ void Endstops::enable(const bool onoff) {
hit_on_purpose();
else {
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillHome_L, ID_KillHome_D));
TERN_(CREALITY_RTS, RTS_Error(Error_202));
marlin.kill(GET_TEXT_F(MSG_KILL_HOMING_FAILED));
}
}

View file

@ -35,7 +35,10 @@
#if IS_SCARA
#include "../libs/buzzer.h"
#include "../lcd/marlinui.h"
#endif
#if ENABLED(CREALITY_RTS)
#include "../lcd/rts/lcd_rts.h"
#endif
#if ENABLED(POLAR)
@ -2220,6 +2223,14 @@ void prepare_line_to_destination() {
DEBUG_ECHOLNPGM(")");
}
#if ENABLED(PROBE_ACTIVATION_SWITCH)
if (axis == Z_AXIS && HIGH == READ(PROBE_ACTIVATION_SWITCH_PIN)) {
WRITE(PROBE_TARE_PIN, LOW);
delay(200);
WRITE(PROBE_TARE_PIN, HIGH);
}
#endif
// Only do some things when moving towards an endstop
const int8_t axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
? TOOL_X_HOME_DIR(active_extruder) : home_dir(axis);
@ -2279,13 +2290,12 @@ void prepare_line_to_destination() {
planner.synchronize();
if (is_home_dir) {
endstops.validate_homing_move();
#if HOMING_Z_WITH_PROBE && HAS_QUIET_PROBING
if (axis == Z_AXIS && final_approach) probe.set_devices_paused_for_probing(false);
#endif
endstops.validate_homing_move();
// Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
end_sensorless_homing_per_axis(axis, stealth_states);
@ -2459,6 +2469,7 @@ void prepare_line_to_destination() {
#define _CAN_HOME(A) (axis == _AXIS(A) && (ANY(A##_SPI_SENSORLESS, HAS_##A##_STATE) || TERN0(HOMING_Z_WITH_PROBE, _AXIS(A) == Z_AXIS)))
#define _ANDCANT(N) && !_CAN_HOME(N)
if (true MAIN_AXIS_MAP(_ANDCANT)) return;
#undef _CAN_HOME
#endif
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> homeaxis(", C(AXIS_CHAR(axis)), ")");
@ -2757,6 +2768,8 @@ void prepare_line_to_destination() {
destination[axis] = current_position[axis];
//if (axis == Z_AXIS) current_position.z -= probe.offset.z; //rock_20220801 手动对高功能。
if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position);
#endif
@ -2847,7 +2860,32 @@ void set_axis_is_at_home(const AxisEnum axis) {
/**
* Z Probe Z Homing? Account for the probe's Z offset.
*/
#if HAS_BED_PROBE && Z_HOME_TO_MIN
#if 0
#if HAS_BED_PROBE && Z_HOME_TO_MAX // Z_HOME_TO_MIN Rock_20220827
if (axis == Z_AXIS) {
#if HOMING_Z_WITH_PROBE
SERIAL_ECHOLNPGM(" current_position.z_old=: ", current_position.z);
current_position.z -= probe.offset.z;
SERIAL_ECHOLNPGM(" probe.offset.z=: ", probe.offset.z);
SERIAL_ECHOLNPGM(" current_position.z_new=: ", current_position.z);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("*** Z HOMED WITH PROBE (Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) ***\n> probe.offset.z = ", probe.offset.z);
#else
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("*** Z HOMED TO ENDSTOP ***");
#endif
}
#endif
#if ENABLED(BLTOUCH_AND_Z_LIMIT) // 正方向回原点进行Z轴补偿
if (axis == Z_AXIS) current_position.z -= probe.offset.z;
#endif
#endif
#if HAS_BED_PROBE && Z_HOME_DIR < 0
if (axis == Z_AXIS) {
#if HOMING_Z_WITH_PROBE
#if ENABLED(BD_SENSOR)
@ -2861,6 +2899,15 @@ void set_axis_is_at_home(const AxisEnum axis) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("*** Z homed to ENDSTOP ***");
#endif
}
#elif HAS_BED_PROBE && Z_HOME_DIR > 0 // Return to the origin in the positive direction for Z-axis compensation
if (axis == Z_AXIS) {
#if ALL(CREALITY_RTS, BLTOUCH, HOMING_Z_WITH_PROBE) && Z_HOME_DIR > 0
if (st_bedNozzleHeightCal.bedNozzleHeightCalFinishFlag)
current_position.z -= probe.offset.z + st_bedNozzleHeightCal.zCoordinateOffset;
#else
//current_position.z -= probe.offset.z;
#endif
}
#endif
TERN_(I2C_POSITION_ENCODERS, I2CPEM.homed(axis));
@ -2886,3 +2933,555 @@ void set_axis_is_at_home(const AxisEnum axis) {
home_offset[axis] = v;
}
#endif
#if ENABLED(CREALITY_RTS)
#if ENABLED(BLTOUCH_AND_Z_LIMIT)
float homeaxis_bl(const AxisEnum axis, const feedRate_t fr_mm_fast, const feedRate_t fr_mm_slow) {
float coordinateOffset = VALUE_INVALID_8BIT;
#if ANY(MORGAN_SCARA, MP_SCARA)
// Only Z homing (with probe) is permitted
if (axis != Z_AXIS) { BUZZ(100, 880); return; }
#else
#define _CAN_HOME(A) (axis == _AXIS(A) && (ANY(A##_SPI_SENSORLESS, HAS_##A##_ENDSTOP) || TERN0(HOMING_Z_WITH_PROBE, _AXIS(A) == Z_AXIS)))
if (!_CAN_HOME(X) && !_CAN_HOME(Y) && !_CAN_HOME(Z)) return 0xFFFF;
#undef _CAN_HOME
#endif
if (ENABLED(USER_LEVEL_DEBUG)) {
SERIAL_ECHOLNPGM("\nhomeaxis_bl start current_position.z * 100 = ", current_position.z * 100);
DEBUG_ECHOLNPGM(">>> homeaxis(", axis_codes[axis], ")");
}
// const int axis_home_dir = -TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
// ? x_home_dir(active_extruder) : home_dir(axis);
//由于此时使用了最大限位开关Z_HOME_DIR被设置成1不能用上面的判断所以此处强制赋值为-1
const int axis_home_dir = -1;
// Homing Z towards the bed? Deploy the Z probe or endstop.
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && probe.deploy())) // 弹出bltouch
return VALUE_INVALID_8BIT;
// Set flags for X, Y, Z motor locking
#if HAS_EXTRA_ENDSTOPS
switch (axis) {
TERN_(X_DUAL_ENDSTOPS, case X_AXIS:)
TERN_(Y_DUAL_ENDSTOPS, case Y_AXIS:)
TERN_(Z_MULTI_ENDSTOPS, case Z_AXIS:)
stepper.set_separate_multi_axis(true);
default: break;
}
#endif
// Fast move towards endstop until triggered
if (ENABLED(USER_LEVEL_DEBUG)) DEBUG_ECHOLNPGM("Home 1 Fast:");
#if ALL(HOMING_Z_WITH_PROBE, BLTOUCH)
if (axis == Z_AXIS && bltouch.deploy()) return VALUE_INVALID_8BIT; // The initial DEPLOY
#endif
#if DISABLED(DELTA) && defined(SENSORLESS_BACKOFF_MM)
const xy_float_t backoff = SENSORLESS_BACKOFF_MM;
if (((ENABLED(X_SENSORLESS) && axis == X_AXIS) || (ENABLED(Y_SENSORLESS) && axis == Y_AXIS)) && backoff[axis])
do_homing_move(axis, -ABS(backoff[axis]) * axis_home_dir, homing_feedrate(axis));
#endif
if (ENABLED(USER_LEVEL_DEBUG))
SERIAL_ECHOLNPGM("\nhomeaxis_bl start to move z * 100 = ", axis * 100,
"\nhomeaxis_bl current scalin * 100 = ", (int)(max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir * 100),
);
abce_pos_t target1 = planner.get_axis_positions_mm(); // 获取向下移动前的坐标
if (ENABLED(USER_LEVEL_DEBUG))
SERIAL_ECHOLNPGM("\nhomeaxis_bl target1[axis] * 100 = ", target1[axis] * 100);
do_homing_move(axis, 0.90f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir, MMM_TO_MMS(fr_mm_fast));
// do_homing_move(axis, 1.5f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir);//Z轴向下移动移动距离为当前 Z_MAX_POS x 1.5f,当bltouch有反馈信号时停止运行
abce_pos_t target2 = planner.get_axis_positions_mm(); // 获取向下移动后的坐标
if (ENABLED(USER_LEVEL_DEBUG))
SERIAL_ECHOLNPGM("\nhomeaxis_bl target2[axis] * 100 = ", target2[axis] * 100);
// 获取z轴两坐标系的差值
#if ANY(DWIN_CREALITY_CR200B_PRO)
rts.setZCoordinateOffset(target2[axis] + target1[axis]);
#elif ENABLED(DWIN_CREALITY_SERMOON_V2)
gLcdSermoonV2UI.setZCoordinateOffset(target2[axis] + target1[axis]);
#endif
coordinateOffset = target2[axis] + target1[axis];
if (ENABLED(USER_LEVEL_DEBUG)) {
#if ANY(DWIN_CREALITY_SERMOON_D3, DWIN_CREALITY_CR200B_PRO)
SERIAL_ECHOLNPGM("\nhomeaxis_bl Home 1-1 Fast: zCoordinateOffset * 100 = ", rts.zCoordinateOffset * 100);
#elif ENABLED(DWIN_CREALITY_SERMOON_V2)
SERIAL_ECHOLNPGM("\nhomeaxis_bl Home 1-1 Fast: zCoordinateOffset * 100 = ", gLcdSermoonV2UI.zCoordinateOffset * 100);
#endif
SERIAL_EOL();
}
abce_pos_t target3 = planner.get_axis_positions_mm(); // 获取向下移动前的坐标
if (ENABLED(USER_LEVEL_DEBUG))
SERIAL_ECHOLNPGM("\nhomeaxis_bl target3[axis] * 100 = ", target3[axis] * 100);
//do_homing_move(axis, 0.75f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir, MMM_TO_MMS(Z_PROBE_FEEDRATE_FAST * 15));
do_homing_move(axis, 0.25f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir, MMM_TO_MMS(fr_mm_slow));//Z轴向下移动移动距离为当前 Z_MAX_POS x 1.5f,当bltouch有反馈信号时停止运行
abce_pos_t target4 = planner.get_axis_positions_mm(); // 获取向下移动后的坐标
if (ENABLED(USER_LEVEL_DEBUG))
SERIAL_ECHOLNPGM("\nhomeaxis_bl target4[axis] * 100 = ", target4[axis] * 100);
// 获取z轴两坐标系的差值
#if ENABLED(DWIN_CREALITY_CR200B_PRO)
rts.setZCoordinateOffset(rts.GetzCoordinateOffset() + /*target3[axis] + */target4[axis]);
#elif ENABLED(DWIN_CREALITY_SERMOON_V2)
gLcdSermoonV2UI.setZCoordinateOffset(gLcdSermoonV2UI.GetzCoordinateOffset() + /*target3[axis] + */target4[axis]);
#endif
coordinateOffset += target4[axis];
if (ENABLED(USER_LEVEL_DEBUG)) {
#if ANY(DWIN_CREALITY_SERMOON_D3, DWIN_CREALITY_CR200B_PRO)
SERIAL_ECHOLNPGM("\nhomeaxis_bl Home 1-2 Fast: zCoordinateOffset * 100 = ", rts.zCoordinateOffset * 100, " coordinateOffset * 100 = ", coordinateOffset * 100);
#elif ENABLED(DWIN_CREALITY_SERMOON_V2)
SERIAL_ECHOLNPGM("\nhomeaxis_bl Home 1-2 Fast: zCoordinateOffset * 100 = ", gLcdSermoonV2UI.zCoordinateOffset * 100);
#endif
SERIAL_EOL();
}
// 当前z位置
// 这时候是bltouch刚刚碰到热床此时的坐标其实就是 0 - probe.offset.z。
current_position[axis] = 0 - probe.offset.z;
if (ENABLED(USER_LEVEL_DEBUG))
SERIAL_ECHOLNPGM("\nhomeaxis_bl probe.offset.z * 100 = ", probe.offset.z * 100,
"\nhomeaxis_bl current_position[Z] * 100 = ", current_position[axis] * 100);
#if ALL(HOMING_Z_WITH_PROBE, BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE)
#endif
// When homing Z with probe respect probe clearance
const bool use_probe_bump = TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && home_bump_mm(Z_AXIS));
const float bump = axis_home_dir * (
use_probe_bump ? _MAX(TERN0(HOMING_Z_WITH_PROBE, Z_CLEARANCE_BETWEEN_PROBES), home_bump_mm(Z_AXIS)) : home_bump_mm(axis)
);
// If a second homing move is configured...
if (bump) {
// Move away from the endstop by the axis HOMING_BUMP_MM
if (ENABLED(USER_LEVEL_DEBUG)) DEBUG_ECHOLNPGM("Move Away:");
do_homing_move(axis, -bump
#if HOMING_Z_WITH_PROBE
, MMM_TO_MMS(axis == Z_AXIS ? Z_PROBE_FEEDRATE_FAST : 0)
#endif
);
#if ENABLED(DETECT_BROKEN_ENDSTOP)
// Check for a broken endstop
EndstopEnum es;
switch (axis) {
default:
case X_AXIS: es = X_ENDSTOP; break;
case Y_AXIS: es = Y_ENDSTOP; break;
case Z_AXIS: es = Z_ENDSTOP; break;
}
if (TEST(endstops.state(), es)) {
SERIAL_ECHO_MSG("Bad ", axis_codes[axis], " Endstop?");
kill(GET_TEXT(MSG_KILL_HOMING_FAILED));
}
#endif
// Slow move towards endstop until triggered
if (ENABLED(USER_LEVEL_DEBUG)) DEBUG_ECHOLNPGM("Home 2 Slow:"); //第二次测量
#if ALL(HOMING_Z_WITH_PROBE, BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
if (axis == Z_AXIS && bltouch.deploy()) return; // Intermediate DEPLOY (in LOW SPEED MODE)
#endif
abce_pos_t target5 = planner.get_axis_positions_mm(); // 获取向下移动前的坐标
if (ENABLED(USER_LEVEL_DEBUG))
SERIAL_ECHOLNPGM("\nhomeaxis_bl target5[axis] * 100 = ", target5[axis] * 100);
do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis));
abce_pos_t target6 = planner.get_axis_positions_mm(); // 获取向下移动后的坐标
if (ENABLED(USER_LEVEL_DEBUG))
SERIAL_ECHOLNPGM("\nhomeaxis_bl target6[axis] * 100 = ", target6[axis] * 100);
// 当前z位置
// 这时候是bltouch刚刚碰到热床此时的坐标其实就是 0 - probe.offset.z。
current_position[axis] = 0 - probe.offset.z;
if (ENABLED(USER_LEVEL_DEBUG))
SERIAL_ECHOLNPGM("\nhomeaxis_bl probe.offset.z_2 * 100 = ", probe.offset.z * 100,
"\nhomeaxis_bl current_position[Z]_2 * 100 = ", current_position[axis] * 100);
// 第二次测量值
#if ENABLED(DWIN_CREALITY_CR200B_PRO)
rts.setZCoordinateOffset(rts.GetzCoordinateOffset() - (target5[axis] + target6[axis]));
#elif ENABLED(DWIN_CREALITY_SERMOON_V2)
gLcdSermoonV2UI.setZCoordinateOffset(gLcdSermoonV2UI.GetzCoordinateOffset() - (target5[axis] + target6[axis]));
#endif
coordinateOffset -= (target5[axis] + target6[axis]);
if (ENABLED(USER_LEVEL_DEBUG)) {
#if ANY(DWIN_CREALITY_SERMOON_D3, DWIN_CREALITY_CR200B_PRO)
SERIAL_ECHOLNPGM("\nhomeaxis_bl Home 2 Slow: zCoordinateOffset * 100 = ", rts.zCoordinateOffset * 100,
"\nhomeaxis_bl Home 2 Slow: coordinateOffset * 100 = ", coordinateOffset * 100);
#elif ENABLED(DWIN_CREALITY_SERMOON_V2)
SERIAL_ECHOLNPGM("\nhomeaxis_bl Home 2 Slow: zCoordinateOffset * 100 = ", gLcdSermoonV2UI.zCoordinateOffset * 100);
#endif
SERIAL_EOL();
}
#if ALL(HOMING_Z_WITH_PROBE, BLTOUCH)
if (axis == Z_AXIS) bltouch.stow(); // The final STOW
#endif
}
#if HAS_EXTRA_ENDSTOPS
const bool pos_dir = axis_home_dir > 0;
#if ENABLED(X_DUAL_ENDSTOPS)
if (axis == X_AXIS) {
const float adj = ABS(endstops.x2_endstop_adj);
if (adj) {
if (pos_dir ? (endstops.x2_endstop_adj > 0) : (endstops.x2_endstop_adj < 0)) stepper.set_x_lock(true); else stepper.set_x2_lock(true);
do_homing_move(axis, pos_dir ? -adj : adj);
stepper.set_x_lock(false);
stepper.set_x2_lock(false);
}
}
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
if (axis == Y_AXIS) {
const float adj = ABS(endstops.y2_endstop_adj);
if (adj) {
if (pos_dir ? (endstops.y2_endstop_adj > 0) : (endstops.y2_endstop_adj < 0)) stepper.set_y_lock(true); else stepper.set_y2_lock(true);
do_homing_move(axis, pos_dir ? -adj : adj);
stepper.set_y_lock(false);
stepper.set_y2_lock(false);
}
}
#endif
// Reset flags for X, Y, Z motor locking
switch (axis) {
default: break;
TERN_(X_DUAL_ENDSTOPS, case X_AXIS:)
TERN_(Y_DUAL_ENDSTOPS, case Y_AXIS:)
TERN_(Z_MULTI_ENDSTOPS, case Z_AXIS:)
stepper.set_separate_multi_axis(false);
}
#endif
#ifdef TMC_HOME_PHASE
// move back to homing phase if configured and capable
backout_to_tmc_homing_phase(axis);
#endif
#if IS_SCARA
set_axis_is_at_home(axis);
sync_plan_position();
#elif ENABLED(DELTA)
// Delta has already moved all three towers up in G28
// so here it re-homes each tower in turn.
// Delta homing treats the axes as normal linear axes.
const float adjDistance = delta_endstop_adj[axis],
minDistance = (MIN_STEPS_PER_SEGMENT) * planner.mm_per_step[axis];
// Retrace by the amount specified in delta_endstop_adj if more than min steps.
if (adjDistance * (Z_HOME_DIR) < 0 && ABS(adjDistance) > minDistance) { // away from endstop, more than min distance
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("adjDistance:", adjDistance);
do_homing_move(axis, adjDistance, get_homing_bump_feedrate(axis));
}
#else // CARTESIAN / CORE / MARKFORGED_XY
//set_axis_is_at_home(axis);
sync_plan_position();
destination[axis] = current_position[axis];
if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position);
#endif
// Put away the Z probe
#if HOMING_Z_WITH_PROBE
if (axis == Z_AXIS && probe.stow()) return VALUE_INVALID_8BIT;
#endif
#if DISABLED(DELTA) && defined(HOMING_BACKOFF_POST_MM)
const xyz_float_t endstop_backoff = HOMING_BACKOFF_POST_MM;
if (endstop_backoff[axis]) {
current_position[axis] -= ABS(endstop_backoff[axis]) * axis_home_dir;
line_to_current_position(
#if HOMING_Z_WITH_PROBE
(axis == Z_AXIS) ? MMM_TO_MMS(Z_PROBE_FEEDRATE_FAST) :
#endif
homing_feedrate(axis)
);
#if ENABLED(SENSORLESS_HOMING)
planner.synchronize();
if (false
#if ANY(IS_CORE, MARKFORGED_XY)
|| axis != NORMAL_AXIS
#endif
) safe_delay(200); // Short delay to allow belts to spring back
#endif
}
#endif
// Clear retracted status if homing the Z axis
TERN_(FWRETRACT, if (axis == Z_AXIS) fwretract.current_hop = 0.0);
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPGM("\nhomeaxis_bl end current_position.z * 100 = ", current_position.z * 100);
SERIAL_EOL();
}
return coordinateOffset;
}
#else // !BLTOUCH_AND_Z_LIMIT
void homeaxis_bl(const AxisEnum axis) {
#if IS_SCARA
// Only Z homing (with probe) is permitted
if (axis != Z_AXIS) { BUZZ(100, 880); return; }
#else
#define _CAN_HOME(A) (axis == _AXIS(A) && (ANY(A##_SPI_SENSORLESS, HAS_##A##_ENDSTOP) || TERN0(HOMING_Z_WITH_PROBE, _AXIS(A) == Z_AXIS)))
if (!_CAN_HOME(X) && !_CAN_HOME(Y) && !_CAN_HOME(Z)) return;
#endif
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLNPGM("\nhomeaxis_bl start current_position.z * 100 = ", current_position.z * 100);
DEBUG_ECHOLNPGM(">>> homeaxis(", axis_codes[axis], ")");
}
// const int axis_home_dir = -TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
// ? x_home_dir(active_extruder) : home_dir(axis);
//由于此时使用了最大限位开关Z_HOME_DIR被设置成1不能用上面的判断所以此处强制赋值为-1
const int axis_home_dir = -1;
// Homing Z towards the bed? Deploy the Z probe or endstop.
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && probe.deploy())) // 弹出bltouch
return;
// Set flags for X, Y, Z motor locking
#if HAS_EXTRA_ENDSTOPS
switch (axis) {
TERN_(X_DUAL_ENDSTOPS, case X_AXIS:)
TERN_(Y_DUAL_ENDSTOPS, case Y_AXIS:)
TERN_(Z_MULTI_ENDSTOPS, case Z_AXIS:)
stepper.set_separate_multi_axis(true);
default: break;
}
#endif
// Fast move towards endstop until triggered
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 1 Fast:");
#if ALL(HOMING_Z_WITH_PROBE, BLTOUCH)
if (axis == Z_AXIS && bltouch.deploy()) return; // The initial DEPLOY
#endif
#if DISABLED(DELTA) && defined(SENSORLESS_BACKOFF_MM)
const xy_float_t backoff = SENSORLESS_BACKOFF_MM;
if (((ENABLED(X_SENSORLESS) && axis == X_AXIS) || (ENABLED(Y_SENSORLESS) && axis == Y_AXIS)) && backoff[axis])
do_homing_move(axis, -ABS(backoff[axis]) * axis_home_dir, homing_feedrate(axis));
#endif
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPGM("\nhomeaxis_bl start to move z * 100 = ", axis * 100,
"\nhomeaxis_bl current scalin * 100 = ", (int)(max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir * 100),
);
}
abce_pos_t target1 = planner.get_axis_positions_mm(); // 获取向下移动前的坐标
if (DEBUGGING(LEVELING))
SERIAL_ECHOLNPGM("\nhomeaxis_bl target1[axis] * 100 = ", target1[axis] * 100);
do_homing_move(axis, 1.5f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir);//Z轴向下移动移动距离为当前 Z_MAX_POS x 1.5f,当bltouch有反馈信号时停止运行
abce_pos_t target2 = planner.get_axis_positions_mm(); // 获取向下移动后的坐标
if (DEBUGGING(LEVELING))
SERIAL_ECHOLNPGM("\nhomeaxis_bl target2[axis] * 100 = ", target2[axis] * 100);
#if ENABLED(CREALITY_RTS)
// 获取z轴两坐标系的差值
// 这里的“+probe.offset.z”是因为执行了G28后Z轴会走一段路程其长度为probe.offset.z ,这也是实现下限位必须走的距离
// gLcdSermoonV2UI.setZCoordinateOffset(target2[axis] + target1[axis] + gLcdSermoonV2UI.GetzCoordinateOffset() + probe.offset.z);
// st_bedNozzleHeightCal.zCoordinateOffset=target2[axis] + target1[axis] + st_bedNozzleHeightCal.zCoordinateOffset+probe.offset.z;
st_bedNozzleHeightCal.zCoordinateOffset=target2[axis] + target1[axis];
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPGM("\nhomeaxis_bl zCoordinateOffset * 100 = ", st_bedNozzleHeightCal.zCoordinateOffset * 100);
SERIAL_EOL();
}
// 当前z位置
// 这时候是bltouch刚刚碰到热床测试的坐标其实就是 0 - probe.offset.z。
current_position[axis] = 0 - probe.offset.z;
#endif
#if HOMING_Z_WITH_PROBE
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPGM("\nhomeaxis_bl probe.offset.z * 100 = ", probe.offset.z * 100,
"\nhomeaxis_bl current_position[Z] * 100 = ", current_position[axis] * 100);
}
#endif
#if ALL(HOMING_Z_WITH_PROBE, BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE)
#endif
// When homing Z with probe respect probe clearance
const bool use_probe_bump = TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && home_bump_mm(Z_AXIS));
const float bump = axis_home_dir * (
use_probe_bump ? _MAX(TERN0(HOMING_Z_WITH_PROBE, Z_CLEARANCE_BETWEEN_PROBES), home_bump_mm(Z_AXIS)) : home_bump_mm(axis)
);
// If a second homing move is configured...
if (bump) {
// Move away from the endstop by the axis HOMING_BUMP_MM
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move Away:");
do_homing_move(axis, -bump
OPTARG(HOMING_Z_WITH_PROBE, MMM_TO_MMS(axis == Z_AXIS ? Z_PROBE_FEEDRATE_FAST : 0))
);
#if ENABLED(DETECT_BROKEN_ENDSTOP)
// Check for a broken endstop
EndstopEnum es;
switch (axis) {
default:
case X_AXIS: es = X_ENDSTOP; break;
case Y_AXIS: es = Y_ENDSTOP; break;
case Z_AXIS: es = Z_ENDSTOP; break;
}
if (TEST(endstops.state(), es)) {
SERIAL_ECHO_MSG("Bad ", axis_codes[axis], " Endstop?");
kill(GET_TEXT(MSG_KILL_HOMING_FAILED));
}
#endif
// Slow move towards endstop until triggered
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 2 Slow:"); //第二次测量
#if ALL(HOMING_Z_WITH_PROBE, BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
if (axis == Z_AXIS && bltouch.deploy()) return; // Intermediate DEPLOY (in LOW SPEED MODE)
#endif
do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis));
#if ALL(HOMING_Z_WITH_PROBE, BLTOUCH)
if (axis == Z_AXIS) bltouch.stow(); // The final STOW
#endif
}
#if HAS_EXTRA_ENDSTOPS
const bool pos_dir = axis_home_dir > 0;
#if ENABLED(X_DUAL_ENDSTOPS)
if (axis == X_AXIS) {
const float adj = ABS(endstops.x2_endstop_adj);
if (adj) {
if (pos_dir ? (endstops.x2_endstop_adj > 0) : (endstops.x2_endstop_adj < 0)) stepper.set_x_lock(true); else stepper.set_x2_lock(true);
do_homing_move(axis, pos_dir ? -adj : adj);
stepper.set_x_lock(false);
stepper.set_x2_lock(false);
}
}
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
if (axis == Y_AXIS) {
const float adj = ABS(endstops.y2_endstop_adj);
if (adj) {
if (pos_dir ? (endstops.y2_endstop_adj > 0) : (endstops.y2_endstop_adj < 0)) stepper.set_y_lock(true); else stepper.set_y2_lock(true);
do_homing_move(axis, pos_dir ? -adj : adj);
stepper.set_y_lock(false);
stepper.set_y2_lock(false);
}
}
#endif
// Reset flags for X, Y, Z motor locking
switch (axis) {
default: break;
TERN_(X_DUAL_ENDSTOPS, case X_AXIS:)
TERN_(Y_DUAL_ENDSTOPS, case Y_AXIS:)
TERN_(Z_MULTI_ENDSTOPS, case Z_AXIS:)
stepper.set_separate_multi_axis(false);
}
#endif
#ifdef TMC_HOME_PHASE
// move back to homing phase if configured and capable
backout_to_tmc_homing_phase(axis);
#endif
#if IS_SCARA
set_axis_is_at_home(axis);
sync_plan_position();
#elif ENABLED(DELTA)
// Delta has already moved all three towers up in G28
// so here it re-homes each tower in turn.
// Delta homing treats the axes as normal linear axes.
const float adjDistance = delta_endstop_adj[axis],
minDistance = (MIN_STEPS_PER_SEGMENT) * planner.mm_per_step[axis];
// Retrace by the amount specified in delta_endstop_adj if more than min steps.
if (adjDistance * (Z_HOME_DIR) < 0 && ABS(adjDistance) > minDistance) { // away from endstop, more than min distance
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("adjDistance:", adjDistance);
do_homing_move(axis, adjDistance, get_homing_bump_feedrate(axis));
}
#else // CARTESIAN / CORE / MARKFORGED_XY
//set_axis_is_at_home(axis);
sync_plan_position();
destination[axis] = current_position[axis];
if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position);
#endif
// Put away the Z probe
#if HOMING_Z_WITH_PROBE
if (axis == Z_AXIS && probe.stow()) return;
#endif
#if DISABLED(DELTA) && defined(HOMING_BACKOFF_POST_MM)
const xyz_float_t endstop_backoff = HOMING_BACKOFF_POST_MM;
if (endstop_backoff[axis]) {
current_position[axis] -= ABS(endstop_backoff[axis]) * axis_home_dir;
line_to_current_position(TERN_(HOMING_Z_WITH_PROBE, axis == Z_AXIS ? MMM_TO_MMS(Z_PROBE_FEEDRATE_FAST) :) homing_feedrate(axis));
#if ENABLED(SENSORLESS_HOMING)
planner.synchronize();
if (false
#if ANY(IS_CORE, MARKFORGED_XY)
|| axis != NORMAL_AXIS
#endif
) safe_delay(200); // Short delay to allow belts to spring back
#endif
}
#endif
// Clear retracted status if homing the Z axis
#if ENABLED(FWRETRACT)
if (axis == Z_AXIS) fwretract.current_hop = 0.0;
#endif
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPGM("\nhomeaxis_bl end current_position.z * 100 = ", current_position.z * 100);
SERIAL_EOL();
}
}
#endif // !BLTOUCH_AND_Z_LIMIT
#endif // CREALITY_RTS

View file

@ -74,6 +74,10 @@ extern xyz_pos_t cartes;
constexpr feedRate_t z_probe_fast_mm_s = MMM_TO_MMS(Z_PROBE_FEEDRATE_FAST);
#endif
#if ENABLED(Z_SAFE_HOMING)
constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT };
#endif
/**
* Feed rates are often configured with mm/m
* but the planner and stepper like mm/s units.
@ -455,6 +459,13 @@ void set_axis_is_at_home(const AxisEnum axis);
*/
extern main_axes_bits_t axes_homed, axes_trusted;
void homeaxis(const AxisEnum axis);
#if ENABLED(CREALITY_RTS)
#if ENABLED(BLTOUCH_AND_Z_LIMIT)
float homeaxis_bl(const AxisEnum axis, const feedRate_t fr_mm_fast=Z_PROBE_FEEDRATE_FAST, const feedRate_t fr_mm_slow=Z_PROBE_FEEDRATE_SLOW);
#else
void homeaxis_bl(const AxisEnum axis);
#endif
#endif
void set_axis_never_homed(const AxisEnum axis);
main_axes_bits_t axes_should_home(main_axes_bits_t axes_mask=main_axes_mask);
bool homing_needed_error(main_axes_bits_t axes_mask=main_axes_mask);

View file

@ -37,6 +37,9 @@
#include "../gcode/gcode.h"
#include "../lcd/marlinui.h"
#if ENABLED(CREALITY_RTS)
#include "../lcd/rts/lcd_rts.h"
#endif
#if HAS_LEVELING
#include "../feature/bedlevel/bedlevel.h"
@ -1060,6 +1063,7 @@ float Probe::probe_at_point(
// The user may want to quickly move the carriage or bed by hand to avoid bed damage from the (hot) nozzle.
// This would also benefit from the contemplated "Audio Alerts" feature.
stow();
TERN_(CREALITY_RTS, RTS_ProbingFailed());
LCD_MESSAGE(MSG_LCD_PROBING_FAILED);
#if DISABLED(G29_RETRY_AND_RECOVER)
SERIAL_ERROR_MSG(STR_ERR_PROBING_FAILED);

View file

@ -51,6 +51,10 @@
#include "stepper.h"
#include "temperature.h"
#if ENABLED(CREALITY_RTS)
#include "../lcd/rts/lcd_rts.h"
#endif
#include "../lcd/marlinui.h"
#include "../libs/vector_3.h" // for matrix_3x3
#include "../gcode/gcode.h"
@ -711,6 +715,17 @@ typedef struct SettingsDataStruct {
char gcode_macros[GCODE_MACROS_SLOTS][GCODE_MACROS_SLOT_SIZE + 1];
#endif
//
// Creality RTS
//
#if ENABLED(CREALITY_RTS)
bool wifi_enable_flag; // M194 S
#if ENABLED(BLTOUCH_AND_Z_LIMIT)
float zCoordinateOffset; // RTS Z offset
#endif
float bedNozzleHeightCalZ;
#endif
} SettingsData;
//static_assert(sizeof(SettingsData) <= MARLIN_EEPROM_SIZE, "EEPROM too small to contain SettingsData!");
@ -1765,6 +1780,15 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(ui.language);
#endif
#if ENABLED(CREALITY_RTS)
_FIELD_TEST(wifi_enable_flag);
EEPROM_WRITE(wifi_enable_flag);
#if ENABLED(BLTOUCH_AND_Z_LIMIT)
EEPROM_WRITE(rts.zCoordinateOffset); // Z轴空间坐标差
#endif
EEPROM_WRITE(bedNozzleHeightCalZ); // caixiaoliang add 20210807
#endif
//
// Model predictive control
//
@ -2900,6 +2924,13 @@ void MarlinSettings::postprocess() {
}
#endif
#if ENABLED(CREALITY_RTS)
_FIELD_TEST(wifi_enable_flag);
EEPROM_READ(wifi_enable_flag);
EEPROM_READ(rts.zCoordinateOffset); // rock_20220730
EEPROM_READ(bedNozzleHeightCalZ); // caixiaoliang add 20210807
#endif
//
// Model predictive control
//
@ -3690,6 +3721,11 @@ void MarlinSettings::reset() {
stepper.set_digipot_current(q, tmp_motor_current_setting[q]);
#endif
#if ENABLED(CREALITY_RTS)
ui.language = 1; // 0:Chinese, 1:English
wifi_enable_flag = true;
#endif
//
// Adaptive Step Smoothing state
//
@ -4185,6 +4221,12 @@ void MarlinSettings::reset() {
// MMU3
//
TERN_(HAS_PRUSA_MMU3, gcode.MMU3_report(forReplay));
#if ENABLED(CREALITY_RTS)
CONFIG_ECHO_HEADING("WIFI Enabled");
CONFIG_ECHO_MSG(" M194 S", wifi_enable_flag);
//SERIAL_ECHOLNPGM(" rts.zCoordinateOffset ! ", rts.zCoordinateOffset);
#endif
}
#endif // !DISABLE_M503

View file

@ -54,6 +54,8 @@
#include "../lcd/dwin/creality/dwin.h"
#elif ENABLED(SOVOL_SV06_RTS)
#include "../lcd/sovol_rts/sovol_rts.h"
#elif ENABLED(CREALITY_RTS)
#include "../lcd/rts/lcd_rts.h"
#endif
#if ENABLED(EXTENSIBLE_UI)
@ -701,7 +703,7 @@ volatile bool Temperature::raw_temps_ready = false;
TERN_(USE_CONTROLLER_FAN, controllerFan.update());
// Run UI update
#if ENABLED(SOVOL_SV06_RTS)
#if ANY(SOVOL_SV06_RTS, CREALITY_RTS)
RTS_Update();
#else
ui.update();
@ -789,7 +791,8 @@ void Temperature::factory_reset() {
int cycles = 0;
bool heating = true;
millis_t next_temp_ms = millis(), t1 = next_temp_ms, t2 = next_temp_ms;
millis_t next_temp_ms, t1, t2;
next_temp_ms = t1 = t2 = millis();
long t_high = 0, t_low = 0;
raw_pid_t tune_pid = { 0, 0, 0 };
@ -950,11 +953,13 @@ void Temperature::factory_reset() {
}
else if (ELAPSED(ms, temp_change_ms)) { // Watch timer expired
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillHeat_L, ID_KillHeat_D));
TERN_(CREALITY_RTS, RTS_Error(heater_id == H_BED ? Error_10 : Error_07));
_TEMP_ERROR(heater_id, FPSTR(str_t_heating_failed), MSG_ERR_HEATING_FAILED, current_temp);
}
}
else if (current_temp < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) { // Heated, then temperature fell too far?
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillRunaway_L, ID_KillRunaway_D));
TERN_(CREALITY_RTS, RTS_Error(heater_id == H_BED ? Error_10 : Error_07));
_TEMP_ERROR(heater_id, FPSTR(str_t_thermal_runaway), MSG_ERR_THERMAL_RUNAWAY, current_temp);
}
}
@ -970,6 +975,7 @@ void Temperature::factory_reset() {
TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::pidresult_t::PID_TUNING_TIMEOUT));
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT)));
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillHeat_L, ID_KillHeat_D));
TERN_(CREALITY_RTS, RTS_Error(heater_id == H_BED ? Error_10 : Error_07));
SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
break;
}
@ -1677,6 +1683,7 @@ void Temperature::_temp_error(
void Temperature::maxtemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_TEMP, const celsius_float_t deg)) {
#if HAS_HOTEND || HAS_HEATED_BED
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillBadTemp_L, ID_KillBadTemp_D));
TERN_(CREALITY_RTS, RTS_Error(heater_id == H_BED ? Error_11 : Error_08));
TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(1));
TERN_(EXTENSIBLE_UI, ExtUI::onMaxTempError(heater_id));
#endif
@ -1693,6 +1700,7 @@ void Temperature::maxtemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T
void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_TEMP, const celsius_float_t deg)) {
#if HAS_HOTEND || HAS_HEATED_BED
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillBadTemp_L, ID_KillBadTemp_D));
TERN_(CREALITY_RTS, RTS_Error(heater_id == H_BED ? Error_11 : Error_08));
TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0));
TERN_(EXTENSIBLE_UI, ExtUI::onMinTempError(heater_id));
#endif
@ -1925,6 +1933,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T
const auto deg = degHotend(e);
if (deg > temp_range[e].maxtemp) {
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillBadTemp_L, ID_KillBadTemp_D));
TERN_(CREALITY_RTS, RTS_Error(Error_08));
MAXTEMP_ERROR(e, deg);
}
}
@ -1948,6 +1957,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T
start_watching_hotend(e); // If temp reached, turn off elapsed check
else {
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillHeat_L, ID_KillHeat_D));
TERN_(CREALITY_RTS, RTS_Error(Error_07));
TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0));
TERN_(EXTENSIBLE_UI, ExtUI::onHeatingError(e));
_TEMP_ERROR(e, FPSTR(str_t_heating_failed), MSG_ERR_HEATING_FAILED, temp);
@ -1974,6 +1984,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T
const auto deg = degBed();
if (deg > BED_MAXTEMP) {
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillBadTemp_L, ID_KillBadTemp_D));
TERN_(CREALITY_RTS, RTS_Error(Error_08));
MAXTEMP_ERROR(H_BED, deg);
}
}
@ -1988,6 +1999,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T
start_watching_bed(); // If temp reached, turn off elapsed check
else {
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillHeat_L, ID_KillHeat_D));
TERN_(CREALITY_RTS, RTS_Error(Error_10));
TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0));
TERN_(EXTENSIBLE_UI, ExtUI::onHeatingError(H_BED));
_TEMP_ERROR(H_BED, FPSTR(str_t_heating_failed), MSG_ERR_HEATING_FAILED, deg);
@ -3446,6 +3458,7 @@ void Temperature::init() {
case TRRunaway:
TERN_(SOVOL_SV06_RTS, rts.gotoPageBeep(ID_KillRunaway_L, ID_KillRunaway_D));
TERN_(CREALITY_RTS, RTS_Error(heater_id == H_BED ? Error_09 : Error_06));
TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0));
TERN_(EXTENSIBLE_UI, ExtUI::onHeatingError(heater_id));
_TEMP_ERROR(heater_id, FPSTR(str_t_thermal_runaway), MSG_ERR_THERMAL_RUNAWAY, current);
@ -3454,6 +3467,7 @@ void Temperature::init() {
#if ENABLED(THERMAL_PROTECTION_VARIANCE_MONITOR)
case TRMalfunction:
TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0));
TERN_(CREALITY_RTS, RTS_Error(heater_id == H_BED ? Error_09 : Error_06));
TERN_(EXTENSIBLE_UI, ExtUI::onHeatingError(heater_id));
_TEMP_ERROR(heater_id, F(STR_T_THERMAL_MALFUNCTION), MSG_ERR_TEMP_MALFUNCTION, current);
break;
@ -4498,9 +4512,25 @@ void Temperature::isr() {
#if HAS_TEMP_HOTEND
print_heater_state(H_NONE, degHotend(target_extruder), degTargetHotend(target_extruder) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTemp(target_extruder)));
#endif
#if HAS_HEATED_BED
print_heater_state(H_BED, degBed(), degTargetBed() OPTARG(SHOW_TEMP_ADC_VALUES, rawBedTemp()));
#if ENABLED(BED_TEMP_COMP)
celsius_float_t bedDisp = degBed();
celsius_float_t bedTargetDisp = degTargetBed();
if (degTargetBed() > 65 && degTargetBed() <= 86) {
bedDisp -= (5 * bedDisp) / degTargetBed();
bedTargetDisp -= 5;
}
else if (degTargetBed() > 86 && degTargetBed() <= 127) {
bedDisp -= (7 * bedDisp) / degTargetBed();
bedTargetDisp -= 7;
}
print_heater_state(H_BED, bedDisp, bedTargetDisp OPTARG(SHOW_TEMP_ADC_VALUES, rawBedTemp()));
#else
print_heater_state(H_BED, degBed(), degTargetBed() OPTARG(SHOW_TEMP_ADC_VALUES, rawBedTemp()));
#endif
#endif
#if HAS_TEMP_CHAMBER
print_heater_state(H_CHAMBER, degChamber(), TERN0(HAS_HEATED_CHAMBER, degTargetChamber()) OPTARG(SHOW_TEMP_ADC_VALUES, rawChamberTemp()));
#endif
@ -4522,7 +4552,7 @@ void Temperature::isr() {
#if HAS_MULTI_HOTEND
HOTEND_LOOP() print_heater_state((heater_id_t)e, degHotend(e), degTargetHotend(e) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTemp(e)));
#endif
SString<100> s(F(" @:"), getHeaterPower((heater_id_t)target_extruder));
SString<120> s(F(" @:"), getHeaterPower((heater_id_t)target_extruder));
TERN_(HAS_HEATED_BED, s.append(F(" B@:"), getHeaterPower(H_BED)));
TERN_(PELTIER_BED, s.append(F(" P@:"), temp_bed.peltier_dir_heating ? 'H' : 'C'));
TERN_(HAS_HEATED_CHAMBER, s.append(F(" C@:"), getHeaterPower(H_CHAMBER)));
@ -4530,6 +4560,10 @@ void Temperature::isr() {
#if HAS_MULTI_HOTEND
HOTEND_LOOP() s.append(F(" @"), e, ':', getHeaterPower((heater_id_t)e));
#endif
#if ENABLED(CREALITY_CLOUD)
TERN_(HAS_FAN0, s.append(F(" FAN0@:"), thermalManager.fan_speed[0]));
TERN_(HAS_FAN1, s.append(F(" FAN1@:"), thermalManager.fan_speed[1]));
#endif
s.echo();
}
@ -4573,6 +4607,7 @@ void Temperature::isr() {
#define MIN_COOLING_SLOPE_TIME 60
#endif
//static int s_cnt = 0;
bool Temperature::wait_for_hotend(const uint8_t target_extruder, const bool no_wait_for_cooling/*=true*/
OPTARG(G26_CLICK_CAN_CANCEL, const bool click_to_cancel/*=false*/)
) {
@ -4604,6 +4639,7 @@ void Temperature::isr() {
millis_t now, next_temp_ms = 0, cool_check_ms = 0;
for (marlin.heatup_start(); marlin.is_heating() && TEMP_CONDITIONS; ) {
// Target temperature might be changed during the loop
//if (!(++s_cnt % 200)) SERIAL_ECHOLN("wait_for_hotend");
if (target_temp != degTargetHotend(target_extruder)) {
wants_to_cool = isCoolingHotend(target_extruder);
target_temp = degTargetHotend(target_extruder);
@ -4687,6 +4723,8 @@ void Temperature::isr() {
update_time_value = RTS_UPDATE_VALUE;
if (card.isStillPrinting()) rts.refreshTime();
rts.start_print_flag = false;
#elif ENABLED(CREALITY_RTS)
update_time_value = RTS_UPDATE_VALUE;
#else
ui.reset_status();
#endif
@ -4798,6 +4836,7 @@ void Temperature::isr() {
millis_t now, next_temp_ms = 0, cool_check_ms = 0;
marlin.heatup_start();
do {
//if (!(++s_cnt % 200)) SERIAL_ECHOLN("wait_for_bed");
// Target temperature might be changed during the loop
if (target_temp != degTargetBed()) {
wants_to_cool = isCoolingBed();

View file

@ -41,6 +41,10 @@
#include "../lcd/sovol_rts/sovol_rts.h"
#endif
#if ENABLED(CREALITY_RTS)
#include "../lcd/rts/lcd_rts.h"
#endif
#include "../module/planner.h" // for synchronize
#include "../module/printcounter.h"
#include "../gcode/queue.h"
@ -485,6 +489,7 @@ void CardReader::printSelectedFilename() {
}
void CardReader::mount() {
delay(5);
flag.mounted = false;
nrItems = -1;
if (root.isOpen()) root.close();
@ -1665,6 +1670,8 @@ void CardReader::fileHasFinished() {
flag.sdprintdone = true; // Stop getting bytes from the SD card
marlin.setState(MF_SD_COMPLETE); // Tell Marlin to enqueue M1001 soon
TERN_(CREALITY_RTS, RTS_SDFileCompleted());
}
#if ENABLED(AUTO_REPORT_SD_STATUS)

View file

@ -22,6 +22,10 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../feature/powerloss.h"
#endif
/**
* Adjust USB_DEBUG to select debugging verbosity.
* 0 - no debug messages
@ -229,7 +233,16 @@ void DiskIODriver_USBFlash::idle() {
}
break;
case MEDIA_READY: break;
case MEDIA_READY:
#if ENABLED(POWER_LOSS_RECOVERY)
static bool firstStart = false;
if (!firstStart) {
firstStart = true;
recovery.check();
}
#endif
break;
case MEDIA_ERROR: break;
}

View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
#
# Build tests for STM32F401RE_creality
#
# exit on first failure
set -e
use_example_configs "Creality/Ender-5 S1"
exec_test $1 $2 "Ender-5 S1" "$3"
# clean up
restore_configs

View file

@ -47,6 +47,7 @@ HAS_(FSMC|SPI|LTDC)_TFT = build_src_filter=+<src/lcd/tft_io>
I2C_EEPROM = build_src_filter=+<src/HAL/shared/eeprom_if_i2c.cpp>
SOFT_I2C_EEPROM|U8G_USES_SW_I2C = SlowSoftI2CMaster, SlowSoftWire=https://github.com/felias-fogg/SlowSoftWire/archive/f34d777f39.zip
SPI_EEPROM = build_src_filter=+<src/HAL/shared/eeprom_if_spi.cpp>
CREALITY_RTS = build_src_filter=+<src/lcd/rts> +<src/gcode/feature/leds/M224_M225.cpp> +<src/gcode/bedlevel/M2900.cpp> +<src/gcode/stats/M72.cpp> +<src/gcode/stats/M79.cpp>
HAS_DWIN_E3V2|IS_DWIN_MARLINUI = build_src_filter=+<src/lcd/dwin/common>
DWIN_CREALITY_LCD = build_src_filter=+<src/lcd/dwin/creality>
DWIN_LCD_PROUI = build_src_filter=+<src/lcd/dwin/proui>
@ -333,6 +334,7 @@ EXPECTED_PRINTER_CHECK = build_src_filter=+<src/gcode/host/M16.c
HOST_KEEPALIVE_FEATURE = build_src_filter=+<src/gcode/host/M113.cpp>
CAPABILITIES_REPORT = build_src_filter=+<src/gcode/host/M115.cpp>
AUTO_REPORT_POSITION = build_src_filter=+<src/gcode/host/M154.cpp>
MENU_RESET_WIFI = build_src_filter=+<src/gcode/host/M194.cpp>
REPETIER_GCODE_M360 = build_src_filter=+<src/gcode/host/M360.cpp>
HAS_GCODE_M876 = build_src_filter=+<src/gcode/host/M876.cpp>
HAS_RESUME_CONTINUE = build_src_filter=+<src/gcode/lcd/M0_M1.cpp>
@ -369,6 +371,7 @@ HAS_PID_HEATING = build_src_filter=+<src/gcode/temp/M303.
MPCTEMP = build_src_filter=+<src/gcode/temp/M306.cpp>
INCH_MODE_SUPPORT = build_src_filter=+<src/gcode/units/G20_G21.cpp>
TEMPERATURE_UNITS_SUPPORT = build_src_filter=+<src/gcode/units/M149.cpp>
CREALITY_WIFI = build_src_filter=+<src/gcode/wifi>
NEED_HEX_PRINT = build_src_filter=+<src/libs/hex_print.cpp>
NEED_LSF = build_src_filter=+<src/libs/least_squares_fit.cpp>
NOZZLE_PARK_FEATURE = build_src_filter=+<src/libs/nozzle.cpp> +<src/gcode/feature/pause/G27.cpp>

View file

@ -58,7 +58,8 @@ lib_deps =
default_src_filter = +<src/*> -<src/config> -<src/tests>
; LCDs and Controllers
-<src/lcd/HD44780> -<src/lcd/dogm> -<src/lcd/TFTGLCD> -<src/lcd/tft> -<src/lcd/tft_io>
-<src/lcd/dwin> -<src/lcd/sovol_rts> -<src/lcd/menu> -<src/lcd/extui> -<src/lcd/touch>
-<src/lcd/dwin> -<src/lcd/menu> -<src/lcd/extui> -<src/lcd/touch>
-<src/lcd/rts> -<src/lcd/sovol_rts>
-<src/lcd/lcdprint.cpp>
; Marlin HAL
-<src/HAL>
@ -82,8 +83,10 @@ default_src_filter = +<src/*> -<src/config> -<src/tests>
-<src/gcode/probe>
-<src/gcode/scara>
-<src/gcode/sd>
-<src/gcode/stats>
-<src/gcode/temp>
-<src/gcode/units>
-<src/gcode/wifi>
; Library Code
-<src/libs/heatshrink>
-<src/libs/BL24CXX.cpp> -<src/libs/W25Qxx.cpp>
@ -118,6 +121,8 @@ default_src_filter = +<src/*> -<src/config> -<src/tests>
+<src/gcode/motion/G0_G1.cpp>
+<src/gcode/motion/G4.cpp>
+<src/gcode/motion/M400.cpp>
+<src/gcode/stats/M31.cpp>
+<src/gcode/stats/M75-M78.cpp>
+<src/gcode/temp/M105.cpp>
+<src/module/endstops.cpp>
+<src/module/motion.cpp>