Optional M42/M226; Add more features filters (#19664)

This commit is contained in:
Scott Lahteine
2020-10-09 16:42:23 -05:00
committed by GitHub
parent 631457ffea
commit 0988af453c
11 changed files with 111 additions and 78 deletions

View File

@ -3559,6 +3559,11 @@
//
//#define M100_FREE_MEMORY_WATCHER
//
// M42 - Set pin states
//
//#define DIRECT_PIN_CONTROL
//
// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
//

View File

@ -20,6 +20,10 @@
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(DIRECT_PIN_CONTROL)
#include "../gcode.h"
#include "../../MarlinCore.h" // for pin_is_protected and idle()
#include "../../module/stepper.h"
@ -50,3 +54,5 @@ void GcodeSuite::M226() {
} // pin_state -1 0 1 && pin > -1
} // parser.seen('P')
}
#endif // DIRECT_PIN_CONTROL

View File

@ -20,9 +20,12 @@
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(DIRECT_PIN_CONTROL)
#include "../gcode.h"
#include "../../MarlinCore.h" // for pin_is_protected
#include "../../inc/MarlinConfig.h"
#if HAS_FAN
#include "../../module/temperature.h"
@ -96,3 +99,5 @@ void GcodeSuite::M42() {
extDigitalWrite(pin, pin_status);
analogWrite(pin, pin_status);
}
#endif // DIRECT_PIN_CONTROL

View File

@ -445,7 +445,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#endif // SDSUPPORT
case 31: M31(); break; // M31: Report time since the start of SD print or last M109
case 42: M42(); break; // M42: Change pin state
#if ENABLED(DIRECT_PIN_CONTROL)
case 42: M42(); break; // M42: Change pin state
#endif
#if ENABLED(PINS_DEBUGGING)
case 43: M43(); break; // M43: Read pin state
@ -620,7 +623,9 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 221: M221(); break; // M221: Set Flow Percentage
#endif
case 226: M226(); break; // M226: Wait until a pin reaches a state
#if ENABLED(DIRECT_PIN_CONTROL)
case 226: M226(); break; // M226: Wait until a pin reaches a state
#endif
#if HAS_SERVOS
case 280: M280(); break; // M280: Set servo position absolute

View File

@ -109,7 +109,7 @@
* The '#' is necessary when calling from within sd files, as it stops buffer prereading
* M33 - Get the longname version of a path. (Requires LONG_FILENAME_HOST_SUPPORT)
* M34 - Set SD Card sorting options. (Requires SDCARD_SORT_ALPHA)
* M42 - Change pin status via gcode: M42 P<pin> S<value>. LED pin assumed if P is omitted.
* M42 - Change pin status via gcode: M42 P<pin> S<value>. LED pin assumed if P is omitted. (Requires DIRECT_PIN_CONTROL)
* M43 - Display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
* M48 - Measure Z Probe repeatability: M48 P<points> X<pos> Y<pos> V<level> E<engage> L<legs> S<chizoid>. (Requires Z_MIN_PROBE_REPEATABILITY_TEST)
* M73 - Set the progress percentage. (Requires LCD_SET_PROGRESS_MANUALLY)
@ -183,7 +183,7 @@
* M220 - Set Feedrate Percentage: "M220 S<percent>" (i.e., "FR" on the LCD)
* Use "M220 B" to back up the Feedrate Percentage and "M220 R" to restore it. (Requires PRUSA_MMU2)
* M221 - Set Flow Percentage: "M221 S<percent>"
* M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>"
* M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>" (Requires DIRECT_PIN_CONTROL)
* M240 - Trigger a camera to take a photograph. (Requires PHOTO_GCODE)
* M250 - Set LCD contrast: "M250 C<contrast>" (0-63). (Requires LCD support)
* M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS)
@ -544,8 +544,7 @@ private:
#endif
#endif
static void M42();
TERN_(DIRECT_PIN_CONTROL, static void M42());
TERN_(PINS_DEBUGGING, static void M43());
TERN_(Z_MIN_PROBE_REPEATABILITY_TEST, static void M48());
@ -673,7 +672,7 @@ private:
static void M221();
#endif
static void M226();
TERN_(DIRECT_PIN_CONTROL, static void M226());
TERN_(PHOTO_GCODE, static void M240());

View File

@ -27,21 +27,31 @@
#include "MarlinConfigPre.h"
#include "../HAL/HAL.h"
#ifndef __MARLIN_DEPS__
#include "../HAL/HAL.h"
#endif
#include "../pins/pins.h"
#include HAL_PATH(../HAL, timers.h)
#include HAL_PATH(../HAL, spi_pins.h)
#ifndef __MARLIN_DEPS__
#include HAL_PATH(../HAL, timers.h)
#include HAL_PATH(../HAL, spi_pins.h)
#endif
#include "Conditionals_post.h"
#include HAL_PATH(../HAL, inc/Conditionals_post.h)
#include "../core/types.h" // Ahead of sanity-checks
#ifndef __MARLIN_DEPS__
#include "SanityCheck.h"
#include HAL_PATH(../HAL, inc/SanityCheck.h)
#include HAL_PATH(../HAL, inc/Conditionals_post.h)
// Include all core headers
#include "../core/language.h"
#include "../core/utility.h"
#include "../core/serial.h"
#include "../core/types.h" // Ahead of sanity-checks
#include "SanityCheck.h"
#include HAL_PATH(../HAL, inc/SanityCheck.h)
// Include all core headers
#include "../core/language.h"
#include "../core/utility.h"
#include "../core/serial.h"
#endif

View File

@ -30,7 +30,9 @@
//
#include <stdint.h>
#include "../HAL/platforms.h"
#ifndef __MARLIN_DEPS__
#include "../HAL/platforms.h"
#endif
#include "../core/boards.h"
#include "../core/macros.h"
@ -45,10 +47,16 @@
#include "Version.h"
#include "Conditionals_LCD.h"
#include HAL_PATH(../HAL, inc/Conditionals_LCD.h)
#ifndef __MARLIN_DEPS__
#include HAL_PATH(../HAL, inc/Conditionals_LCD.h)
#endif
#include "../core/drivers.h"
#include "../../Configuration_adv.h"
#include "Conditionals_adv.h"
#include HAL_PATH(../HAL, inc/Conditionals_adv.h)
#ifndef __MARLIN_DEPS__
#include HAL_PATH(../HAL, inc/Conditionals_adv.h)
#endif

View File

@ -52,7 +52,7 @@
#define HAS_FREE_AUX2_PINS !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD))
// Test the target within the included pins file
#ifdef __MARLIN_PREBUILD__
#ifdef __MARLIN_DEPS__
#define NOT_TARGET(V...) 0
#else
#define NOT_TARGET(V...) NONE(V)