util.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #define e_CHECK_MODE_NULL 0xFF
  29. #define e_NOZZLE_DIAMETER_NULL 0xFF
  30. typedef enum
  31. {
  32. e_NOZZLE_DIAMETER_250,
  33. e_NOZZLE_DIAMETER_400,
  34. e_NOZZLE_DIAMETER_600
  35. } eNOZZLE_DIAMETER;
  36. typedef enum
  37. {
  38. e_CHECK_MODE_none,
  39. e_CHECK_MODE_warn,
  40. e_CHECK_MODE_strict
  41. } eCHECK_MODE;
  42. extern eNOZZLE_DIAMETER eNozzleDiameter;
  43. extern eCHECK_MODE eCheckMode;
  44. void fCheckModeInit();
  45. void nozzle_diameter_check(uint16_t nDiameter);
  46. #endif /* UTIL_H */