Browse Source

Fix `M862.4` with [strict] mode
Max 8 falvor versions

3d-gussner 2 years ago
parent
commit
6f5a67491c
3 changed files with 31 additions and 26 deletions
  1. 1 1
      Firmware/Configuration.h
  2. 21 20
      Firmware/util.cpp
  3. 9 5
      Firmware/util.h

+ 1 - 1
Firmware/Configuration.h

@@ -20,7 +20,7 @@ extern PGM_P sPrinterName;
 #define FW_MINOR 13
 #define FW_MINOR 13
 #define FW_REVISION 0
 #define FW_REVISION 0
 #define FW_FLAVOR ALPHA      //uncomment if DEBUG, DEVEL, ALPHA, BETA or RC
 #define FW_FLAVOR ALPHA      //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

+ 21 - 20
Firmware/util.cpp

@@ -378,27 +378,28 @@ void fw_version_check(const char *pVersion) {
     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)
+    if ((nCompareValueResult < COMPARE_VALUE_EQUAL) && (oCheckVersion == ClCheckVersion::_Warn || oCheckVersion == ClCheckVersion::_Strict))
         return;
         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?"));

+ 9 - 5
Firmware/util.h

@@ -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_DEV = 0x0100,
-    FIRMWARE_REVISION_ALPHA = 0x0200,
-    FIRMWARE_REVISION_BETA = 0x0300,
-    FIRMWARE_REVISION_RC = 0x0400
+    FIRMWARE_REVISION_RELEASED = 0x0040,
+    FIRMWARE_REVISION_DEV = 0x0000,
+    FIRMWARE_REVISION_ALPHA = 0x008,
+    FIRMWARE_REVISION_BETA = 0x0010,
+    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);