Skip to content

Commit

Permalink
[cron] Bump distribution date
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 30, 2019
1 parent 2aef83d commit 4758db6
Show file tree
Hide file tree
Showing 9 changed files with 2,345 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
#define STRING_DISTRIBUTION_DATE "2019-08-29"
#define STRING_DISTRIBUTION_DATE "2019-08-30"

/**
* Required minimum Configuration.h and Configuration_adv.h file versions.
Expand Down
143 changes: 143 additions & 0 deletions Marlin/src/module/stepper/L6470.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* module/stepper/L6470.cpp
* Stepper driver indirection for L6470 drivers
*/

#include "../../inc/MarlinConfigPre.h"

#if HAS_DRIVER(L6470)

#include "L6470.h"

#define _L6470_DEFINE(ST) L6470 stepper##ST((const int)L6470_CHAIN_SS_PIN)

// L6470 Stepper objects
#if AXIS_DRIVER_TYPE_X(L6470)
_L6470_DEFINE(X);
#endif
#if AXIS_DRIVER_TYPE_X2(L6470)
_L6470_DEFINE(X2);
#endif
#if AXIS_DRIVER_TYPE_Y(L6470)
_L6470_DEFINE(Y);
#endif
#if AXIS_DRIVER_TYPE_Y2(L6470)
_L6470_DEFINE(Y2);
#endif
#if AXIS_DRIVER_TYPE_Z(L6470)
_L6470_DEFINE(Z);
#endif
#if AXIS_DRIVER_TYPE_Z2(L6470)
_L6470_DEFINE(Z2);
#endif
#if AXIS_DRIVER_TYPE_Z3(L6470)
_L6470_DEFINE(Z3);
#endif
#if AXIS_DRIVER_TYPE_E0(L6470)
_L6470_DEFINE(E0);
#endif
#if AXIS_DRIVER_TYPE_E1(L6470)
_L6470_DEFINE(E1);
#endif
#if AXIS_DRIVER_TYPE_E2(L6470)
_L6470_DEFINE(E2);
#endif
#if AXIS_DRIVER_TYPE_E3(L6470)
_L6470_DEFINE(E3);
#endif
#if AXIS_DRIVER_TYPE_E4(L6470)
_L6470_DEFINE(E4);
#endif
#if AXIS_DRIVER_TYPE_E5(L6470)
_L6470_DEFINE(E5);
#endif

// not using L6470 library's init command because it
// briefly sends power to the steppers

#define _L6470_INIT_CHIP(Q) do{ \
stepper##Q.resetDev(); \
stepper##Q.softFree(); \
stepper##Q.SetParam(L6470_CONFIG, CONFIG_PWM_DIV_1 \
| CONFIG_PWM_MUL_2 \
| CONFIG_SR_290V_us \
| CONFIG_OC_SD_DISABLE \
| CONFIG_VS_COMP_DISABLE \
| CONFIG_SW_HARD_STOP \
| CONFIG_INT_16MHZ); \
stepper##Q.SetParam(L6470_KVAL_RUN, 0xFF); \
stepper##Q.SetParam(L6470_KVAL_ACC, 0xFF); \
stepper##Q.SetParam(L6470_KVAL_DEC, 0xFF); \
stepper##Q.setMicroSteps(Q##_MICROSTEPS); \
stepper##Q.setOverCurrent(Q##_OVERCURRENT); \
stepper##Q.setStallCurrent(Q##_STALLCURRENT); \
stepper##Q.SetParam(L6470_KVAL_HOLD, Q##_MAX_VOLTAGE); \
stepper##Q.SetParam(L6470_ABS_POS, 0); \
stepper##Q.getStatus(); \
}while(0)

void L6470_Marlin::init_to_defaults() {
#if AXIS_DRIVER_TYPE_X(L6470)
_L6470_INIT_CHIP(X);
#endif
#if AXIS_DRIVER_TYPE_X2(L6470)
_L6470_INIT_CHIP(X2);
#endif
#if AXIS_DRIVER_TYPE_Y(L6470)
_L6470_INIT_CHIP(Y);
#endif
#if AXIS_DRIVER_TYPE_Y2(L6470)
_L6470_INIT_CHIP(Y2);
#endif
#if AXIS_DRIVER_TYPE_Z(L6470)
_L6470_INIT_CHIP(Z);
#endif
#if AXIS_DRIVER_TYPE_Z2(L6470)
_L6470_INIT_CHIP(Z2);
#endif
#if AXIS_DRIVER_TYPE_Z3(L6470)
_L6470_INIT_CHIP(Z3);
#endif
#if AXIS_DRIVER_TYPE_E0(L6470)
_L6470_INIT_CHIP(E0);
#endif
#if AXIS_DRIVER_TYPE_E1(L6470)
_L6470_INIT_CHIP(E1);
#endif
#if AXIS_DRIVER_TYPE_E2(L6470)
_L6470_INIT_CHIP(E2);
#endif
#if AXIS_DRIVER_TYPE_E3(L6470)
_L6470_INIT_CHIP(E3);
#endif
#if AXIS_DRIVER_TYPE_E4(L6470)
_L6470_INIT_CHIP(E4);
#endif
#if AXIS_DRIVER_TYPE_E5(L6470)
_L6470_INIT_CHIP(E5);
#endif
}

#endif // HAS_DRIVER(L6470)
179 changes: 179 additions & 0 deletions Marlin/src/module/stepper/L6470.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once

/**
* module/stepper/indirection.h
*
* Stepper motor driver indirection to allow some stepper functions to
* be done via SPI/I2c instead of direct pin manipulation.
*
* Copyright (c) 2015 Dominik Wenger
*/

#include "../../inc/MarlinConfig.h"
#include "../../libs/L6470/L6470_Marlin.h"

#define L6470_WRITE_DIR_COMMAND(STATE,Q) do{ L6470_dir_commands[Q] = (STATE ? dSPIN_STEP_CLOCK_REV : dSPIN_STEP_CLOCK_FWD); }while(0)

// X Stepper
#if AXIS_DRIVER_TYPE_X(L6470)
extern L6470 stepperX;
#define X_ENABLE_INIT NOOP
#define X_ENABLE_WRITE(STATE) NOOP
#define X_ENABLE_READ() (stepperX.getStatus() & STATUS_HIZ)
#define X_DIR_INIT NOOP
#define X_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,X)
#define X_DIR_READ() (stepperX.getStatus() & STATUS_DIR)
#endif

// Y Stepper
#if AXIS_DRIVER_TYPE_Y(L6470)
extern L6470 stepperY;
#define Y_ENABLE_INIT NOOP
#define Y_ENABLE_WRITE(STATE) NOOP
#define Y_ENABLE_READ() (stepperY.getStatus() & STATUS_HIZ)
#define Y_DIR_INIT NOOP
#define Y_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Y)
#define Y_DIR_READ() (stepperY.getStatus() & STATUS_DIR)
#endif

// Z Stepper
#if AXIS_DRIVER_TYPE_Z(L6470)
extern L6470 stepperZ;
#define Z_ENABLE_INIT NOOP
#define Z_ENABLE_WRITE(STATE) NOOP
#define Z_ENABLE_READ() (stepperZ.getStatus() & STATUS_HIZ)
#define Z_DIR_INIT NOOP
#define Z_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Z)
#define Z_DIR_READ() (stepperZ.getStatus() & STATUS_DIR)
#endif

// X2 Stepper
#if HAS_X2_ENABLE && AXIS_DRIVER_TYPE_X2(L6470)
extern L6470 stepperX2;
#define X2_ENABLE_INIT NOOP
#define X2_ENABLE_WRITE(STATE) NOOP
#define X2_ENABLE_READ() (stepperX2.getStatus() & STATUS_HIZ)
#define X2_DIR_INIT NOOP
#define X2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,X2)
#define X2_DIR_READ() (stepperX2.getStatus() & STATUS_DIR)
#endif

// Y2 Stepper
#if HAS_Y2_ENABLE && AXIS_DRIVER_TYPE_Y2(L6470)
extern L6470 stepperY2;
#define Y2_ENABLE_INIT NOOP
#define Y2_ENABLE_WRITE(STATE) NOOP
#define Y2_ENABLE_READ() (stepperY2.getStatus() & STATUS_HIZ)
#define Y2_DIR_INIT NOOP
#define Y2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Y2)
#define Y2_DIR_READ() (stepperY2.getStatus() & STATUS_DIR)
#endif

// Z2 Stepper
#if HAS_Z2_ENABLE && AXIS_DRIVER_TYPE_Z2(L6470)
extern L6470 stepperZ2;
#define Z2_ENABLE_INIT NOOP
#define Z2_ENABLE_WRITE(STATE) NOOP
#define Z2_ENABLE_READ() (stepperZ2.getStatus() & STATUS_HIZ)
#define Z2_DIR_INIT NOOP
#define Z2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Z2)
#define Z2_DIR_READ() (stepperZ2.getStatus() & STATUS_DIR)
#endif

// Z3 Stepper
#if HAS_Z3_ENABLE && AXIS_DRIVER_TYPE_Z3(L6470)
extern L6470 stepperZ3;
#define Z3_ENABLE_INIT NOOP
#define Z3_ENABLE_WRITE(STATE) NOOP
#define Z3_ENABLE_READ() (stepperZ3.getStatus() & STATUS_HIZ)
#define Z3_DIR_INIT NOOP
#define Z3_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Z3)
#define Z3_DIR_READ() (stepperZ3.getStatus() & STATUS_DIR)
#endif

// E0 Stepper
#if AXIS_DRIVER_TYPE_E0(L6470)
extern L6470 stepperE0;
#define E0_ENABLE_INIT NOOP
#define E0_ENABLE_WRITE(STATE) NOOP
#define E0_ENABLE_READ() (stepperE0.getStatus() & STATUS_HIZ)
#define E0_DIR_INIT NOOP
#define E0_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E0)
#define E0_DIR_READ() (stepperE0.getStatus() & STATUS_DIR)
#endif

// E1 Stepper
#if AXIS_DRIVER_TYPE_E1(L6470)
extern L6470 stepperE1;
#define E1_ENABLE_INIT NOOP
#define E1_ENABLE_WRITE(STATE) NOOP
#define E1_ENABLE_READ() (stepperE1.getStatus() & STATUS_HIZ)
#define E1_DIR_INIT NOOP
#define E1_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E1)
#define E1_DIR_READ() (stepperE1.getStatus() & STATUS_DIR)
#endif

// E2 Stepper
#if AXIS_DRIVER_TYPE_E2(L6470)
extern L6470 stepperE2;
#define E2_ENABLE_INIT NOOP
#define E2_ENABLE_WRITE(STATE) NOOP
#define E2_ENABLE_READ() (stepperE2.getStatus() & STATUS_HIZ)
#define E2_DIR_INIT NOOP
#define E2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E2)
#define E2_DIR_READ() (stepperE2.getStatus() & STATUS_DIR)
#endif

// E3 Stepper
#if AXIS_DRIVER_TYPE_E3(L6470)
extern L6470 stepperE3;
#define E3_ENABLE_INIT NOOP
#define E3_ENABLE_WRITE(STATE) NOOP
#define E3_ENABLE_READ() (stepperE3.getStatus() & STATUS_HIZ)
#define E3_DIR_INIT NOOP
#define E3_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E3)
#define E3_DIR_READ() (stepperE3.getStatus() & STATUS_DIR)
#endif

// E4 Stepper
#if AXIS_DRIVER_TYPE_E4(L6470)
extern L6470 stepperE4;
#define E4_ENABLE_INIT NOOP
#define E4_ENABLE_WRITE(STATE) NOOP
#define E4_ENABLE_READ() (stepperE4.getStatus() & STATUS_HIZ)
#define E4_DIR_INIT NOOP
#define E4_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E4)
#define E4_DIR_READ() (stepperE4.getStatus() & STATUS_DIR)
#endif

// E5 Stepper
#if AXIS_DRIVER_TYPE_E5(L6470)
extern L6470 stepperE5;
#define E5_ENABLE_INIT NOOP
#define E5_ENABLE_WRITE(STATE) NOOP
#define E5_ENABLE_READ() (stepperE5.getStatus() & STATUS_HIZ)
#define E5_DIR_INIT NOOP
#define E5_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E5)
#define E5_DIR_READ() (stepperE5.getStatus() & STATUS_DIR)
#endif
Loading

2 comments on commit 4758db6

@Chaotnix
Copy link

@Chaotnix Chaotnix commented on 4758db6 Aug 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get errors while compiling:

Compiling .pio\build\BIGTREE_SKR_MINI\src\src\module\stepper\trinamic.cpp.o
 #include "../inc/MarlinConfig.h"
          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\BIGTREE_SKR_MINI\src\src\module\stepper\TMC26X.cpp.o] Error 1
In file included from Marlin\src\module\stepper\indirection.h:40:0,
                 from Marlin\src\module\stepper\indirection.cpp:34:
Marlin\src\module\stepper\trinamic.h:66:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(X, X) stepperX;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:78:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(Y, Y) stepperY;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:90:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(Z, Z) stepperZ;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:150:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS_E(0) stepperE0;
 ^ ~~~~
In file included from Marlin\src\module\stepper\indirection.cpp:34:0:
Marlin\src\module\stepper\indirection.h:63:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
     extern TMC_CLASS(X, X) stepperX;
 ^   ~~
compilation terminated due to -fmax-errors=5.
In file included from Marlin\src\module\stepper\trinamic.cpp:32:0:
Marlin\src\module\stepper\trinamic.h:66:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(X, X) stepperX;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:78:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(Y, Y) stepperY;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:90:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(Z, Z) stepperZ;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:150:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS_E(0) stepperE0;
 ^ ~~~~
*** [.pio\build\BIGTREE_SKR_MINI\src\src\module\stepper\indirection.cpp.o] Error 1
In file included from d:\git\marlin\marlin\src\inc\MarlinConfigPre.h:42:0,
                 from d:\git\marlin\marlin\src\inc\marlinconfig.h:28,
                 from Marlin\src\module\stepper\trinamic.cpp:28:
d:\git\marlin\marlin\configuration_adv.h:1880:26: error: 'CHOPPER_DEFAULT_24V' was not declared in this scope
   #define CHOPPER_TIMING CHOPPER_DEFAULT_24V
                          ^
Marlin\src\module\stepper\trinamic.h:56:52: note: in expansion of macro 'CHOPPER_TIMING'
 static constexpr chopper_timing_t chopper_timing = CHOPPER_TIMING;
                                                    ^~~~~~~~~~~~~~
compilation terminated due to -fmax-errors=5.
*** [.pio\build\BIGTREE_SKR_MINI\src\src\module\stepper\trinamic.cpp.o] Error 1
`

If I change  #include "../inc/MarlinConfig.h" to  #include "../../inc/MarlinConfig.h" there are errors to:

`Compiling .pio\build\BIGTREE_SKR_MINI\src\src\module\tool_change.cpp.o
In file included from Marlin\src\module\stepper\indirection.h:40:0,
                 from Marlin\src\module\stepper\indirection.cpp:34:
Marlin\src\module\stepper\trinamic.h:66:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(X, X) stepperX;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:78:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(Y, Y) stepperY;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:90:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(Z, Z) stepperZ;
 ^ ~~~~
In file included from Marlin\src\module\stepper\trinamic.cpp:32:0:
Marlin\src\module\stepper\trinamic.h:66:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(X, X) stepperX;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:78:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(Y, Y) stepperY;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:90:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS(Z, Z) stepperZ;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:150:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS_E(0) stepperE0;
 ^ ~~~~
Marlin\src\module\stepper\trinamic.h:150:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
   extern TMC_CLASS_E(0) stepperE0;
 ^ ~~~~
In file included from Marlin\src\module\stepper\indirection.cpp:34:0:
Marlin\src\module\stepper\indirection.h:63:1: error: macro "__TMC_CLASS" requires 4 arguments, but only 3 given
     extern TMC_CLASS(X, X) stepperX;
 ^   ~~
compilation terminated due to -fmax-errors=5.
*** [.pio\build\BIGTREE_SKR_MINI\src\src\module\stepper\indirection.cpp.o] Error 1
In file included from d:\git\marlin\marlin\src\inc\MarlinConfigPre.h:42:0,
                 from d:\git\marlin\marlin\src\inc\marlinconfig.h:28,
                 from Marlin\src\module\stepper\trinamic.cpp:28:
d:\git\marlin\marlin\configuration_adv.h:1880:26: error: 'CHOPPER_DEFAULT_24V' was not declared in this scope
   #define CHOPPER_TIMING CHOPPER_DEFAULT_24V
                          ^
Marlin\src\module\stepper\trinamic.h:56:52: note: in expansion of macro 'CHOPPER_TIMING'
 static constexpr chopper_timing_t chopper_timing = CHOPPER_TIMING;
                                                    ^~~~~~~~~~~~~~
compilation terminated due to -fmax-errors=5.
*** [.pio\build\BIGTREE_SKR_MINI\src\src\module\stepper\trinamic.cpp.o] Error 1

@sl1pkn07
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related #15102

Please sign in to comment.