Prusa3d Marlin fork
Public Types | Public Member Functions | Static Public Attributes | List of all members
IR_sensor_analog Class Reference
Inheritance diagram for IR_sensor_analog:
Inheritance graph
[legend]
Collaboration diagram for IR_sensor_analog:
Collaboration graph
[legend]

Public Types

enum class  SensorRevision : uint8_t { _Old = 0 , _Rev04 = 1 , _Undef = EEPROM_EMPTY_VALUE }
 
- Public Types inherited from Filament_sensor
enum class  State : uint8_t { disabled = 0 , initializing , ready , error }
 
enum class  SensorActionOnError : uint8_t { _Continue = 0 , _Pause = 1 , _Undef = EEPROM_EMPTY_VALUE }
 

Public Member Functions

void init ()
 
bool update ()
 
void voltUpdate (uint16_t raw)
 
uint16_t __attribute__ ((noinline)) getVoltRaw()
 
SensorRevision getSensorRevision () const
 
const char * __attribute__ ((noinline)) getIRVersionText()
 
void setSensorRevision (SensorRevision rev, bool updateEEPROM=false)
 
- Public Member Functions inherited from IR_sensor
void init ()
 
void deinit ()
 
bool update ()
 
bool getFilamentPresent () const
 
void settings_init ()
 
- Public Member Functions inherited from Filament_sensor
void setAutoLoadEnabled (bool state, bool updateEEPROM=false)
 
bool getAutoLoadEnabled () const
 
void setRunoutEnabled (bool state, bool updateEEPROM=false)
 
bool getRunoutEnabled () const
 
void setActionOnError (SensorActionOnError state, bool updateEEPROM=false)
 
SensorActionOnError getActionOnError () const
 
bool getFilamentLoadEvent () const
 
bool isError () const
 
bool isReady () const
 
bool isEnabled () const
 

Static Public Attributes

constexpr static uint16_t IRsensor_Ldiode_TRESHOLD = Voltage2Raw(0.3F)
 
constexpr static uint16_t IRsensor_Lmax_TRESHOLD = Voltage2Raw(1.5F)
 
constexpr static uint16_t IRsensor_Hmin_TRESHOLD = Voltage2Raw(3.0F)
 
constexpr static uint16_t IRsensor_Hopen_TRESHOLD = Voltage2Raw(4.6F)
 
constexpr static uint16_t IRsensor_VMax_TRESHOLD = Voltage2Raw(5.F)
 

Additional Inherited Members

- Static Public Member Functions inherited from IR_sensor
static bool probeOtherType ()
 
- Static Public Member Functions inherited from Filament_sensor
static void setEnabled (bool enabled)
 
- Protected Member Functions inherited from Filament_sensor
void settings_init_common ()
 
bool checkFilamentEvents ()
 
void triggerFilamentInserted ()
 
void triggerFilamentRemoved ()
 
void filRunout ()
 
void triggerError ()
 
- Protected Attributes inherited from Filament_sensor
State state
 
bool autoLoadEnabled
 
bool runoutEnabled
 
bool oldFilamentPresent
 
bool postponedLoadEvent
 
ShortTimer eventBlankingTimer
 
SensorActionOnError sensorActionOnError
 

Member Function Documentation

◆ update()

bool IR_sensor_analog::update ( )

The trouble is, I can hold the filament in the hole in such a way, that it creates the exact voltage to be detected as the new fsensor We can either fake it by extending the detection window to a looooong time or do some other countermeasures

what we want to detect: if minvolt gets below ~0.3V, it means there is an old fsensor if maxvolt gets above 4.6V, it means we either have an old fsensor or broken cables/fsensor So I'm waiting for a situation, when minVolt gets to range <0, 1.5> and maxVolt gets into range <3.0, 5> If and only if minVolt is in range <0.3, 1.5> and maxVolt is in range <3.0, 4.6>, I'm considering a situation with the new fsensor

If and only if minVolt is in range <0.0, 0.3> and maxVolt is in range <4.6, 5.0V>, I'm considering a situation with the old fsensor Note, we are not relying on one voltage here - getting just +5V can mean an old fsensor or a broken new sensor - that's why we need to have both voltages detected correctly to allow switching back to the old fsensor.


The documentation for this class was generated from the following files: