Parcourir la source

Followup to serial reform

Reference #13250
Scott Lahteine il y a 5 ans
Parent
révision
64253e1a58

+ 5
- 6
Marlin/src/core/serial.h Voir le fichier

42
 extern uint8_t marlin_debug_flags;
42
 extern uint8_t marlin_debug_flags;
43
 #define DEBUGGING(F) (marlin_debug_flags & (MARLIN_DEBUG_## F))
43
 #define DEBUGGING(F) (marlin_debug_flags & (MARLIN_DEBUG_## F))
44
 
44
 
45
-#if TX_BUFFER_SIZE < 1
46
-  #define SERIAL_FLUSHTX()
47
-#endif
48
-
49
 #if NUM_SERIAL > 1
45
 #if NUM_SERIAL > 1
50
   extern int8_t serial_port_index;
46
   extern int8_t serial_port_index;
51
   #define _PORT_REDIRECT(n,p)   REMEMBER(n,serial_port_index,p)
47
   #define _PORT_REDIRECT(n,p)   REMEMBER(n,serial_port_index,p)
52
   #define _PORT_RESTORE(n)      RESTORE(n)
48
   #define _PORT_RESTORE(n)      RESTORE(n)
53
   #define SERIAL_BOTH 0x7F
49
   #define SERIAL_BOTH 0x7F
54
   #define SERIAL_OUT(WHAT, ...) do{ \
50
   #define SERIAL_OUT(WHAT, ...) do{ \
55
-    if (!serial_port_index || serial_port_index == SERIAL_BOTH) MYSERIAL0.WHAT(##__VA_ARGS__); \
56
-    if ( serial_port_index) MYSERIAL1.WHAT(##__VA_ARGS__); \
51
+    if (!serial_port_index || serial_port_index == SERIAL_BOTH) MYSERIAL0.WHAT(__VA_ARGS__); \
52
+    if ( serial_port_index) MYSERIAL1.WHAT(__VA_ARGS__); \
57
   }while(0)
53
   }while(0)
58
 #else
54
 #else
59
   #define _PORT_REDIRECT(n,p)   NOOP
55
   #define _PORT_REDIRECT(n,p)   NOOP
72
 #define SERIAL_PRINTLN(x,b)     SERIAL_OUT(println, x, b)
68
 #define SERIAL_PRINTLN(x,b)     SERIAL_OUT(println, x, b)
73
 #define SERIAL_PRINTF(args...)  SERIAL_OUT(printf, args)
69
 #define SERIAL_PRINTF(args...)  SERIAL_OUT(printf, args)
74
 #define SERIAL_FLUSH()          SERIAL_OUT(flush)
70
 #define SERIAL_FLUSH()          SERIAL_OUT(flush)
71
+
75
 #if TX_BUFFER_SIZE > 0
72
 #if TX_BUFFER_SIZE > 0
76
   #define SERIAL_FLUSHTX()      SERIAL_OUT(flushTX)
73
   #define SERIAL_FLUSHTX()      SERIAL_OUT(flushTX)
74
+#else
75
+  #define SERIAL_FLUSHTX()
77
 #endif
76
 #endif
78
 
77
 
79
 #define SERIAL_ECHOPGM(x)                   (serialprintPGM(PSTR(x)))
78
 #define SERIAL_ECHOPGM(x)                   (serialprintPGM(PSTR(x)))

+ 4
- 24
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp Voir le fichier

51
  */
51
  */
52
 void GcodeSuite::M20() {
52
 void GcodeSuite::M20() {
53
   SERIAL_ECHOLNPGM(MSG_BEGIN_FILE_LIST);
53
   SERIAL_ECHOLNPGM(MSG_BEGIN_FILE_LIST);
54
-  card.ls(
55
-    #if NUM_SERIAL > 1
56
-      command_queue_port[cmd_queue_index_r]
57
-    #endif
58
-  );
54
+  card.ls();
59
   SERIAL_ECHOLNPGM(MSG_END_FILE_LIST);
55
   SERIAL_ECHOLNPGM(MSG_END_FILE_LIST);
60
 }
56
 }
61
 
57
 
160
  *      OR, with 'C' get the current filename.
156
  *      OR, with 'C' get the current filename.
161
  */
157
  */
162
 void GcodeSuite::M27() {
158
 void GcodeSuite::M27() {
163
-  #if NUM_SERIAL > 1
164
-    const int16_t port = serial_port_index;
165
-  #endif
166
-
167
   if (parser.seen('C')) {
159
   if (parser.seen('C')) {
168
     SERIAL_ECHOPGM("Current file: ");
160
     SERIAL_ECHOPGM("Current file: ");
169
     card.printFilename();
161
     card.printFilename();
171
 
163
 
172
   #if ENABLED(AUTO_REPORT_SD_STATUS)
164
   #if ENABLED(AUTO_REPORT_SD_STATUS)
173
     else if (parser.seenval('S'))
165
     else if (parser.seenval('S'))
174
-      card.set_auto_report_interval(parser.value_byte()
175
-        #if NUM_SERIAL > 1
176
-          , port
177
-        #endif
178
-      );
166
+      card.set_auto_report_interval(parser.value_byte());
179
   #endif
167
   #endif
180
 
168
 
181
   else
169
   else
182
-    card.report_status(
183
-      #if NUM_SERIAL > 1
184
-        port
185
-      #endif
186
-    );
170
+    card.report_status();
187
 }
171
 }
188
 
172
 
189
 /**
173
 /**
281
    *   /Miscellaneous/Armchair/Armchair.gcode
265
    *   /Miscellaneous/Armchair/Armchair.gcode
282
    */
266
    */
283
   void GcodeSuite::M33() {
267
   void GcodeSuite::M33() {
284
-    card.printLongPath(parser.string_arg
285
-      #if NUM_SERIAL > 1
286
-        , command_queue_port[cmd_queue_index_r]
287
-      #endif
288
-    );
268
+    card.printLongPath(parser.string_arg);
289
   }
269
   }
290
 
270
 
291
 #endif // LONG_FILENAME_HOST_SUPPORT
271
 #endif // LONG_FILENAME_HOST_SUPPORT

+ 0
- 3
Marlin/src/gcode/stats/M31.cpp Voir le fichier

34
  * M31: Get the time since the start of SD Print (or last M109)
34
  * M31: Get the time since the start of SD Print (or last M109)
35
  */
35
  */
36
 void GcodeSuite::M31() {
36
 void GcodeSuite::M31() {
37
-  #if NUM_SERIAL > 1
38
-    const int16_t port = command_queue_port[cmd_queue_index_r];
39
-  #endif
40
   char buffer[21];
37
   char buffer[21];
41
   duration_t elapsed = print_job_timer.duration();
38
   duration_t elapsed = print_job_timer.duration();
42
   elapsed.toString(buffer);
39
   elapsed.toString(buffer);

+ 1
- 9
Marlin/src/gcode/temperature/M105.cpp Voir le fichier

35
   const int8_t target_extruder = get_target_extruder_from_command();
35
   const int8_t target_extruder = get_target_extruder_from_command();
36
   if (target_extruder < 0) return;
36
   if (target_extruder < 0) return;
37
 
37
 
38
-  #if NUM_SERIAL > 1
39
-    const int16_t port = command_queue_port[cmd_queue_index_r];
40
-  #endif
41
-
42
   #if HAS_TEMP_SENSOR
38
   #if HAS_TEMP_SENSOR
43
     SERIAL_ECHOPGM(MSG_OK);
39
     SERIAL_ECHOPGM(MSG_OK);
44
-    thermalManager.print_heater_states(target_extruder
45
-      #if NUM_SERIAL > 1
46
-        , port
47
-      #endif
48
-    );
40
+    thermalManager.print_heater_states(target_extruder);
49
   #else // !HAS_TEMP_SENSOR
41
   #else // !HAS_TEMP_SENSOR
50
     SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS);
42
     SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS);
51
   #endif
43
   #endif

+ 0
- 9
Marlin/src/module/temperature.cpp Voir le fichier

2537
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2537
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2538
           , rawHotendTemp(target_extruder)
2538
           , rawHotendTemp(target_extruder)
2539
         #endif
2539
         #endif
2540
-        #if NUM_SERIAL > 1
2541
-          , port
2542
-        #endif
2543
       );
2540
       );
2544
     #endif
2541
     #endif
2545
     #if HAS_HEATED_BED
2542
     #if HAS_HEATED_BED
2547
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2544
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2548
           , rawBedTemp()
2545
           , rawBedTemp()
2549
         #endif
2546
         #endif
2550
-        #if NUM_SERIAL > 1
2551
-          , port
2552
-        #endif
2553
         , -1 // BED
2547
         , -1 // BED
2554
       );
2548
       );
2555
     #endif
2549
     #endif
2566
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2560
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2567
           , rawHotendTemp(e)
2561
           , rawHotendTemp(e)
2568
         #endif
2562
         #endif
2569
-        #if NUM_SERIAL > 1
2570
-          , port
2571
-        #endif
2572
         , e
2563
         , e
2573
       );
2564
       );
2574
     #endif
2565
     #endif

Chargement…
Annuler
Enregistrer