Merge pull request #3806 from 3d-gussner/MK3_3.12_Fix_M862.4_strict

MK3_3.12: Fix `M862.4` with [strict] mode
This commit is contained in:
Yuri D'Elia 2022-12-12 13:04:12 +01:00 committed by GitHub
commit 1e19eedf26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 61 deletions

View File

@ -20,7 +20,7 @@ extern PGM_P sPrinterName;
#define FW_MINOR 12 #define FW_MINOR 12
#define FW_REVISION 0 #define FW_REVISION 0
#define FW_FLAVOR RC //uncomment if DEBUG, DEVEL, ALPHA, BETA or RC #define FW_FLAVOR RC //uncomment if DEBUG, DEVEL, ALPHA, BETA or RC
#define FW_FLAVERSION 1 //uncomment if FW_FLAVOR is defined and versioning is needed. #define FW_FLAVERSION 1 //uncomment if FW_FLAVOR is defined and versioning is needed. Limited to max 8.
#ifndef FW_FLAVOR #ifndef FW_FLAVOR
#define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION) #define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION)
#else #else

View File

@ -378,39 +378,39 @@ return((uint8_t)ClCompareValue::_Equal);
} }
void fw_version_check(const char *pVersion) { void fw_version_check(const char *pVersion) {
uint16_t aVersion[4];
uint8_t nCompareValueResult;
if (oCheckVersion == ClCheckVersion::_None) if (oCheckVersion == ClCheckVersion::_None)
return; return;
uint16_t aVersion[4];
uint8_t nCompareValueResult;
parse_version(pVersion, aVersion); parse_version(pVersion, aVersion);
nCompareValueResult = mCompareValue(aVersion[0], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_MAJOR)) << 6; nCompareValueResult = mCompareValue(aVersion[0], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_MAJOR)) << 6;
nCompareValueResult += mCompareValue(aVersion[1], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_MINOR)) << 4; nCompareValueResult += mCompareValue(aVersion[1], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_MINOR)) << 4;
nCompareValueResult += mCompareValue(aVersion[2], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_REVISION)) << 2; nCompareValueResult += mCompareValue(aVersion[2], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_REVISION)) << 2;
nCompareValueResult += mCompareValue(aVersion[3], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_FLAVOR)); nCompareValueResult += mCompareValue(aVersion[3], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_FLAVOR));
if (nCompareValueResult == COMPARE_VALUE_EQUAL) if (nCompareValueResult <= COMPARE_VALUE_EQUAL)
return; return;
if ((nCompareValueResult < COMPARE_VALUE_EQUAL) && oCheckVersion == ClCheckVersion::_Warn)
return;
// SERIAL_ECHO_START;
// SERIAL_ECHOLNPGM("Printer FW version differs from the G-code ...");
// SERIAL_ECHOPGM("actual : ");
// SERIAL_ECHO(eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_MAJOR));
// SERIAL_ECHO('.');
// SERIAL_ECHO(eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_MINOR));
// SERIAL_ECHO('.');
// SERIAL_ECHO(eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_REVISION));
// SERIAL_ECHO('.');
// SERIAL_ECHO(eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_FLAVOR));
// SERIAL_ECHOPGM("\nexpected: ");
// SERIAL_ECHO(aVersion[0]);
// SERIAL_ECHO('.');
// SERIAL_ECHO(aVersion[1]);
// SERIAL_ECHO('.');
// SERIAL_ECHO(aVersion[2]);
// SERIAL_ECHO('.');
// SERIAL_ECHOLN(aVersion[3]);
/*
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Printer FW version differs from the G-code ...");
SERIAL_ECHOPGM("actual : ");
SERIAL_ECHO(eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_MAJOR));
SERIAL_ECHO('.');
SERIAL_ECHO(eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_MINOR));
SERIAL_ECHO('.');
SERIAL_ECHO(eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_REVISION));
SERIAL_ECHO('.');
SERIAL_ECHO(eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_FLAVOR));
SERIAL_ECHOPGM("\nexpected: ");
SERIAL_ECHO(aVersion[0]);
SERIAL_ECHO('.');
SERIAL_ECHO(aVersion[1]);
SERIAL_ECHO('.');
SERIAL_ECHO(aVersion[2]);
SERIAL_ECHO('.');
SERIAL_ECHOLN(aVersion[3]);
*/
switch (oCheckVersion) { switch (oCheckVersion) {
case ClCheckVersion::_Warn: case ClCheckVersion::_Warn:
// lcd_show_fullscreen_message_and_wait_P(_i("Printer FW version differs from the G-code. Continue?")); // lcd_show_fullscreen_message_and_wait_P(_i("Printer FW version differs from the G-code. Continue?"));
@ -430,37 +430,35 @@ void fw_version_check(const char *pVersion) {
} }
} }
void gcode_level_check(uint16_t nGcodeLevel) void gcode_level_check(uint16_t nGcodeLevel) {
{ if (oCheckGcode == ClCheckGcode::_None)
if(oCheckGcode==ClCheckGcode::_None) return;
return; if (nGcodeLevel <= (uint16_t)GCODE_LEVEL)
if(nGcodeLevel==(uint16_t)GCODE_LEVEL) return;
return;
if((nGcodeLevel<(uint16_t)GCODE_LEVEL)&&(oCheckGcode==ClCheckGcode::_Warn)) // SERIAL_ECHO_START;
return; // SERIAL_ECHOLNPGM("Printer G-code level differs from the G-code ...");
//SERIAL_ECHO_START; // SERIAL_ECHOPGM("actual : ");
//SERIAL_ECHOLNPGM("Printer G-code level differs from the G-code ..."); // SERIAL_ECHOLN(GCODE_LEVEL);
//SERIAL_ECHOPGM("actual : "); // SERIAL_ECHOPGM("expected: ");
//SERIAL_ECHOLN(GCODE_LEVEL); // SERIAL_ECHOLN(nGcodeLevel);
//SERIAL_ECHOPGM("expected: "); switch (oCheckGcode) {
//SERIAL_ECHOLN(nGcodeLevel); case ClCheckGcode::_Warn:
switch(oCheckGcode) // lcd_show_fullscreen_message_and_wait_P(_i("Printer G-code level differs from the G-code. Continue?"));
{ lcd_display_message_fullscreen_P(_i("G-code sliced for a different level. Continue?")); ////MSG_GCODE_DIFF_CONTINUE c=20 r=4
case ClCheckGcode::_Warn: lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT);
// lcd_show_fullscreen_message_and_wait_P(_i("Printer G-code level differs from the G-code. Continue?")); //???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery
lcd_display_message_fullscreen_P(_i("G-code sliced for a different level. Continue?"));////MSG_GCODE_DIFF_CONTINUE c=20 r=4 lcd_update_enable(true); // display / status-line recovery
lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT); break;
//???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery case ClCheckGcode::_Strict:
lcd_update_enable(true); // display / status-line recovery lcd_show_fullscreen_message_and_wait_P(
break; _i("G-code sliced for a different level. Please re-slice the model again. Print cancelled.")); ////MSG_GCODE_DIFF_CANCELLED c=20 r=7
case ClCheckGcode::_Strict: lcd_print_stop();
lcd_show_fullscreen_message_and_wait_P(_i("G-code sliced for a different level. Please re-slice the model again. Print cancelled."));////MSG_GCODE_DIFF_CANCELLED c=20 r=7 break;
lcd_print_stop(); case ClCheckGcode::_None:
break; case ClCheckGcode::_Undef:
case ClCheckGcode::_None: break;
case ClCheckGcode::_Undef: }
break;
}
} }
//-// -> cmdqueue ??? //-// -> cmdqueue ???

View File

@ -4,12 +4,16 @@
extern const char* FW_VERSION_STR_P(); extern const char* FW_VERSION_STR_P();
// Definition of a firmware flavor numerical values. // Definition of a firmware flavor numerical values.
// To keep it short as possible
// DEVs/ALPHAs/BETAs limited to max 8 flavor versions
// RCs limited to 32 flavor versions
// Final Release always 64 as highest
enum FirmwareRevisionFlavorType : uint16_t { enum FirmwareRevisionFlavorType : uint16_t {
FIRMWARE_REVISION_RELEASED = 0, FIRMWARE_REVISION_RELEASED = 0x0040,
FIRMWARE_REVISION_DEV = 0x0100, FIRMWARE_REVISION_DEV = 0x0000,
FIRMWARE_REVISION_ALPHA = 0x0200, FIRMWARE_REVISION_ALPHA = 0x008,
FIRMWARE_REVISION_BETA = 0x0300, FIRMWARE_REVISION_BETA = 0x0010,
FIRMWARE_REVISION_RC = 0x0400 FIRMWARE_REVISION_RC = 0x0020
}; };
extern bool show_upgrade_dialog_if_version_newer(const char *version_string); extern bool show_upgrade_dialog_if_version_newer(const char *version_string);