fsensor.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //! @file
  2. #ifndef FSENSOR_H
  3. #define FSENSOR_H
  4. #include <inttypes.h>
  5. #include "config.h"
  6. // enable/disable flag
  7. extern bool fsensor_enabled;
  8. // not responding flag
  9. extern bool fsensor_not_responding;
  10. #ifdef PAT9125
  11. // optical checking "chunk lenght" (already in steps)
  12. extern int16_t fsensor_chunk_len;
  13. // count of soft failures
  14. extern uint8_t fsensor_softfail;
  15. #endif
  16. //! @name save restore printing
  17. //! @{
  18. extern void fsensor_stop_and_save_print(void);
  19. //! restore print - restore position and heatup to original temperature
  20. extern void fsensor_restore_print_and_continue(void);
  21. //! split the current gcode stream to insert new instructions
  22. extern void fsensor_checkpoint_print(void);
  23. //! @}
  24. //! initialize
  25. extern void fsensor_init(void);
  26. #ifdef PAT9125
  27. //! update axis resolution
  28. extern void fsensor_set_axis_steps_per_unit(float u);
  29. #endif
  30. //! @name enable/disable
  31. //! @{
  32. extern bool fsensor_enable(bool bUpdateEEPROM=true);
  33. extern void fsensor_disable(bool bUpdateEEPROM=true);
  34. //! @}
  35. //autoload feature enabled
  36. extern bool fsensor_autoload_enabled;
  37. extern void fsensor_autoload_set(bool State);
  38. extern void fsensor_update(void);
  39. #ifdef PAT9125
  40. //! setup pin-change interrupt
  41. extern void fsensor_setup_interrupt(void);
  42. //! @name autoload support
  43. //! @{
  44. extern void fsensor_autoload_check_start(void);
  45. extern void fsensor_autoload_check_stop(void);
  46. #endif //PAT9125
  47. extern bool fsensor_check_autoload(void);
  48. //! @}
  49. #ifdef PAT9125
  50. //! @name optical quality measurement support
  51. //! @{
  52. extern bool fsensor_oq_meassure_enabled;
  53. extern void fsensor_oq_meassure_set(bool State);
  54. extern void fsensor_oq_meassure_start(uint8_t skip);
  55. extern void fsensor_oq_meassure_stop(void);
  56. extern bool fsensor_oq_result(void);
  57. //! @}
  58. //! @name callbacks from stepper
  59. //! @{
  60. extern void fsensor_st_block_chunk(int cnt);
  61. // debugging
  62. extern uint8_t fsensor_log;
  63. // There's really nothing to do in block_begin: the stepper ISR likely has
  64. // called us already at the end of the last block, making this integration
  65. // redundant. LA1.5 might not always do that during a coasting move, so attempt
  66. // to drain fsensor_st_cnt anyway at the beginning of the new block.
  67. #define fsensor_st_block_begin(rev) fsensor_st_block_chunk(0)
  68. //! @}
  69. #endif //PAT9125
  70. #ifdef IR_SENSOR_ANALOG
  71. #define IR_SENSOR_STEADY 10 // [ms]
  72. enum class ClFsensorPCB:uint_least8_t
  73. {
  74. _Old=0,
  75. _Rev04=1,
  76. _Undef=EEPROM_EMPTY_VALUE
  77. };
  78. enum class ClFsensorActionNA:uint_least8_t
  79. {
  80. _Continue=0,
  81. _Pause=1,
  82. _Undef=EEPROM_EMPTY_VALUE
  83. };
  84. extern ClFsensorPCB oFsensorPCB;
  85. extern ClFsensorActionNA oFsensorActionNA;
  86. extern bool fsensor_IR_check();
  87. #endif //IR_SENSOR_ANALOG
  88. #endif //FSENSOR_H