General cleanup ahead of L64XX
This commit is contained in:
parent
2f1e1dcb42
commit
fa236e9718
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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[]);
|
||||
|
|
|
@ -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(' ');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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_;
|
||||
|
|
|
@ -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,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)
|
||||
```
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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…
Reference in a new issue