Quellcode durchsuchen

Fix Host Keepalive serial target (#21283)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Victor Oliveira vor 3 Jahren
Ursprung
Commit
1b9ff68f8c
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden

+ 2
- 4
Marlin/src/HAL/ESP32/FlushableHardwareSerial.h Datei anzeigen

@@ -21,9 +21,9 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
-#ifdef ARDUINO_ARCH_ESP32
25
-
26 24
 #include <HardwareSerial.h>
25
+
26
+#include "../shared/Marduino.h"
27 27
 #include "../../core/serial_hook.h"
28 28
 
29 29
 class FlushableHardwareSerial : public HardwareSerial {
@@ -32,5 +32,3 @@ public:
32 32
 };
33 33
 
34 34
 extern Serial0Type<FlushableHardwareSerial> flushableSerial;
35
-
36
-#endif // ARDUINO_ARCH_ESP32

+ 1
- 1
Marlin/src/core/serial.h Datei anzeigen

@@ -62,7 +62,7 @@ extern uint8_t marlin_debug_flags;
62 62
 //
63 63
 // Serial redirection
64 64
 //
65
-#define SERIAL_ALL 0x7F
65
+#define SERIAL_ALL 0xFF
66 66
 #if HAS_MULTI_SERIAL
67 67
   #define _PORT_REDIRECT(n,p)   REMEMBER(n,multiSerial.portMask,p)
68 68
   #define _PORT_RESTORE(n,p)    RESTORE(n)

+ 1
- 1
Marlin/src/core/serial_hook.h Datei anzeigen

@@ -165,7 +165,7 @@ struct RuntimeSerial : public SerialBase< RuntimeSerial<SerialT> >, public Seria
165 165
   RuntimeSerial(const bool e, Args... args) : BaseClassT(e), SerialT(args...), writeHook(0), eofHook(0), userPointer(0) {}
166 166
 };
167 167
 
168
-// A class that's duplicating its output conditionally to 2 serial interface
168
+// A class that duplicates its output conditionally to 2 serial interfaces
169 169
 template <class Serial0T, class Serial1T, const uint8_t offset = 0, const uint8_t step = 1>
170 170
 struct MultiSerial : public SerialBase< MultiSerial<Serial0T, Serial1T, offset, step> > {
171 171
   typedef SerialBase< MultiSerial<Serial0T, Serial1T, offset, step> > BaseClassT;

+ 1
- 0
Marlin/src/gcode/gcode.cpp Datei anzeigen

@@ -1067,6 +1067,7 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
1067 1067
     static millis_t next_busy_signal_ms = 0;
1068 1068
     if (!autoreport_paused && host_keepalive_interval && busy_state != NOT_BUSY) {
1069 1069
       if (PENDING(ms, next_busy_signal_ms)) return;
1070
+      PORT_REDIRECT(SERIAL_ALL);
1070 1071
       switch (busy_state) {
1071 1072
         case IN_HANDLER:
1072 1073
         case IN_PROCESS:

+ 9
- 17
Marlin/src/gcode/queue.cpp Datei anzeigen

@@ -272,21 +272,7 @@ void GCodeQueue::flush_and_request_resend(const serial_index_t serial_ind) {
272 272
   SERIAL_ECHOLN(serial_state[serial_ind].last_N + 1);
273 273
 }
274 274
 
275
-// Multiserial already handle the dispatch to/from multiple port by itself
276
-inline bool serial_data_available(uint8_t index = SERIAL_ALL) {
277
-  if (index == SERIAL_ALL) {
278
-    for (index = 0; index < NUM_SERIAL; index++) {
279
-      const int a = SERIAL_IMPL.available(index);
280
-      #if BOTH(RX_BUFFER_MONITOR, RX_BUFFER_SIZE)
281
-        if (a > RX_BUFFER_SIZE - 2) {
282
-          PORT_REDIRECT(SERIAL_PORTMASK(index));
283
-          SERIAL_ERROR_MSG("RX BUF overflow, increase RX_BUFFER_SIZE: ", a);
284
-        }
285
-      #endif
286
-      if (a > 0) return true;
287
-    }
288
-    return false;
289
-  }
275
+inline bool serial_data_available(uint8_t index) {
290 276
   const int a = SERIAL_IMPL.available(index);
291 277
   #if BOTH(RX_BUFFER_MONITOR, RX_BUFFER_SIZE)
292 278
     if (a > RX_BUFFER_SIZE - 2) {
@@ -294,10 +280,16 @@ inline bool serial_data_available(uint8_t index = SERIAL_ALL) {
294 280
       SERIAL_ERROR_MSG("RX BUF overflow, increase RX_BUFFER_SIZE: ", a);
295 281
     }
296 282
   #endif
297
-
298 283
   return a > 0;
299 284
 }
300 285
 
286
+// Multiserial already handles dispatch to/from multiple ports
287
+inline bool any_serial_data_available() {
288
+  LOOP_L_N(p, NUM_SERIAL)
289
+    if (serial_data_available(p))
290
+      return true;
291
+}
292
+
301 293
 inline int read_serial(const uint8_t index) { return SERIAL_IMPL.read(index); }
302 294
 
303 295
 void GCodeQueue::gcode_line_error(PGM_P const err, const serial_index_t serial_ind) {
@@ -409,7 +401,7 @@ void GCodeQueue::get_serial_commands() {
409 401
   // send "wait" to indicate Marlin is still waiting.
410 402
   #if NO_TIMEOUTS > 0
411 403
     const millis_t ms = millis();
412
-    if (ring_buffer.empty() && !serial_data_available() && ELAPSED(ms, last_command_time + NO_TIMEOUTS)) {
404
+    if (ring_buffer.empty() && !any_serial_data_available() && ELAPSED(ms, last_command_time + NO_TIMEOUTS)) {
413 405
       SERIAL_ECHOLNPGM(STR_WAIT);
414 406
       last_command_time = ms;
415 407
     }

+ 3
- 3
platformio.ini Datei anzeigen

@@ -424,9 +424,9 @@ HAS_SERVOS              = src_filter=+<src/module/servo.cpp> +<src/gcode/control
424 424
 MORGAN_SCARA            = src_filter=+<src/gcode/scara>
425 425
 HAS_MICROSTEPS          = src_filter=+<src/gcode/control/M350_M351.cpp>
426 426
 (ESP3D_)?WIFISUPPORT    = AsyncTCP, ESP Async WebServer
427
-  ESP3DLib=https://github.com/luc-github/ESP3DLib.git
428
-  arduinoWebSockets=https://github.com/Links2004/arduinoWebSockets.git
429
-  ESP32SSDP=https://github.com/luc-github/ESP32SSDP.git
427
+  ESP3DLib=https://github.com/luc-github/ESP3DLib/archive/master.zip
428
+  arduinoWebSockets=links2004/WebSockets@2.3.4
429
+  luc-github/ESP32SSDP@^1.1.1
430 430
   lib_ignore=ESPAsyncTCP
431 431
 
432 432
 #

Laden…
Abbrechen
Speichern