Skip to content

Commit 0be90dc

Browse files
authored
Merge pull request prusa3d#3320 from prusa3d/MK3_3.10.1
Merge MK3_3.10.1 into MK3 after release
2 parents 98d4e69 + caca7bb commit 0be90dc

38 files changed

+5944
-3791
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.project
33
.cproject
44
Debug
5+
__pycache__
56
Firmware/Configuration_prusa.h
67
Firmware/Doc
78
/Firmware/.vs/Firmware/v14
@@ -52,3 +53,5 @@ Firmware/Doc
5253
/Firmware/Firmware.vcxproj
5354
/Firmware/Configuration_prusa_bckp.h
5455
/Firmware/variants/printers.h
56+
Configuration.tmp
57+
config.tmp

Firmware/Configuration.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@ extern PGM_P sPrinterName;
1818
// Firmware version
1919
#define FW_MAJOR 3
2020
#define FW_MINOR 10
21-
#define FW_REVISION 0
22-
#define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION)
21+
#define FW_REVISION 1
22+
//#define FW_FLAVOR RC //uncomment if DEBUG, DEVEL, APLHA, BETA or RC
23+
//#define FW_FLAVERSION 1 //uncomment if FW_FLAVOR is defined and versioning is needed.
24+
#ifndef FW_FLAVOR
25+
#define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION)
26+
#else
27+
#define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION) "-" STR(FW_FLAVOR) "" STR(FW_FLAVERSION)
28+
#endif
2329

24-
#define FW_COMMIT_NR 4481
30+
#define FW_COMMIT_NR 4697
2531

2632
// FW_VERSION_UNKNOWN means this is an unofficial build.
2733
// The firmware should only be checked into github with this symbol.

Firmware/Marlin.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,12 @@ void update_currents();
236236
void get_coordinates();
237237
void prepare_move();
238238
void kill(const char *full_screen_message = NULL, unsigned char id = 0);
239-
void Stop();
240-
bool IsStopped();
241239
void finishAndDisableSteppers();
242240

241+
void UnconditionalStop(); // Stop heaters, motion and clear current print status
242+
void Stop(); // Emergency stop used by overtemp functions which allows recovery
243+
bool IsStopped(); // Returns true if the print has been stopped
244+
243245
//put an ASCII command at the end of the current buffer, read from flash
244246
#define enquecommand_P(cmd) enquecommand(cmd, true)
245247

Firmware/Marlin_main.cpp

+49-10
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ uint8_t newFanSpeed = 0;
294294
bool powersupply = true;
295295
#endif
296296

297-
bool cancel_heatup = false ;
297+
bool cancel_heatup = false;
298298

299299
int8_t busy_state = NOT_BUSY;
300300
static long prev_busy_signal_ms = -1;
@@ -1011,7 +1011,8 @@ static void fw_crash_init()
10111011
eeprom_read_byte((uint8_t*)EEPROM_FW_CRASH_FLAG) != 0xFF)
10121012
{
10131013
lcd_show_fullscreen_message_and_wait_P(
1014-
_i("FIRMWARE CRASH!\n"
1014+
_i("FW crash detected! "
1015+
"You can continue printing. "
10151016
"Debug data available for analysis. "
10161017
"Contact support to submit details."));
10171018
}
@@ -6751,7 +6752,7 @@ SERIAL_PROTOCOLPGM("\n\n");
67516752
target_direction = isHeatingBed(); // true if heating, false if cooling
67526753

67536754
KEEPALIVE_STATE(NOT_BUSY);
6754-
while ( (target_direction)&&(!cancel_heatup) ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) )
6755+
while ( (!cancel_heatup) && (target_direction ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false))) )
67556756
{
67566757
if(( _millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
67576758
{
@@ -8625,7 +8626,7 @@ SERIAL_PROTOCOLPGM("\n\n");
86258626
*/
86268627
case 910:
86278628
{
8628-
tmc2130_init();
8629+
tmc2130_init(TMCInitParams(false, FarmOrUserECool()));
86298630
}
86308631
break;
86318632

@@ -8692,7 +8693,7 @@ SERIAL_PROTOCOLPGM("\n\n");
86928693
{
86938694
tmc2130_mode = TMC2130_MODE_NORMAL;
86948695
update_mode_profile();
8695-
tmc2130_init();
8696+
tmc2130_init(TMCInitParams(false, FarmOrUserECool()));
86968697
}
86978698
break;
86988699

@@ -8704,7 +8705,7 @@ SERIAL_PROTOCOLPGM("\n\n");
87048705
{
87058706
tmc2130_mode = TMC2130_MODE_SILENT;
87068707
update_mode_profile();
8707-
tmc2130_init();
8708+
tmc2130_init(TMCInitParams(false, FarmOrUserECool()));
87088709
}
87098710
break;
87108711

@@ -9329,7 +9330,7 @@ SERIAL_PROTOCOLPGM("\n\n");
93299330

93309331
#ifdef XFLASH_DUMP
93319332
/*!
9332-
### D20 - Generate an offline crash dump
9333+
### D20 - Generate an offline crash dump <a href="https://reprap.org/wiki/G-code#D20:_Generate_an_offline_crash_dump">D20: Generate an offline crash dump</a>
93339334
Generate a crash dump for later retrival.
93349335
#### Usage
93359336
@@ -9348,7 +9349,7 @@ SERIAL_PROTOCOLPGM("\n\n");
93489349
};
93499350

93509351
/*!
9351-
### D21 - Print crash dump to serial
9352+
### D21 - Print crash dump to serial <a href="https://reprap.org/wiki/G-code#D21:_Print_crash_dump_to_serial">D21: Print crash dump to serial</a>
93529353
Output the complete crash dump (if present) to the serial.
93539354
#### Usage
93549355
@@ -9363,7 +9364,7 @@ SERIAL_PROTOCOLPGM("\n\n");
93639364
};
93649365

93659366
/*!
9366-
### D22 - Clear crash dump state
9367+
### D22 - Clear crash dump state <a href="https://reprap.org/wiki/G-code#D22:_Clear_crash_dump_state">D22: Clear crash dump state</a>
93679368
Clear an existing internal crash dump.
93689369
#### Usage
93699370
@@ -9377,7 +9378,7 @@ SERIAL_PROTOCOLPGM("\n\n");
93779378

93789379
#ifdef EMERGENCY_SERIAL_DUMP
93799380
/*!
9380-
### D23 - Request emergency dump on serial
9381+
### D23 - Request emergency dump on serial <a href="https://reprap.org/wiki/G-code#D23:_Request_emergency_dump_on_serial">D23: Request emergency dump on serial</a>
93819382
On boards without offline dump support, request online dumps to the serial port on firmware faults.
93829383
When online dumps are enabled, the FW will dump memory on the serial before resetting.
93839384
#### Usage
@@ -10157,6 +10158,32 @@ void kill(const char *full_screen_message, unsigned char id)
1015710158
} // Wait for reset
1015810159
}
1015910160

10161+
void UnconditionalStop()
10162+
{
10163+
CRITICAL_SECTION_START;
10164+
10165+
// Disable all heaters and unroll the temperature wait loop stack
10166+
disable_heater();
10167+
cancel_heatup = true;
10168+
10169+
// Clear any saved printing state
10170+
cancel_saved_printing();
10171+
10172+
// Abort the planner
10173+
planner_abort_hard();
10174+
10175+
// Reset the queue
10176+
cmdqueue_reset();
10177+
cmdqueue_serial_disabled = false;
10178+
10179+
// Reset the sd status
10180+
card.sdprinting = false;
10181+
card.closefile();
10182+
10183+
st_reset_timer();
10184+
CRITICAL_SECTION_END;
10185+
}
10186+
1016010187
// Stop: Emergency stop used by overtemp functions which allows recovery
1016110188
//
1016210189
// In addition to stopping the print, this prevents subsequent G[0-3] commands to be
@@ -10169,15 +10196,27 @@ void kill(const char *full_screen_message, unsigned char id)
1016910196
// the addition of disabling the headers) could allow true recovery in the future.
1017010197
void Stop()
1017110198
{
10199+
// Keep disabling heaters
1017210200
disable_heater();
10201+
10202+
// Call the regular stop function if that's the first time during a new print
1017310203
if(Stopped == false) {
1017410204
Stopped = true;
1017510205
lcd_print_stop();
1017610206
Stopped_gcode_LastN = gcode_LastN; // Save last g_code for restart
10207+
10208+
// Eventually report the stopped status (though this is usually overridden by a
10209+
// higher-priority alert status message)
1017710210
SERIAL_ERROR_START;
1017810211
SERIAL_ERRORLNRPGM(MSG_ERR_STOPPED);
1017910212
LCD_MESSAGERPGM(_T(MSG_STOPPED));
1018010213
}
10214+
10215+
// Return to the status screen to stop any pending menu action which could have been
10216+
// started by the user while stuck in the Stopped state. This also ensures the NEW
10217+
// error is immediately shown.
10218+
if (menu_menu != lcd_status_screen)
10219+
lcd_return_to_status();
1018110220
}
1018210221

1018310222
bool IsStopped() { return Stopped; };

Firmware/cardreader.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,6 @@ void CardReader::presort() {
10301030

10311031
lcd_update(2);
10321032
KEEPALIVE_STATE(NOT_BUSY);
1033-
lcd_timeoutToStatus.start();
10341033
}
10351034

10361035
void CardReader::flush_presort() {

Firmware/temperature.cpp

+13-32
Original file line numberDiff line numberDiff line change
@@ -1381,33 +1381,15 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
13811381

13821382
void temp_runaway_stop(bool isPreheat, bool isBed)
13831383
{
1384-
cancel_heatup = true;
1385-
quickStop();
1386-
if (card.sdprinting)
1387-
{
1388-
card.sdprinting = false;
1389-
card.closefile();
1390-
}
1391-
// Clean the input command queue
1392-
// This is necessary, because in command queue there can be commands which would later set heater or bed temperature.
1393-
cmdqueue_reset();
1394-
1395-
disable_heater();
1396-
disable_x();
1397-
disable_y();
1398-
disable_e0();
1399-
disable_e1();
1400-
disable_e2();
1401-
manage_heater();
1402-
lcd_update(0);
1403-
Sound_MakeCustom(200,0,true);
1404-
1405-
if (isPreheat)
1384+
disable_heater();
1385+
Sound_MakeCustom(200,0,true);
1386+
1387+
if (isPreheat)
14061388
{
1407-
Stop();
1408-
isBed ? LCD_ALERTMESSAGEPGM("BED PREHEAT ERROR") : LCD_ALERTMESSAGEPGM("PREHEAT ERROR");
1389+
lcd_setalertstatuspgm(isBed? PSTR("BED PREHEAT ERROR") : PSTR("PREHEAT ERROR"), LCD_STATUS_CRITICAL);
14091390
SERIAL_ERROR_START;
1410-
isBed ? SERIAL_ERRORLNPGM(" THERMAL RUNAWAY ( PREHEAT HEATBED)") : SERIAL_ERRORLNPGM(" THERMAL RUNAWAY ( PREHEAT HOTEND)");
1391+
isBed ? SERIAL_ERRORLNPGM(" THERMAL RUNAWAY (PREHEAT HEATBED)") : SERIAL_ERRORLNPGM(" THERMAL RUNAWAY (PREHEAT HOTEND)");
1392+
14111393
#ifdef EXTRUDER_ALTFAN_DETECT
14121394
altfanStatus.altfanOverride = 1; //full speed
14131395
#endif //EXTRUDER_ALTFAN_DETECT
@@ -1418,16 +1400,16 @@ void temp_runaway_stop(bool isPreheat, bool isBed)
14181400
#else //FAN_SOFT_PWM
14191401
analogWrite(FAN_PIN, 255);
14201402
#endif //FAN_SOFT_PWM
1421-
14221403
fanSpeed = 255;
1423-
delayMicroseconds(2000);
14241404
}
14251405
else
14261406
{
1427-
isBed ? LCD_ALERTMESSAGEPGM("BED THERMAL RUNAWAY") : LCD_ALERTMESSAGEPGM("THERMAL RUNAWAY");
1407+
lcd_setalertstatuspgm(isBed? PSTR("BED THERMAL RUNAWAY") : PSTR("THERMAL RUNAWAY"), LCD_STATUS_CRITICAL);
14281408
SERIAL_ERROR_START;
14291409
isBed ? SERIAL_ERRORLNPGM(" HEATBED THERMAL RUNAWAY") : SERIAL_ERRORLNPGM(" HOTEND THERMAL RUNAWAY");
14301410
}
1411+
1412+
Stop();
14311413
}
14321414
#endif
14331415

@@ -1483,21 +1465,20 @@ uint8_t last_alert_sent_to_lcd = LCDALERT_NONE;
14831465

14841466
//! update the current temperature error message
14851467
//! @param type short error abbreviation (PROGMEM)
1486-
//! @param func optional lcd update function (lcd_setalertstatus when first setting the error)
1487-
void temp_update_messagepgm(const char* PROGMEM type, void (*func)(const char*) = lcd_updatestatus)
1468+
void temp_update_messagepgm(const char* PROGMEM type)
14881469
{
14891470
char msg[LCD_WIDTH];
14901471
strcpy_P(msg, PSTR("Err: "));
14911472
strcat_P(msg, type);
1492-
(*func)(msg);
1473+
lcd_setalertstatus(msg, LCD_STATUS_CRITICAL);
14931474
}
14941475

14951476
//! signal a temperature error on both the lcd and serial
14961477
//! @param type short error abbreviation (PROGMEM)
14971478
//! @param e optional extruder index for hotend errors
14981479
void temp_error_messagepgm(const char* PROGMEM type, uint8_t e = EXTRUDERS)
14991480
{
1500-
temp_update_messagepgm(type, lcd_setalertstatus);
1481+
temp_update_messagepgm(type);
15011482

15021483
SERIAL_ERROR_START;
15031484

Firmware/temperature.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ FORCE_INLINE bool isCoolingBed() {
220220
#define CHECK_ALL_HEATERS (checkAllHotends()||(target_temperature_bed!=0))
221221

222222
int getHeaterPower(int heater);
223-
void disable_heater();
223+
void disable_heater(); // Disable all heaters
224224
void updatePID();
225225

226226

0 commit comments

Comments
 (0)