Merge pull request #507 from PavelSindler/force_selftest

force selftest if user upgraded from 3.1.2-RC1 or older fw version
This commit is contained in:
PavelSindler 2018-03-01 14:49:03 +01:00 committed by GitHub
commit d94ee6dca1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 44 additions and 2 deletions

View file

@ -1273,6 +1273,12 @@ void setup()
lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW); lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW);
} }
} }
if (force_selftest_if_fw_version() && calibration_status() < CALIBRATION_STATUS_ASSEMBLED ) {
lcd_show_fullscreen_message_and_wait_P(MSG_FORCE_SELFTEST);
update_current_firmware_version_to_eeprom();
lcd_selftest();
}
KEEPALIVE_STATE(IN_PROCESS); KEEPALIVE_STATE(IN_PROCESS);
#endif //DEBUG_DISABLE_STARTMSGS #endif //DEBUG_DISABLE_STARTMSGS
lcd_update_enable(true); lcd_update_enable(true);

View file

@ -779,6 +779,13 @@ const char * const MSG_FOLLOW_CALIBRATION_FLOW_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_FOLLOW_CALIBRATION_FLOW_CZ MSG_FOLLOW_CALIBRATION_FLOW_CZ
}; };
const char MSG_FORCE_SELFTEST_EN[] PROGMEM = "Selftest will be run to calibrate accurate sensorless rehoming.";
const char MSG_FORCE_SELFTEST_CZ[] PROGMEM = "Pro kalibraci presneho rehomovani bude nyni spusten selftest.";
const char * const MSG_FORCE_SELFTEST_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_FORCE_SELFTEST_EN,
MSG_FORCE_SELFTEST_CZ
};
const char MSG_FREE_MEMORY_EN[] PROGMEM = " Free Memory: "; const char MSG_FREE_MEMORY_EN[] PROGMEM = " Free Memory: ";
const char * const MSG_FREE_MEMORY_LANG_TABLE[1] PROGMEM = { const char * const MSG_FREE_MEMORY_LANG_TABLE[1] PROGMEM = {
MSG_FREE_MEMORY_EN MSG_FREE_MEMORY_EN

View file

@ -270,6 +270,8 @@ extern const char* const MSG_FLOW2_LANG_TABLE[1];
#define MSG_FLOW2 LANG_TABLE_SELECT_EXPLICIT(MSG_FLOW2_LANG_TABLE, 0) #define MSG_FLOW2 LANG_TABLE_SELECT_EXPLICIT(MSG_FLOW2_LANG_TABLE, 0)
extern const char* const MSG_FOLLOW_CALIBRATION_FLOW_LANG_TABLE[LANG_NUM]; extern const char* const MSG_FOLLOW_CALIBRATION_FLOW_LANG_TABLE[LANG_NUM];
#define MSG_FOLLOW_CALIBRATION_FLOW LANG_TABLE_SELECT(MSG_FOLLOW_CALIBRATION_FLOW_LANG_TABLE) #define MSG_FOLLOW_CALIBRATION_FLOW LANG_TABLE_SELECT(MSG_FOLLOW_CALIBRATION_FLOW_LANG_TABLE)
extern const char* const MSG_FORCE_SELFTEST_LANG_TABLE[LANG_NUM];
#define MSG_FORCE_SELFTEST LANG_TABLE_SELECT(MSG_FORCE_SELFTEST_LANG_TABLE)
extern const char* const MSG_FREE_MEMORY_LANG_TABLE[1]; extern const char* const MSG_FREE_MEMORY_LANG_TABLE[1];
#define MSG_FREE_MEMORY LANG_TABLE_SELECT_EXPLICIT(MSG_FREE_MEMORY_LANG_TABLE, 0) #define MSG_FREE_MEMORY LANG_TABLE_SELECT_EXPLICIT(MSG_FREE_MEMORY_LANG_TABLE, 0)
extern const char* const MSG_FSENSOR_NA_LANG_TABLE[LANG_NUM]; extern const char* const MSG_FSENSOR_NA_LANG_TABLE[LANG_NUM];

View file

@ -406,3 +406,4 @@
#define MSG_FW_VERSION_ALPHA "Pouzivate alpha verzi firmwaru. Jedna se o vyvojovou verzi. Pouzivani teto verze firmware neni doporuceno a muze zpusobit poskozeni tiskarny." #define MSG_FW_VERSION_ALPHA "Pouzivate alpha verzi firmwaru. Jedna se o vyvojovou verzi. Pouzivani teto verze firmware neni doporuceno a muze zpusobit poskozeni tiskarny."
#define MSG_FW_VERSION_BETA "Pouzivate beta verzi firmwaru. Jedna se o vyvojovou verzi. Pouzivani teto verze firmware neni doporuceno a muze zpusobit poskozeni tiskarny." #define MSG_FW_VERSION_BETA "Pouzivate beta verzi firmwaru. Jedna se o vyvojovou verzi. Pouzivani teto verze firmware neni doporuceno a muze zpusobit poskozeni tiskarny."
#define MSG_FW_VERSION_RC "Tato verze firmware je release candidate. Nektere z funkci nemusi pracovat spolehlive." #define MSG_FW_VERSION_RC "Tato verze firmware je release candidate. Nektere z funkci nemusi pracovat spolehlive."
#define MSG_FORCE_SELFTEST "Pro kalibraci presneho rehomovani bude nyni spusten selftest."

View file

@ -412,3 +412,4 @@
#define(length=20, lines=8) MSG_FW_VERSION_ALPHA "You are using firmware alpha version. This is development version. Using this version is not recommended and may cause printer damage." #define(length=20, lines=8) MSG_FW_VERSION_ALPHA "You are using firmware alpha version. This is development version. Using this version is not recommended and may cause printer damage."
#define(length=20, lines=8) MSG_FW_VERSION_BETA "You are using firmware beta version. This is development version. Using this version is not recommended and may cause printer damage." #define(length=20, lines=8) MSG_FW_VERSION_BETA "You are using firmware beta version. This is development version. Using this version is not recommended and may cause printer damage."
#define(length=20, lines=8) MSG_FW_VERSION_RC "This firmware version is release candidate. Some of the features may not work properly." #define(length=20, lines=8) MSG_FW_VERSION_RC "This firmware version is release candidate. Some of the features may not work properly."
#define(length=20, lines=8) MSG_FORCE_SELFTEST "Selftest will be run to calibrate accurate sensorless rehoming."

View file

@ -5842,7 +5842,7 @@ static void lcd_selftest_v()
(void)lcd_selftest(); (void)lcd_selftest();
} }
static bool lcd_selftest() bool lcd_selftest()
{ {
int _progress = 0; int _progress = 0;
bool _result = true; bool _result = true;

View file

@ -35,7 +35,7 @@ void lcd_mylang();
bool lcd_detected(void); bool lcd_detected(void);
static void lcd_selftest_v(); static void lcd_selftest_v();
static bool lcd_selftest(); extern bool lcd_selftest();
static bool lcd_selfcheck_endstops(); static bool lcd_selfcheck_endstops();
#ifdef TMC2130 #ifdef TMC2130

View file

@ -239,6 +239,30 @@ inline int8_t is_provided_version_newer(const char *version_string)
return 0; return 0;
} }
bool force_selftest_if_fw_version()
{
//if fw version used before flashing new firmware (fw version currently stored in eeprom) is lower then 3.1.2-RC2, function returns true to force selftest
uint16_t ver_eeprom[4];
uint16_t ver_with_calibration[4] = {3, 1, 2, 4}; //hardcoded 3.1.2-RC2 version
bool force_selftest = false;
ver_eeprom[0] = eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MAJOR);
ver_eeprom[1] = eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MINOR);
ver_eeprom[2] = eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_REVISION);
ver_eeprom[3] = eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR);
for (uint8_t i = 0; i < 4; ++i) {
if (ver_with_calibration[i] > ver_eeprom[i]) {
force_selftest = true;
break;
}
else if (ver_with_calibration[i] < ver_eeprom[i])
break;
}
return force_selftest;
}
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], ver_current[4]; uint16_t ver_gcode[4], ver_current[4];

View file

@ -18,6 +18,7 @@ enum FirmwareRevisionFlavorType
}; };
extern bool show_upgrade_dialog_if_version_newer(const char *version_string); extern bool show_upgrade_dialog_if_version_newer(const char *version_string);
extern bool force_selftest_if_fw_version();
extern void update_current_firmware_version_to_eeprom(); extern void update_current_firmware_version_to_eeprom();