fsensor.h 2.4 KB

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