fsensor.h 2.4 KB

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