Skip to content

Commit

Permalink
New function: Print from any z height
Browse files Browse the repository at this point in the history
  • Loading branch information
tenlog committed Dec 19, 2019
1 parent f4b1a4e commit 561bac5
Show file tree
Hide file tree
Showing 23 changed files with 66,151 additions and 65,569 deletions.
Binary file modified HexFile/TENLOG-3.5-Touchscreen.tft
Binary file not shown.
Binary file modified HexFile/TENLOG-4.3-Touchscreen.tft
Binary file not shown.
11,468 changes: 5,763 additions & 5,705 deletions HexFile/Touch_D2P.hex

Large diffs are not rendered by default.

12,537 changes: 6,294 additions & 6,243 deletions HexFile/Touch_D2P_PLR.hex

Large diffs are not rendered by default.

11,468 changes: 5,763 additions & 5,705 deletions HexFile/Touch_D3P.hex

Large diffs are not rendered by default.

12,537 changes: 6,294 additions & 6,243 deletions HexFile/Touch_D3P_PLR.hex

Large diffs are not rendered by default.

11,468 changes: 5,763 additions & 5,705 deletions HexFile/Touch_D3S.hex

Large diffs are not rendered by default.

11,468 changes: 5,763 additions & 5,705 deletions HexFile/Touch_D4P.hex

Large diffs are not rendered by default.

12,537 changes: 6,294 additions & 6,243 deletions HexFile/Touch_D4P_PLR.hex

Large diffs are not rendered by default.

11,468 changes: 5,763 additions & 5,705 deletions HexFile/Touch_D5P.hex

Large diffs are not rendered by default.

12,537 changes: 6,294 additions & 6,243 deletions HexFile/Touch_D5P_PLR.hex

Large diffs are not rendered by default.

11,468 changes: 5,763 additions & 5,705 deletions HexFile/Touch_D6P.hex

Large diffs are not rendered by default.

12,537 changes: 6,294 additions & 6,243 deletions HexFile/Touch_D6P_PLR.hex

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Marlin/ConfigurationStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ String EEPROM_Read_PLR()
EEPROM_READ_VAR(i,f_feedrate);
// 1FPos 2TPos 3TPos1 4T01 5ZPos 6EPos 7FanPos 8XPos 9YPos 10BPos 11DXCM 12DEXO 13Feedrate
strRet = String(lFPos) + "|" + String(iTPos) + "|" + String(iTPos1) + "|" + String(iT01) + "|" + String(fZPos) + "|" + String(fEPos) + "|" + String(iFanPos) + "|" + String(fXPos) + "|" + String(fYPos) + "|" + String(iBPos) + "|" + String(i_dual_x_carriage_mode) + "|" + String(f_duplicate_extruder_x_offset) + "|" + String(f_feedrate);
//ZYF_DEBUG_PRINT_LN(strRet);
return strRet;
}

Expand Down
9 changes: 4 additions & 5 deletions Marlin/Configuration_xy.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@
// The minimal temperature defines the temperature below which the heater will not be enabled It is used
// to check that the wiring to the thermistor is not broken.
// Otherwise this would lead to the heater being powered on all the time.
#define HEATER_0_MINTEMP 5
#define HEATER_1_MINTEMP 5
#define HEATER_2_MINTEMP 5
#define BED_MINTEMP 5
#define HEATER_0_MINTEMP 1
#define HEATER_1_MINTEMP 1
#define HEATER_2_MINTEMP 1
#define BED_MINTEMP 1

// When temperature exceeds max temp, your heater will be switched off.
// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
Expand All @@ -160,7 +160,6 @@
#define HEATER_1_MAXTEMP 275
#define HEATER_2_MAXTEMP 275
#define BED_MAXTEMP 100
#define BED_MINTEMP 5
// If your bed has low resistance e.g. .6 ohm and throws the fuse you can duty cycle it to reduce the
// average current. The value should be an integer and the heat bed will be turned on for 1 interval of
// HEATER_BED_DUTY_CYCLE_DIVIDER intervals.
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Configuration_zyf.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define TENLOG_CONTROLLER
#define FILAMENT_FAIL_DETECT //Done 20191102
#define POWER_LOSS_RECOVERY //It's OK need hardware support. Done 20191120
//#define PRINT_FROM_Z_LEVEL // in Development 20191127
#define PRINT_FROM_Z_HEIGHT // Done 20191219

////////////////////////
//Raise up z when Pause; //By ZYF
Expand Down
5 changes: 5 additions & 0 deletions Marlin/Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ void enquecommand_P(const char *cmd); //put an ascii command at the end of the c
void prepare_arc_move(char isclockwise);
void clamp_to_software_endstops(float target[3]);

void command_G1(float XValue=-99999.0,float YValue=-99999.0,float ZValue=-99999.0,float EValue=-99999.0);

void PrintStopOrFinished();

#ifdef POWER_LOSS_RECOVERY
Expand Down Expand Up @@ -222,7 +224,10 @@ extern float add_homeing[3];
extern float min_pos[3];
extern float max_pos[3];
extern int fanSpeed;

#ifdef DUAL_X_CARRIAGE
extern int dual_x_carriage_mode;
#endif

#ifdef BARICUDA
extern int ValvePressure;
Expand Down
96 changes: 42 additions & 54 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,6 @@ void setup()
TenlogScreen_println("sleep=0");
TenlogScreen_println("page main");
#ifdef POWER_LOSS_RECOVERY
//ZYF_DEBUG_PRINT_LN("Checking PLR ");
String sFileName = card.isPowerLoss();

if(sFileName != ""){
Expand All @@ -827,6 +826,11 @@ void setup()
#endif
#endif

#ifdef PRINT_FROM_Z_HEIGHT
PrintFromZLevelFound = true;
print_from_z_target = 0.0;
#endif

}

void loop()
Expand Down Expand Up @@ -1346,8 +1350,6 @@ static void axis_is_at_home(int axis) {
min_pos[X_AXIS] = X2_MIN_POS;
#ifdef CONFIG_XYZ
max_pos[X_AXIS] = max(extruder_offset[X_AXIS][1], zyf_X2_MAX_POS);
//ZYF_DEBUG_PRINT("X2_MAX_POS:");
//ZYF_DEBUG_PRINT_LN(max_pos[X_AXIS]);
#else
max_pos[X_AXIS] = max(extruder_offset[X_AXIS][1], X2_MAX_POS);
#endif
Expand Down Expand Up @@ -1444,7 +1446,7 @@ static void homeaxis(int axis) {
}


void command_M605()
void command_M605()
{
st_synchronize();

Expand Down Expand Up @@ -1503,18 +1505,16 @@ void command_G28(int XHome=0, int YHome=0, int ZHome=0){ //By zyf
home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))) && XHome==0 && YHome==0 && ZHome==0;

bool bSkip = false;
#ifdef PRINT_FROM_Z_LEVEL
if((home_all_axis || code_seen(axis_codes[2]) || ZHome == 1) && !PrintFromZLevelFound){
#ifdef PRINT_FROM_Z_HEIGHT
if((home_all_axis || code_seen(axis_codes[2]) || ZHome == 1) && !PrintFromZLevelFound && card.sdprinting == 1){
bSkip = true;
}
bool b_temp_PrintFromZLevelFound = PrintFromZLevelFound;
#endif


#if Z_HOME_DIR < 0
if((home_all_axis || ZHome == 1 || code_seen(axis_codes[Z_AXIS])) && !bSkip) {

//ZYF_DEBUG_PRINT("homeing 0 PrintFromZLevelFound:");
//ZYF_DEBUG_PRINT_LN(PrintFromZLevelFound);

plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[Z_AXIS] = current_position[Z_AXIS] + 7.0;
Expand All @@ -1541,6 +1541,10 @@ void command_G28(int XHome=0, int YHome=0, int ZHome=0){ //By zyf
}
#endif

#ifdef PRINT_FROM_Z_HEIGHT
PrintFromZLevelFound = true;
#endif

#ifdef QUICK_HOME
if((home_all_axis)||( code_seen(axis_codes[X_AXIS]) && code_seen(axis_codes[Y_AXIS])) ) //first diagonal move
{
Expand Down Expand Up @@ -1577,10 +1581,6 @@ void command_G28(int XHome=0, int YHome=0, int ZHome=0){ //By zyf
}
#endif

#ifdef PRINT_FROM_Z_LEVEL
if(bSkip) PrintFromZLevelFound = false;
#endif

if((home_all_axis) || XHome == 1 || (code_seen(axis_codes[X_AXIS])))
{
#ifdef DUAL_X_CARRIAGE
Expand Down Expand Up @@ -1614,16 +1614,13 @@ void command_G28(int XHome=0, int YHome=0, int ZHome=0){ //By zyf
HOMEAXIS(Y);
}

#ifdef PRINT_FROM_Z_LEVEL
if(bSkip) PrintFromZLevelFound = false;
#ifdef PRINT_FROM_Z_HEIGHT
PrintFromZLevelFound = b_temp_PrintFromZLevelFound;
#endif

#if Z_HOME_DIR < 0 // If homing towards BED do Z last
if((home_all_axis || ZHome == 1 || code_seen(axis_codes[Z_AXIS])) && !bSkip) {

//ZYF_DEBUG_PRINT("Homing 1 PrintFromZLevelFound:");
//ZYF_DEBUG_PRINT_LN(PrintFromZLevelFound);

#ifdef ZYF_DUAL_Z //By Zyf

zyf_Y_STEP_PIN = Z2_STEP_PIN; //65;//60
Expand Down Expand Up @@ -1713,7 +1710,7 @@ void command_G28(int XHome=0, int YHome=0, int ZHome=0){ //By zyf
feedmultiply = saved_feedmultiply;
previous_millis_cmd = millis();
endstops_hit_on_purpose();
}
} //command_G28

void command_T(int T01=-1){

Expand Down Expand Up @@ -1850,9 +1847,9 @@ void command_T(int T01=-1){

void PrintStopOrFinished()
{
#ifdef PRINT_FROM_Z_LEVEL
#ifdef PRINT_FROM_Z_HEIGHT
PrintFromZLevelFound = true;
planner_disabled_below_z = 0.0;
print_from_z_target = 0.0;
#endif
//raised_parked_position[X_AXIS] = current_position[X_AXIS]; //By zyf
raised_parked_position[Y_AXIS] = 0; //By zyf
Expand All @@ -1867,7 +1864,7 @@ void PrintStopOrFinished()
}


void command_G1(float XValue=-99999.0,float YValue=-99999.0,float ZValue=-99999.0,float EValue=-99999.0){
void command_G1(float XValue,float YValue,float ZValue,float EValue){
if(Stopped == false) {
//BOF By zyf
if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE){
Expand Down Expand Up @@ -1958,13 +1955,11 @@ void command_M190(int SValue=-1){
if(strTemp.substring(0,1) == "S")
iTempE = strTemp.substring(1, strTemp.length()).toInt();
setTargetBed(iTempE);
//ZYF_DEBUG_PRINT_LN("Set Bed: " + String(iTempE));
}else if(strSerial2 == "M1033"){
sdcard_stop();
}else if(strSerial2 == "M1031"){
sdcard_pause();
}else if(strSerial2 == "M1031 O1"){
//sdcard_pause(1);
}else if(strSerial2.substring(0,5) == "M1032"){
sdcard_resume();
}
Expand Down Expand Up @@ -2116,7 +2111,6 @@ void command_M109(int SValue=-1){ // M109 - Wait for extruder heater to reach
if(strTemp.substring(0,1) == "S")
iTempE = strTemp.substring(1, strTemp.length()).toInt();
setTargetHotend(iTempE, iTemp);
//ZYF_DEBUG_PRINT_LN(String(iTemp) + " / " + String(iTempE));

#ifdef DUAL_X_CARRIAGE
if ((dual_x_carriage_mode == DXC_DUPLICATION_MODE ||dual_x_carriage_mode == DXC_MIRROR_MODE) && tmp_extruder == 0)
Expand Down Expand Up @@ -3344,8 +3338,8 @@ void process_commands()
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder); //move z back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], feedrate/60, active_extruder); //final untretract
}
break;
#endif //FILAMENTCHANGEENABLE
break;//M600
#endif //FILAMENTCHANGEENABLE
#ifdef DUAL_X_CARRIAGE
case 605: // Set dual x-carriage movement mode:
// M605 S0: Full control mode. The slicer has full control over x-carriage movement
Expand Down Expand Up @@ -3588,7 +3582,7 @@ void process_commands()
break;
#endif //TENLOG_CONTROLLER

#ifdef PRINT_FROM_Z_LEVEL
#ifdef PRINT_FROM_Z_HEIGHT
case 1040:
{
if(code_seen('S'))
Expand All @@ -3597,18 +3591,15 @@ void process_commands()
if(fValue == 0){
PrintFromZLevelFound = true;
}else{
//command_G28(1,1,0);
planner_disabled_below_z = fValue / 10.0;
print_from_z_target = fValue / 10.0;
PrintFromZLevelFound = false;
if(dual_x_carriage_mode == 2)
dual_x_carriage_mode = 1;
}
}
//ZYF_DEBUG_PRINT("1040 planner_disabled_below_z:");
//ZYF_DEBUG_PRINT_LN(planner_disabled_below_z);
//ZYF_DEBUG_PRINT("1040 PrintFromZLevelFound:");
//ZYF_DEBUG_PRINT_LN(PrintFromZLevelFound);
}
break;
#endif //PRINT_FROM_Z_LEVEL
#endif //PRINT_FROM_Z_HEIGHT

#ifdef ENGRAVE
case 2000: //M2000
Expand Down Expand Up @@ -3886,6 +3877,9 @@ void calculate_delta(float cartesian[3])

void prepare_move()
{



clamp_to_software_endstops(destination);
previous_millis_cmd = millis();

Expand All @@ -3894,13 +3888,13 @@ void prepare_move()
{
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0)
{
// move duplicate extruder into correct duplication position. //By Zyf Add 15mm Z
plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS] - 15.0, current_position[E_AXIS]);
plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[X_AXIS], 1);
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + 15, current_position[E_AXIS]);
st_synchronize();
extruder_carriage_mode = 2;
active_extruder_parked = false;
// move duplicate extruder into correct duplication position. //By Zyf Add 15mm Z
plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS] - 15.0, current_position[E_AXIS]);
plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[X_AXIS], 1);
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + 15, current_position[E_AXIS]);
st_synchronize();
extruder_carriage_mode = 2;
active_extruder_parked = false;
}
else if (dual_x_carriage_mode == DXC_MIRROR_MODE)
{
Expand Down Expand Up @@ -4332,7 +4326,7 @@ float ePos_pause = 0.0;

void sdcard_pause(int OValue)
{
#ifdef PRINT_FROM_Z_LEVEL
#ifdef PRINT_FROM_Z_HEIGHT
if(!PrintFromZLevelFound)
return;
#endif
Expand Down Expand Up @@ -4383,6 +4377,11 @@ void sdcard_pause(int OValue)

void sdcard_resume()
{
#ifdef PRINT_FROM_Z_HEIGHT
if(!PrintFromZLevelFound)
return;
#endif

card.sdprinting = 2;
if(code_seen('T'))
{
Expand Down Expand Up @@ -4424,18 +4423,11 @@ void raise_Z_E(int Z, int E){
float e = current_position[E_AXIS] + E;
feedrate = 6000;
command_G1(x,y,z,e);
//plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[X_AXIS], 1);
//plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z, current_position[E_AXIS] + E);
//st_synchronize();
//current_position[Z_AXIS] -= Z;
}

void sdcard_stop()
{
card.sdprinting = 0;
#ifdef PAUSE_RAISE_Z //By Zyf
raise_Z_E(15, -5);
#endif

setTargetHotend(0,0); //By Zyf
setTargetHotend(0,1); //By Zyf
Expand Down Expand Up @@ -4470,8 +4462,4 @@ void load_filament(int LoadUnload, int TValue){
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder); //20
}

//if(bChanged){
// command_T(iTempE);
// command_G1(fX);
//}
}
5 changes: 0 additions & 5 deletions Marlin/cardreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ String CardReader::get_PLR() {
#endif
sRet = sRet + "|" + strRet;
}
//ZYF_DEBUG_PRINT_LN(sRet);
return sRet;
}

Expand Down Expand Up @@ -818,8 +817,6 @@ void CardReader::Write_PLR(uint32_t lFPos, int iTPos, int iTPos1, int iT01, floa
arrFileContentNew = "0";
}

ZYF_DEBUG_PRINT_LN(arrFileContentNew);

uint8_t O_TF = O_CREAT | O_EXCL | O_WRITE;
if(bFileExists) O_TF = O_WRITE | O_TRUNC;

Expand Down Expand Up @@ -922,7 +919,6 @@ uint32_t CardReader::Read_PLR_0(){
}

if(strFileContent != ""){
//ZYF_DEBUG_PRINT_LN(strFileContent);
lRet = atol(const_cast<char*>(getSplitValue(strFileContent, '|', 0).c_str()));
}
}
Expand Down Expand Up @@ -955,7 +951,6 @@ String CardReader::Read_PLR(){
}

if(strFileContent != ""){
//ZYF_DEBUG_PRINT_LN(strFileContent);
lFP = atol(const_cast<char*>(getSplitValue(strFileContent, '|', 0).c_str()));
}
}
Expand Down
7 changes: 1 addition & 6 deletions Marlin/cardreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ class CardReader
bool filenameIsDir;
int lastnr; //last number of the autostart;
uint32_t sdpos ;
uint32_t filesize;
private:
SdFile root,*curDir,workDir,workDirParents[MAX_DIR_DEPTH];
uint16_t workDirDepth;
Sd2Card card;
SdVolume volume;
SdFile file;
uint32_t filesize;
unsigned long autostart_atmillis;

bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
Expand Down Expand Up @@ -105,8 +105,3 @@ extern CardReader card;
#define IS_SD_PRINTING (false)
#endif //SDSUPPORT
#endif //CARDREADER_H
#ifdef TENLOG_CONTROLLER
void TenlogScreen_print(const char s[]);
void TenlogScreen_println(const char s[]);
void TenlogScreen_printend();
#endif
Loading

0 comments on commit 561bac5

Please sign in to comment.