fsensor.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef FSENSOR_H
  2. #define FSENSOR_H
  3. #include "planner.h"
  4. #define FSENSOR_CHUNK_LEN 180 //filament sensor chunk length in steps - 0.64mm
  5. #define FSENSOR_ERR_MAX 10 //filament sensor maximum error count for runout detection
  6. //Optical quality meassurement params
  7. #define FSENSOR_OQ_MAX_ER 5 //maximum error count for loading (~150mm)
  8. #define FSENSOR_OQ_MIN_YD 2 //minimum yd per chunk
  9. #define FSENSOR_OQ_MAX_YD 200 //maximum yd per chunk
  10. #define FSENSOR_OQ_MAX_PD 3 //maximum positive deviation (= yd_max/yd_avg)
  11. #define FSENSOR_OQ_MAX_ND 5 //maximum negative deviation (= yd_avg/yd_min)
  12. //save restore printing
  13. extern void fsensor_stop_and_save_print(void);
  14. extern void fsensor_restore_print_and_continue(void);
  15. extern void fsensor_init(void);
  16. //enable/disable
  17. extern bool fsensor_enable(void);
  18. extern void fsensor_disable(void);
  19. extern bool fsensor_autoload_enabled;
  20. extern void fsensor_autoload_set(bool State);
  21. //update (perform M600 on filament runout)
  22. extern void fsensor_update(void);
  23. //setup pin-change interrupt
  24. extern void fsensor_setup_interrupt(void);
  25. //autoload support
  26. extern void fsensor_autoload_check_start(void);
  27. extern void fsensor_autoload_check_stop(void);
  28. extern bool fsensor_check_autoload(void);
  29. //optical quality meassurement support
  30. extern void fsensor_oq_meassure_start(void);
  31. extern void fsensor_oq_meassure_stop(void);
  32. extern bool fsensor_oq_result(void);
  33. //callbacks from stepper
  34. extern void fsensor_st_block_begin(block_t* bl);
  35. extern void fsensor_st_block_chunk(block_t* bl, int cnt);
  36. //minimum meassured chunk length in steps
  37. extern int16_t fsensor_chunk_len;
  38. //enable/disable flag
  39. extern bool fsensor_enabled;
  40. //watch runout flag
  41. extern bool fsensor_watch_runout;
  42. //not responding flag
  43. extern bool fsensor_not_responding;
  44. extern uint8_t fsensor_err_cnt;
  45. //autoload enable/disable flag
  46. extern bool fsensor_watch_autoload;
  47. //filament optical quality meassurement
  48. extern bool fsensor_oq_meassure;
  49. extern uint8_t fsensor_oq_skipchunk;
  50. extern uint32_t fsensor_oq_st_sum;
  51. extern uint32_t fsensor_oq_yd_sum;
  52. extern uint16_t fsensor_oq_er_sum;
  53. extern uint8_t fsensor_oq_er_max;
  54. extern uint16_t fsensor_oq_yd_min;
  55. extern uint16_t fsensor_oq_yd_max;
  56. #endif //FSENSOR_H