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

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

142
 #define  enable_Z() do{ Z_enable; Z2_enable; Z3_enable; }while(0)
142
 #define  enable_Z() do{ Z_enable; Z2_enable; Z3_enable; }while(0)
143
 #define disable_Z() do{ Z_disable; Z2_disable; Z3_disable; CBI(axis_known_position, Z_AXIS); }while(0)
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
 // Extruder Stepper enable / disable
146
 // Extruder Stepper enable / disable
149
 //
147
 //
220
   #define  E5_enable NOOP
218
   #define  E5_enable NOOP
221
   #define E5_disable NOOP
219
   #define E5_disable NOOP
222
 #endif
220
 #endif
223
-// end individual enables/disables
224
 
221
 
225
 #if ENABLED(MIXING_EXTRUDER)
222
 #if ENABLED(MIXING_EXTRUDER)
226
 
223
 

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

52
 void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) : PSTR(MSG_OFF)); }
52
 void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) : PSTR(MSG_OFF)); }
53
 void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); }
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
 #if ENABLED(DEBUG_LEVELING_FEATURE)
64
 #if ENABLED(DEBUG_LEVELING_FEATURE)
56
 
65
 
57
   #include "enum.h"
66
   #include "enum.h"

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

114
 void serialprintln_onoff(const bool onoff);
114
 void serialprintln_onoff(const bool onoff);
115
 void serial_spaces(uint8_t count);
115
 void serial_spaces(uint8_t count);
116
 
116
 
117
+void print_bin(const uint16_t val);
118
+
117
 #if ENABLED(DEBUG_LEVELING_FEATURE)
119
 #if ENABLED(DEBUG_LEVELING_FEATURE)
118
   void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z);
120
   void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z);
119
   void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]);
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
   }
441
   }
442
 
442
 
443
 #endif // DEBUG_LEVELING_FEATURE
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
   void log_machine_info();
120
   void log_machine_info();
121
 #endif
121
 #endif
122
 
122
 
123
-void print_bin(const uint16_t val);
124
-
125
 template<typename T>
123
 template<typename T>
126
 class restorer {
124
 class restorer {
127
   T& ref_;
125
   T& ref_;

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

1953
                 sanity_arr_2[] = DEFAULT_MAX_FEEDRATE,
1953
                 sanity_arr_2[] = DEFAULT_MAX_FEEDRATE,
1954
                 sanity_arr_3[] = DEFAULT_MAX_ACCELERATION;
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
 static_assert(COUNT(sanity_arr_1) >= XYZE, "DEFAULT_AXIS_STEPS_PER_UNIT requires X, Y, Z and E elements.");
1958
 static_assert(COUNT(sanity_arr_1) >= XYZE, "DEFAULT_AXIS_STEPS_PER_UNIT requires X, Y, Z and E elements.");
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?)");
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
 
6
 
7
 This software assumes that all L6470 drivers are in one SPI daisy chain.
7
 This software assumes that all L6470 drivers are in one SPI daisy chain.
8
 
8
 
9
-``` {.gcode}
9
+```
10
     The hardware setup is:
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
 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).
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
 
58
 
59
 This array is used by all routines that transmit SPI data.
59
 This array is used by all routines that transmit SPI data.
60
 
60
 
61
-``` {.gcode}
61
+```
62
   Location 0 - number of drivers in chain
62
   Location 0 - number of drivers in chain
63
 
63
 
64
   Location 1 - axis index for first device in the chain (closest to MOSI)
64
   Location 1 - axis index for first device in the chain (closest to MOSI)
65
 
65
 
66
-  
66
+  ...
67
 
67
 
68
   Location N - axis index for last device in the N device long chain (closest to MISO)
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
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
  *
20
  *
21
  */
21
  */
22
+#pragma once
22
 
23
 
23
 #include "../../inc/MarlinConfig.h"
24
 #include "../../inc/MarlinConfig.h"
24
 
25
 
61
   static char index_to_axis[MAX_L6470][3];
62
   static char index_to_axis[MAX_L6470][3];
62
   static uint8_t dir_commands[MAX_L6470];
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
   static volatile bool spi_abort;
66
   static volatile bool spi_abort;
66
   static bool spi_active;
67
   static bool spi_active;
67
 
68
 

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

640
         static uint8_t auto_report_temp_interval;
640
         static uint8_t auto_report_temp_interval;
641
         static millis_t next_temp_report_ms;
641
         static millis_t next_temp_report_ms;
642
         static void auto_report_temperatures(void);
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
           NOMORE(v, 60);
644
           NOMORE(v, 60);
645
           auto_report_temp_interval = v;
645
           auto_report_temp_interval = v;
646
           next_temp_report_ms = millis() + 1000UL * v;
646
           next_temp_report_ms = millis() + 1000UL * v;

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

128
 
128
 
129
   #if ENABLED(AUTO_REPORT_SD_STATUS)
129
   #if ENABLED(AUTO_REPORT_SD_STATUS)
130
     static void auto_report_sd_status(void);
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
       #if NUM_SERIAL > 1
132
       #if NUM_SERIAL > 1
133
         auto_report_port = serial_port_index;
133
         auto_report_port = serial_port_index;
134
       #endif
134
       #endif

Loading…
Cancel
Save