Simplify firmware/gcode version comparisons
Fix cherry-pick issue
This commit is contained in:
parent
49506b5348
commit
a6eff8f8a5
|
|
@ -378,20 +378,19 @@ 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;
|
|
||||||
if ((nCompareValueResult < COMPARE_VALUE_EQUAL) && (oCheckVersion == ClCheckVersion::_Warn || oCheckVersion == ClCheckVersion::_Strict))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOLNPGM("Printer FW version differs from the G-code ...");
|
SERIAL_ECHOLNPGM("Printer FW version differs from the G-code ...");
|
||||||
|
|
@ -431,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 ???
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue