Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
fix bug: power loss detected after auto power off
  • Loading branch information
tenlog committed Apr 7, 2020
1 parent 4b3772d commit b3238c3
Show file tree
Hide file tree
Showing 18 changed files with 62,372 additions and 62,352 deletions.
7 changes: 6 additions & 1 deletion HexFile/Read.me
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ How to upgrade the touch screen.
7. Power off the printer, remove the tf card from the touch screen.
8. All done.

191101 filament runout dectection enabled (demo).
d2p = hands 2
plr = power loss recovery(need hardware support)
you can edit these configurations at: Configuration_zyf.h

191101 filament runout dectection enabled (demo).
200407 fix bug: power loss detected after auto power off.
10,856 changes: 5,428 additions & 5,428 deletions HexFile/Touch_D2P.hex

Large diffs are not rendered by default.

11,908 changes: 5,955 additions & 5,953 deletions HexFile/Touch_D2P_PLR.hex

Large diffs are not rendered by default.

10,856 changes: 5,428 additions & 5,428 deletions HexFile/Touch_D3P.hex

Large diffs are not rendered by default.

11,908 changes: 5,955 additions & 5,953 deletions HexFile/Touch_D3P_PLR.hex

Large diffs are not rendered by default.

10,856 changes: 5,428 additions & 5,428 deletions HexFile/Touch_D3S.hex

Large diffs are not rendered by default.

10,856 changes: 5,428 additions & 5,428 deletions HexFile/Touch_D4P.hex

Large diffs are not rendered by default.

11,908 changes: 5,955 additions & 5,953 deletions HexFile/Touch_D4P_PLR.hex

Large diffs are not rendered by default.

10,856 changes: 5,428 additions & 5,428 deletions HexFile/Touch_D5P.hex

Large diffs are not rendered by default.

11,908 changes: 5,955 additions & 5,953 deletions HexFile/Touch_D5P_PLR.hex

Large diffs are not rendered by default.

10,856 changes: 5,428 additions & 5,428 deletions HexFile/Touch_D6P.hex

Large diffs are not rendered by default.

11,908 changes: 5,955 additions & 5,953 deletions HexFile/Touch_D6P_PLR.hex

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Marlin/Configuration_zyf.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

#define TENLOG_CONTROLLER
#define FILAMENT_FAIL_DETECT //Done 20191102
//#define POWER_LOSS_RECOVERY //It's OK need hardware support. Done 20191120
#define POWER_LOSS_RECOVERY //It's OK need hardware support. Done 20191120
#define PRINT_FROM_Z_HEIGHT // Done 20191219

////////////////////////
//Raise up z when Pause; //By ZYF
#define PAUSE_RAISE_Z

//#define MODEL_D2P
#define MODEL_D3P
#define MODEL_D2P //TL-Hands 2
//#define MODEL_D3P //TL-D3 Pro
//#define MODEL_D3S
//#define MODEL_D4P
//#define MODEL_D5P
Expand All @@ -33,7 +33,7 @@ const bool Y_ENDSTOPS_INVERTING = false; // set to true to invert the logic of t

//#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,800,94.4} //755 94.4 default steps per unit for Ultimaker
#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,792,92.6} //755 94.4 default steps per unit for Ultimaker
#define DEFAULT_MAX_ACCELERATION {500, 500, 100, 1000} // 800 800 160 1600 500 500 100 1000 X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
#define DEFAULT_MAX_ACCELERATION {800, 800, 160, 1600} // 800 800 160 1600 500 500 100 1000 X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
#define DEFAULT_MAX_FEEDRATE {120, 80, 4, 37} // (mm/pul) 80 80 3 25
#define DEFAULT_ACCELERATION 500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 500 // X, Y, Z and E max acceleration in mm/s^2 for retracts
Expand Down
26 changes: 16 additions & 10 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,13 +730,13 @@ void CSDI_TLS()

void setup()
{
setup_killpin();
setup_powerhold();
setup_killpin();
setup_powerhold();

#ifdef ENGRAVE
pinMode(ENGRAVE_PIN, OUTPUT);
digitalWrite(ENGRAVE_PIN, ENGRAVE_OFF);
#endif
#ifdef ENGRAVE
pinMode(ENGRAVE_PIN, OUTPUT);
digitalWrite(ENGRAVE_PIN, ENGRAVE_OFF);
#endif

_delay_ms(20);
#ifdef TENLOG_CONTROLLER
Expand Down Expand Up @@ -1069,6 +1069,9 @@ bool code_seen(char code)
}

void command_M81(){
#ifdef POWER_LOSS_RECOVERY
card.sdpos = 0;
#endif
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
st_synchronize();
suicide();
Expand Down Expand Up @@ -1235,7 +1238,8 @@ void get_command()
(serial_char == ':' && comment_mode == false) ||
serial_count >= (MAX_CMD_SIZE - 1)||n==-1)
{
if(card.eof()){
if(card.eof())
{
SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
stoptime=millis();
char time[30];
Expand All @@ -1255,7 +1259,7 @@ void get_command()
String strMessage="";
bool bAutoOff = false;
if(languageID==0)
strMessage="Print finished, " + String(hours) + " hours and " + String(minutes) + " minutes. ";
strMessage="Print finished, " + String(hours) + " hours and " + String(minutes) + " minutes.\r\n";
else
strMessage="打印完成!共用了" + String(hours) + "" + String(minutes) + "分。";
#ifdef POWER_LOSS_TRIGGER_BY_PIN
Expand All @@ -1273,7 +1277,8 @@ void get_command()
TenlogScreen_println("page msgbox");

if(bAutoOff){
command_G4(10.0);
card.sdprinting = 0;
command_G4(10.0);
command_M81();
}
#endif //TENLOG_CONTROLLER
Expand All @@ -1286,7 +1291,7 @@ void get_command()
return; //if empty line
}
cmdbuffer[bufindw][serial_count] = 0; //terminate string
// if(!comment_mode){
// if(!comment_mode){
fromsd[bufindw] = true;
buflen += 1;
bufindw = (bufindw + 1)%BUFSIZE;
Expand Down Expand Up @@ -3168,6 +3173,7 @@ void process_commands()
SERIAL_PROTOCOL(Kc);
#endif
SERIAL_PROTOCOLLN("");
Config_StoreSettings();
}
break;
#endif //PIDTEMP
Expand Down
1 change: 0 additions & 1 deletion Marlin/cardreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ void CardReader::lsDive(const char *prepend,SdFile parent)
if(cnt==nrFiles)
return;
cnt++;

//SERIAL_PROTOCOL(prepend);
//SERIAL_PROTOCOLLN(filename);

Expand Down
2 changes: 1 addition & 1 deletion Marlin/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ void bed_min_temp_error(void) {
strMessage = "msgbox.tMessage.txt=\"" + strMessage + "\"";
const char* str0 = strMessage.c_str();
TenlogScreen_println(str0);
TenlogScreen_println("page msgbox");
TenlogScreen_println("page msgbox");
#endif
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
Expand Down
2 changes: 1 addition & 1 deletion Marlin/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ bool strISAscii(String str)
{
if(!isAscii(cFN[i]))
{
//ZYF_DEBUG_PRINT_LN((int)cFN[i]);
bOK = false;
break;
}else{
}
}
return bOK;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ void watchdog_reset();
FORCE_INLINE void watchdog_init() {};
FORCE_INLINE void watchdog_reset() {};
#endif
#endif
#endif

0 comments on commit b3238c3

Please sign in to comment.