Przeglądaj źródła

Simple rename of hex_print

Scott Lahteine 3 lat temu
rodzic
commit
d69c2a90b7

+ 1
- 1
Marlin/src/HAL/STM32_F4_F7/STM32F7/TMC2660.cpp Wyświetl plik

@@ -40,7 +40,7 @@
40 40
 #include "../../../module/stepper/indirection.h"
41 41
 #include "../../../module/printcounter.h"
42 42
 #include "../../../libs/duration_t.h"
43
-#include "../../../libs/hex_print_routines.h"
43
+#include "../../../libs/hex_print.h"
44 44
 
45 45
 //some default values used in initialization
46 46
 #define DEFAULT_MICROSTEPPING_VALUE 32

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp Wyświetl plik

@@ -28,7 +28,7 @@
28 28
 
29 29
   #include "../../../MarlinCore.h"
30 30
   #include "../../../HAL/shared/eeprom_api.h"
31
-  #include "../../../libs/hex_print_routines.h"
31
+  #include "../../../libs/hex_print.h"
32 32
   #include "../../../module/configuration_store.h"
33 33
   #include "../../../lcd/ultralcd.h"
34 34
   #include "../../../module/stepper.h"

+ 1
- 1
Marlin/src/feature/tmc_util.cpp Wyświetl plik

@@ -34,7 +34,7 @@
34 34
 
35 35
 #if ENABLED(TMC_DEBUG)
36 36
   #include "../module/planner.h"
37
-  #include "../libs/hex_print_routines.h"
37
+  #include "../libs/hex_print.h"
38 38
   #if ENABLED(MONITOR_DRIVER_STATUS)
39 39
     static uint16_t report_tmc_status_interval; // = 0
40 40
   #endif

+ 1
- 1
Marlin/src/gcode/calibrate/M100.cpp Wyświetl plik

@@ -26,7 +26,7 @@
26 26
 
27 27
 #include "../gcode.h"
28 28
 #include "../queue.h"
29
-#include "../../libs/hex_print_routines.h"
29
+#include "../../libs/hex_print.h"
30 30
 
31 31
 #include "../../MarlinCore.h" // for idle()
32 32
 

+ 1
- 1
Marlin/src/gcode/eeprom/M500-M504.cpp Wyświetl plik

@@ -60,7 +60,7 @@ void GcodeSuite::M502() {
60 60
 #if ENABLED(EEPROM_SETTINGS)
61 61
 
62 62
   #if ENABLED(MARLIN_DEV_MODE)
63
-    #include "../../libs/hex_print_routines.h"
63
+    #include "../../libs/hex_print.h"
64 64
   #endif
65 65
 
66 66
   /**

+ 1
- 1
Marlin/src/gcode/parser.h Wyświetl plik

@@ -31,7 +31,7 @@
31 31
 
32 32
 //#define DEBUG_GCODE_PARSER
33 33
 #if ENABLED(DEBUG_GCODE_PARSER)
34
-  #include "../libs/hex_print_routines.h"
34
+  #include "../libs/hex_print.h"
35 35
 #endif
36 36
 
37 37
 #if ENABLED(TEMPERATURE_UNITS_SUPPORT)

+ 5
- 0
Marlin/src/inc/Conditionals_adv.h Wyświetl plik

@@ -378,3 +378,8 @@
378 378
 #if ENABLED(EEPROM_SETTINGS) && NONE(I2C_EEPROM, SPI_EEPROM, QSPI_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SDCARD_EEPROM_EMULATION)
379 379
   #define NO_EEPROM_SELECTED 1
380 380
 #endif
381
+
382
+// Flag whether hex_print.cpp is used
383
+#if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG, MARLIN_DEV_MODE)
384
+  #define NEED_HEX_PRINT 1
385
+#endif

+ 90
- 0
Marlin/src/libs/hex_print.cpp Wyświetl plik

@@ -0,0 +1,90 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../inc/MarlinConfig.h"
24
+#include "../gcode/parser.h"
25
+
26
+#if NEED_HEX_PRINT
27
+
28
+#include "hex_print.h"
29
+
30
+#ifdef CPU_32_BIT
31
+  constexpr int byte_start = 4;
32
+  static char _hex[] = "0x00000000";
33
+#else
34
+  constexpr int byte_start = 0;
35
+  static char _hex[] = "0x0000";
36
+#endif
37
+
38
+char* hex_byte(const uint8_t b) {
39
+  _hex[byte_start + 4] = hex_nybble(b >> 4);
40
+  _hex[byte_start + 5] = hex_nybble(b);
41
+  return &_hex[byte_start + 4];
42
+}
43
+
44
+inline void _hex_word(const uint16_t w) {
45
+  _hex[byte_start + 2] = hex_nybble(w >> 12);
46
+  _hex[byte_start + 3] = hex_nybble(w >> 8);
47
+  _hex[byte_start + 4] = hex_nybble(w >> 4);
48
+  _hex[byte_start + 5] = hex_nybble(w);
49
+}
50
+
51
+char* hex_word(const uint16_t w) {
52
+  _hex_word(w);
53
+  return &_hex[byte_start + 2];
54
+}
55
+
56
+#ifdef CPU_32_BIT
57
+  char* hex_long(const uint32_t l) {
58
+    _hex[2] = hex_nybble(l >> 28);
59
+    _hex[3] = hex_nybble(l >> 24);
60
+    _hex[4] = hex_nybble(l >> 20);
61
+    _hex[5] = hex_nybble(l >> 16);
62
+    _hex_word((uint16_t)(l & 0xFFFF));
63
+    return &_hex[2];
64
+  }
65
+#endif
66
+
67
+char* hex_address(const void * const w) {
68
+  #ifdef CPU_32_BIT
69
+    (void)hex_long((ptr_int_t)w);
70
+  #else
71
+    (void)hex_word((ptr_int_t)w);
72
+  #endif
73
+  return _hex;
74
+}
75
+
76
+void print_hex_nybble(const uint8_t n)       { SERIAL_CHAR(hex_nybble(n));  }
77
+void print_hex_byte(const uint8_t b)         { SERIAL_ECHO(hex_byte(b));    }
78
+void print_hex_word(const uint16_t w)        { SERIAL_ECHO(hex_word(w));    }
79
+void print_hex_address(const void * const w) { SERIAL_ECHO(hex_address(w)); }
80
+
81
+void print_hex_long(const uint32_t w, const char delimiter) {
82
+  SERIAL_ECHOPGM("0x");
83
+  for (int B = 24; B >= 8; B -= 8){
84
+    print_hex_byte(w >> B);
85
+    SERIAL_CHAR(delimiter);
86
+  }
87
+  print_hex_byte(w);
88
+}
89
+
90
+#endif // NEED_HEX_PRINT

Marlin/src/libs/hex_print_routines.h → Marlin/src/libs/hex_print.h Wyświetl plik


+ 0
- 90
Marlin/src/libs/hex_print_routines.cpp Wyświetl plik

@@ -1,90 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-#include "../inc/MarlinConfig.h"
24
-#include "../gcode/parser.h"
25
-
26
-#if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG, MARLIN_DEV_MODE)
27
-
28
-  #include "hex_print_routines.h"
29
-
30
-  #ifdef CPU_32_BIT
31
-    constexpr int byte_start = 4;
32
-    static char _hex[] = "0x00000000";
33
-  #else
34
-    constexpr int byte_start = 0;
35
-    static char _hex[] = "0x0000";
36
-  #endif
37
-
38
-  char* hex_byte(const uint8_t b) {
39
-    _hex[byte_start + 4] = hex_nybble(b >> 4);
40
-    _hex[byte_start + 5] = hex_nybble(b);
41
-    return &_hex[byte_start + 4];
42
-  }
43
-
44
-  inline void _hex_word(const uint16_t w) {
45
-    _hex[byte_start + 2] = hex_nybble(w >> 12);
46
-    _hex[byte_start + 3] = hex_nybble(w >> 8);
47
-    _hex[byte_start + 4] = hex_nybble(w >> 4);
48
-    _hex[byte_start + 5] = hex_nybble(w);
49
-  }
50
-
51
-  char* hex_word(const uint16_t w) {
52
-    _hex_word(w);
53
-    return &_hex[byte_start + 2];
54
-  }
55
-
56
-  #ifdef CPU_32_BIT
57
-    char* hex_long(const uint32_t l) {
58
-      _hex[2] = hex_nybble(l >> 28);
59
-      _hex[3] = hex_nybble(l >> 24);
60
-      _hex[4] = hex_nybble(l >> 20);
61
-      _hex[5] = hex_nybble(l >> 16);
62
-      _hex_word((uint16_t)(l & 0xFFFF));
63
-      return &_hex[2];
64
-    }
65
-  #endif
66
-
67
-  char* hex_address(const void * const w) {
68
-    #ifdef CPU_32_BIT
69
-      (void)hex_long((ptr_int_t)w);
70
-    #else
71
-      (void)hex_word((ptr_int_t)w);
72
-    #endif
73
-    return _hex;
74
-  }
75
-
76
-  void print_hex_nybble(const uint8_t n)       { SERIAL_CHAR(hex_nybble(n));  }
77
-  void print_hex_byte(const uint8_t b)         { SERIAL_ECHO(hex_byte(b));    }
78
-  void print_hex_word(const uint16_t w)        { SERIAL_ECHO(hex_word(w));    }
79
-  void print_hex_address(const void * const w) { SERIAL_ECHO(hex_address(w)); }
80
-
81
-  void print_hex_long(const uint32_t w, const char delimiter) {
82
-    SERIAL_ECHOPGM("0x");
83
-    for (int B = 24; B >= 8; B -= 8){
84
-      print_hex_byte(w >> B);
85
-      SERIAL_CHAR(delimiter);
86
-    }
87
-    print_hex_byte(w);
88
-  }
89
-
90
-#endif // AUTO_BED_LEVELING_UBL || M100_FREE_MEMORY_WATCHER || DEBUG_GCODE_PARSER

Ładowanie…
Anuluj
Zapisz