2018-10-09 20:33:54 +00:00
|
|
|
//! @file
|
2017-10-22 20:42:45 +00:00
|
|
|
#ifndef FSENSOR_H
|
|
|
|
#define FSENSOR_H
|
|
|
|
|
2018-07-20 23:57:41 +00:00
|
|
|
#include <inttypes.h>
|
2019-09-15 22:43:37 +00:00
|
|
|
#include "config.h"
|
2017-10-22 20:42:45 +00:00
|
|
|
|
2018-07-20 18:30:08 +00:00
|
|
|
|
2018-10-09 20:33:54 +00:00
|
|
|
// enable/disable flag
|
2018-07-20 23:57:41 +00:00
|
|
|
extern bool fsensor_enabled;
|
2018-10-09 20:33:54 +00:00
|
|
|
// not responding flag
|
2018-07-20 23:57:41 +00:00
|
|
|
extern bool fsensor_not_responding;
|
2020-02-05 14:17:19 +00:00
|
|
|
#ifdef PAT9125
|
|
|
|
// optical checking "chunk lenght" (already in steps)
|
|
|
|
extern int16_t fsensor_chunk_len;
|
|
|
|
// count of soft failures
|
2019-06-02 16:00:31 +00:00
|
|
|
extern uint8_t fsensor_softfail;
|
2020-02-05 14:17:19 +00:00
|
|
|
#endif
|
2018-07-19 18:55:38 +00:00
|
|
|
|
2018-10-09 20:33:54 +00:00
|
|
|
//! @name save restore printing
|
|
|
|
//! @{
|
2018-07-20 12:03:22 +00:00
|
|
|
extern void fsensor_stop_and_save_print(void);
|
2019-06-05 16:34:10 +00:00
|
|
|
//! restore print - restore position and heatup to original temperature
|
2018-07-20 12:03:22 +00:00
|
|
|
extern void fsensor_restore_print_and_continue(void);
|
2019-10-16 16:47:18 +00:00
|
|
|
//! split the current gcode stream to insert new instructions
|
|
|
|
extern void fsensor_checkpoint_print(void);
|
2018-10-09 20:33:54 +00:00
|
|
|
//! @}
|
2018-07-20 12:03:22 +00:00
|
|
|
|
2018-10-09 20:33:54 +00:00
|
|
|
//! initialize
|
2018-07-20 12:03:22 +00:00
|
|
|
extern void fsensor_init(void);
|
2017-10-24 17:45:15 +00:00
|
|
|
|
2020-02-05 14:17:19 +00:00
|
|
|
#ifdef PAT9125
|
2020-02-05 13:23:41 +00:00
|
|
|
//! update axis resolution
|
|
|
|
extern void fsensor_set_axis_steps_per_unit(float u);
|
2020-02-05 14:17:19 +00:00
|
|
|
#endif
|
2020-02-05 13:23:41 +00:00
|
|
|
|
2018-10-09 20:33:54 +00:00
|
|
|
//! @name enable/disable
|
|
|
|
//! @{
|
2019-09-15 22:43:37 +00:00
|
|
|
extern bool fsensor_enable(bool bUpdateEEPROM=true);
|
|
|
|
extern void fsensor_disable(bool bUpdateEEPROM=true);
|
2018-10-09 20:33:54 +00:00
|
|
|
//! @}
|
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
|
|
|
|
2018-07-20 12:03:22 +00:00
|
|
|
extern void fsensor_update(void);
|
2019-01-24 15:14:02 +00:00
|
|
|
#ifdef PAT9125
|
2018-10-09 20:33:54 +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-10-09 20:33:54 +00:00
|
|
|
//! @name autoload support
|
|
|
|
//! @{
|
2019-01-24 15:14:02 +00:00
|
|
|
|
2017-12-13 16:39:32 +00:00
|
|
|
extern void fsensor_autoload_check_start(void);
|
|
|
|
extern void fsensor_autoload_check_stop(void);
|
2019-01-24 15:00:52 +00:00
|
|
|
#endif //PAT9125
|
2017-12-13 16:39:32 +00:00
|
|
|
extern bool fsensor_check_autoload(void);
|
2018-10-09 20:33:54 +00:00
|
|
|
//! @}
|
2017-12-13 16:39:32 +00:00
|
|
|
|
2020-02-05 14:17:19 +00:00
|
|
|
#ifdef PAT9125
|
2018-10-09 20:33:54 +00:00
|
|
|
//! @name optical quality measurement support
|
|
|
|
//! @{
|
2020-02-05 14:17:19 +00:00
|
|
|
extern bool fsensor_oq_meassure_enabled;
|
2018-10-04 13:48:28 +00:00
|
|
|
extern void fsensor_oq_meassure_set(bool State);
|
2018-07-22 14:14:13 +00:00
|
|
|
extern void fsensor_oq_meassure_start(uint8_t skip);
|
2018-07-20 18:30:08 +00:00
|
|
|
extern void fsensor_oq_meassure_stop(void);
|
|
|
|
extern bool fsensor_oq_result(void);
|
2018-10-09 20:33:54 +00:00
|
|
|
//! @}
|
|
|
|
|
|
|
|
//! @name callbacks from stepper
|
|
|
|
//! @{
|
2019-06-01 17:59:39 +00:00
|
|
|
extern void fsensor_st_block_chunk(int cnt);
|
2019-06-03 09:48:36 +00:00
|
|
|
|
|
|
|
// There's really nothing to do in block_begin: the stepper ISR likely has
|
|
|
|
// called us already at the end of the last block, making this integration
|
|
|
|
// redundant. LA1.5 might not always do that during a coasting move, so attempt
|
|
|
|
// to drain fsensor_st_cnt anyway at the beginning of the new block.
|
|
|
|
#define fsensor_st_block_begin(rev) fsensor_st_block_chunk(0)
|
2018-10-09 20:33:54 +00:00
|
|
|
//! @}
|
2020-02-05 14:17:19 +00:00
|
|
|
#endif //PAT9125
|
2018-07-19 18:55:38 +00:00
|
|
|
|
2019-09-15 22:43:37 +00:00
|
|
|
|
|
|
|
#if IR_SENSOR_ANALOG
|
|
|
|
#define IR_SENSOR_STEADY 10 // [ms]
|
|
|
|
|
|
|
|
enum class ClFsensorPCB:uint_least8_t
|
|
|
|
{
|
|
|
|
_Old=0,
|
|
|
|
_Rev03b=1,
|
|
|
|
_Undef=EEPROM_EMPTY_VALUE
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class ClFsensorActionNA:uint_least8_t
|
|
|
|
{
|
|
|
|
_Continue=0,
|
|
|
|
_Pause=1,
|
|
|
|
_Undef=EEPROM_EMPTY_VALUE
|
|
|
|
};
|
|
|
|
|
|
|
|
extern ClFsensorPCB oFsensorPCB;
|
|
|
|
extern ClFsensorActionNA oFsensorActionNA;
|
|
|
|
|
|
|
|
extern bool fsensor_IR_check();
|
|
|
|
#endif //IR_SENSOR_ANALOG
|
|
|
|
|
2017-10-22 20:42:45 +00:00
|
|
|
#endif //FSENSOR_H
|