Enable Analog IR sensor again
This commit is contained in:
parent
f5b9d2ac2e
commit
f6135f2ed1
|
|
@ -5,21 +5,17 @@
|
|||
#include "Configuration_var.h"
|
||||
#include "pins.h"
|
||||
|
||||
#if (defined(VOLT_IR_PIN) && defined(IR_SENSOR))
|
||||
// TODO: IR_SENSOR_ANALOG currently disabled as being incompatible with the new thermal regulation
|
||||
// # define IR_SENSOR_ANALOG
|
||||
#endif
|
||||
|
||||
//ADC configuration
|
||||
#ifndef IR_SENSOR_ANALOG
|
||||
#define ADC_CHAN_MSK 0b0000001001011111 //used AD channels bit mask (0,1,2,3,4,6,9)
|
||||
#define ADC_DIDR_MSK 0b0000001001011111 //AD channels DIDR mask (1 ~ disabled digital input)
|
||||
#define ADC_CHAN_CNT 7 //number of used channels)
|
||||
#else //!IR_SENSOR_ANALOG
|
||||
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
#define ADC_CHAN_MSK 0b0000001101011111 //used AD channels bit mask (0,1,2,3,4,6,8,9)
|
||||
#define ADC_DIDR_MSK 0b0000001001011111 //AD channels DIDR mask (1 ~ disabled digital input)
|
||||
#define ADC_CHAN_CNT 8 //number of used channels)
|
||||
#endif //!IR_SENSOR_ANALOG
|
||||
#else
|
||||
#define ADC_CHAN_MSK 0b0000001001011111 //used AD channels bit mask (0,1,2,3,4,6,9)
|
||||
#define ADC_DIDR_MSK 0b0000001001011111 //AD channels DIDR mask (1 ~ disabled digital input)
|
||||
#define ADC_CHAN_CNT 7 //number of used channels)
|
||||
#endif
|
||||
#define ADC_OVRSAMPL 16 //oversampling multiplier
|
||||
#define ADC_CALLBACK adc_callback //callback function ()
|
||||
|
||||
|
|
|
|||
|
|
@ -2093,9 +2093,9 @@ void adc_callback()
|
|||
#ifdef VOLT_BED_PIN
|
||||
current_voltage_raw_bed = adc_values[ADC_PIN_IDX(VOLT_BED_PIN)]; // 6->9
|
||||
#endif
|
||||
#ifdef IR_SENSOR_ANALOG
|
||||
current_voltage_raw_IR = adc_values[ADC_PIN_IDX(VOLT_IR_PIN)];
|
||||
#endif //IR_SENSOR_ANALOG
|
||||
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
fsensor.voltUpdate(adc_values[ADC_PIN_IDX(VOLT_IR_PIN)]);
|
||||
#endif //defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
adc_values_ready = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,10 +62,6 @@ extern int current_voltage_raw_pwr;
|
|||
extern int current_voltage_raw_bed;
|
||||
#endif
|
||||
|
||||
#ifdef IR_SENSOR_ANALOG
|
||||
extern uint16_t current_voltage_raw_IR;
|
||||
#endif //IR_SENSOR_ANALOG
|
||||
|
||||
extern bool bedPWMDisabled;
|
||||
|
||||
#ifdef PIDTEMP
|
||||
|
|
|
|||
|
|
@ -1410,12 +1410,12 @@ static void lcd_menu_voltages()
|
|||
float volt_bed = VOLT_DIV_REF * ((float)current_voltage_raw_bed / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
|
||||
lcd_home();
|
||||
lcd_printf_P(PSTR(" PWR: %4.1fV\n" " BED: %4.1fV"), volt_pwr, volt_bed);
|
||||
#ifdef IR_SENSOR_ANALOG
|
||||
lcd_printf_P(PSTR("\n IR : %3.1fV"), fsensor.Raw2Voltage(fsensor.getVoltRaw()));
|
||||
#endif //IR_SENSOR_ANALOG
|
||||
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
lcd_printf_P(PSTR("\n IR : %3.1fV"), Raw2Voltage(fsensor.getVoltRaw()));
|
||||
#endif //defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
menu_back_if_clicked();
|
||||
}
|
||||
#endif //defined (VOLT_BED_PIN) || defined (VOLT_PWR_PIN) || defined(IR_SENSOR_ANALOG)
|
||||
#endif //defined (VOLT_BED_PIN) || defined (VOLT_PWR_PIN) || (defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG))
|
||||
|
||||
#ifdef TMC2130
|
||||
//! @brief Show Belt Status
|
||||
|
|
@ -1648,7 +1648,7 @@ static void lcd_support_menu()
|
|||
MENU_ITEM_BACK_P(STR_SEPARATOR);
|
||||
MENU_ITEM_BACK_P(PSTR("Fil. sensor v.:"));
|
||||
MENU_ITEM_BACK_P(fsensor.getIRVersionText());
|
||||
#endif // IR_SENSOR_ANALOG
|
||||
#endif //defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
|
||||
MENU_ITEM_BACK_P(STR_SEPARATOR);
|
||||
if (MMU2::mmu2.Enabled())
|
||||
|
|
@ -4505,7 +4505,7 @@ void lcd_hw_setup_menu(void) // can not be "static"
|
|||
//! 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
|
||||
if(!MMU2::mmu2.Enabled()) MENU_ITEM_FUNCTION_P(PSTR("Fsensor Detection"), lcd_detect_IRsensor);
|
||||
#endif //IR_SENSOR_ANALOG
|
||||
#endif //defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
|
||||
if (_md->experimental_menu_visibility)
|
||||
{
|
||||
|
|
@ -6010,7 +6010,7 @@ static void lcd_detect_IRsensor(){
|
|||
lcd_show_fullscreen_message_and_wait_P(_i("Verification failed, remove the filament and try again."));////MSG_FIL_FAILED c=20 r=4
|
||||
}
|
||||
}
|
||||
#endif //IR_SENSOR_ANALOG
|
||||
#endif //defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
|
||||
static void lcd_selftest_v()
|
||||
{
|
||||
|
|
@ -6236,17 +6236,6 @@ bool lcd_selftest()
|
|||
_progress = lcd_selftest_screen(TestScreen::FsensorOk, _progress, 3, true, 2000); //fil sensor OK
|
||||
}
|
||||
#endif //FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125
|
||||
#if 0
|
||||
// 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.
|
||||
//defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
_progress = lcd_selftest_screen(TestScreen::Fsensor, _progress, 3, true, 2000); //check filament sensor
|
||||
_result = lcd_selftest_IRsensor();
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(TestScreen::FsensorOk, _progress, 3, true, 2000); //filament sensor OK
|
||||
}
|
||||
#endif //IR_SENSOR_ANALOG
|
||||
}
|
||||
}
|
||||
#endif //FILAMENT_SENSOR
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ extern bool FarmOrUserECool();
|
|||
|
||||
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
void printf_IRSensorAnalogBoardChange();
|
||||
#endif //IR_SENSOR_ANALOG
|
||||
#endif //defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
|
||||
|
||||
extern int8_t SilentModeMenu;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue