Fix Host Keepalive serial target (#21283)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
parent
aa054471f2
commit
1b9ff68f8c
@ -21,9 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
|
|
||||||
#include <HardwareSerial.h>
|
#include <HardwareSerial.h>
|
||||||
|
|
||||||
|
#include "../shared/Marduino.h"
|
||||||
#include "../../core/serial_hook.h"
|
#include "../../core/serial_hook.h"
|
||||||
|
|
||||||
class FlushableHardwareSerial : public HardwareSerial {
|
class FlushableHardwareSerial : public HardwareSerial {
|
||||||
@ -32,5 +32,3 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern Serial0Type<FlushableHardwareSerial> flushableSerial;
|
extern Serial0Type<FlushableHardwareSerial> flushableSerial;
|
||||||
|
|
||||||
#endif // ARDUINO_ARCH_ESP32
|
|
||||||
|
@ -62,7 +62,7 @@ extern uint8_t marlin_debug_flags;
|
|||||||
//
|
//
|
||||||
// Serial redirection
|
// Serial redirection
|
||||||
//
|
//
|
||||||
#define SERIAL_ALL 0x7F
|
#define SERIAL_ALL 0xFF
|
||||||
#if HAS_MULTI_SERIAL
|
#if HAS_MULTI_SERIAL
|
||||||
#define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p)
|
#define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p)
|
||||||
#define _PORT_RESTORE(n,p) RESTORE(n)
|
#define _PORT_RESTORE(n,p) RESTORE(n)
|
||||||
|
@ -165,7 +165,7 @@ struct RuntimeSerial : public SerialBase< RuntimeSerial<SerialT> >, public Seria
|
|||||||
RuntimeSerial(const bool e, Args... args) : BaseClassT(e), SerialT(args...), writeHook(0), eofHook(0), userPointer(0) {}
|
RuntimeSerial(const bool e, Args... args) : BaseClassT(e), SerialT(args...), writeHook(0), eofHook(0), userPointer(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// A class that's duplicating its output conditionally to 2 serial interface
|
// A class that duplicates its output conditionally to 2 serial interfaces
|
||||||
template <class Serial0T, class Serial1T, const uint8_t offset = 0, const uint8_t step = 1>
|
template <class Serial0T, class Serial1T, const uint8_t offset = 0, const uint8_t step = 1>
|
||||||
struct MultiSerial : public SerialBase< MultiSerial<Serial0T, Serial1T, offset, step> > {
|
struct MultiSerial : public SerialBase< MultiSerial<Serial0T, Serial1T, offset, step> > {
|
||||||
typedef SerialBase< MultiSerial<Serial0T, Serial1T, offset, step> > BaseClassT;
|
typedef SerialBase< MultiSerial<Serial0T, Serial1T, offset, step> > BaseClassT;
|
||||||
|
@ -1067,6 +1067,7 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
|
|||||||
static millis_t next_busy_signal_ms = 0;
|
static millis_t next_busy_signal_ms = 0;
|
||||||
if (!autoreport_paused && host_keepalive_interval && busy_state != NOT_BUSY) {
|
if (!autoreport_paused && host_keepalive_interval && busy_state != NOT_BUSY) {
|
||||||
if (PENDING(ms, next_busy_signal_ms)) return;
|
if (PENDING(ms, next_busy_signal_ms)) return;
|
||||||
|
PORT_REDIRECT(SERIAL_ALL);
|
||||||
switch (busy_state) {
|
switch (busy_state) {
|
||||||
case IN_HANDLER:
|
case IN_HANDLER:
|
||||||
case IN_PROCESS:
|
case IN_PROCESS:
|
||||||
|
@ -272,21 +272,7 @@ void GCodeQueue::flush_and_request_resend(const serial_index_t serial_ind) {
|
|||||||
SERIAL_ECHOLN(serial_state[serial_ind].last_N + 1);
|
SERIAL_ECHOLN(serial_state[serial_ind].last_N + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multiserial already handle the dispatch to/from multiple port by itself
|
inline bool serial_data_available(uint8_t index) {
|
||||||
inline bool serial_data_available(uint8_t index = SERIAL_ALL) {
|
|
||||||
if (index == SERIAL_ALL) {
|
|
||||||
for (index = 0; index < NUM_SERIAL; index++) {
|
|
||||||
const int a = SERIAL_IMPL.available(index);
|
|
||||||
#if BOTH(RX_BUFFER_MONITOR, RX_BUFFER_SIZE)
|
|
||||||
if (a > RX_BUFFER_SIZE - 2) {
|
|
||||||
PORT_REDIRECT(SERIAL_PORTMASK(index));
|
|
||||||
SERIAL_ERROR_MSG("RX BUF overflow, increase RX_BUFFER_SIZE: ", a);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (a > 0) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const int a = SERIAL_IMPL.available(index);
|
const int a = SERIAL_IMPL.available(index);
|
||||||
#if BOTH(RX_BUFFER_MONITOR, RX_BUFFER_SIZE)
|
#if BOTH(RX_BUFFER_MONITOR, RX_BUFFER_SIZE)
|
||||||
if (a > RX_BUFFER_SIZE - 2) {
|
if (a > RX_BUFFER_SIZE - 2) {
|
||||||
@ -294,10 +280,16 @@ inline bool serial_data_available(uint8_t index = SERIAL_ALL) {
|
|||||||
SERIAL_ERROR_MSG("RX BUF overflow, increase RX_BUFFER_SIZE: ", a);
|
SERIAL_ERROR_MSG("RX BUF overflow, increase RX_BUFFER_SIZE: ", a);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return a > 0;
|
return a > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Multiserial already handles dispatch to/from multiple ports
|
||||||
|
inline bool any_serial_data_available() {
|
||||||
|
LOOP_L_N(p, NUM_SERIAL)
|
||||||
|
if (serial_data_available(p))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
inline int read_serial(const uint8_t index) { return SERIAL_IMPL.read(index); }
|
inline int read_serial(const uint8_t index) { return SERIAL_IMPL.read(index); }
|
||||||
|
|
||||||
void GCodeQueue::gcode_line_error(PGM_P const err, const serial_index_t serial_ind) {
|
void GCodeQueue::gcode_line_error(PGM_P const err, const serial_index_t serial_ind) {
|
||||||
@ -409,7 +401,7 @@ void GCodeQueue::get_serial_commands() {
|
|||||||
// send "wait" to indicate Marlin is still waiting.
|
// send "wait" to indicate Marlin is still waiting.
|
||||||
#if NO_TIMEOUTS > 0
|
#if NO_TIMEOUTS > 0
|
||||||
const millis_t ms = millis();
|
const millis_t ms = millis();
|
||||||
if (ring_buffer.empty() && !serial_data_available() && ELAPSED(ms, last_command_time + NO_TIMEOUTS)) {
|
if (ring_buffer.empty() && !any_serial_data_available() && ELAPSED(ms, last_command_time + NO_TIMEOUTS)) {
|
||||||
SERIAL_ECHOLNPGM(STR_WAIT);
|
SERIAL_ECHOLNPGM(STR_WAIT);
|
||||||
last_command_time = ms;
|
last_command_time = ms;
|
||||||
}
|
}
|
||||||
|
@ -424,9 +424,9 @@ HAS_SERVOS = src_filter=+<src/module/servo.cpp> +<src/gcode/control
|
|||||||
MORGAN_SCARA = src_filter=+<src/gcode/scara>
|
MORGAN_SCARA = src_filter=+<src/gcode/scara>
|
||||||
HAS_MICROSTEPS = src_filter=+<src/gcode/control/M350_M351.cpp>
|
HAS_MICROSTEPS = src_filter=+<src/gcode/control/M350_M351.cpp>
|
||||||
(ESP3D_)?WIFISUPPORT = AsyncTCP, ESP Async WebServer
|
(ESP3D_)?WIFISUPPORT = AsyncTCP, ESP Async WebServer
|
||||||
ESP3DLib=https://github.com/luc-github/ESP3DLib.git
|
ESP3DLib=https://github.com/luc-github/ESP3DLib/archive/master.zip
|
||||||
arduinoWebSockets=https://github.com/Links2004/arduinoWebSockets.git
|
arduinoWebSockets=links2004/WebSockets@2.3.4
|
||||||
ESP32SSDP=https://github.com/luc-github/ESP32SSDP.git
|
luc-github/ESP32SSDP@^1.1.1
|
||||||
lib_ignore=ESPAsyncTCP
|
lib_ignore=ESPAsyncTCP
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user