util.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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);
  76. void printer_smodel_check(const char* pStrPos);
  77. void fw_version_check(const char *pVersion);
  78. void gcode_level_check(uint16_t nGcodeLevel);
  79. void fSetMmuMode(bool bMMu);
  80. #define IP4_STR_SIZE 16
  81. extern void ip4_to_str(char* dest, uint8_t* IP);