Skip to content

Commit

Permalink
✨ Sovol SV06 Plus Touchscreen (MarlinFirmware#25864)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <[email protected]>
  • Loading branch information
saddfox and thinkyhead authored Sep 28, 2024
1 parent 2afc2f2 commit bbb8275
Show file tree
Hide file tree
Showing 23 changed files with 2,344 additions and 21 deletions.
5 changes: 5 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3244,6 +3244,11 @@
//
//#define ANYCUBIC_LCD_VYPER

//
// Sovol SV-06 Resistive Touch Screen
//
//#define SOVOL_SV06_RTS

//
// 320x240 Nextion 2.8" serial TFT Resistive Touch Screen NX3224T028
//
Expand Down
23 changes: 20 additions & 3 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
#include "lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "lcd/e3v2/jyersui/dwin.h"
#elif ENABLED(SOVOL_SV06_RTS)
#include "lcd/sovol_rts/sovol_rts.h"
#endif
#endif

Expand Down Expand Up @@ -825,7 +827,11 @@ void idle(const bool no_stepper_sleep/*=false*/) {
TERN_(HAS_BEEPER, buzzer.tick());

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

// Run i2c Position Encoders
#if ENABLED(I2C_POSITION_ENCODERS)
Expand Down Expand Up @@ -1162,6 +1168,12 @@ void setup() {
millis_t serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL1.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }

#if ENABLED(SOVOL_SV06_RTS)
LCD_SERIAL.begin(BAUDRATE);
serial_connect_timeout = millis() + 1000UL;
while (!LCD_SERIAL.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#endif

#if HAS_MULTI_SERIAL && !HAS_ETHERNET
#ifndef BAUDRATE_2
#define BAUDRATE_2 BAUDRATE
Expand Down Expand Up @@ -1319,8 +1331,11 @@ void setup() {

// UI must be initialized before EEPROM
// (because EEPROM code calls the UI).

SETUP_RUN(ui.init());
#if ENABLED(SOVOL_SV06_RTS)
SETUP_RUN(RTS_Update());
#else
SETUP_RUN(ui.init());
#endif

#if PIN_EXISTS(SAFE_POWER)
#if HAS_DRIVER_SAFE_POWER_PROTECT
Expand Down Expand Up @@ -1609,6 +1624,8 @@ void setup() {

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

#if HAS_SERVICE_INTERVALS && DISABLED(DWIN_CREALITY_LCD)
Expand Down
33 changes: 33 additions & 0 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@

#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#elif ENABLED(SOVOL_SV06_RTS)
#include "../lcd/sovol_rts/sovol_rts.h"
#endif

#include "../lcd/marlinui.h"
Expand Down Expand Up @@ -150,6 +152,11 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P

ui.pause_show_message(PAUSE_MESSAGE_HEATING, mode);

#if ENABLED(SOVOL_SV06_RTS)
rts.gotoPage(ID_Cold_L, ID_Cold_D);
rts.updateTempE0();
#endif

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

// Allow interruption by Emergency Parser M108
Expand Down Expand Up @@ -277,6 +284,11 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
// "Wait for filament purge"
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);

#if ENABLED(SOVOL_SV06_RTS)
rts.updateTempE0();
rts.gotoPage(ID_Purge_L, ID_Purge_D);
#endif

// Extrude filament to get into hotend
unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
}
Expand All @@ -292,6 +304,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
ui.pause_show_message(PAUSE_MESSAGE_OPTION); // MarlinUI and MKS UI also set PAUSE_RESPONSE_WAIT_FOR
#else
pause_menu_response = PAUSE_RESPONSE_WAIT_FOR;
TERN_(SOVOL_SV06_RTS, rts.gotoPage(ID_PurgeMore_L, ID_PurgeMore_D));
#endif
while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle_no_sleep();
}
Expand Down Expand Up @@ -355,6 +368,11 @@ bool unload_filament(const_float_t unload_length, const bool show_lcd/*=false*/,

if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_UNLOAD, mode);

#if ENABLED(SOVOL_SV06_RTS)
rts.updateTempE0();
rts.gotoPage(ID_Unload_L, ID_Unload_D);
#endif

// Retract filament
unscaled_e_move(-(FILAMENT_UNLOAD_PURGE_RETRACT) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier);

Expand Down Expand Up @@ -503,6 +521,11 @@ void show_continue_prompt(const bool is_reload) {
DEBUG_ECHOLNPGM("... is_reload:", is_reload);

ui.pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING);
#if ENABLED(SOVOL_SV06_RTS)
rts.updateTempE0();
rts.gotoPage(ID_Insert_L, ID_Insert_D);
rts.sendData(Beep, SoundAddr);
#endif
SERIAL_ECHO_START();
SERIAL_ECHO(is_reload ? F(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : F(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
}
Expand Down Expand Up @@ -544,6 +567,10 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
// re-heat the nozzle, re-show the continue prompt, restart idle timers, start over
if (nozzle_timed_out) {
ui.pause_show_message(PAUSE_MESSAGE_HEAT);
#if ENABLED(SOVOL_SV06_RTS)
rts.updateTempE0();
rts.gotoPage(ID_HeatNozzle_L, ID_HeatNozzle_D);
#endif
SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_HEAT));

TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_REHEAT)));
Expand Down Expand Up @@ -709,6 +736,12 @@ void resume_print(
planner.set_e_position_mm((destination.e = current_position.e = resume_position.e));

ui.pause_show_message(PAUSE_MESSAGE_STATUS);
#if ENABLED(SOVOL_SV06_RTS)
if (pause_flag)
rts.gotoPage(ID_PrintResume_L, ID_PrintResume_D);
else
rts.refreshTime();
#endif

#ifdef ACTION_ON_RESUMED
hostui.resumed();
Expand Down
9 changes: 9 additions & 0 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ uint32_t PrintJobRecovery::cmd_sdpos, // = 0
#include "../module/probe.h"
#endif

#if ENABLED(SOVOL_SV06_RTS)
#include "../lcd/sovol_rts/sovol_rts.h"
#endif

#if ENABLED(FWRETRACT)
#include "fwretract.h"
#endif
Expand Down Expand Up @@ -584,6 +588,11 @@ void PrintJobRecovery::resume() {
// Resume the SD file from the last position
PROCESS_SUBCOMMANDS_NOW(MString<MAX_CMD_SIZE>(F("M23 "), info.sd_filename));
PROCESS_SUBCOMMANDS_NOW(TS(F("M24S"), resume_sdpos, 'T', info.print_job_elapsed));

#if ENABLED(SOVOL_SV06_RTS)
if (rts.print_state) rts.refreshTime();
rts.start_print_flag = false;
#endif
}

#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/feature/tmc_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "../libs/duration_t.h"
#include "../gcode/gcode.h"

#if ENABLED(SOVOL_SV06_RTS)
#include "../lcd/sovol_rts/sovol_rts.h"
#endif

#if ENABLED(TMC_DEBUG)
#include "../libs/hex_print.h"
#if ENABLED(MONITOR_DRIVER_STATUS)
Expand Down Expand Up @@ -207,6 +211,7 @@
if (data.is_ot) SERIAL_ECHOLNPGM("overtemperature");
if (data.is_s2g) SERIAL_ECHOLNPGM("coil short circuit");
TERN_(TMC_DEBUG, tmc_report_all());
TERN_(SOVOL_SV06_RTS, rts.gotoPage(ID_DriverError_L, ID_DriverError_D));
kill(F("Driver error"));
}
#endif
Expand Down
17 changes: 17 additions & 0 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "../../../module/motion.h"
#include "../../../module/planner.h"
#include "../../../module/probe.h"
#include "../../../module/temperature.h"
#include "../../queue.h"

#if ENABLED(AUTO_BED_LEVELING_LINEAR)
Expand All @@ -51,6 +52,8 @@
#include "../../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(SOVOL_SV06_RTS)
#include "../../../lcd/sovol_rts/sovol_rts.h"
#endif

#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
Expand Down Expand Up @@ -438,6 +441,12 @@ G29_TYPE GcodeSuite::G29() {
remember_feedrate_scaling_off();

#if ENABLED(PREHEAT_BEFORE_LEVELING)
#if ENABLED(SOVOL_SV06_RTS)
rts.updateTempE0();
rts.updateTempBed();
rts.sendData(1, Wait_VP);
rts.gotoPage(ID_ABL_HeatWait_L, ID_ABL_HeatWait_D);
#endif
if (!abl.dryrun) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP,
TERN(EXTENSIBLE_UI, ExtUI::getLevelingBedTemp(), LEVELING_BED_TEMP)
);
Expand Down Expand Up @@ -775,6 +784,12 @@ G29_TYPE GcodeSuite::G29() {
abl.z_values[abl.meshCount.x][abl.meshCount.y] = z;
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(abl.meshCount, z));

#if ENABLED(SOVOL_SV06_RTS)
if (pt_index <= GRID_MAX_POINTS) rts.sendData(pt_index, AUTO_BED_LEVEL_ICON_VP);
rts.sendData(z * 100.0f, AUTO_BED_LEVEL_1POINT_VP + (pt_index - 1) * 2);
rts.gotoPage(ID_ABL_Wait_L, ID_ABL_Wait_D);
#endif

#endif

abl.reenable = false; // Don't re-enable after modifying the mesh
Expand Down Expand Up @@ -992,6 +1007,8 @@ G29_TYPE GcodeSuite::G29() {
process_subcommands_now(F(EVENT_GCODE_AFTER_G29));
#endif

TERN_(SOVOL_SV06_RTS, RTS_AutoBedLevelPage());

probe.use_probing_tool(false);

report_current_position();
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
#include "../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD)
#include "../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(SOVOL_SV06_RTS)
#include "../../lcd/sovol_rts/sovol_rts.h"
#endif

#if ENABLED(LASER_FEATURE)
Expand Down Expand Up @@ -555,6 +557,7 @@ void GcodeSuite::G28() {

ui.refresh();

TERN_(SOVOL_SV06_RTS, RTS_MoveAxisHoming());
TERN_(DWIN_CREALITY_LCD, dwinHomingDone());
TERN_(EXTENSIBLE_UI, ExtUI::onHomingDone());

Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/gcode/feature/pause/G27.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include "../../gcode.h"
#include "../../../libs/nozzle.h"
#include "../../../module/motion.h"
#if ENABLED(SOVOL_SV06_RTS)
#include "../../../lcd/sovol_rts/sovol_rts.h"
#endif

/**
* G27: Park the nozzle according with the given style
Expand All @@ -42,6 +45,7 @@ void GcodeSuite::G27() {
// Don't allow nozzle parking without homing first
if (homing_needed_error()) return;
nozzle.park(parser.ushortval('P'));
TERN_(SOVOL_SV06_RTS, RTS_MoveAxisHoming());
}

#endif // NOZZLE_PARK_FEATURE
6 changes: 6 additions & 0 deletions Marlin/src/gcode/feature/pause/M600.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
#include "../../../feature/pause.h"
#include "../../../module/motion.h"
#include "../../../module/printcounter.h"

#include "../../../lcd/marlinui.h"
#if ENABLED(SOVOL_SV06_RTS)
#include "../../../lcd/sovol_rts/sovol_rts.h"
#endif

#if HAS_MULTI_EXTRUDER
#include "../../../module/tool_change.h"
Expand Down Expand Up @@ -115,6 +119,8 @@ void GcodeSuite::M600() {
if (standardM600)
ui.pause_show_message(PAUSE_MESSAGE_CHANGING, PAUSE_MODE_PAUSE_PRINT, target_extruder);

TERN_(SOVOL_SV06_RTS, rts.gotoPage(ID_ChangeWait_L, ID_ChangeWait_D)); //given the context it seems this likely should have been pages 6 & 61

// If needed, home before parking for filament change
TERN_(HOME_BEFORE_FILAMENT_CHANGE, home_if_needed(true));

Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/gcode/motion/G0_G1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include "../../module/planner.h"
#endif

#if ENABLED(SOVOL_SV06_RTS)
#include "../../lcd/sovol_rts/sovol_rts.h"
#endif

extern xyze_pos_t destination;

#if ENABLED(VARIABLE_G0_FEEDRATE)
Expand Down Expand Up @@ -116,4 +120,6 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
#else
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
#endif

TERN_(SOVOL_SV06_RTS, RTS_PauseMoveAxisPage());
}
12 changes: 12 additions & 0 deletions Marlin/src/gcode/sd/M1001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
#define PE_LEDS_COMPLETED_TIME (30*60)
#endif

#if ENABLED(SOVOL_SV06_RTS)
#include "../../lcd/sovol_rts/sovol_rts.h"
#endif

/**
* M1001: Execute actions for SD print completion
*/
Expand Down Expand Up @@ -110,6 +114,14 @@ void GcodeSuite::M1001() {

// Re-select the last printed file in the UI
TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());

#if ENABLED(SOVOL_SV06_RTS)
rts.sendData(100, PRINT_PROCESS_VP); delay(1);
rts.sendData(100, PRINT_PROCESS_ICON_VP); delay(1);
rts.sendData(0, PRINT_SURPLUS_TIME_HOUR_VP); delay(1);
rts.sendData(0, PRINT_SURPLUS_TIME_MIN_VP); delay(1);
rts.gotoPage(ID_Finish_L, ID_Finish_D);
#endif
}

#endif // HAS_MEDIA
6 changes: 3 additions & 3 deletions Marlin/src/inc/Conditionals-2-LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@
#if ANY(DWIN_CREALITY_LCD, DWIN_LCD_PROUI)
#define HAS_DWIN_E3V2_BASIC 1
#endif
#if ANY(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI)
#if ANY(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI, SOVOL_SV06_RTS)
#define HAS_DWIN_E3V2 1
#define STD_ENCODER_PULSES_PER_STEP 4
#endif
Expand Down Expand Up @@ -555,7 +555,7 @@
#endif

// E3V2 extras
#if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
#if ANY(HAS_DWIN_E3V2, IS_DWIN_MARLINUI, SOVOL_SV06_RTS)
#define SERIAL_CATCHALL 0
#define HAS_LCD_BRIGHTNESS 1
#define LCD_BRIGHTNESS_MAX 250
Expand All @@ -568,7 +568,7 @@
#endif

// Serial Controllers require LCD_SERIAL_PORT
#if ANY(IS_DWIN_MARLINUI, HAS_DWIN_E3V2, HAS_DGUS_LCD, MALYAN_LCD, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT)
#if ANY(IS_DWIN_MARLINUI, HAS_DWIN_E3V2, HAS_DGUS_LCD, MALYAN_LCD, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT, SOVOL_SV06_RTS)
#define LCD_IS_SERIAL_HOST 1
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals-5-post.h
Original file line number Diff line number Diff line change
Expand Up @@ -3225,7 +3225,7 @@
* Advanced Pause - Filament Change
*/
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI) || ALL(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI, SOVOL_SV06_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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2736,7 +2736,7 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
+ COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35, ANYCUBIC_LCD_VYPER) \
+ DGUS_UI_IS(ORIGIN) + DGUS_UI_IS(FYSETC) + DGUS_UI_IS(HIPRECY) + DGUS_UI_IS(MKS) + DGUS_UI_IS(RELOADED) + DGUS_UI_IS(IA_CREALITY) \
+ COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \
+ COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \
+ COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE, SOVOL_SV06_RTS) \
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_GENERIC_12864_1_1) \
+ COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
+ COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \
Expand Down
Loading

0 comments on commit bbb8275

Please sign in to comment.