Browse Source

General cleanup ahead of L64XX

pull/1/head
Scott Lahteine 6 years ago
parent
commit
fa236e9718
  1. 16
      Marlin/src/HAL/shared/HAL_spi_L6470.cpp
  2. 3
      Marlin/src/Marlin.h
  3. 9
      Marlin/src/core/serial.cpp
  4. 2
      Marlin/src/core/serial.h
  5. 7
      Marlin/src/core/utility.cpp
  6. 2
      Marlin/src/core/utility.h
  7. 2
      Marlin/src/inc/SanityCheck.h
  8. 6
      Marlin/src/libs/L6470/000_l6470_read_me.md
  9. 3
      Marlin/src/libs/L6470/L6470_Marlin.h
  10. 2
      Marlin/src/module/temperature.h
  11. 2
      Marlin/src/sd/cardreader.h

16
Marlin/src/HAL/shared/HAL_spi_L6470.cpp

@ -25,31 +25,15 @@
* Copyright (C) 2009 by William Greiman
*/
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "../../inc/MarlinConfig.h"
#if HAS_DRIVER(L6470)
#include "Delay.h"
// --------------------------------------------------------------------------
// Public Variables
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Public functions
// --------------------------------------------------------------------------
#include "../../core/serial.h"
#include "../../libs/L6470/L6470_Marlin.h"
// --------------------------------------------------------------------------
// Software L6470 SPI
// --------------------------------------------------------------------------
// Make sure GCC optimizes this file.
// Note that this line triggers a bug in GCC which is fixed by casting.
// See the note below.

3
Marlin/src/Marlin.h

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

9
Marlin/src/core/serial.cpp

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

2
Marlin/src/core/serial.h

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

7
Marlin/src/core/utility.cpp

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

2
Marlin/src/core/utility.h

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

2
Marlin/src/inc/SanityCheck.h

@ -1953,7 +1953,7 @@ constexpr float sanity_arr_1[] = DEFAULT_AXIS_STEPS_PER_UNIT,
sanity_arr_2[] = DEFAULT_MAX_FEEDRATE,
sanity_arr_3[] = DEFAULT_MAX_ACCELERATION;
#define _ARR_TEST(N,I) (sanity_arr_##N[MIN(I,COUNT(sanity_arr_##N)-1)] > 0)
#define _ARR_TEST(N,I) (sanity_arr_##N[MIN(I,int(COUNT(sanity_arr_##N))-1)] > 0)
static_assert(COUNT(sanity_arr_1) >= XYZE, "DEFAULT_AXIS_STEPS_PER_UNIT requires X, Y, Z and E elements.");
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?)");

6
Marlin/src/libs/L6470/000_l6470_read_me.md

@ -6,7 +6,7 @@ These devices use voltage PWMs to drive the stepper phases. Phase current is not
This software assumes that all L6470 drivers are in one SPI daisy chain.
``` {.gcode}
```
The hardware setup is:
MOSI from controller tied to SDI on the first device
@ -58,12 +58,12 @@ The steppers are **NOT** powered up during this sequence.
This array is used by all routines that transmit SPI data.
``` {.gcode}
```
Location 0 - number of drivers in chain
Location 1 - axis index for first device in the chain (closest to MOSI)
...
Location N - axis index for last device in the N device long chain (closest to MISO)
```

3
Marlin/src/libs/L6470/L6470_Marlin.h

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

2
Marlin/src/module/temperature.h

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

2
Marlin/src/sd/cardreader.h

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

Loading…
Cancel
Save