util.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #pragma once
  2. #include <stdint.h>
  3. extern const char* FW_VERSION_STR_P();
  4. // Definition of a firmware flavor numerical values.
  5. // To keep it short as possible
  6. // DEVs/ALPHAs/BETAs limited to max 8 flavor versions
  7. // RCs limited to 32 flavor versions
  8. // Final Release always 64 as highest
  9. enum FirmwareRevisionFlavorType : uint16_t {
  10. FIRMWARE_REVISION_RELEASED = 0x0040,
  11. FIRMWARE_REVISION_DEV = 0x0000,
  12. FIRMWARE_REVISION_ALPHA = 0x008,
  13. FIRMWARE_REVISION_BETA = 0x0010,
  14. FIRMWARE_REVISION_RC = 0x0020
  15. };
  16. extern bool show_upgrade_dialog_if_version_newer(const char *version_string);
  17. extern bool force_selftest_if_fw_version();
  18. extern void update_current_firmware_version_to_eeprom();
  19. //-//
  20. #define EEPROM_NOZZLE_DIAMETER_uM_DEFAULT 400
  21. enum class ClPrintChecking:uint_least8_t
  22. {
  23. _Nozzle=1,
  24. _Model=2,
  25. _Smodel=3,
  26. _Version=4,
  27. _Gcode=5
  28. };
  29. enum class ClNozzleDiameter:uint_least8_t
  30. {
  31. _Diameter_250=25,
  32. _Diameter_400=40,
  33. _Diameter_600=60,
  34. _Diameter_800=80,
  35. _Diameter_Undef=EEPROM_EMPTY_VALUE
  36. };
  37. enum class ClCheckMode:uint_least8_t
  38. {
  39. _None,
  40. _Warn,
  41. _Strict,
  42. _Undef=EEPROM_EMPTY_VALUE
  43. };
  44. enum class ClCheckModel:uint_least8_t
  45. {
  46. _None,
  47. _Warn,
  48. _Strict,
  49. _Undef=EEPROM_EMPTY_VALUE
  50. };
  51. enum class ClCheckVersion:uint_least8_t
  52. {
  53. _None,
  54. _Warn,
  55. _Strict,
  56. _Undef=EEPROM_EMPTY_VALUE
  57. };
  58. enum class ClCheckGcode:uint_least8_t
  59. {
  60. _None,
  61. _Warn,
  62. _Strict,
  63. _Undef=EEPROM_EMPTY_VALUE
  64. };
  65. #define COMPARE_VALUE_EQUAL (((uint8_t)ClCompareValue::_Equal<<6)+((uint8_t)ClCompareValue::_Equal<<4)+((uint8_t)ClCompareValue::_Equal<<2)+((uint8_t)ClCompareValue::_Equal))
  66. enum class ClCompareValue:uint_least8_t
  67. {
  68. _Less=0,
  69. _Equal=1,
  70. _Greater=2
  71. };
  72. extern ClNozzleDiameter oNozzleDiameter;
  73. extern ClCheckMode oCheckMode;
  74. extern ClCheckModel oCheckModel;
  75. extern ClCheckVersion oCheckVersion;
  76. extern ClCheckGcode oCheckGcode;
  77. void fCheckModeInit();
  78. void nozzle_diameter_check(uint16_t nDiameter);
  79. void printer_model_check(uint16_t nPrinterModel, uint16_t actualPrinterModel);
  80. void printer_smodel_check(const char *pStrPos, const char *actualPrinterSModel);
  81. void fw_version_check(const char *pVersion);
  82. void gcode_level_check(uint16_t nGcodeLevel);
  83. uint16_t nPrinterType(bool bMMu);
  84. const char *sPrinterType(bool bMMu);
  85. #define IP4_STR_SIZE 16
  86. extern void ip4_to_str(char* dest, uint8_t* IP);