Show FINDA state as N/A if last received response is older than 1s.
This commit is contained in:
parent
ba0362b7d5
commit
76c39ce689
3 changed files with 6 additions and 1 deletions
|
@ -70,6 +70,7 @@ uint8_t mmu_extruder = MMU_FILAMENT_UNKNOWN;
|
||||||
uint8_t tmp_extruder = MMU_FILAMENT_UNKNOWN;
|
uint8_t tmp_extruder = MMU_FILAMENT_UNKNOWN;
|
||||||
|
|
||||||
int8_t mmu_finda = -1;
|
int8_t mmu_finda = -1;
|
||||||
|
uint32_t mmu_last_finda_response = 0;
|
||||||
|
|
||||||
int16_t mmu_version = -1;
|
int16_t mmu_version = -1;
|
||||||
|
|
||||||
|
@ -264,6 +265,7 @@ void mmu_loop(void)
|
||||||
if (mmu_rx_ok() > 0)
|
if (mmu_rx_ok() > 0)
|
||||||
{
|
{
|
||||||
fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer
|
fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer
|
||||||
|
mmu_last_finda_response = _millis();
|
||||||
FDEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_finda);
|
FDEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_finda);
|
||||||
puts_P(PSTR("MMU - ENABLED"));
|
puts_P(PSTR("MMU - ENABLED"));
|
||||||
mmu_enabled = true;
|
mmu_enabled = true;
|
||||||
|
@ -376,6 +378,7 @@ void mmu_loop(void)
|
||||||
if (mmu_rx_ok() > 0)
|
if (mmu_rx_ok() > 0)
|
||||||
{
|
{
|
||||||
fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer
|
fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer
|
||||||
|
mmu_last_finda_response = _millis();
|
||||||
FDEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_finda);
|
FDEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_finda);
|
||||||
//printf_P(PSTR("Eact: %d\n"), int(e_active()));
|
//printf_P(PSTR("Eact: %d\n"), int(e_active()));
|
||||||
if (!mmu_finda && CHECK_FSENSOR && fsensor_enabled) {
|
if (!mmu_finda && CHECK_FSENSOR && fsensor_enabled) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ extern uint8_t mmu_extruder;
|
||||||
extern uint8_t tmp_extruder;
|
extern uint8_t tmp_extruder;
|
||||||
|
|
||||||
extern int8_t mmu_finda;
|
extern int8_t mmu_finda;
|
||||||
|
extern uint32_t mmu_last_finda_response;
|
||||||
extern bool ir_sensor_detected;
|
extern bool ir_sensor_detected;
|
||||||
|
|
||||||
extern int16_t mmu_version;
|
extern int16_t mmu_version;
|
||||||
|
|
|
@ -4016,7 +4016,8 @@ static void lcd_show_sensors_state()
|
||||||
uint8_t idler_state = STATE_NA;
|
uint8_t idler_state = STATE_NA;
|
||||||
|
|
||||||
pinda_state = READ(Z_MIN_PIN);
|
pinda_state = READ(Z_MIN_PIN);
|
||||||
if (mmu_enabled) {
|
if (mmu_enabled && ((_millis() - mmu_last_finda_response) < 1000ul) )
|
||||||
|
{
|
||||||
finda_state = mmu_finda;
|
finda_state = mmu_finda;
|
||||||
}
|
}
|
||||||
if (ir_sensor_detected) {
|
if (ir_sensor_detected) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue