Skip to content

Commit

Permalink
update stepper motor drivers to TMC2209_STANDALONE, add Z Probe Offse…
Browse files Browse the repository at this point in the history
…t manual entry, add X, Y, Z steps adjustment functionality
  • Loading branch information
johncarlson21 committed Apr 3, 2023
1 parent cac482a commit 51867a4
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
*/
#define X_DRIVER_TYPE A4988
#define Y_DRIVER_TYPE A4988
#define Z_DRIVER_TYPE A4988
#define X2_DRIVER_TYPE A4988
#define X_DRIVER_TYPE TMC2209_STANDALONE
#define Y_DRIVER_TYPE TMC2209_STANDALONE
#define Z_DRIVER_TYPE TMC2209_STANDALONE
#define X2_DRIVER_TYPE TMC2209_STANDALONE
//#define Y2_DRIVER_TYPE A4988
#define Z2_DRIVER_TYPE A4988
#define Z2_DRIVER_TYPE TMC2209_STANDALONE
//#define Z3_DRIVER_TYPE A4988
//#define Z4_DRIVER_TYPE A4988
//#define I_DRIVER_TYPE A4988
Expand All @@ -176,8 +176,8 @@
//#define U_DRIVER_TYPE A4988
//#define V_DRIVER_TYPE A4988
//#define W_DRIVER_TYPE A4988
//#define E0_DRIVER_TYPE A4988
//#define E1_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE TMC2209_STANDALONE
#define E1_DRIVER_TYPE TMC2209_STANDALONE
//#define E2_DRIVER_TYPE A4988
//#define E3_DRIVER_TYPE A4988
//#define E4_DRIVER_TYPE A4988
Expand Down Expand Up @@ -575,13 +575,13 @@

#if HAS_E_TEMP_SENSOR
#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109
#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_WINDOW 2 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#endif

#if TEMP_SENSOR_BED
#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190
#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_BED_WINDOW 2 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#endif

Expand Down
52 changes: 52 additions & 0 deletions Marlin/src/lcd/e3v2/creality/LCD_RTS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ void RTSSHOW::RTS_Init()
/***************transmit E-Steps to screen*******************/
RTS_SndData(planner.settings.axis_steps_per_mm[3], E0_SET_STEP_VP);
RTS_SndData(planner.settings.axis_steps_per_mm[4], E1_SET_STEP_VP);
RTS_SndData(planner.settings.axis_steps_per_mm[0], X_SET_STEP_VP);
RTS_SndData(planner.settings.axis_steps_per_mm[1], Y_SET_STEP_VP);
RTS_SndData(planner.settings.axis_steps_per_mm[2], Z_SET_STEP_VP);
RTS_SndData(planner.flow_percentage[0], E0_SET_FLOW_VP);
RTS_SndData(planner.flow_percentage[1], E1_SET_FLOW_VP);
RTS_SndData(thermalManager.fan_speed[0], E0_SET_FAN_VP);
Expand Down Expand Up @@ -1274,6 +1277,30 @@ void RTSSHOW::RTS_HandleData()
RTS_SndData(StartSoundSet, SoundAddr);
RTS_SndData(recdat.data[0], E1_SET_STEP_VP);
break;

case XStepsKey:
sprintf_P(cmd, PSTR("M92 X%d"), recdat.data[0]);
queue.enqueue_now_P(cmd);
queue.enqueue_now_P(PSTR("M500"));
RTS_SndData(StartSoundSet, SoundAddr);
RTS_SndData(recdat.data[0], X_SET_STEP_VP);
break;

case YStepsKey:
sprintf_P(cmd, PSTR("M92 Y%d"), recdat.data[0]);
queue.enqueue_now_P(cmd);
queue.enqueue_now_P(PSTR("M500"));
RTS_SndData(StartSoundSet, SoundAddr);
RTS_SndData(recdat.data[0], Y_SET_STEP_VP);
break;

case ZStepsKey:
sprintf_P(cmd, PSTR("M92 Z%d"), recdat.data[0]);
queue.enqueue_now_P(cmd);
queue.enqueue_now_P(PSTR("M500"));
RTS_SndData(StartSoundSet, SoundAddr);
RTS_SndData(recdat.data[0], Z_SET_STEP_VP);
break;
// end updating for e-steps
// added by John Carlson for updating flow
case E0FlowKey:
Expand Down Expand Up @@ -1316,6 +1343,31 @@ void RTSSHOW::RTS_HandleData()
break;
// end updating for fan speed

case ZOffsetKey: // manual type zoffset
SERIAL_ECHOLNPGM("ZOffsetKey Value: ", recdat.data[0]);
float tmp_zprobe_offset;

if (recdat.data[0] >= 32768)
{
tmp_zprobe_offset = (recdat.data[0] - 65536) / 100.0;
}
else
{
tmp_zprobe_offset = (recdat.data[0]) / 100.0;
}
last_zoffset = zprobe_zoffset;
//SERIAL_ECHOLNPGM("Last ZOffset: ", last_zoffset);
if (WITHIN((tmp_zprobe_offset), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
{
zprobe_zoffset = tmp_zprobe_offset;
//SERIAL_ECHOLNPGM("Add babbystep: ", tmp_zprobe_offset - last_zoffset);
babystep.add_mm(Z_AXIS, tmp_zprobe_offset - last_zoffset);
probe.offset.z = zprobe_zoffset;
}
RTS_SndData(probe.offset.z * 100, AUTO_BED_LEVEL_ZOFFSET_VP);

break;

case ChangeFilamentKey: //FILAMENT_RUNOUT_SCRIPT
char cmdF[MAX_CMD_SIZE+16];
sprintf_P(cmdF, PSTR(FILAMENT_RUNOUT_SCRIPT), recdat.data[0]);
Expand Down
9 changes: 9 additions & 0 deletions Marlin/src/lcd/e3v2/creality/LCD_RTS.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ extern int power_off_type_yes;
#define E1_SET_FLOW_VP 0X1106
#define E0_SET_FAN_VP 0x1107
#define E1_SET_FAN_VP 0x1108
#define X_SET_STEP_VP 0x1122
#define Y_SET_STEP_VP 0x1124
#define Z_SET_STEP_VP 0x1126

#define AUTO_TRAM_1TEXT_VP 0x1120

Expand Down Expand Up @@ -199,6 +202,9 @@ enum PROC_COM
E1FlowKey,
E0FanKey,
E1FanKey,
XStepsKey,
YStepsKey,
ZStepsKey,
ChangeFilamentKey,
SettingScreenKey,
SettingBackKey,
Expand Down Expand Up @@ -247,6 +253,9 @@ const unsigned long Addrbuf[] =
0x1106,
0x1107,
0x1108,
0x1122,
0x1124,
0x1126,
0x1109,
0x103E,
0x1040,
Expand Down

0 comments on commit 51867a4

Please sign in to comment.