2017-10-10 09:35:20 +02:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2019-02-12 22:06:53 +01:00
|
|
|
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2017-10-10 09:35:20 +02:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
|
|
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* feature/runout.cpp - Runout sensor support
|
|
|
|
*/
|
|
|
|
|
2018-02-18 09:42:09 +01:00
|
|
|
#include "../inc/MarlinConfigPre.h"
|
2017-10-10 09:35:20 +02:00
|
|
|
|
2019-02-13 03:08:34 +01:00
|
|
|
#if HAS_FILAMENT_SENSOR
|
2017-10-10 09:35:20 +02:00
|
|
|
|
2018-02-18 09:42:09 +01:00
|
|
|
#include "runout.h"
|
2017-10-10 09:35:20 +02:00
|
|
|
|
2018-11-14 18:45:57 +01:00
|
|
|
FilamentMonitor runout;
|
2017-10-10 09:35:20 +02:00
|
|
|
|
2018-11-14 18:45:57 +01:00
|
|
|
bool FilamentMonitorBase::enabled = true,
|
2019-02-12 22:55:47 +01:00
|
|
|
FilamentMonitorBase::filament_ran_out; // = false
|
|
|
|
|
|
|
|
#if ENABLED(HOST_ACTION_COMMANDS)
|
|
|
|
bool FilamentMonitorBase::host_handling; // = false
|
|
|
|
#endif
|
2018-02-18 09:42:09 +01:00
|
|
|
|
2018-11-14 18:45:57 +01:00
|
|
|
/**
|
|
|
|
* Called by FilamentSensorSwitch::run when filament is detected.
|
|
|
|
* Called by FilamentSensorEncoder::block_completed when motion is detected.
|
|
|
|
*/
|
|
|
|
void FilamentSensorBase::filament_present(const uint8_t extruder) {
|
|
|
|
runout.filament_present(extruder); // calls response.filament_present(extruder)
|
2018-10-16 14:28:52 +02:00
|
|
|
}
|
2018-02-18 09:42:09 +01:00
|
|
|
|
2018-11-14 18:45:57 +01:00
|
|
|
#if ENABLED(FILAMENT_MOTION_SENSOR)
|
2018-11-14 23:54:05 +01:00
|
|
|
uint8_t FilamentSensorEncoder::motion_detected;
|
2018-11-14 18:45:57 +01:00
|
|
|
#endif
|
2018-02-18 09:42:09 +01:00
|
|
|
|
2019-05-04 06:53:15 +02:00
|
|
|
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
2018-10-16 14:28:52 +02:00
|
|
|
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
|
2018-11-14 18:45:57 +01:00
|
|
|
volatile float RunoutResponseDelayed::runout_mm_countdown[EXTRUDERS];
|
2018-10-16 14:28:52 +02:00
|
|
|
#else
|
2018-11-14 18:45:57 +01:00
|
|
|
int8_t RunoutResponseDebounced::runout_count; // = 0
|
2018-10-16 14:28:52 +02:00
|
|
|
#endif
|
2017-10-10 09:35:20 +02:00
|
|
|
|
2019-02-13 03:08:34 +01:00
|
|
|
#endif // HAS_FILAMENT_SENSOR
|