Prusa MINI Firmware overview
filament_sensor.h File Reference

Go to the source code of this file.

Enumerations

enum  fsensor_t {
  FS_NOT_INICIALIZED, FS_HAS_FILAMENT, FS_NO_FILAMENT, FS_NOT_CONNECTED,
  FS_DISABLED
}
 

Functions

fsensor_t fs_get_state ()
 
int fs_did_filament_runout ()
 
void fs_send_M600_on_edge ()
 
void fs_send_M600_on_level ()
 
void fs_send_M600_never ()
 
void fs_enable ()
 
void fs_disable ()
 
fsensor_t fs_wait_inicialized ()
 
void fs_init_on_edge ()
 
void fs_init_on_level ()
 
void fs_init_never ()
 
void fs_cycle ()
 

Enumeration Type Documentation

◆ fsensor_t

enum fsensor_t
Enumerator
FS_NOT_INICIALIZED 
FS_HAS_FILAMENT 
FS_NO_FILAMENT 
FS_NOT_CONNECTED 
FS_DISABLED 
17  {
18  FS_NOT_INICIALIZED, //enable enters this state too
23 } fsensor_t;

Function Documentation

◆ fs_get_state()

fsensor_t fs_get_state ( )
67  {
68  return state;
69 }
Here is the caller graph for this function:

◆ fs_did_filament_runout()

int fs_did_filament_runout ( )
72  {
73  return state == FS_NO_FILAMENT;
74 }
Here is the caller graph for this function:

◆ fs_send_M600_on_edge()

void fs_send_M600_on_edge ( )
76  {
78 }
Here is the caller graph for this function:

◆ fs_send_M600_on_level()

void fs_send_M600_on_level ( )
80  {
82 }
Here is the caller graph for this function:

◆ fs_send_M600_never()

void fs_send_M600_never ( )
84  {
86 }
Here is the caller graph for this function:

◆ fs_enable()

void fs_enable ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fs_disable()

void fs_disable ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fs_wait_inicialized()

fsensor_t fs_wait_inicialized ( )
104  {
105  fsensor_t ret = fs_get_state();
106  while (ret == FS_NOT_INICIALIZED) {
107  osDelay(0); // switch to other threads
108  ret = fs_get_state();
109  }
110  return ret;
111 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fs_init_on_edge()

void fs_init_on_edge ( )
124  {
125  _init();
127 }
Here is the call graph for this function:

◆ fs_init_on_level()

void fs_init_on_level ( )
128  {
129  _init();
131 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fs_init_never()

void fs_init_never ( )
132  {
133  _init();
135 }
Here is the call graph for this function:

◆ fs_cycle()

void fs_cycle ( )
185  {
186  //sensor is disabled (only init can enable it)
187  if (state == FS_DISABLED)
188  return;
189 
190  //sensor is enabled
191  if (status.meas_cycle == 0) {
192  _cycle0();
193  } else {
194  _cycle1();
195  }
196 
197  //clear M600_sent status if marlin is paused
199  status.M600_sent = 0;
200  }
201 }
Here is the call graph for this function:
Here is the caller graph for this function:
M600_on_edge
Definition: filament_sensor.c:27
fs_send_M600_on_edge
void fs_send_M600_on_edge()
Definition: filament_sensor.c:76
variant8_ui8
variant8_t variant8_ui8(uint8_t ui8)
Definition: variant8.c:18
status_t::meas_cycle
uint8_t meas_cycle
Definition: filament_sensor.c:35
EEVAR_FSENSOR_ENABLED
#define EEVAR_FSENSOR_ENABLED
Definition: eeprom.h:17
FS_DISABLED
Definition: filament_sensor.h:22
state
static volatile fsensor_t state
Definition: filament_sensor.c:23
eeprom_set_var
void eeprom_set_var(uint8_t id, variant8_t var)
Definition: eeprom.c:88
fs_send_M600_never
void fs_send_M600_never()
Definition: filament_sensor.c:84
FS_NOT_INICIALIZED
Definition: filament_sensor.h:18
_disable
static void _disable()
Definition: filament_sensor.c:59
osDelay
osStatus osDelay(uint32_t millisec)
Wait for Timeout (Time Delay)
Definition: cmsis_os.c:365
MARLIN_VAR_WAITUSER
#define MARLIN_VAR_WAITUSER
Definition: marlin_vars.h:28
FS_HAS_FILAMENT
Definition: filament_sensor.h:19
taskENTER_CRITICAL
#define taskENTER_CRITICAL()
Definition: task.h:217
_cycle1
static void _cycle1()
Definition: filament_sensor.c:177
fs_send_M600_on_level
void fs_send_M600_on_level()
Definition: filament_sensor.c:80
FS_NO_FILAMENT
Definition: filament_sensor.h:20
fs_get_state
fsensor_t fs_get_state()
Definition: filament_sensor.c:67
marlin_update_vars
marlin_vars_t * marlin_update_vars(uint64_t msk)
Definition: marlin_client.c:368
MARLIN_VAR_MSK
#define MARLIN_VAR_MSK(v_id)
Definition: marlin_vars.h:35
status_t::M600_sent
uint8_t M600_sent
Definition: filament_sensor.c:33
M600_never
Definition: filament_sensor.c:29
status_t::send_M600_on
uint8_t send_M600_on
Definition: filament_sensor.c:34
M600_on_level
Definition: filament_sensor.c:28
status
static status_t status
Definition: filament_sensor.c:37
FS_NOT_CONNECTED
Definition: filament_sensor.h:21
_cycle0
static void _cycle0()
Definition: filament_sensor.c:147
fsensor_t
fsensor_t
Definition: filament_sensor.h:17
taskEXIT_CRITICAL
#define taskEXIT_CRITICAL()
Definition: task.h:232
_init
static void _init()
Definition: filament_sensor.c:115
_enable
static void _enable()
Definition: filament_sensor.c:52