util.h 2.2 KB

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