Browse Source

🧑‍💻 Drop hostui.flag

FB4S_WIFI
Scott Lahteine 3 years ago
parent
commit
38484c6eb6
  1. 8
      Marlin/src/feature/host_actions.cpp
  2. 8
      Marlin/src/feature/host_actions.h
  3. 8
      Marlin/src/gcode/control/M111.cpp

8
Marlin/src/feature/host_actions.cpp

@ -39,10 +39,7 @@
HostUI hostui; HostUI hostui;
flag_t HostUI::flag;
void HostUI::action(FSTR_P const fstr, const bool eol) { void HostUI::action(FSTR_P const fstr, const bool eol) {
if (!flag.bits) return;
PORT_REDIRECT(SerialMask::All); PORT_REDIRECT(SerialMask::All);
SERIAL_ECHOPGM("//action:"); SERIAL_ECHOPGM("//action:");
SERIAL_ECHOF(fstr); SERIAL_ECHOF(fstr);
@ -96,21 +93,18 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
#endif #endif
void HostUI::notify(const char * const cstr) { void HostUI::notify(const char * const cstr) {
if (!flag.bits) return;
PORT_REDIRECT(SerialMask::All); PORT_REDIRECT(SerialMask::All);
action(F("notification "), false); action(F("notification "), false);
SERIAL_ECHOLN(cstr); SERIAL_ECHOLN(cstr);
} }
void HostUI::notify_P(PGM_P const pstr) { void HostUI::notify_P(PGM_P const pstr) {
if (!flag.bits) return;
PORT_REDIRECT(SerialMask::All); PORT_REDIRECT(SerialMask::All);
action(F("notification "), false); action(F("notification "), false);
SERIAL_ECHOLNPGM_P(pstr); SERIAL_ECHOLNPGM_P(pstr);
} }
void HostUI::prompt(FSTR_P const ptype, const bool eol/*=true*/) { void HostUI::prompt(FSTR_P const ptype, const bool eol/*=true*/) {
if (!flag.bits) return;
PORT_REDIRECT(SerialMask::All); PORT_REDIRECT(SerialMask::All);
action(F("prompt_"), false); action(F("prompt_"), false);
SERIAL_ECHOF(ptype); SERIAL_ECHOF(ptype);
@ -118,7 +112,6 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
} }
void HostUI::prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char/*='\0'*/) { void HostUI::prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char/*='\0'*/) {
if (!flag.bits) return;
prompt(ptype, false); prompt(ptype, false);
PORT_REDIRECT(SerialMask::All); PORT_REDIRECT(SerialMask::All);
SERIAL_CHAR(' '); SERIAL_CHAR(' ');
@ -127,7 +120,6 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
SERIAL_EOL(); SERIAL_EOL();
} }
void HostUI::prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char/*='\0'*/) { void HostUI::prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char/*='\0'*/) {
if (!flag.bits) return;
prompt_end(); prompt_end();
host_prompt_reason = reason; host_prompt_reason = reason;
prompt_plus(F("begin"), fstr, extra_char); prompt_plus(F("begin"), fstr, extra_char);

8
Marlin/src/feature/host_actions.h

@ -24,11 +24,6 @@
#include "../inc/MarlinConfigPre.h" #include "../inc/MarlinConfigPre.h"
#include "../HAL/shared/Marduino.h" #include "../HAL/shared/Marduino.h"
typedef union {
uint8_t bits;
struct { bool info:1, errors:1, debug:1; };
} flag_t;
#if ENABLED(HOST_PROMPT_SUPPORT) #if ENABLED(HOST_PROMPT_SUPPORT)
enum PromptReason : uint8_t { enum PromptReason : uint8_t {
@ -45,9 +40,6 @@ typedef union {
class HostUI { class HostUI {
public: public:
static flag_t flag;
HostUI() { flag.bits = 0xFF; }
static void action(FSTR_P const fstr, const bool eol=true); static void action(FSTR_P const fstr, const bool eol=true);
#ifdef ACTION_ON_KILL #ifdef ACTION_ON_KILL

8
Marlin/src/gcode/control/M111.cpp

@ -22,20 +22,12 @@
#include "../gcode.h" #include "../gcode.h"
#if ENABLED(HOST_ACTION_COMMANDS)
#include "../../feature/host_actions.h"
#endif
/** /**
* M111: Set the debug level * M111: Set the debug level
*/ */
void GcodeSuite::M111() { void GcodeSuite::M111() {
if (parser.seenval('S')) marlin_debug_flags = parser.value_byte(); if (parser.seenval('S')) marlin_debug_flags = parser.value_byte();
#if EITHER(HOST_ACTION_COMMANDS, HOST_PROMPT_SUPPORT)
if (parser.seenval('H')) hostui.flag.bits = parser.value_byte();
#endif
static PGMSTR(str_debug_1, STR_DEBUG_ECHO); static PGMSTR(str_debug_1, STR_DEBUG_ECHO);
static PGMSTR(str_debug_2, STR_DEBUG_INFO); static PGMSTR(str_debug_2, STR_DEBUG_INFO);
static PGMSTR(str_debug_4, STR_DEBUG_ERRORS); static PGMSTR(str_debug_4, STR_DEBUG_ERRORS);

Loading…
Cancel
Save