2017-10-22 20:42:45 +00:00
|
|
|
#ifndef FSENSOR_H
|
|
|
|
#define FSENSOR_H
|
|
|
|
|
2017-10-24 17:45:15 +00:00
|
|
|
#include "planner.h"
|
2017-10-22 20:42:45 +00:00
|
|
|
|
2018-07-19 18:55:38 +00:00
|
|
|
#define FSENSOR_CHUNK_LEN 180 //filament sensor chunk length in steps - 0.64mm
|
2018-07-20 18:30:08 +00:00
|
|
|
#define FSENSOR_ERR_MAX 10 //filament sensor maximum error count for runout detection
|
|
|
|
|
|
|
|
//Optical quality meassurement params
|
|
|
|
#define FSENSOR_OQ_MAX_ER 5 //maximum error count for loading (~150mm)
|
|
|
|
#define FSENSOR_OQ_MIN_YD 2 //minimum yd per chunk
|
|
|
|
#define FSENSOR_OQ_MAX_YD 200 //maximum yd per chunk
|
|
|
|
#define FSENSOR_OQ_MAX_PD 3 //maximum positive deviation (= yd_max/yd_avg)
|
|
|
|
#define FSENSOR_OQ_MAX_ND 5 //maximum negative deviation (= yd_avg/yd_min)
|
|
|
|
|
2018-07-19 18:55:38 +00:00
|
|
|
|
2017-10-24 17:45:15 +00:00
|
|
|
//save restore printing
|
2018-07-20 12:03:22 +00:00
|
|
|
extern void fsensor_stop_and_save_print(void);
|
|
|
|
extern void fsensor_restore_print_and_continue(void);
|
|
|
|
|
2018-07-20 21:48:00 +00:00
|
|
|
//initialize
|
2018-07-20 12:03:22 +00:00
|
|
|
extern void fsensor_init(void);
|
2017-10-24 17:45:15 +00:00
|
|
|
|
|
|
|
//enable/disable
|
2018-07-20 12:03:22 +00:00
|
|
|
extern bool fsensor_enable(void);
|
|
|
|
extern void fsensor_disable(void);
|
2017-10-24 17:45:15 +00:00
|
|
|
|
2018-07-20 21:48:00 +00:00
|
|
|
//autoload feature enabled
|
2018-07-20 12:03:22 +00:00
|
|
|
extern bool fsensor_autoload_enabled;
|
2018-07-19 18:55:38 +00:00
|
|
|
extern void fsensor_autoload_set(bool State);
|
2018-07-11 18:45:56 +00:00
|
|
|
|
2017-10-24 17:45:15 +00:00
|
|
|
//update (perform M600 on filament runout)
|
2018-07-20 12:03:22 +00:00
|
|
|
extern void fsensor_update(void);
|
2017-10-22 20:42:45 +00:00
|
|
|
|
2017-10-24 17:45:15 +00:00
|
|
|
//setup pin-change interrupt
|
2018-07-20 12:03:22 +00:00
|
|
|
extern void fsensor_setup_interrupt(void);
|
2017-10-22 20:42:45 +00:00
|
|
|
|
2018-07-20 18:30:08 +00:00
|
|
|
//autoload support
|
2017-12-13 16:39:32 +00:00
|
|
|
extern void fsensor_autoload_check_start(void);
|
|
|
|
extern void fsensor_autoload_check_stop(void);
|
|
|
|
extern bool fsensor_check_autoload(void);
|
|
|
|
|
2018-07-20 18:30:08 +00:00
|
|
|
//optical quality meassurement support
|
|
|
|
extern void fsensor_oq_meassure_start(void);
|
|
|
|
extern void fsensor_oq_meassure_stop(void);
|
|
|
|
extern bool fsensor_oq_result(void);
|
|
|
|
|
2017-10-24 17:45:15 +00:00
|
|
|
//callbacks from stepper
|
|
|
|
extern void fsensor_st_block_begin(block_t* bl);
|
|
|
|
extern void fsensor_st_block_chunk(block_t* bl, int cnt);
|
2017-10-22 20:42:45 +00:00
|
|
|
|
2017-10-24 17:45:15 +00:00
|
|
|
//minimum meassured chunk length in steps
|
|
|
|
extern int16_t fsensor_chunk_len;
|
2017-11-26 16:14:39 +00:00
|
|
|
//enable/disable flag
|
|
|
|
extern bool fsensor_enabled;
|
2018-07-19 18:55:38 +00:00
|
|
|
//watch runout flag
|
|
|
|
extern bool fsensor_watch_runout;
|
2017-12-11 17:17:25 +00:00
|
|
|
//not responding flag
|
|
|
|
extern bool fsensor_not_responding;
|
|
|
|
|
2018-07-20 21:48:00 +00:00
|
|
|
//error counter
|
2018-07-19 18:55:38 +00:00
|
|
|
extern uint8_t fsensor_err_cnt;
|
|
|
|
|
2017-12-13 16:39:32 +00:00
|
|
|
//autoload enable/disable flag
|
2018-07-20 12:03:22 +00:00
|
|
|
extern bool fsensor_watch_autoload;
|
2017-10-22 20:42:45 +00:00
|
|
|
|
2018-07-19 18:55:38 +00:00
|
|
|
|
2017-10-22 20:42:45 +00:00
|
|
|
#endif //FSENSOR_H
|