Correct ifdefs for all IR sensor types
This commit is contained in:
parent
a256370c39
commit
bbe1b1145e
|
|
@ -1,3 +1,9 @@
|
||||||
#include "Filament_sensor.h"
|
#include "Filament_sensor.h"
|
||||||
|
|
||||||
|
#ifdef FILAMENT_SENSOR
|
||||||
|
#if FILAMENT_SENSOR_TYPE == FSENSOR_IR
|
||||||
|
IR_sensor fsensor;
|
||||||
|
#elif FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG
|
||||||
IR_sensor_analog fsensor;
|
IR_sensor_analog fsensor;
|
||||||
|
#endif
|
||||||
|
#endif //FILAMENT_SENSOR
|
||||||
|
|
@ -16,6 +16,11 @@
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
|
|
||||||
|
#define FSENSOR_IR 1
|
||||||
|
#define FSENSOR_IR_ANALOG 2
|
||||||
|
#define FSENSOR_PAT9125 3
|
||||||
|
|
||||||
|
#ifdef FILAMENT_SENSOR
|
||||||
class Filament_sensor {
|
class Filament_sensor {
|
||||||
public:
|
public:
|
||||||
virtual void init() = 0;
|
virtual void init() = 0;
|
||||||
|
|
@ -167,6 +172,7 @@ protected:
|
||||||
SensorActionOnError sensorActionOnError;
|
SensorActionOnError sensorActionOnError;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if (FILAMENT_SENSOR_TYPE == FSENSOR_IR) || (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
class IR_sensor: public Filament_sensor {
|
class IR_sensor: public Filament_sensor {
|
||||||
public:
|
public:
|
||||||
void init() {
|
void init() {
|
||||||
|
|
@ -207,6 +213,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
class IR_sensor_analog: public IR_sensor {
|
class IR_sensor_analog: public IR_sensor {
|
||||||
public:
|
public:
|
||||||
void init() {
|
void init() {
|
||||||
|
|
@ -403,5 +410,13 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
|
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_IR) || (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
|
|
||||||
|
#if FILAMENT_SENSOR_TYPE == FSENSOR_IR
|
||||||
|
extern IR_sensor fsensor;
|
||||||
|
#elif FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG
|
||||||
extern IR_sensor_analog fsensor;
|
extern IR_sensor_analog fsensor;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //FILAMENT_SENSOR
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ static FanCheck lcd_selftest_fan_auto(uint8_t _fan);
|
||||||
static bool lcd_selftest_fsensor();
|
static bool lcd_selftest_fsensor();
|
||||||
#endif //PAT9125
|
#endif //PAT9125
|
||||||
static bool selftest_irsensor();
|
static bool selftest_irsensor();
|
||||||
#ifdef IR_SENSOR_ANALOG
|
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
static bool lcd_selftest_IRsensor(bool bStandalone=false);
|
static bool lcd_selftest_IRsensor(bool bStandalone=false);
|
||||||
static void lcd_detect_IRsensor();
|
static void lcd_detect_IRsensor();
|
||||||
#endif //IR_SENSOR_ANALOG
|
#endif //IR_SENSOR_ANALOG
|
||||||
|
|
@ -1415,7 +1415,7 @@ static void lcd_menu_temperatures()
|
||||||
menu_back_if_clicked();
|
menu_back_if_clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (VOLT_BED_PIN) || defined (VOLT_PWR_PIN) || defined(IR_SENSOR_ANALOG)
|
#if defined (VOLT_BED_PIN) || defined (VOLT_PWR_PIN) || (defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG))
|
||||||
#define VOLT_DIV_R1 10000
|
#define VOLT_DIV_R1 10000
|
||||||
#define VOLT_DIV_R2 2370
|
#define VOLT_DIV_R2 2370
|
||||||
#define VOLT_DIV_FAC ((float)VOLT_DIV_R2 / (VOLT_DIV_R2 + VOLT_DIV_R1))
|
#define VOLT_DIV_FAC ((float)VOLT_DIV_R2 / (VOLT_DIV_R2 + VOLT_DIV_R1))
|
||||||
|
|
@ -1673,7 +1673,7 @@ static void lcd_support_menu()
|
||||||
MENU_ITEM_BACK_P(_i("Date:"));////MSG_DATE c=17
|
MENU_ITEM_BACK_P(_i("Date:"));////MSG_DATE c=17
|
||||||
MENU_ITEM_BACK_P(PSTR(__DATE__));
|
MENU_ITEM_BACK_P(PSTR(__DATE__));
|
||||||
|
|
||||||
#ifdef IR_SENSOR_ANALOG
|
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
MENU_ITEM_BACK_P(STR_SEPARATOR);
|
MENU_ITEM_BACK_P(STR_SEPARATOR);
|
||||||
MENU_ITEM_BACK_P(PSTR("Fil. sensor v.:"));
|
MENU_ITEM_BACK_P(PSTR("Fil. sensor v.:"));
|
||||||
MENU_ITEM_BACK_P(fsensor.getIRVersionText());
|
MENU_ITEM_BACK_P(fsensor.getIRVersionText());
|
||||||
|
|
@ -4692,7 +4692,7 @@ void lcd_hw_setup_menu(void) // can not be "static"
|
||||||
SETTINGS_NOZZLE;
|
SETTINGS_NOZZLE;
|
||||||
MENU_ITEM_SUBMENU_P(_i("Checks"), lcd_checking_menu); ////MSG_CHECKS c=18
|
MENU_ITEM_SUBMENU_P(_i("Checks"), lcd_checking_menu); ////MSG_CHECKS c=18
|
||||||
|
|
||||||
#ifdef IR_SENSOR_ANALOG
|
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
//! Fsensor Detection isn't ready for mmu yet it is temporarily disabled.
|
//! Fsensor Detection isn't ready for mmu yet it is temporarily disabled.
|
||||||
//! @todo Don't forget to remove this as soon Fsensor Detection works with mmu
|
//! @todo Don't forget to remove this as soon Fsensor Detection works with mmu
|
||||||
if(!mmu_enabled) MENU_ITEM_FUNCTION_P(PSTR("Fsensor Detection"), lcd_detect_IRsensor);
|
if(!mmu_enabled) MENU_ITEM_FUNCTION_P(PSTR("Fsensor Detection"), lcd_detect_IRsensor);
|
||||||
|
|
@ -6118,7 +6118,7 @@ void lcd_belttest()
|
||||||
}
|
}
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
|
|
||||||
#ifdef IR_SENSOR_ANALOG
|
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
// called also from marlin_main.cpp
|
// called also from marlin_main.cpp
|
||||||
void printf_IRSensorAnalogBoardChange(){
|
void printf_IRSensorAnalogBoardChange(){
|
||||||
printf_P(PSTR("Filament sensor board change detected: revision%S\n"), fsensor.getIRVersionText());
|
printf_P(PSTR("Filament sensor board change detected: revision%S\n"), fsensor.getIRVersionText());
|
||||||
|
|
@ -6190,7 +6190,7 @@ bool lcd_selftest()
|
||||||
uint8_t _progress = 0;
|
uint8_t _progress = 0;
|
||||||
bool _result = true;
|
bool _result = true;
|
||||||
bool _swapped_fan = false;
|
bool _swapped_fan = false;
|
||||||
#ifdef IR_SENSOR_ANALOG
|
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
//! Check if IR sensor is in unknown state, if so run Fsensor Detection
|
//! Check if IR sensor is in unknown state, if so run Fsensor Detection
|
||||||
//! As the Fsensor Detection isn't yet ready for the mmu2s we set temporarily the IR sensor 0.3 or older for mmu2s
|
//! As the Fsensor Detection isn't yet ready for the mmu2s we set temporarily the IR sensor 0.3 or older for mmu2s
|
||||||
//! @todo Don't forget to remove this as soon Fsensor Detection works with mmu
|
//! @todo Don't forget to remove this as soon Fsensor Detection works with mmu
|
||||||
|
|
@ -6202,7 +6202,7 @@ bool lcd_selftest()
|
||||||
fsensor.setSensorRevision(IR_sensor_analog::SensorRevision::_Old, true);
|
fsensor.setSensorRevision(IR_sensor_analog::SensorRevision::_Old, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //IR_SENSOR_ANALOG
|
#endif
|
||||||
lcd_wait_for_cool_down();
|
lcd_wait_for_cool_down();
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
lcd_puts_at_P(0, 0, _i("Self test start"));////MSG_SELFTEST_START c=20
|
lcd_puts_at_P(0, 0, _i("Self test start"));////MSG_SELFTEST_START c=20
|
||||||
|
|
@ -6412,7 +6412,7 @@ bool lcd_selftest()
|
||||||
#if 0
|
#if 0
|
||||||
// Intentionally disabled - that's why we moved the detection to runtime by just checking the two voltages.
|
// Intentionally disabled - that's why we moved the detection to runtime by just checking the two voltages.
|
||||||
// The idea is not to force the user to remove and insert the filament on an assembled printer.
|
// The idea is not to force the user to remove and insert the filament on an assembled printer.
|
||||||
//def IR_SENSOR_ANALOG
|
//defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
_progress = lcd_selftest_screen(TestScreen::Fsensor, _progress, 3, true, 2000); //check filament sensor
|
_progress = lcd_selftest_screen(TestScreen::Fsensor, _progress, 3, true, 2000); //check filament sensor
|
||||||
_result = lcd_selftest_IRsensor();
|
_result = lcd_selftest_IRsensor();
|
||||||
if (_result)
|
if (_result)
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ extern bool FarmOrUserECool();
|
||||||
#define SILENT_MODE_OFF SILENT_MODE_POWER
|
#define SILENT_MODE_OFF SILENT_MODE_POWER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IR_SENSOR_ANALOG
|
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||||
void printf_IRSensorAnalogBoardChange();
|
void printf_IRSensorAnalogBoardChange();
|
||||||
#endif //IR_SENSOR_ANALOG
|
#endif //IR_SENSOR_ANALOG
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
|
|
||||||
// Filament sensor
|
// Filament sensor
|
||||||
#define FILAMENT_SENSOR
|
#define FILAMENT_SENSOR
|
||||||
#define IR_SENSOR
|
#define FILAMENT_SENSOR_TYPE FSENSOR_IR
|
||||||
|
|
||||||
#define DEBUG_DCODE2
|
#define DEBUG_DCODE2
|
||||||
#define DEBUG_DCODE3
|
#define DEBUG_DCODE3
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
|
|
||||||
// Filament sensor
|
// Filament sensor
|
||||||
#define FILAMENT_SENSOR
|
#define FILAMENT_SENSOR
|
||||||
#define IR_SENSOR
|
#define FILAMENT_SENSOR_TYPE FSENSOR_IR
|
||||||
|
|
||||||
#define DEBUG_DCODE2
|
#define DEBUG_DCODE2
|
||||||
#define DEBUG_DCODE3
|
#define DEBUG_DCODE3
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@
|
||||||
|
|
||||||
// Filament sensor
|
// Filament sensor
|
||||||
#define FILAMENT_SENSOR
|
#define FILAMENT_SENSOR
|
||||||
#define IR_SENSOR
|
#define FILAMENT_SENSOR_TYPE FSENSOR_IR_ANALOG
|
||||||
|
|
||||||
// Backlash -
|
// Backlash -
|
||||||
//#define BACKLASH_X
|
//#define BACKLASH_X
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue