Browse Source

General cleanup ahead of L64XX

Scott Lahteine 5 years ago
parent
commit
fa236e9718

+ 0
- 16
Marlin/src/HAL/shared/HAL_spi_L6470.cpp View File

@@ -25,31 +25,15 @@
25 25
  * Copyright (C) 2009 by William Greiman
26 26
  */
27 27
 
28
-// --------------------------------------------------------------------------
29
-// Includes
30
-// --------------------------------------------------------------------------
31
-
32 28
 #include "../../inc/MarlinConfig.h"
33 29
 
34 30
 #if HAS_DRIVER(L6470)
35 31
 
36 32
 #include "Delay.h"
37 33
 
38
-// --------------------------------------------------------------------------
39
-// Public Variables
40
-// --------------------------------------------------------------------------
41
-
42
-// --------------------------------------------------------------------------
43
-// Public functions
44
-// --------------------------------------------------------------------------
45
-
46 34
 #include "../../core/serial.h"
47 35
 #include "../../libs/L6470/L6470_Marlin.h"
48 36
 
49
-// --------------------------------------------------------------------------
50
-// Software L6470 SPI
51
-// --------------------------------------------------------------------------
52
-
53 37
 // Make sure GCC optimizes this file.
54 38
 // Note that this line triggers a bug in GCC which is fixed by casting.
55 39
 // See the note below.

+ 0
- 3
Marlin/src/Marlin.h View File

@@ -142,8 +142,6 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
142 142
 #define  enable_Z() do{ Z_enable; Z2_enable; Z3_enable; }while(0)
143 143
 #define disable_Z() do{ Z_disable; Z2_disable; Z3_disable; CBI(axis_known_position, Z_AXIS); }while(0)
144 144
 
145
-// end  X, Y, Z Stepper enable / disable
146
-
147 145
 //
148 146
 // Extruder Stepper enable / disable
149 147
 //
@@ -220,7 +218,6 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
220 218
   #define  E5_enable NOOP
221 219
   #define E5_disable NOOP
222 220
 #endif
223
-// end individual enables/disables
224 221
 
225 222
 #if ENABLED(MIXING_EXTRUDER)
226 223
 

+ 9
- 0
Marlin/src/core/serial.cpp View File

@@ -52,6 +52,15 @@ void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (c
52 52
 void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) : PSTR(MSG_OFF)); }
53 53
 void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); }
54 54
 
55
+void print_bin(const uint16_t val) {
56
+  uint16_t mask = 0x8000;
57
+  for (uint8_t i = 16; i--;) {
58
+    if (i && !(i % 4)) SERIAL_CHAR(' ');
59
+    SERIAL_CHAR((val & mask) ? '1' : '0');
60
+    mask >>= 1;
61
+  }
62
+}
63
+
55 64
 #if ENABLED(DEBUG_LEVELING_FEATURE)
56 65
 
57 66
   #include "enum.h"

+ 2
- 0
Marlin/src/core/serial.h View File

@@ -114,6 +114,8 @@ void serialprint_onoff(const bool onoff);
114 114
 void serialprintln_onoff(const bool onoff);
115 115
 void serial_spaces(uint8_t count);
116 116
 
117
+void print_bin(const uint16_t val);
118
+
117 119
 #if ENABLED(DEBUG_LEVELING_FEATURE)
118 120
   void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z);
119 121
   void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]);

+ 0
- 7
Marlin/src/core/utility.cpp View File

@@ -441,10 +441,3 @@ void safe_delay(millis_t ms) {
441 441
   }
442 442
 
443 443
 #endif // DEBUG_LEVELING_FEATURE
444
-
445
-void print_bin(const uint16_t val) {
446
-  for (uint8_t i = 16; i--;) {
447
-    SERIAL_ECHO(TEST(val, i));
448
-    if (!(i & 0x3)) SERIAL_CHAR(' ');
449
-  }
450
-}

+ 0
- 2
Marlin/src/core/utility.h View File

@@ -120,8 +120,6 @@ inline void serial_delay(const millis_t ms) {
120 120
   void log_machine_info();
121 121
 #endif
122 122
 
123
-void print_bin(const uint16_t val);
124
-
125 123
 template<typename T>
126 124
 class restorer {
127 125
   T& ref_;

+ 1
- 1
Marlin/src/inc/SanityCheck.h View File

@@ -1953,7 +1953,7 @@ constexpr float sanity_arr_1[] = DEFAULT_AXIS_STEPS_PER_UNIT,
1953 1953
                 sanity_arr_2[] = DEFAULT_MAX_FEEDRATE,
1954 1954
                 sanity_arr_3[] = DEFAULT_MAX_ACCELERATION;
1955 1955
 
1956
-#define _ARR_TEST(N,I) (sanity_arr_##N[MIN(I,COUNT(sanity_arr_##N)-1)] > 0)
1956
+#define _ARR_TEST(N,I) (sanity_arr_##N[MIN(I,int(COUNT(sanity_arr_##N))-1)] > 0)
1957 1957
 
1958 1958
 static_assert(COUNT(sanity_arr_1) >= XYZE, "DEFAULT_AXIS_STEPS_PER_UNIT requires X, Y, Z and E elements.");
1959 1959
 static_assert(COUNT(sanity_arr_1) <= XYZE_N, "DEFAULT_AXIS_STEPS_PER_UNIT has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)");

+ 9
- 9
Marlin/src/libs/L6470/000_l6470_read_me.md View File

@@ -6,20 +6,20 @@ These devices use voltage PWMs to drive the stepper phases. Phase current is not
6 6
 
7 7
 This software assumes that all L6470 drivers are in one SPI daisy chain.
8 8
 
9
-``` {.gcode}
9
+```
10 10
     The hardware setup is:
11 11
 
12
-        MOSI from controller tied to SDI on the first device
12
+      MOSI from controller tied to SDI on the first device
13 13
 
14
-        SDO of the first device is tied to SDI of the next device
14
+      SDO of the first device is tied to SDI of the next device
15 15
 
16
-        SDO of the last device is tied to MISO of the controller
16
+      SDO of the last device is tied to MISO of the controller
17 17
 
18
-        all devices share the same SCK, SS\_PIN and RESET\_PIN
18
+      all devices share the same SCK, SS\_PIN and RESET\_PIN
19 19
 
20
-        Each L6470 passes the data it saw on its SDI to its neighbor on the **NEXT** SPI cycle (8 bit delay).
20
+      Each L6470 passes the data it saw on its SDI to its neighbor on the **NEXT** SPI cycle (8 bit delay).
21 21
 
22
-        Each L6470 acts on the **last** SPI data it saw when the SS\_PIN **goes high**.
22
+      Each L6470 acts on the **last** SPI data it saw when the SS\_PIN **goes high**.
23 23
 ```
24 24
 
25 25
 The L6470 drivers operate in STEP\_CLOCK mode. In this mode the direction and enable are done via SPI commands and the phase currents are changed in response to step pulses (generated in the usual way).
@@ -58,12 +58,12 @@ The steppers are **NOT** powered up during this sequence.
58 58
 
59 59
 This array is used by all routines that transmit SPI data.
60 60
 
61
-``` {.gcode}
61
+```
62 62
   Location 0 - number of drivers in chain
63 63
 
64 64
   Location 1 - axis index for first device in the chain (closest to MOSI)
65 65
 
66
-  
66
+  ...
67 67
 
68 68
   Location N - axis index for last device in the N device long chain (closest to MISO)
69 69
 ```

+ 2
- 1
Marlin/src/libs/L6470/L6470_Marlin.h View File

@@ -19,6 +19,7 @@
19 19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22
+#pragma once
22 23
 
23 24
 #include "../../inc/MarlinConfig.h"
24 25
 
@@ -61,7 +62,7 @@ public:
61 62
   static char index_to_axis[MAX_L6470][3];
62 63
   static uint8_t dir_commands[MAX_L6470];
63 64
 
64
-  // flags to guarantee graceful switch if stepper interrupts L6470 SPI transfer
65
+  // Flags to guarantee graceful switch if stepper interrupts L6470 SPI transfer
65 66
   static volatile bool spi_abort;
66 67
   static bool spi_active;
67 68
 

+ 1
- 1
Marlin/src/module/temperature.h View File

@@ -640,7 +640,7 @@ class Temperature {
640 640
         static uint8_t auto_report_temp_interval;
641 641
         static millis_t next_temp_report_ms;
642 642
         static void auto_report_temperatures(void);
643
-        FORCE_INLINE void set_auto_report_interval(uint8_t v) {
643
+        static inline void set_auto_report_interval(uint8_t v) {
644 644
           NOMORE(v, 60);
645 645
           auto_report_temp_interval = v;
646 646
           next_temp_report_ms = millis() + 1000UL * v;

+ 1
- 1
Marlin/src/sd/cardreader.h View File

@@ -128,7 +128,7 @@ public:
128 128
 
129 129
   #if ENABLED(AUTO_REPORT_SD_STATUS)
130 130
     static void auto_report_sd_status(void);
131
-    static inline void set_auto_report_interval(const uint8_t v) {
131
+    static inline void set_auto_report_interval(uint8_t v) {
132 132
       #if NUM_SERIAL > 1
133 133
         auto_report_port = serial_port_index;
134 134
       #endif

Loading…
Cancel
Save