Fix a merge error
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,381 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
|
||||
#include "inc/MarlinConfig.h"
|
||||
|
||||
#ifdef DEBUG_GCODE_PARSER
|
||||
#include "gcode/parser.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#include "libs/L6470/L6470_Marlin.h"
|
||||
extern uint8_t axis_known_position;
|
||||
#endif
|
||||
|
||||
void stop();
|
||||
|
||||
void idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
bool no_stepper_sleep = false // pass true to keep steppers from disabling on timeout
|
||||
#endif
|
||||
);
|
||||
|
||||
void manage_inactivity(const bool ignore_stepper_queue=false);
|
||||
|
||||
//
|
||||
// X, Y, Z Stepper enable / disable
|
||||
//
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
extern L6470 stepperX;
|
||||
#define X_enable() NOOP
|
||||
#define X_disable() stepperX.free()
|
||||
#elif HAS_X_ENABLE
|
||||
#define X_enable() X_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define X_disable() X_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#else
|
||||
#define X_enable() NOOP
|
||||
#define X_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
extern L6470 stepperX2;
|
||||
#define X2_enable() NOOP
|
||||
#define X2_disable() stepperX2.free()
|
||||
#elif HAS_X2_ENABLE
|
||||
#define X2_enable() X2_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define X2_disable() X2_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#else
|
||||
#define X2_enable() NOOP
|
||||
#define X2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#define enable_X() do{ X_enable(); X2_enable(); }while(0)
|
||||
#define disable_X() do{ X_disable(); X2_disable(); CBI(axis_known_position, X_AXIS); }while(0)
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
extern L6470 stepperY;
|
||||
#define Y_enable() NOOP
|
||||
#define Y_disable() stepperY.free()
|
||||
#elif HAS_Y_ENABLE
|
||||
#define Y_enable() Y_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define Y_disable() Y_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#else
|
||||
#define Y_enable() NOOP
|
||||
#define Y_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
extern L6470 stepperY2;
|
||||
#define Y2_enable() NOOP
|
||||
#define Y2_disable() stepperY2.free()
|
||||
#elif HAS_Y2_ENABLE
|
||||
#define Y2_enable() Y2_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define Y2_disable() Y2_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#else
|
||||
#define Y2_enable() NOOP
|
||||
#define Y2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#define enable_Y() do{ Y_enable(); Y2_enable(); }while(0)
|
||||
#define disable_Y() do{ Y_disable(); Y2_disable(); CBI(axis_known_position, Y_AXIS); }while(0)
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
extern L6470 stepperZ;
|
||||
#define Z_enable() NOOP
|
||||
#define Z_disable() stepperZ.free()
|
||||
#elif HAS_Z_ENABLE
|
||||
#define Z_enable() Z_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z_disable() Z_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z_enable() NOOP
|
||||
#define Z_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
extern L6470 stepperZ2;
|
||||
#define Z2_enable() NOOP
|
||||
#define Z2_disable() stepperZ2.free()
|
||||
#elif HAS_Z2_ENABLE
|
||||
#define Z2_enable() Z2_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z2_disable() Z2_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z2_enable() NOOP
|
||||
#define Z2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
extern L6470 stepperZ3;
|
||||
#define Z3_enable() NOOP
|
||||
#define Z3_disable() stepperZ3.free()
|
||||
#elif HAS_Z3_ENABLE
|
||||
#define Z3_enable() Z3_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z3_disable() Z3_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z3_enable() NOOP
|
||||
#define Z3_disable() NOOP
|
||||
#endif
|
||||
|
||||
#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)
|
||||
|
||||
//
|
||||
// Extruder Stepper enable / disable
|
||||
//
|
||||
|
||||
// define the individual enables/disables
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
extern L6470 stepperE0;
|
||||
#define E0_enable() NOOP
|
||||
#define E0_disable() do{ stepperE0.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif HAS_E0_ENABLE
|
||||
#define E0_enable() E0_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E0_disable() E0_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E0_enable() NOOP
|
||||
#define E0_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
extern L6470 stepperE1;
|
||||
#define E1_enable() NOOP
|
||||
#define E1_disable() do{ stepperE1.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 1 && HAS_E1_ENABLE
|
||||
#define E1_enable() E1_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E1_disable() E1_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E1_enable() NOOP
|
||||
#define E1_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
extern L6470 stepperE2;
|
||||
#define E2_enable() NOOP
|
||||
#define E2_disable() do{ stepperE2.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 2 && HAS_E2_ENABLE
|
||||
#define E2_enable() E2_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E2_disable() E2_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E2_enable() NOOP
|
||||
#define E2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
extern L6470 stepperE3;
|
||||
#define E3_enable() NOOP
|
||||
#define E3_disable() do{ stepperE3.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 3 && HAS_E3_ENABLE
|
||||
#define E3_enable() E3_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E3_disable() E3_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E3_enable() NOOP
|
||||
#define E3_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
extern L6470 stepperE4;
|
||||
#define E4_enable() NOOP
|
||||
#define E4_disable() do{ stepperE4.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 4 && HAS_E4_ENABLE
|
||||
#define E4_enable() E4_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E4_disable() E4_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E4_enable() NOOP
|
||||
#define E4_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
extern L6470 stepperE5;
|
||||
#define E5_enable() NOOP
|
||||
#define E5_disable() do{ stepperE5.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 5 && HAS_E5_ENABLE
|
||||
#define E5_enable() E5_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E5_disable() E5_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E5_enable() NOOP
|
||||
#define E5_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
|
||||
/**
|
||||
* Mixing steppers synchronize their enable (and direction) together
|
||||
*/
|
||||
#if MIXING_STEPPERS > 5
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); E4_enable(); E5_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); E4_disable(); E5_disable(); }
|
||||
#elif MIXING_STEPPERS > 4
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); E4_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); E4_disable(); }
|
||||
#elif MIXING_STEPPERS > 3
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); }
|
||||
#elif MIXING_STEPPERS > 2
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); }
|
||||
#else
|
||||
#define enable_E0() { E0_enable(); E1_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); }
|
||||
#endif
|
||||
#define enable_E1() NOOP
|
||||
#define disable_E1() NOOP
|
||||
#define enable_E2() NOOP
|
||||
#define disable_E2() NOOP
|
||||
#define enable_E3() NOOP
|
||||
#define disable_E3() NOOP
|
||||
#define enable_E4() NOOP
|
||||
#define disable_E4() NOOP
|
||||
#define enable_E5() NOOP
|
||||
#define disable_E5() NOOP
|
||||
|
||||
#else // !MIXING_EXTRUDER
|
||||
|
||||
#if HAS_E0_ENABLE
|
||||
#define enable_E0() E0_enable()
|
||||
#define disable_E0() E0_disable()
|
||||
#else
|
||||
#define enable_E0() NOOP
|
||||
#define disable_E0() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 1 && HAS_E1_ENABLE
|
||||
#define enable_E1() E1_enable()
|
||||
#define disable_E1() E1_disable()
|
||||
#else
|
||||
#define enable_E1() NOOP
|
||||
#define disable_E1() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 2 && HAS_E2_ENABLE
|
||||
#define enable_E2() E2_enable()
|
||||
#define disable_E2() E2_disable()
|
||||
#else
|
||||
#define enable_E2() NOOP
|
||||
#define disable_E2() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 3 && HAS_E3_ENABLE
|
||||
#define enable_E3() E3_enable()
|
||||
#define disable_E3() E3_disable()
|
||||
#else
|
||||
#define enable_E3() NOOP
|
||||
#define disable_E3() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 4 && HAS_E4_ENABLE
|
||||
#define enable_E4() E4_enable()
|
||||
#define disable_E4() E4_disable()
|
||||
#else
|
||||
#define enable_E4() NOOP
|
||||
#define disable_E4() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 5 && HAS_E5_ENABLE
|
||||
#define enable_E5() E5_enable()
|
||||
#define disable_E5() E5_disable()
|
||||
#else
|
||||
#define enable_E5() NOOP
|
||||
#define disable_E5() NOOP
|
||||
#endif
|
||||
|
||||
#endif // !MIXING_EXTRUDER
|
||||
|
||||
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
||||
#include "feature/twibus.h"
|
||||
extern TWIBus i2c;
|
||||
#endif
|
||||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
extern uint8_t G38_move; // Flag to tell the ISR that G38 is in progress, and the type
|
||||
extern bool G38_did_trigger; // Flag from the ISR to indicate the endstop changed
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The axis order in all axis related arrays is X, Y, Z, E
|
||||
*/
|
||||
void enable_e_steppers();
|
||||
void enable_all_steppers();
|
||||
void disable_e_stepper(const uint8_t e);
|
||||
void disable_e_steppers();
|
||||
void disable_all_steppers();
|
||||
|
||||
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
|
||||
void minkill(const bool steppers_off=false);
|
||||
|
||||
void quickstop_stepper();
|
||||
|
||||
extern bool Running;
|
||||
inline bool IsRunning() { return Running; }
|
||||
inline bool IsStopped() { return !Running; }
|
||||
|
||||
bool printingIsActive();
|
||||
bool printingIsPaused();
|
||||
void startOrResumeJob();
|
||||
|
||||
extern bool wait_for_heatup;
|
||||
|
||||
#if HAS_RESUME_CONTINUE
|
||||
extern bool wait_for_user;
|
||||
#endif
|
||||
|
||||
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||
extern bool suspend_auto_report;
|
||||
#endif
|
||||
|
||||
// Inactivity shutdown timer
|
||||
extern millis_t max_inactive_time, stepper_inactive_time;
|
||||
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
extern uint8_t controllerfan_speed;
|
||||
#endif
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
extern bool powersupply_on;
|
||||
#define PSU_PIN_ON() do{ OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_HIGH); powersupply_on = true; }while(0)
|
||||
#define PSU_PIN_OFF() do{ OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_HIGH); powersupply_on = false; }while(0)
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
#define PSU_ON() powerManager.power_on()
|
||||
#define PSU_OFF() powerManager.power_off()
|
||||
#else
|
||||
#define PSU_ON() PSU_PIN_ON()
|
||||
#define PSU_OFF() PSU_PIN_OFF()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool pin_is_protected(const pin_t pin);
|
||||
void protected_pin_err();
|
||||
|
||||
#if HAS_SUICIDE
|
||||
inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(G29_RETRY_AND_RECOVER)
|
||||
void event_probe_recover();
|
||||
void event_probe_failure();
|
||||
#endif
|
||||
|
||||
extern const char NUL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
|
||||
SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[];
|
@@ -1,231 +0,0 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* DGUS implementation written by coldtobi in 2019 for Marlin */
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD)
|
||||
|
||||
#include "DGUSDisplayDefinition.h"
|
||||
#include "DGUSDisplay.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
|
||||
#include "../../../ultralcd.h"
|
||||
|
||||
const uint16_t VPList_Boot[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Main[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded. */
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Temp[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_I, VP_T_E1_S,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_I, VP_T_E1_S,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if FAN_COUNT > 0
|
||||
VP_Fan_Percentage,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
VP_PrintProgress_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status2[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_Flowrate_E0,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_Flowrate_E1,
|
||||
#endif
|
||||
VP_PrintProgress_Percentage,
|
||||
VP_PrintTime,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualMove[] PROGMEM = {
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualExtrude[] PROGMEM = {
|
||||
VP_EPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FanAndFeedrate[] PROGMEM = {
|
||||
VP_Feedrate_Percentage, VP_Fan_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_FlowRates[] PROGMEM = {
|
||||
VP_Flowrate_E0, VP_Flowrate_E1,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDFileList[] PROGMEM = {
|
||||
VP_SD_FileName0, VP_SD_FileName1, VP_SD_FileName2, VP_SD_FileName3, VP_SD_FileName4,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_PrintManipulation[] PROGMEM = {
|
||||
VP_PrintProgress_Percentage, VP_PrintTime,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
|
||||
{ DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp },
|
||||
{ DGUSLCD_SCREEN_STATUS, VPList_Status },
|
||||
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
|
||||
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
|
||||
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
|
||||
{ DGUSLCD_SCREEN_FANANDFEEDRATE, VPList_FanAndFeedrate },
|
||||
{ DGUSLCD_SCREEN_FLOWRATES, VPList_SD_FlowRates },
|
||||
{ DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
|
||||
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
|
||||
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
|
||||
// Helper to define a DGUS_VP_Variable for common use cases.
|
||||
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=sizeof(VPADRVAR), \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR }
|
||||
|
||||
// Helper to define a DGUS_VP_Variable when the sizeo of the var cannot be determined automaticalyl (eg. a string)
|
||||
#define VPHELPER_STR(VPADR, VPADRVAR, STRLEN, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=STRLEN, \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR }
|
||||
|
||||
const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
// Helper to detect touch events
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, DGUSScreenVariableHandler::ScreenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, DGUSScreenVariableHandler::ScreenChangeHookIfIdle, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, DGUSScreenVariableHandler::ScreenChangeHookIfSD, nullptr),
|
||||
VPHELPER(VP_CONFIRMED, nullptr, DGUSScreenVariableHandler::ScreenConfirmedOK, nullptr),
|
||||
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, &DGUSScreenVariableHandler::HandleAllHeatersOff, nullptr),
|
||||
|
||||
VPHELPER(VP_MOVE_X, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
|
||||
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
// M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr
|
||||
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplay },
|
||||
|
||||
// Temperature Data
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, nullptr, DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_T_E1_I, &thermalManager.temp_hotend[1].celsius, nullptr, DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_S, &thermalManager.temp_hotend[1].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, nullptr, DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
|
||||
#endif
|
||||
#if HOTENDS >= 3
|
||||
#error More than 2 Hotends currently not implemented on the Display UI design.
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
// Fan Data.
|
||||
#if FAN_COUNT > 0
|
||||
VPHELPER(VP_Fan_Percentage, &thermalManager.fan_speed[0], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay),
|
||||
#endif
|
||||
|
||||
// Feedrate.
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, DGUSScreenVariableHandler::DGUSLCD_SetValueDirectly<int16_t>, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
|
||||
|
||||
// Position Data.
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
// Print Progress.
|
||||
VPHELPER(VP_PrintProgress_Percentage, &ui.progress_override, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay ),
|
||||
|
||||
// SDCard File listing.
|
||||
#if ENABLED(SDSUPPORT)
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_FileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_StartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
#endif
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They cant be autouploaded as we do not buffer content.
|
||||
{ .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD
|
@@ -1,105 +0,0 @@
|
||||
Arduino-6470 library revision 0.7.0 or above is required.
|
||||
|
||||
This software can be used with any L647x chip and the powerSTEP01. L647x and powerSTEP01 devices can not be mixed within a system. A flag in the library must be set to enable use of a powerSTEP01.
|
||||
|
||||
These devices use voltage PWMs to drive the stepper phases. Phase current is not directly controlled. Each microstep corresponds to a particular PWM duty cycle. The KVAL\_HOLD register scales the PWM duty cycle.
|
||||
|
||||
This software assumes that all L6470 drivers are in one SPI daisy chain.
|
||||
|
||||
```
|
||||
The hardware setup is:
|
||||
|
||||
MOSI from controller tied to SDI on the first device
|
||||
|
||||
SDO of the first device is tied to SDI of the next device
|
||||
|
||||
SDO of the last device is tied to MISO of the controller
|
||||
|
||||
all devices share the same SCK, SS\_PIN and RESET\_PIN
|
||||
|
||||
Each L6470 passes the data it saw on its SDI to its neighbor on the **NEXT** SPI cycle (8 bit delay).
|
||||
|
||||
Each L6470 acts on the **last** SPI data it saw when the SS\_PIN **goes high**.
|
||||
```
|
||||
|
||||
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).
|
||||
|
||||
There are two different SPI routines used.
|
||||
|
||||
- **uint8\_t** L6470\_Transfer(uint8\_t data, int \_SSPin, const uint8\_t chain\_position) is used to setup the chips and by the maintenance/status code. This code uses the Arduino-6470 library.
|
||||
|
||||
- **void** L6470\_Transfer(uint8\_t L6470\_buf[], const uint8\_t length) is used by the set\_directions() routine to send the direction/enable commands. The library is NOT used by this code.
|
||||
|
||||
**HARDWARE/SOFTWARE interaction**
|
||||
|
||||
Powering up a stepper and setting the direction are done by the same command. Can't do one without the other.
|
||||
|
||||
**All** directions are set **every time** a new block is popped off the queue by the stepper ISR.
|
||||
|
||||
SPI transfers, when setting the directions, are minimized by using arrays and a SPI routine dedicated to this function. L6470 library calls are not used. For N L6470 drivers, this results in a N byte transfer. If library calls were used then N\*N bytes would be sent.
|
||||
|
||||
**Power up (reset) sequence:**
|
||||
|
||||
1. Stepper objects are created before the **setup()** entry point is reached.
|
||||
|
||||
2. After the **setup()** entry point is reached and before the steppers are initialized, L6470\_init() is called to do the following
|
||||
|
||||
3. If present, the hardware reset is pulsed.
|
||||
|
||||
4. The L6470\_chain array is populated during **setup()**. This array is used to tell where in the SPI stream the commands/data for an stepper is positioned.
|
||||
|
||||
5. The L6470 soft SPI pins are initialized.
|
||||
|
||||
6. The L6470 chips are initialized during **setup()**. They can be re-initialized using the **L6470\_init\_to\_defaults()** function
|
||||
|
||||
The steppers are **NOT** powered up during this sequence.
|
||||
|
||||
**L6470\_chain** array
|
||||
|
||||
This array is used by all routines that transmit SPI data.
|
||||
|
||||
```
|
||||
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)
|
||||
```
|
||||
|
||||
**Direction set and enable**
|
||||
|
||||
The DIR\_WRITE macros for the L6470 drivers are written so that the standard X, Y, Z and extruder logic used by the set\_directions() routine is not altered. These macros write the correct forward/reverse command to the corresponding location in the array *L6470\_dir\_commands*.
|
||||
|
||||
At the end of the set\_directions() routine, the array *L6470\_chain* is used to grab the corresponding direction/enable commands out of the array *L6470\_dir\_commands* and put them in the correct sequence in the array *L6470\_buf*. Array *L6470\_buf* is then passed to the **void** L6470\_Transfer function which actually sends the data to the devices.
|
||||
|
||||
**Utilities and misc**
|
||||
|
||||
The **absolute position** registers should accurately reflect Marlin’s stepper position counts. They are set to zero during initialization. G28 sets them to the Marlin counts for the corresponding axis after homing. NOTE – these registers are often the negative of the Marlin counts. This is because the Marlin counts reflect the logical direction while the registers reflect the stepper direction. The register contents are displayed via the M114 D command.
|
||||
|
||||
The **L6470\_monitor** feature reads the status of each device every half second. It will report if there are any error conditions present or if communications has been lost/restored. The KVAL\_HOLD value is reduced every 2 – 2.5 seconds if the thermal warning or thermal shutdown conditions are present.
|
||||
|
||||
**M122** displays the settings of most of the bits in the status register plus a couple of other items.
|
||||
|
||||
**M906** can be used to set the KVAL\_HOLD register one driver at a time. If a setting is not included with the command then the contents of the registers that affect the phase current/voltage are displayed.
|
||||
|
||||
**M916, M917 & M918**
|
||||
|
||||
These utilities are used to tune the system. They can get you in the ballpark for acceptable jerk, acceleration, top speed and KVAL\_HOLD settings. In general they seem to provide an overly optimistic KVAL\_HOLD setting because of the lag between setting KVAL\_HOLD and the driver reaching final temperature. Enabling the **L6470\_monitor** feature during prints will provide the **final useful KVAL\_HOLD setting**.
|
||||
|
||||
The amount of power needed to move the stepper without skipping steps increases as jerk, acceleration and top speed increase. The power dissipated by the driver increases as the power to the stepper increases. The net result is a balancing act between jerk, acceleration, top speed and power dissipated by the driver.
|
||||
|
||||
**M916 -** Increases KVAL\_HOLD while moving one axis until get thermal warning. This routine is also useful for determining the approximate KVAL\_HOLD where the stepper stops losing steps. The sound will get noticeably quieter as it stops losing steps.
|
||||
|
||||
**M917 -** Find minimum current thresholds. This is done by doing the following steps while moving an axis:
|
||||
|
||||
1. Decrease OCD current until overcurrent error
|
||||
|
||||
2. Increase OCD until overcurrent error goes away
|
||||
|
||||
3. Decrease stall threshold until stall error
|
||||
|
||||
4. Increase stall until stall error goes away
|
||||
|
||||
**M918 -** Increase speed until error or max feedrate achieved.
|
@@ -1,796 +0,0 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* The monitor_driver routines are a close copy of the TMC code
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
|
||||
#include "L6470_Marlin.h"
|
||||
|
||||
L6470_Marlin L6470;
|
||||
|
||||
#include "../../module/stepper/indirection.h"
|
||||
#include "../../module/planner.h"
|
||||
#include "../../gcode/gcode.h"
|
||||
|
||||
#define DEBUG_OUT ENABLED(L6470_CHITCHAT)
|
||||
#include "../../core/debug_out.h"
|
||||
|
||||
uint8_t L6470_Marlin::dir_commands[MAX_L6470]; // array to hold direction command for each driver
|
||||
|
||||
char L6470_Marlin::index_to_axis[MAX_L6470][3] = { "X ", "Y ", "Z ", "X2", "Y2", "Z2", "Z3", "E0", "E1", "E2", "E3", "E4", "E5" };
|
||||
|
||||
bool L6470_Marlin::index_to_dir[MAX_L6470] = {
|
||||
INVERT_X_DIR , // 0 X
|
||||
INVERT_Y_DIR , // 1 Y
|
||||
INVERT_Z_DIR , // 2 Z
|
||||
#if ENABLED(X_DUAL_STEPPER_DRIVERS)
|
||||
INVERT_X_DIR ^ INVERT_X2_VS_X_DIR , // 3 X2
|
||||
#else
|
||||
INVERT_X_DIR , // 3 X2
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
|
||||
INVERT_Y_DIR ^ INVERT_Y2_VS_Y_DIR , // 4 Y2
|
||||
#else
|
||||
INVERT_Y_DIR , // 4 Y2
|
||||
#endif
|
||||
INVERT_Z_DIR , // 5 Z2
|
||||
INVERT_Z_DIR , // 6 Z3
|
||||
INVERT_E0_DIR , // 7 E0
|
||||
INVERT_E1_DIR , // 8 E1
|
||||
INVERT_E2_DIR , // 9 E2
|
||||
INVERT_E3_DIR , //10 E3
|
||||
INVERT_E4_DIR , //11 E4
|
||||
INVERT_E5_DIR , //12 E5
|
||||
};
|
||||
|
||||
uint8_t L6470_Marlin::axis_xref[MAX_L6470] = {
|
||||
AxisEnum(X_AXIS), // X
|
||||
AxisEnum(Y_AXIS), // Y
|
||||
AxisEnum(Z_AXIS), // Z
|
||||
AxisEnum(X_AXIS), // X2
|
||||
AxisEnum(Y_AXIS), // Y2
|
||||
AxisEnum(Z_AXIS), // Z2
|
||||
AxisEnum(Z_AXIS), // Z3
|
||||
AxisEnum(E_AXIS), // E0
|
||||
AxisEnum(E_AXIS), // E1
|
||||
AxisEnum(E_AXIS), // E2
|
||||
AxisEnum(E_AXIS), // E3
|
||||
AxisEnum(E_AXIS), // E4
|
||||
AxisEnum(E_AXIS) // E5
|
||||
};
|
||||
|
||||
volatile bool L6470_Marlin::spi_abort = false;
|
||||
bool L6470_Marlin::spi_active = false;
|
||||
|
||||
void L6470_Marlin::populate_chain_array() {
|
||||
|
||||
#define _L6470_INIT_SPI(Q) do{ stepper##Q.set_chain_info(Q, Q##_CHAIN_POS); }while(0)
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
_L6470_INIT_SPI(X);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
_L6470_INIT_SPI(X2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
_L6470_INIT_SPI(Y);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
_L6470_INIT_SPI(Y2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
_L6470_INIT_SPI(Z);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
_L6470_INIT_SPI(Z2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
_L6470_INIT_SPI(Z3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
_L6470_INIT_SPI(E0);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
_L6470_INIT_SPI(E1);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
_L6470_INIT_SPI(E2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
_L6470_INIT_SPI(E3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
_L6470_INIT_SPI(E4);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
_L6470_INIT_SPI(E5);
|
||||
#endif
|
||||
}
|
||||
|
||||
void L6470_Marlin::init() { // Set up SPI and then init chips
|
||||
#if PIN_EXISTS(L6470_RESET_CHAIN)
|
||||
OUT_WRITE(L6470_RESET_CHAIN_PIN, LOW); // hardware reset of drivers
|
||||
delay(1);
|
||||
OUT_WRITE(L6470_RESET_CHAIN_PIN, HIGH);
|
||||
delay(1); // need about 650uS for the chip to fully start up
|
||||
#endif
|
||||
populate_chain_array(); // Set up array to control where in the SPI transfer sequence a particular stepper's data goes
|
||||
L6470_spi_init(); // Set up L6470 soft SPI pins
|
||||
init_to_defaults(); // init the chips
|
||||
}
|
||||
|
||||
uint16_t L6470_Marlin::get_status(const uint8_t axis) {
|
||||
|
||||
#define GET_L6470_STATUS(Q) stepper##Q.getStatus()
|
||||
|
||||
switch (axis) {
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
case 0: return GET_L6470_STATUS(X);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
case 1: return GET_L6470_STATUS(Y);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
case 2: return GET_L6470_STATUS(Z);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
case 3: return GET_L6470_STATUS(X2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
case 4: return GET_L6470_STATUS(Y2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
case 5: return GET_L6470_STATUS(Z2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
case 6: return GET_L6470_STATUS(Z3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
case 7: return GET_L6470_STATUS(E0);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
case 8: return GET_L6470_STATUS(E1);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
case 9: return GET_L6470_STATUS(E2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
case 10: return GET_L6470_STATUS(E3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
case 11: return GET_L6470_STATUS(E4);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
case 12: return GET_L6470_STATUS(E5);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0; // Not needed but kills a compiler warning
|
||||
}
|
||||
|
||||
uint32_t L6470_Marlin::get_param(uint8_t axis, uint8_t param) {
|
||||
|
||||
#define GET_L6470_PARAM(Q) L6470_GETPARAM(param,Q)
|
||||
|
||||
switch (axis) {
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
case 0: return GET_L6470_PARAM(X);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
case 1: return GET_L6470_PARAM(Y);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
case 2: return GET_L6470_PARAM(Z);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
case 3: return GET_L6470_PARAM(X2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
case 4: return GET_L6470_PARAM(Y2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
case 5: return GET_L6470_PARAM(Z2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
case 6: return GET_L6470_PARAM(Z3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
case 7: return GET_L6470_PARAM(E0);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
case 8: return GET_L6470_PARAM(E1);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
case 9: return GET_L6470_PARAM(E2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
case 10: return GET_L6470_PARAM(E3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
case 11: return GET_L6470_PARAM(E4);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
case 12: return GET_L6470_PARAM(E5);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0 ; // not needed but kills a compiler warning
|
||||
}
|
||||
|
||||
void L6470_Marlin::set_param(uint8_t axis, uint8_t param, uint32_t value) {
|
||||
|
||||
#define SET_L6470_PARAM(Q) stepper##Q.SetParam(param, value)
|
||||
|
||||
switch (axis) {
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
case 0: SET_L6470_PARAM(X);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
case 1: SET_L6470_PARAM(Y);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
case 2: SET_L6470_PARAM(Z);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
case 3: SET_L6470_PARAM(X2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
case 4: SET_L6470_PARAM(Y2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
case 5: SET_L6470_PARAM(Z2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
case 6: SET_L6470_PARAM(Z3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
case 7: SET_L6470_PARAM(E0);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
case 8: SET_L6470_PARAM(E1);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
case 9: SET_L6470_PARAM(E2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
case 10: SET_L6470_PARAM(E3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
case 11: SET_L6470_PARAM(E4);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
case 12: SET_L6470_PARAM(E5);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
inline void echo_min_max(const char a, const float &min, const float &max) {
|
||||
DEBUG_CHAR(' '); DEBUG_CHAR(a);
|
||||
DEBUG_ECHOPAIR(" min = ", min);
|
||||
DEBUG_ECHOLNPAIR(" max = ", max);
|
||||
}
|
||||
inline void echo_oct_used(const float &oct, const bool stall) {
|
||||
DEBUG_ECHOPAIR("over_current_threshold used : ", oct);
|
||||
serialprintPGM(stall ? PSTR(" (Stall") : PSTR(" (OCD"));
|
||||
DEBUG_ECHOLNPGM(" threshold)");
|
||||
}
|
||||
inline void err_out_of_bounds() { DEBUG_ECHOLNPGM("ERROR - motion out of bounds"); }
|
||||
|
||||
bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3], char axis_mon[3][3],
|
||||
float &position_max, float &position_min, float &final_feedrate, uint8_t &kval_hold,
|
||||
bool over_current_flag, uint8_t &OCD_TH_val, uint8_t &STALL_TH_val, uint16_t &over_current_threshold
|
||||
) {
|
||||
// Return TRUE if the calling routine needs to abort/kill
|
||||
|
||||
uint16_t displacement = 0; // " = 0" to eliminate compiler warning
|
||||
uint8_t j; // general purpose counter
|
||||
|
||||
if (!all_axes_homed()) {
|
||||
DEBUG_ECHOLNPGM("ERROR - home all before running this command");
|
||||
//return true;
|
||||
}
|
||||
|
||||
LOOP_XYZE(i) if (uint16_t _displacement = parser.intval(axis_codes[i])) {
|
||||
displacement = _displacement;
|
||||
uint8_t axis_offset = parser.byteval('J');
|
||||
axis_mon[0][0] = axis_codes[i]; // axis ASCII value (target character)
|
||||
if (axis_offset >= 2 || axis_mon[0][0] == 'E') // Single axis, E0, or E1
|
||||
axis_mon[0][1] = axis_offset + '0';
|
||||
else if (axis_offset == 0) { // one or more axes
|
||||
uint8_t driver_count_local = 0; // can't use "driver_count" directly as a subscript because it's passed by reference
|
||||
for (j = 0; j < MAX_L6470; j++) // see how many drivers on this axis
|
||||
if (axis_mon[0][0] == index_to_axis[j][0]) {
|
||||
axis_mon[driver_count_local][0] = axis_mon[0][0];
|
||||
axis_mon[driver_count_local][1] = index_to_axis[j][1];
|
||||
axis_mon[driver_count_local][2] = index_to_axis[j][2]; // append end of string
|
||||
axis_index[driver_count_local] = j; // set axis index
|
||||
driver_count_local++;
|
||||
}
|
||||
driver_count = driver_count_local;
|
||||
}
|
||||
break; // only take first axis found
|
||||
}
|
||||
|
||||
//
|
||||
// Position calcs & checks
|
||||
//
|
||||
|
||||
const xyze_pos_t center = {
|
||||
LOGICAL_X_POSITION(current_position.x),
|
||||
LOGICAL_Y_POSITION(current_position.y),
|
||||
LOGICAL_Z_POSITION(current_position.z),
|
||||
current_position.e
|
||||
};
|
||||
|
||||
switch (axis_mon[0][0]) {
|
||||
default: position_max = position_min = 0; break;
|
||||
|
||||
case 'X': {
|
||||
position_min = center.x - displacement;
|
||||
position_max = center.x + displacement;
|
||||
echo_min_max('X', position_min, position_max);
|
||||
if (false
|
||||
#ifdef X_MIN_POS
|
||||
|| position_min < (X_MIN_POS)
|
||||
#endif
|
||||
#ifdef X_MAX_POS
|
||||
|| position_max > (X_MAX_POS)
|
||||
#endif
|
||||
) {
|
||||
err_out_of_bounds();
|
||||
return true;
|
||||
}
|
||||
} break;
|
||||
|
||||
case 'Y': {
|
||||
position_min = center.y - displacement;
|
||||
position_max = center.y + displacement;
|
||||
echo_min_max('Y', position_min, position_max);
|
||||
if (false
|
||||
#ifdef Y_MIN_POS
|
||||
|| position_min < (Y_MIN_POS)
|
||||
#endif
|
||||
#ifdef Y_MAX_POS
|
||||
|| position_max > (Y_MAX_POS)
|
||||
#endif
|
||||
) {
|
||||
err_out_of_bounds();
|
||||
return true;
|
||||
}
|
||||
} break;
|
||||
|
||||
case 'Z': {
|
||||
position_min = center.z - displacement;
|
||||
position_max = center.z + displacement;
|
||||
echo_min_max('Z', position_min, position_max);
|
||||
if (false
|
||||
#ifdef Z_MIN_POS
|
||||
|| position_min < (Z_MIN_POS)
|
||||
#endif
|
||||
#ifdef Z_MAX_POS
|
||||
|| position_max > (Z_MAX_POS)
|
||||
#endif
|
||||
) {
|
||||
err_out_of_bounds();
|
||||
return true;
|
||||
}
|
||||
} break;
|
||||
|
||||
case 'E': {
|
||||
position_min = center.e - displacement;
|
||||
position_max = center.e + displacement;
|
||||
echo_min_max('E', position_min, position_max);
|
||||
} break;
|
||||
}
|
||||
|
||||
//
|
||||
// Work on the drivers
|
||||
//
|
||||
for (uint8_t k = 0; k < driver_count; k++) {
|
||||
bool not_found = true;
|
||||
for (j = 1; j <= L6470::chain[0]; j++) {
|
||||
const char * const ind_axis = index_to_axis[L6470::chain[j]];
|
||||
if (ind_axis[0] == axis_mon[k][0] && ind_axis[1] == axis_mon[k][1]) { // See if a L6470 driver
|
||||
not_found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (not_found) {
|
||||
driver_count = k;
|
||||
axis_mon[k][0] = ' '; // mark this entry invalid
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (driver_count == 0) {
|
||||
DEBUG_ECHOLNPGM("ERROR - not a L6470 axis");
|
||||
return true;
|
||||
}
|
||||
|
||||
DEBUG_ECHOPGM("Monitoring:");
|
||||
for (j = 0; j < driver_count; j++) DEBUG_ECHOPAIR(" ", axis_mon[j]);
|
||||
L6470_EOL();
|
||||
|
||||
// now have a list of driver(s) to monitor
|
||||
|
||||
//
|
||||
// kVAL_HOLD checks & settings
|
||||
//
|
||||
|
||||
kval_hold = parser.byteval('K');
|
||||
if (kval_hold) {
|
||||
DEBUG_ECHOLNPAIR("kval_hold = ", kval_hold);
|
||||
for (j = 0; j < driver_count; j++)
|
||||
set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
|
||||
}
|
||||
else {
|
||||
// only print the KVAL_HOLD from one of the drivers
|
||||
kval_hold = get_param(axis_index[0], L6470_KVAL_HOLD);
|
||||
DEBUG_ECHOLNPAIR("KVAL_HOLD = ", kval_hold);
|
||||
}
|
||||
|
||||
//
|
||||
// Overcurrent checks & settings
|
||||
//
|
||||
|
||||
if (over_current_flag) {
|
||||
|
||||
uint8_t OCD_TH_val_local = 0, // compiler thinks OCD_TH_val is unused if use it directly
|
||||
STALL_TH_val_local = 0; // just in case ...
|
||||
|
||||
over_current_threshold = parser.intval('I');
|
||||
|
||||
if (over_current_threshold) {
|
||||
|
||||
OCD_TH_val_local = over_current_threshold/375;
|
||||
LIMIT(OCD_TH_val_local, 0, 15);
|
||||
STALL_TH_val_local = over_current_threshold/31.25;
|
||||
LIMIT(STALL_TH_val_local, 0, 127);
|
||||
uint16_t OCD_TH_actual = (OCD_TH_val_local + 1) * 375,
|
||||
STALL_TH_actual = (STALL_TH_val_local + 1) * 31.25;
|
||||
if (OCD_TH_actual < STALL_TH_actual) {
|
||||
OCD_TH_val_local++;
|
||||
OCD_TH_actual = (OCD_TH_val_local + 1) * 375;
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPAIR("over_current_threshold specified: ", over_current_threshold);
|
||||
echo_oct_used(STALL_TH_actual, true);
|
||||
echo_oct_used(OCD_TH_actual, false);
|
||||
|
||||
#define SET_OVER_CURRENT(Q) do { stepper##Q.SetParam(L6470_STALL_TH, STALL_TH_val_local); stepper##Q.SetParam(L6470_OCD_TH, OCD_TH_val_local);} while (0)
|
||||
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
set_param(axis_index[j], L6470_STALL_TH, STALL_TH_val_local);
|
||||
set_param(axis_index[j], L6470_OCD_TH, OCD_TH_val_local);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// only get & print the OVER_CURRENT values from one of the drivers
|
||||
STALL_TH_val_local = get_param(axis_index[0], L6470_STALL_TH);
|
||||
OCD_TH_val_local = get_param(axis_index[0], L6470_OCD_TH);
|
||||
|
||||
echo_oct_used((STALL_TH_val_local + 1) * 31.25, true);
|
||||
echo_oct_used((OCD_TH_val_local + 1) * 375, false);
|
||||
} // over_current_threshold
|
||||
|
||||
for (j = 0; j < driver_count; j++) { // set all drivers on axis the same
|
||||
set_param(axis_index[j], L6470_STALL_TH, STALL_TH_val_local);
|
||||
set_param(axis_index[j], L6470_OCD_TH, OCD_TH_val_local);
|
||||
}
|
||||
|
||||
OCD_TH_val = OCD_TH_val_local; // force compiler to update the main routine's copy
|
||||
STALL_TH_val = STALL_TH_val_local; // force compiler to update the main routine's copy
|
||||
} // end of overcurrent
|
||||
|
||||
//
|
||||
// Feedrate
|
||||
//
|
||||
|
||||
final_feedrate = parser.floatval('F');
|
||||
if (final_feedrate == 0) {
|
||||
static constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE;
|
||||
const uint8_t num_feedrates = COUNT(default_max_feedrate);
|
||||
for (j = 0; j < num_feedrates; j++) {
|
||||
if (axis_codes[j] == axis_mon[0][0]) {
|
||||
final_feedrate = default_max_feedrate[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == 3 && num_feedrates > 4) { // have more than one extruder feedrate
|
||||
uint8_t extruder_num = axis_mon[0][1] - '0';
|
||||
if (j <= num_feedrates - extruder_num) // have a feedrate specifically for this extruder
|
||||
final_feedrate = default_max_feedrate[j + extruder_num];
|
||||
else
|
||||
final_feedrate = default_max_feedrate[3]; // use E0 feedrate for this extruder
|
||||
}
|
||||
final_feedrate *= 60; // convert to mm/minute
|
||||
} // end of feedrate
|
||||
|
||||
return false; // FALSE indicates no user input problems
|
||||
}
|
||||
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
inline void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR("YES") : PSTR("NO ")); }
|
||||
#endif
|
||||
|
||||
void L6470_Marlin::say_axis(const uint8_t axis, const bool label/*=true*/) {
|
||||
if (label) SERIAL_ECHOPGM("AXIS:");
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(index_to_axis[axis][0]);
|
||||
SERIAL_CHAR(index_to_axis[axis][1]);
|
||||
SERIAL_CHAR(' ');
|
||||
}
|
||||
|
||||
void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis) { // assumes status bits have been inverted
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
char temp_buf[10];
|
||||
say_axis(axis);
|
||||
sprintf_P(temp_buf, PSTR(" %4x "), status);
|
||||
DEBUG_ECHO(temp_buf);
|
||||
print_bin(status);
|
||||
DEBUG_ECHOPGM(" THERMAL: ");
|
||||
serialprintPGM((status & STATUS_TH_SD) ? PSTR("SHUTDOWN") : (status & STATUS_TH_WRN) ? PSTR("WARNING ") : PSTR("OK "));
|
||||
DEBUG_ECHOPGM(" OVERCURRENT: ");
|
||||
echo_yes_no(status & STATUS_OCD);
|
||||
DEBUG_ECHOPGM(" STALL: ");
|
||||
echo_yes_no(status & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B));
|
||||
L6470_EOL();
|
||||
#else
|
||||
UNUSED(status); UNUSED(axis);
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////
|
||||
//// MONITOR_L6470_DRIVER_STATUS routines
|
||||
////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if ENABLED(MONITOR_L6470_DRIVER_STATUS)
|
||||
|
||||
struct L6470_driver_data {
|
||||
uint8_t driver_index;
|
||||
uint32_t driver_status;
|
||||
bool is_otw;
|
||||
uint8_t otw_counter;
|
||||
bool is_ot;
|
||||
bool is_hi_Z;
|
||||
uint8_t com_counter;
|
||||
};
|
||||
|
||||
L6470_driver_data driver_L6470_data[] = {
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
{ 0, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
{ 1, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
{ 2, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
{ 3, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
{ 4, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
{ 5, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
{ 6, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
{ 7, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
{ 8, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
{ 9, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
{ 10, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
{ 11, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
{ 12, 0, 0, 0, 0, 0, 0 }
|
||||
#endif
|
||||
};
|
||||
|
||||
inline void append_stepper_err(char * &p, const uint8_t stepper_index, const char * const err=nullptr) {
|
||||
p += sprintf_P(p, PSTR("Stepper %c%c "), char(index_to_axis[stepper_index][0]), char(index_to_axis[stepper_index][1]));
|
||||
if (err) p += sprintf_P(p, err);
|
||||
}
|
||||
|
||||
void L6470_monitor_update(uint8_t stepper_index, uint16_t status) {
|
||||
if (spi_abort) return; // don't do anything if set_directions() has occurred
|
||||
uint8_t kval_hold;
|
||||
char temp_buf[120];
|
||||
char* p = &temp_buf[0];
|
||||
uint8_t j;
|
||||
for (j = 0; j < L6470::chain[0]; j++) // find the table for this stepper
|
||||
if (driver_L6470_data[j].driver_index == stepper_index) break;
|
||||
|
||||
driver_L6470_data[j].driver_status = status;
|
||||
uint16_t _status = ~status; // all error bits are active low
|
||||
|
||||
if (status == 0 || status == 0xFFFF) { // com problem
|
||||
if (driver_L6470_data[j].com_counter == 0) { // warn user when it first happens
|
||||
driver_L6470_data[j].com_counter++;
|
||||
append_stepper_err(p, stepper_index, PSTR(" - communications lost\n"));
|
||||
DEBUG_ECHO(temp_buf);
|
||||
}
|
||||
else {
|
||||
driver_L6470_data[j].com_counter++;
|
||||
if (driver_L6470_data[j].com_counter > 240) { // remind of com problem about every 2 minutes
|
||||
driver_L6470_data[j].com_counter = 1;
|
||||
append_stepper_err(p, stepper_index, PSTR(" - still no communications\n"));
|
||||
DEBUG_ECHO(temp_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (driver_L6470_data[j].com_counter) { // comms re-established
|
||||
driver_L6470_data[j].com_counter = 0;
|
||||
append_stepper_err(p, stepper_index, PSTR(" - communications re-established\n.. setting all drivers to default values\n"));
|
||||
DEBUG_ECHO(temp_buf);
|
||||
init_to_defaults();
|
||||
}
|
||||
else {
|
||||
// no com problems - do the usual checks
|
||||
if (_status & L6470_ERROR_MASK) {
|
||||
append_stepper_err(p, stepper_index);
|
||||
|
||||
if (status & STATUS_HIZ) { // the driver has shut down HiZ is active high
|
||||
driver_L6470_data[j].is_hi_Z = true;
|
||||
p += sprintf_P(p, PSTR("%cIS SHUT DOWN"), ' ');
|
||||
// if (_status & STATUS_TH_SD) { // strange - TH_SD never seems to go active, must be implied by the HiZ and TH_WRN
|
||||
if (_status & STATUS_TH_WRN) { // over current shutdown
|
||||
p += sprintf_P(p, PSTR("%cdue to over temperature"), ' ');
|
||||
driver_L6470_data[j].is_ot = true;
|
||||
kval_hold = get_param(stepper_index, L6470_KVAL_HOLD) - 2 * KVAL_HOLD_STEP_DOWN;
|
||||
set_param(stepper_index, L6470_KVAL_HOLD, kval_hold); // reduce KVAL_HOLD
|
||||
p += sprintf_P(p, PSTR(" - KVAL_HOLD reduced by %d to %d"), 2 * KVAL_HOLD_STEP_DOWN, kval_hold); // let user know
|
||||
}
|
||||
else
|
||||
driver_L6470_data[j].is_ot = false;
|
||||
}
|
||||
else {
|
||||
driver_L6470_data[j].is_hi_Z = false;
|
||||
|
||||
if (_status & STATUS_TH_WRN) { // have an over temperature warning
|
||||
driver_L6470_data[j].is_otw = true;
|
||||
driver_L6470_data[j].otw_counter++;
|
||||
kval_hold = get_param(stepper_index, L6470_KVAL_HOLD);
|
||||
if (driver_L6470_data[j].otw_counter > 4) { // otw present for 2 - 2.5 seconds, reduce KVAL_HOLD
|
||||
kval_hold -= KVAL_HOLD_STEP_DOWN;
|
||||
set_param(stepper_index, L6470_KVAL_HOLD, kval_hold); // reduce KVAL_HOLD
|
||||
p += sprintf_P(p, PSTR(" - KVAL_HOLD reduced by %d to %d"), KVAL_HOLD_STEP_DOWN, kval_hold); // let user know
|
||||
driver_L6470_data[j].otw_counter = 0;
|
||||
driver_L6470_data[j].is_otw = true;
|
||||
}
|
||||
else if (driver_L6470_data[j].otw_counter)
|
||||
p += sprintf_P(p, PSTR("%c- thermal warning"), ' '); // warn user
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef L6470_STOP_ON_ERROR
|
||||
if (_status & (STATUS_UVLO | STATUS_TH_WRN | STATUS_TH_SD))
|
||||
kill(temp_buf);
|
||||
#endif
|
||||
|
||||
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
|
||||
if (_status & STATUS_OCD)
|
||||
p += sprintf_P(p, PSTR("%c over current"), ' ');
|
||||
|
||||
if (_status & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B))
|
||||
p += sprintf_P(p, PSTR("%c stall"), ' ');
|
||||
|
||||
if (_status & STATUS_UVLO)
|
||||
p += sprintf_P(p, PSTR("%c under voltage lock out"), ' ');
|
||||
|
||||
p += sprintf_P(p, PSTR("%c\n"), ' ');
|
||||
#endif
|
||||
|
||||
DEBUG_ECHOLN(temp_buf); // print the error message
|
||||
}
|
||||
else {
|
||||
driver_L6470_data[j].is_ot = false;
|
||||
driver_L6470_data[j].otw_counter = 0; //clear out warning indicators
|
||||
driver_L6470_data[j].is_otw = false;
|
||||
|
||||
} // end usual checks
|
||||
} // comms established but have errors
|
||||
} // comms re-established
|
||||
} // end L6470_monitor_update()
|
||||
|
||||
#define MONITOR_L6470_DRIVE(Q) L6470_monitor_update(Q, stepper##Q.getStatus())
|
||||
|
||||
void L6470_Marlin::monitor_driver() {
|
||||
static millis_t next_cOT = 0;
|
||||
if (ELAPSED(millis(), next_cOT)) {
|
||||
next_cOT = millis() + 500;
|
||||
|
||||
spi_active = true; // let set_directions() know we're in the middle of a series of SPI transfers
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
MONITOR_L6470_DRIVE(X);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
MONITOR_L6470_DRIVE(Y);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
MONITOR_L6470_DRIVE(Z);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
MONITOR_L6470_DRIVE(X2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
MONITOR_L6470_DRIVE(Y2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
MONITOR_L6470_DRIVE(Z2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
MONITOR_L6470_DRIVE(Z3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
MONITOR_L6470_DRIVE(E0);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
MONITOR_L6470_DRIVE(E1);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
MONITOR_L6470_DRIVE(E2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
MONITOR_L6470_DRIVE(E3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
MONITOR_L6470_DRIVE(E4);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
MONITOR_L6470_DRIVE(E5);
|
||||
#endif
|
||||
|
||||
#if ENABLED(L6470_DEBUG)
|
||||
if (report_L6470_status) L6470_EOL();
|
||||
#endif
|
||||
|
||||
spi_active = false; // done with all SPI transfers - clear handshake flags
|
||||
spi_abort = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MONITOR_L6470_DRIVER_STATUS
|
||||
|
||||
#endif // HAS_DRIVER(L6470)
|
@@ -1,72 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#include <L6470.h>
|
||||
|
||||
#define L6470_GETPARAM(P,Q) stepper##Q.GetParam(P)
|
||||
|
||||
enum L6470_driver_enum : unsigned char { X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5, MAX_L6470 };
|
||||
|
||||
#define L6470_ERROR_MASK (STATUS_UVLO | STATUS_TH_WRN | STATUS_TH_SD | STATUS_OCD | STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)
|
||||
#define dSPIN_STEP_CLOCK_FWD dSPIN_STEP_CLOCK
|
||||
#define dSPIN_STEP_CLOCK_REV dSPIN_STEP_CLOCK+1
|
||||
|
||||
class L6470_Marlin {
|
||||
public:
|
||||
static bool index_to_dir[MAX_L6470];
|
||||
static uint8_t axis_xref[MAX_L6470];
|
||||
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
|
||||
static volatile bool spi_abort;
|
||||
static bool spi_active;
|
||||
|
||||
L6470_Marlin() {}
|
||||
|
||||
static uint16_t get_status(const uint8_t axis);
|
||||
|
||||
static uint32_t get_param(uint8_t axis, uint8_t param);
|
||||
|
||||
static void set_param(uint8_t axis, uint8_t param, uint32_t value);
|
||||
|
||||
static bool get_user_input(uint8_t &driver_count, uint8_t axis_index[3], char axis_mon[3][3],
|
||||
float &position_max, float &position_min, float &final_feedrate, uint8_t &kval_hold,
|
||||
bool over_current_flag, uint8_t &OCD_TH_val, uint8_t &STALL_TH_val, uint16_t &over_current_threshold);
|
||||
|
||||
static void error_status_decode(const uint16_t status, const uint8_t axis);
|
||||
|
||||
static void monitor_driver();
|
||||
|
||||
static void init();
|
||||
static void init_to_defaults();
|
||||
|
||||
static void say_axis(const uint8_t axis, const bool label=true);
|
||||
|
||||
private:
|
||||
void populate_chain_array();
|
||||
};
|
||||
|
||||
extern L6470_Marlin L6470;
|
@@ -1,143 +0,0 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* stepper/L6470.cpp
|
||||
* Stepper driver indirection for L6470 drivers
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.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 // L6470
|
@@ -1,176 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* stepper/L6470.h
|
||||
* Stepper driver indirection for L6470 drivers
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../libs/L6470/L6470_Marlin.h"
|
||||
|
||||
// L6470 has STEP on normal pins, but DIR/ENABLE via SPI
|
||||
#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
|
@@ -1,150 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
|
||||
#ifndef STM32F4
|
||||
#error "Oops! Select an STM32F4 board in 'Tools > Board.'"
|
||||
#endif
|
||||
|
||||
#ifndef MACHINE_NAME
|
||||
#define MACHINE_NAME "STEVAL-3DP001V1"
|
||||
#endif
|
||||
|
||||
#undef TEMP_TIMER
|
||||
#define TEMP_TIMER 9 // the Marlin default of timer 7 doesn't exist on the STM32MF401 series
|
||||
|
||||
//
|
||||
// Limit Switches
|
||||
//
|
||||
#define X_MIN_PIN 38 // PD8 X_STOP
|
||||
#define X_MAX_PIN -1
|
||||
#define Y_MIN_PIN 39 // PD9 Y_STOP
|
||||
#define Y_MAX_PIN -1
|
||||
#define Z_MIN_PIN 40 // PD10 Z_STOP
|
||||
#define Z_MAX_PIN -1
|
||||
|
||||
//
|
||||
// Z Probe (when not Z_MIN_PIN)
|
||||
//
|
||||
// #ifndef Z_MIN_PROBE_PIN
|
||||
// #define Z_MIN_PROBE_PIN 11 // PA4
|
||||
// #endif
|
||||
|
||||
#define SCK_PIN 16 // PB13 SPI_S
|
||||
#define MISO_PIN 17 // PB14 SPI_M
|
||||
#define MOSI_PIN 18 // PB15 SPI_M
|
||||
|
||||
//
|
||||
// Steppers
|
||||
//
|
||||
|
||||
#define X_STEP_PIN 60 // PE14 X_PWM
|
||||
#define X_DIR_PIN 61 // PE15 X_DIR
|
||||
#define X_ENABLE_PIN 59 // PE13 X_RES
|
||||
#define X_CS_PIN 11 // PA4 SPI_CS
|
||||
|
||||
#define Y_STEP_PIN 62 // PB10 Y_PWM
|
||||
#define Y_DIR_PIN 63 // PE9 Y_DIR
|
||||
#define Y_ENABLE_PIN 64 // PE10 Y_RES
|
||||
#define Y_CS_PIN 11 // PA4 SPI_CS
|
||||
|
||||
#define Z_STEP_PIN 66 // PC6 Z_PWM
|
||||
#define Z_DIR_PIN 67 // PC0 Z_DIR
|
||||
#define Z_ENABLE_PIN 65 // PC15 Z_RES
|
||||
#define Z_CS_PIN 11 // PA4 SPI_CS
|
||||
|
||||
#define E0_STEP_PIN 70 // PD12 E1_PW
|
||||
#define E0_DIR_PIN 68 // PC13 E1_DIR
|
||||
#define E0_ENABLE_PIN 69 // PC14 E1_RE
|
||||
#define E0_CS_PIN 11 // PA4 SPI_CS
|
||||
|
||||
#define E1_STEP_PIN 72 // PE5 E2_PWM
|
||||
#define E1_DIR_PIN 73 // PE6 E2_DIR
|
||||
#define E1_ENABLE_PIN 71 // PE4 E2_RESE
|
||||
#define E1_CS_PIN 11 // PA4 SPI_CS
|
||||
|
||||
#define E2_STEP_PIN 76 // PB8 E3_PWM
|
||||
#define E2_DIR_PIN 74 // PE2 E3_DIR
|
||||
#define E2_ENABLE_PIN 75 // PE3 E3_RESE
|
||||
#define E2_CS_PIN 11 // PA4 SPI_CS
|
||||
|
||||
|
||||
//
|
||||
// Temperature Sensors
|
||||
//
|
||||
#define TEMP_0_PIN 52 // PA0 E1_THER
|
||||
#define TEMP_1_PIN 53 // PA1 E2_THER
|
||||
#define TEMP_BED_PIN 50 // PC2 BED_THE
|
||||
|
||||
//
|
||||
// Heaters / Fans
|
||||
//
|
||||
#define HEATER_0_PIN 52 // PA0 E1_THER
|
||||
#define HEATER_1_PIN 53 // PA1 E2_THER
|
||||
#define HEATER_BED_PIN 50 // PC2 BED_THE
|
||||
|
||||
#define FAN_PIN 56 // PC4 E1_FAN PWM pin, Part cooling fan
|
||||
#define FAN1_PIN 57 // PC5 E2_FAN PWM pin, Extruder fan
|
||||
#define FAN2_PIN 58 // PE8 E3_FAN PWM pin, Controller fan
|
||||
|
||||
//
|
||||
// Misc functions
|
||||
//
|
||||
#define SDSS 11 // PA4 SPI_CS
|
||||
#define LED_PIN -1 // Heart beat
|
||||
#define PS_ON_PIN -1
|
||||
#define KILL_PIN -1
|
||||
#define PWR_LOSS -1 // Power loss / nAC_FAULT
|
||||
|
||||
//
|
||||
// LCD / Controller
|
||||
//
|
||||
//#define SD_DETECT_PIN 24 // PA15 SD_CA
|
||||
//#define BEEPER_PIN 23 // PC9 SDIO_D1
|
||||
//#define LCD_PINS_RS 63 // PE9 Y_DIR
|
||||
//#define LCD_PINS_ENABLE 58 // PE8 E3_FAN
|
||||
//#define LCD_PINS_D4 15 // PB12 SPI_C
|
||||
//#define LCD_PINS_D5 16 // PB13 SPI_S
|
||||
//#define LCD_PINS_D6 17 // PB14 SPI_M
|
||||
//#define LCD_PINS_D7 18 // PB15 SPI_M
|
||||
//#define BTN_EN1 56 // PC4 E1_FAN
|
||||
//#define BTN_EN2 57 // PC5 E2_FAN
|
||||
//#define BTN_ENC 51 // PC3 BED_THE
|
||||
|
||||
//
|
||||
// Filament runout detection
|
||||
//
|
||||
//#define FIL_RUNOUT_PIN 55 // PA3 BED_THE
|
||||
|
||||
//
|
||||
// Extension pins
|
||||
//
|
||||
//#define EXT0_PIN 48 // PB0 E2_HEAT
|
||||
//#define EXT1_PIN 49 // PB1 E3_HEAT
|
||||
//#define EXT2_PIN // PB2
|
||||
//#define EXT3_PIN 38 // PD8 X_STOP
|
||||
//#define EXT4_PIN 39 // PD9 Y_STOP
|
||||
//#define EXT5_PIN 40 // PD10 Z_STOP
|
||||
//#define EXT6_PIN 41 // PD11
|
||||
//#define EXT7_PIN 70 // PD12 E1_PW
|
||||
//#define EXT8_PIN 62 // PB10 Y_PWM
|
||||
//#define EXT9_PIN // PB11
|
Reference in New Issue
Block a user