Fan tachometer support (#23086, #23180, #23199)

Co-Authored-By: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
Giuliano Zaro
2021-11-23 21:01:53 +01:00
committed by Scott Lahteine
parent 884308f964
commit af1d603374
21 changed files with 592 additions and 44 deletions

View File

@ -22,7 +22,7 @@
#include "../gcode.h"
#include "../../lcd/marlinui.h" // for lcd_reset_alert_level
#include "../../lcd/marlinui.h" // for ui.reset_alert_level
#include "../../MarlinCore.h" // for marlin_state
#include "../queue.h" // for flush_and_request_resend

View File

@ -65,6 +65,10 @@ GcodeSuite gcode;
#include "../feature/password/password.h"
#endif
#if HAS_FANCHECK
#include "../feature/fancheck.h"
#endif
#include "../MarlinCore.h" // for idle, kill
// Inactivity shutdown
@ -296,6 +300,8 @@ void GcodeSuite::dwell(millis_t time) {
* Process the parsed command and dispatch it to its handler
*/
void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
TERN_(HAS_FANCHECK, fan_check.check_deferred_error());
KEEPALIVE_STATE(IN_HANDLER);
/**
@ -577,6 +583,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 113: M113(); break; // M113: Set Host Keepalive interval
#endif
#if HAS_FANCHECK
case 123: M123(); break; // M123: Report fan states or set fans auto-report interval
#endif
#if HAS_HEATED_BED
case 140: M140(); break; // M140: Set bed temperature
case 190: M190(); break; // M190: Wait for bed temperature to reach target

View File

@ -156,6 +156,7 @@
* M121 - Disable endstops detection.
*
* M122 - Debug stepper (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660 or L6470)
* M123 - Report fan tachometers. (Requires En_FAN_TACHO_PIN) Optionally set auto-report interval. (Requires AUTO_REPORT_FANS)
* M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE)
*
* M126 - Solenoid Air Valve Open. (Requires BARICUDA)
@ -737,6 +738,10 @@ private:
static void M120();
static void M121();
#if HAS_FANCHECK
static void M123();
#endif
#if ENABLED(PARK_HEAD_ON_PAUSE)
static void M125();
#endif

View File

@ -0,0 +1,48 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* 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 <https://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if HAS_FANCHECK
#include "../gcode.h"
#include "../../feature/fancheck.h"
/**
* M123: Report fan states -or- set interval for auto-report
*
* S<seconds> : Set auto-report interval
*/
void GcodeSuite::M123() {
#if ENABLED(AUTO_REPORT_FANS)
if (parser.seenval('S')) {
fan_check.auto_reporter.set_interval(parser.value_byte());
return;
}
#endif
fan_check.print_fan_states();
}
#endif // HAS_FANCHECK