Add HOST_PROMPT_SUPPORT (#13039)

This commit is contained in:
InsanityAutomation
2019-02-12 16:55:47 -05:00
committed by Scott Lahteine
parent 0feeef2604
commit 7f1b69b0c8
189 changed files with 2076 additions and 3479 deletions

View File

@ -34,6 +34,10 @@
#include "../../module/servo.h"
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
#include "../../feature/host_actions.h"
#endif
inline void toggle_pins() {
const bool ignore_protection = parser.boolval('I');
const int repeat = parser.intval('R', 1),
@ -286,6 +290,9 @@ void GcodeSuite::M43() {
#if HAS_RESUME_CONTINUE
wait_for_user = true;
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), PSTR("Continue"));
#endif
KEEPALIVE_STATE(PAUSED_FOR_USER);
#endif

View File

@ -31,9 +31,17 @@
* M412: Enable / Disable filament runout detection
*/
void GcodeSuite::M412() {
if (parser.seen('S')) {
runout.reset();
runout.enabled = parser.value_bool();
if (parser.seen("HS"
#if ENABLED(HOST_ACTION_COMMANDS)
"R"
#endif
)) {
#if ENABLED(HOST_ACTION_COMMANDS)
if (parser.seen('H')) runout.host_handling = parser.value_bool();
#endif
const bool seenR = parser.seen('R'), seenS = parser.seen('S');
if (seenR || seenS) runout.reset();
if (seenS) runout.enabled = parser.value_bool();
}
else {
SERIAL_ECHO_START();

View File

@ -36,6 +36,10 @@ GcodeSuite gcode;
#include "../module/printcounter.h"
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
#include "../feature/host_actions.h"
#endif
#include "../Marlin.h" // for idle() and suspend_auto_report
millis_t GcodeSuite::previous_move_ms;
@ -128,27 +132,17 @@ void GcodeSuite::dwell(millis_t time) {
void GcodeSuite::G29_with_retry() {
uint8_t retries = G29_MAX_RETRIES;
while (G29()) { // G29 should return true for failed probes ONLY
if (retries--) {
#ifdef G29_ACTION_ON_RECOVER
host_action(PSTR(G29_ACTION_ON_RECOVER));
#endif
#ifdef G29_RECOVER_COMMANDS
process_subcommands_now_P(PSTR(G29_RECOVER_COMMANDS));
#endif
}
if (retries--) event_probe_recover();
else {
#ifdef G29_FAILURE_COMMANDS
process_subcommands_now_P(PSTR(G29_FAILURE_COMMANDS));
#endif
#ifdef G29_ACTION_ON_FAILURE
host_action(PSTR(G29_ACTION_ON_FAILURE));
#endif
#if ENABLED(G29_HALT_ON_FAILURE)
kill(PSTR(MSG_ERR_PROBING_FAILED));
#endif
event_probe_failure();
return;
}
}
#if ENABLED(HOST_PROMPT_SUPPORT)
if (host_prompt_reason == PROMPT_G29_RETRY) host_action_prompt_end();
#endif
#ifdef G29_SUCCESS_COMMANDS
process_subcommands_now_P(PSTR(G29_SUCCESS_COMMANDS));
#endif
@ -365,8 +359,15 @@ void GcodeSuite::process_parsed_command(
case 108: M108(); break; // M108: Cancel Waiting
case 112: M112(); break; // M112: Emergency Stop
case 410: M410(); break; // M410: Quickstop - Abort all the planned moves.
#if ENABLED(HOST_PROMPT_SUPPORT)
case 876: M876(); break; // M876: Handle Host prompt responses
#endif
#else
case 108: case 112: case 410: break;
case 108: case 112: case 410:
#if ENABLED(HOST_PROMPT_SUPPORT)
case 876:
#endif
break;
#endif
#if ENABLED(HOST_KEEPALIVE_FEATURE)

View File

@ -533,6 +533,9 @@ private:
static void M108();
static void M112();
static void M410();
#if ENABLED(HOST_PROMPT_SUPPORT)
static void M876();
#endif
#endif
static void M109();

View File

@ -132,13 +132,20 @@ void GcodeSuite::M115() {
#endif
);
// EMERGENCY_PARSER (M108, M112, M410)
// EMERGENCY_PARSER (M108, M112, M410, M876)
cap_line(PSTR("EMERGENCY_PARSER")
#if ENABLED(EMERGENCY_PARSER)
, true
#endif
);
// PROMPT SUPPORT (M876)
cap_line(PSTR("PROMPT_SUPPORT")
#if ENABLED(HOST_PROMPT_SUPPORT)
, true
#endif
);
// AUTOREPORT_SD_STATUS (M27 extension)
cap_line(PSTR("AUTOREPORT_SD_STATUS")
#if ENABLED(AUTO_REPORT_SD_STATUS)

View File

@ -0,0 +1,37 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(HOST_PROMPT_SUPPORT) && DISABLED(EMERGENCY_PARSER)
#include "../../feature/host_actions.h"
#include "../gcode.h"
#include "../../Marlin.h"
/**
* M876: Handle Prompt Response
*/
void GcodeSuite::M876() {
if (parser.seenval('S')) host_response_handler((uint8_t)parser.value_int());
}
#endif // HOST_PROMPT_SUPPORT && !EMERGENCY_PARSER

View File

@ -37,6 +37,10 @@
#include "../../feature/leds/printer_event_leds.h"
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
#include "../../feature/host_actions.h"
#endif
/**
* M0: Unconditional stop - Wait for user button press on LCD
* M1: Conditional stop - Wait for user button press on LCD
@ -82,6 +86,10 @@ void GcodeSuite::M0_M1() {
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true;
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M0/1 Break Called"), PSTR("Continue"));
#endif
if (ms > 0) {
ms += millis(); // wait until this time for a click
while (PENDING(millis(), ms) && wait_for_user) idle();

View File

@ -42,6 +42,10 @@
#include "../queue.h"
#endif
#if ENABLED(HOST_ACTION_COMMANDS)
#include "../../feature/host_actions.h"
#endif
/**
* M20: List SD card to serial output
*/
@ -103,8 +107,13 @@ void GcodeSuite::M24() {
print_job_timer.start();
}
#ifdef ACTION_ON_RESUME
host_action_resume();
#if ENABLED(HOST_ACTION_COMMANDS)
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_open(PROMPT_INFO, PSTR("Resume SD"));
#endif
#ifdef ACTION_ON_RESUME
host_action_resume();
#endif
#endif
ui.reset_status();
@ -121,14 +130,23 @@ void GcodeSuite::M25() {
#endif
#if ENABLED(PARK_HEAD_ON_PAUSE)
M125();
#else
print_job_timer.pause();
ui.reset_status();
#ifdef ACTION_ON_PAUSE
host_action_pause();
#if ENABLED(HOST_ACTION_COMMANDS)
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume"));
#endif
#ifdef ACTION_ON_PAUSE
host_action_pause();
#endif
#endif
#endif
}