util.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #ifndef UTIL_H
  2. #define UTIL_H
  3. extern const char* FW_VERSION_STR_P();
  4. // Definition of a firmware flavor numerical values.
  5. enum FirmwareRevisionFlavorType
  6. {
  7. FIRMWARE_REVISION_DEV = 0,
  8. FIRMWARE_REVISION_ALPHA = 1,
  9. FIRMWARE_REVISION_BETA = 2,
  10. FIRMWARE_REVISION_RC,
  11. FIRMWARE_REVISION_RC2,
  12. FIRMWARE_REVISION_RC3,
  13. FIRMWARE_REVISION_RC4,
  14. FIRMWARE_REVISION_RC5,
  15. FIRMWARE_REVISION_RELEASED = 127
  16. };
  17. extern bool show_upgrade_dialog_if_version_newer(const char *version_string);
  18. extern bool force_selftest_if_fw_version();
  19. extern void update_current_firmware_version_to_eeprom();
  20. inline int8_t eeprom_read_int8(unsigned char* addr) {
  21. uint8_t v = eeprom_read_byte(addr);
  22. return *reinterpret_cast<int8_t*>(&v);
  23. }
  24. inline void eeprom_update_int8(unsigned char* addr, int8_t v) {
  25. eeprom_update_byte(addr, *reinterpret_cast<uint8_t*>(&v));
  26. }
  27. //-//
  28. enum class ClPrintChecking:uint_least8_t
  29. {
  30. _Nozzle=1,
  31. _Model=2,
  32. _Smodel=3,
  33. _Version=4,
  34. _Gcode=5
  35. };
  36. enum class ClNozzleDiameter:uint_least8_t
  37. {
  38. _Diameter_250=25,
  39. _Diameter_400=40,
  40. _Diameter_600=60,
  41. _Diameter_Undef=EEPROM_EMPTY_VALUE
  42. };
  43. enum class ClCheckMode:uint_least8_t
  44. {
  45. _None,
  46. _Warn,
  47. _Strict,
  48. _Undef=EEPROM_EMPTY_VALUE
  49. };
  50. enum class ClCheckModel:uint_least8_t
  51. {
  52. _None,
  53. _Warn,
  54. _Strict,
  55. _Undef=EEPROM_EMPTY_VALUE
  56. };
  57. enum class ClCheckVersion:uint_least8_t
  58. {
  59. _None,
  60. _Warn,
  61. _Strict,
  62. _Undef=EEPROM_EMPTY_VALUE
  63. };
  64. enum class ClCheckGcode:uint_least8_t
  65. {
  66. _None,
  67. _Warn,
  68. _Strict,
  69. _Undef=EEPROM_EMPTY_VALUE
  70. };
  71. #define COMPARE_VALUE_EQUAL (((uint8_t)ClCompareValue::_Equal<<6)+((uint8_t)ClCompareValue::_Equal<<4)+((uint8_t)ClCompareValue::_Equal<<2)+((uint8_t)ClCompareValue::_Equal))
  72. enum class ClCompareValue:uint_least8_t
  73. {
  74. _Less=0,
  75. _Equal=1,
  76. _Greater=2
  77. };
  78. extern ClNozzleDiameter oNozzleDiameter;
  79. extern ClCheckMode oCheckMode;
  80. extern ClCheckModel oCheckModel;
  81. extern ClCheckVersion oCheckVersion;
  82. extern ClCheckGcode oCheckGcode;
  83. void fCheckModeInit();
  84. void nozzle_diameter_check(uint16_t nDiameter);
  85. void printer_model_check(uint16_t nPrinterModel);
  86. void printer_smodel_check(char* pStrPos);
  87. void fw_version_check(const char *pVersion);
  88. void gcode_level_check(uint16_t nGcodeLevel);
  89. void fSetMmuMode(bool bMMu);
  90. #endif /* UTIL_H */