Merge remote-tracking branch 'upstream/MK3' into PFW-1271_PF-buildv20

This commit is contained in:
3d-gussner 2021-07-17 19:10:51 +02:00
commit 3d871a3aa6
6 changed files with 38 additions and 37 deletions

View File

@ -1,5 +1,5 @@
#include "Dcodes.h"
#include "Marlin.h" #include "Marlin.h"
#include "Dcodes.h"
#include "Configuration.h" #include "Configuration.h"
#include "language.h" #include "language.h"
#include "cmdqueue.h" #include "cmdqueue.h"
@ -974,6 +974,18 @@ void dcode_22()
bool emergency_serial_dump = false; bool emergency_serial_dump = false;
void dcode_23()
{
if(code_seen('E'))
serial_dump_and_reset(dump_crash_reason::manual);
else
{
emergency_serial_dump = !code_seen('R');
SERIAL_ECHOPGM("serial dump ");
SERIAL_ECHOLNRPGM(emergency_serial_dump? _N("enabled"): _N("disabled"));
}
}
void __attribute__((noinline)) serial_dump_and_reset(dump_crash_reason reason) void __attribute__((noinline)) serial_dump_and_reset(dump_crash_reason reason)
{ {
uint16_t sp; uint16_t sp;

View File

@ -37,7 +37,8 @@ extern void dcode_22(); //D22 - Clear crash dump state
#ifdef EMERGENCY_SERIAL_DUMP #ifdef EMERGENCY_SERIAL_DUMP
#include "xflash_dump.h" #include "xflash_dump.h"
extern bool emergency_serial_dump; extern void dcode_23(); //D23 - Request/generate an online serial crash dump
extern bool emergency_serial_dump; //emergency dump enabled flag
extern void serial_dump_and_reset(dump_crash_reason); extern void serial_dump_and_reset(dump_crash_reason);
#endif #endif

View File

@ -9382,12 +9382,14 @@ Sigma_Exit:
When online dumps are enabled, the FW will dump memory on the serial before resetting. When online dumps are enabled, the FW will dump memory on the serial before resetting.
#### Usage #### Usage
D23 [R] D23 [E] [R]
#### Parameters #### Parameters
- `E` - Perform an emergency crash dump (resets the printer).
- `R` - Disable online dumps. - `R` - Disable online dumps.
*/ */
case 23: { case 23: {
emergency_serial_dump = !code_seen('R'); dcode_23();
break;
}; };
#endif #endif

View File

@ -596,20 +596,9 @@ void CardReader::getStatus(bool arg_P)
} }
void CardReader::write_command(char *buf) void CardReader::write_command(char *buf)
{ {
char* begin = buf;
char* npos = 0;
char* end = buf + strlen(buf) - 1;
file.writeError = false; file.writeError = false;
if((npos = strchr(buf, 'N')) != NULL) file.write(buf); //write command
{ file.write("\r\n"); //write line termination
begin = strchr(npos, ' ') + 1;
end = strchr(npos, '*') - 1;
}
end[1] = '\r';
end[2] = '\n';
end[3] = '\0';
file.write(begin);
if (file.writeError) if (file.writeError)
{ {
SERIAL_ERROR_START; SERIAL_ERROR_START;

View File

@ -287,7 +287,9 @@ bool checkAllHotends(void)
return(result); return(result);
} }
void PID_autotune(float temp, int extruder, int ncycles) // WARNING: the following function has been marked noinline to avoid a GCC 4.9.2 LTO
// codegen bug causing a stack overwrite issue in process_commands()
void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycles)
{ {
pid_number_of_cycles = ncycles; pid_number_of_cycles = ncycles;
pid_tuning_finished = false; pid_tuning_finished = false;

View File

@ -146,9 +146,14 @@ inline int8_t is_provided_version_newer(const char *version_string)
uint16_t ver_gcode[4]; uint16_t ver_gcode[4];
if (! parse_version(version_string, ver_gcode)) if (! parse_version(version_string, ver_gcode))
return -1; return -1;
for (uint8_t i = 0; i < 3; ++ i) for (uint8_t i = 0; i < 4; ++ i)
if (ver_gcode[i] > FW_VERSION_NR[i]) {
uint16_t v = (uint16_t)pgm_read_word(&FW_VERSION_NR[i]);
if (ver_gcode[i] > v)
return 1; return 1;
else if (ver_gcode[i] < v)
return 0;
}
return 0; return 0;
} }
@ -182,19 +187,9 @@ bool force_selftest_if_fw_version()
bool show_upgrade_dialog_if_version_newer(const char *version_string) bool show_upgrade_dialog_if_version_newer(const char *version_string)
{ {
uint16_t ver_gcode[4]; int8_t upgrade = is_provided_version_newer(version_string);
if (! parse_version(version_string, ver_gcode)) { if (upgrade < 0)
// SERIAL_PROTOCOLLNPGM("parse_version failed");
return false; return false;
}
bool upgrade = false;
for (uint8_t i = 0; i < 4; ++ i) {
if (ver_gcode[i] > FW_VERSION_NR[i]) {
upgrade = true;
break;
} else if (ver_gcode[i] < FW_VERSION_NR[i])
break;
}
if (upgrade) { if (upgrade) {
lcd_display_message_fullscreen_P(_i("New firmware version available:"));////MSG_NEW_FIRMWARE_AVAILABLE c=20 r=2 lcd_display_message_fullscreen_P(_i("New firmware version available:"));////MSG_NEW_FIRMWARE_AVAILABLE c=20 r=2
@ -220,11 +215,11 @@ void update_current_firmware_version_to_eeprom()
for (int8_t i = 0; i < FW_PRUSA3D_MAGIC_LEN; ++ i){ for (int8_t i = 0; i < FW_PRUSA3D_MAGIC_LEN; ++ i){
eeprom_update_byte((uint8_t*)(EEPROM_FIRMWARE_PRUSA_MAGIC+i), pgm_read_byte(FW_PRUSA3D_MAGIC_STR+i)); eeprom_update_byte((uint8_t*)(EEPROM_FIRMWARE_PRUSA_MAGIC+i), pgm_read_byte(FW_PRUSA3D_MAGIC_STR+i));
} }
eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MAJOR, FW_VERSION_NR[0]); eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MAJOR, (uint16_t)pgm_read_word(&FW_VERSION_NR[0]));
eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MINOR, FW_VERSION_NR[1]); eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MINOR, (uint16_t)pgm_read_word(&FW_VERSION_NR[1]));
eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_REVISION, FW_VERSION_NR[2]); eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_REVISION, (uint16_t)pgm_read_word(&FW_VERSION_NR[2]));
// See FirmwareRevisionFlavorType for the definition of firmware flavors. // See FirmwareRevisionFlavorType for the definition of firmware flavors.
eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR, FW_VERSION_NR[3]); eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR, (uint16_t)pgm_read_word(&FW_VERSION_NR[3]));
} }