Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bugs with unsigned long transform cartesian to delta #294

Open
wants to merge 10 commits into
base: work092
Choose a base branch
from
Binary file added Direct-Calibrate.pdf
Binary file not shown.
2,100 changes: 1,123 additions & 977 deletions src/ArduinoAVR/Repetier/Commands.cpp

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/ArduinoAVR/Repetier/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ class Commands
public:
static void commandLoop();
static void checkForPeriodicalActions();
static void processArc(GCode *com);
static void processGCode(GCode *com);
static void processMCode(GCode *com);
static void executeGCode(GCode *com);
static void waitUntilEndOfAllMoves();
static void waitUntilEndOfAllBuffers();
static void printCurrentPosition();
static void printCurrentPosition(FSTRINGPARAM(s));
static void printTemperatures(bool showRaw = false);
static void setFanSpeed(int speed,bool wait); /// Set fan speed 0..255
static void changeFeedrateMultiply(int factorInPercent);
Expand Down
6 changes: 4 additions & 2 deletions src/ArduinoAVR/Repetier/Communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,15 @@ FSTRINGVALUE(Com::tEPRZMaxFeedrate,"Max. feedrate [mm/s]")
FSTRINGVALUE(Com::tEPRZHomingFeedrate,"Homing feedrate [mm/s]")

FSTRINGVALUE(Com::tEPRDiagonalRodLength,"Diagonal rod length [mm]")
FSTRINGVALUE(Com::tEPRHorizontalRadius,"Horizontal radius [mm]")
FSTRINGVALUE(Com::tEPRHorizontalRadius,"Horizontal rod radius at 0,0 [mm]")
FSTRINGVALUE(Com::tEPRSegmentsPerSecondPrint,"Segments/s for printing")
FSTRINGVALUE(Com::tEPRSegmentsPerSecondTravel,"Segments/s for travel")

FSTRINGVALUE(Com::tEPRTowerXOffset,"Tower X endstop offset [steps]")
FSTRINGVALUE(Com::tEPRTowerYOffset,"Tower Y endstop offset [steps]")
FSTRINGVALUE(Com::tEPRTowerZOffset,"Tower Z endstop offset [steps]")

FSTRINGVALUE(Com::tEPRDeltaMaxRadius,"Max. radius [mm]")
FSTRINGVALUE(Com::tEPRDeltaMaxRadius,"Max printable radius [mm]")
FSTRINGVALUE(Com::tDeltaDiagonalCorrectionA,"Corr. diagonal A [mm]")
FSTRINGVALUE(Com::tDeltaDiagonalCorrectionB,"Corr. diagonal B [mm]")
FSTRINGVALUE(Com::tDeltaDiagonalCorrectionC,"Corr. diagonal C [mm]")
Expand Down Expand Up @@ -327,6 +327,8 @@ FSTRINGVALUE(Com::tEPRHeatManager,"heat manager [0-3]")
FSTRINGVALUE(Com::tEPRDriveMax,"PID drive max")
FSTRINGVALUE(Com::tEPRDriveMin,"PID drive min")
FSTRINGVALUE(Com::tEPRPGain,"PID P-gain/dead-time")
FSTRINGVALUE(Com::tEPRDead,"Heater dead-time")
FSTRINGVALUE(Com::tEPRUnused,"na for dead time ctrl")
FSTRINGVALUE(Com::tEPRIGain,"PID I-gain")
FSTRINGVALUE(Com::tEPRDGain,"PID D-gain")
FSTRINGVALUE(Com::tEPRPIDMaxValue,"PID max value [0-255]")
Expand Down
20 changes: 20 additions & 0 deletions src/ArduinoAVR/Repetier/Communication.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ FSTRINGVAR(tEPRHeatManager)
FSTRINGVAR(tEPRDriveMax)
FSTRINGVAR(tEPRDriveMin)
FSTRINGVAR(tEPRPGain)
FSTRINGVAR(tEPRDead)
FSTRINGVAR(tEPRUnused)
FSTRINGVAR(tEPRIGain)
FSTRINGVAR(tEPRDGain)
FSTRINGVAR(tEPRPIDMaxValue)
Expand Down Expand Up @@ -379,9 +381,27 @@ static inline void print(int value) {print((int32_t)value);}
static void print(const char *text);
static inline void print(char c) {HAL::serialWriteByte(c);}
static void printFloat(float number, uint8_t digits);
static inline void print(float number) {printFloat(number, 6);}
static inline void println() {HAL::serialWriteByte('\r');HAL::serialWriteByte('\n');}
protected:
private:
};

#ifdef DEBUG
#define SHOW(x) {Com::printF(PSTR(" " #x "=")); Com::print(x); Com::println();}
#define SHOWS(x) {Com::printF(PSTR(" " #x "=")); Com::print(x); Com::print(" steps "); Com::print(x/80); Com::printF(PSTR(" mm")); Com::println();}
#define SHOWM(x) {Com::printF(PSTR(" " #x "=")); Com::print((long)x*80); Com::print(" steps "); Com::print(x); Com::printF(PSTR(" mm")); Com::println();}
#define SHOT(x) Com::printF(PSTR(x " "))
#define SHOWA(t,a,n) {SHOT(t); for (int i=0;i<n;i++) SHOWS(a[i]);}
#define SHOWAM(t,a,n) {SHOT(t); for (int i=0;i<n;i++) SHOWM(a[i]);}

#else
#define SHOW(x)
#define SHOT(x)
#define SHOWS(x)
#define SHOWM(x)
#define SHOWA(t,a,n)
#define SHOWAM(t,a,n)
#endif

#endif // COMMUNICATION_H
80 changes: 41 additions & 39 deletions src/ArduinoAVR/Repetier/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ on this endstop.
#define X_MAX_LENGTH 165
#define Y_MAX_LENGTH 175
#define Z_MAX_LENGTH 116.820

// Coordinates for the minimum axis. Can also be negative if you want to have the bed start at 0 and the printer can go to the left side
// of the bed. Maximum coordinate is given by adding the above X_MAX_LENGTH values.
#define X_MIN_POS 0
Expand Down Expand Up @@ -727,24 +726,24 @@ on this endstop.

// Delta settings
#if DRIVE_SYSTEM==DELTA
/** \brief Delta rod length
/** \brief Delta rod length (mm)
*/
#define DELTA_DIAGONAL_ROD 345 // mm


/* =========== Parameter essential for delta calibration ===================

C, Y-Axis
| |___| CARRIAGE_HORIZONTAL_OFFSET
| | \
|_________ X-axis | \
/ \ | \ DELTA_DIAGONAL_ROD
/ \ \
/ \ \ Carriage is at printer center!
A B \_____/
|--| END_EFFECTOR_HORIZONTAL_OFFSET
|----| DELTA_RADIUS
|-----------| PRINTER_RADIUS
| |___| CARRIAGE_HORIZONTAL_OFFSET (recommend set it to 0)
| | \------------------------------------------
|_________ X-axis | \ |
/ \ | \ DELTA_DIAGONAL_ROD (length) Each move this Rod Height
/ \ \ is calculated
/ \ \ Carriage is at printer center! |
A B \_____/--------------------------------
|--| END_EFFECTOR_HORIZONTAL_OFFSET (recommend set it to 0)
|----| ROD_RADIUS (Horizontal rod pivot to pivot measure)
|-----------| PRINTER_RADIUS (recommend set it to ROD_RADIUS)

Column angles are measured from X-axis counterclockwise
"Standard" positions: alpha_A = 210, alpha_B = 330, alpha_C = 90
Expand All @@ -765,28 +764,36 @@ on this endstop.
#define DELTA_DIAGONAL_CORRECTION_B 0
#define DELTA_DIAGONAL_CORRECTION_C 0

/** Max. radius the printer should be able to reach. */
/** Max. radius (mm) the printer should be able to reach. */
#define DELTA_MAX_RADIUS 200

// Margin (mm) to avoid above tower minimum (xMin xMinsteps)
// If your printer can put its carriage low enough the rod is horizontal without hitting the floor
// set this to zero. Otherwise, measure how high the carriage is from horizontal rod
// Also, movement speeds are 10x to 20x cartesian speeds at tower bottom.
// You may need to leave a few mm for safety.
// Hitting floor at high speed can damage your printer (motors, drives, etc)
// THIS MAY NEED UPDATING IF THE HOT END HEIGHT CHANGES!
#define DELTA_FLOOR_SAFETY_MARGIN_MM 15

/** \brief Horizontal offset of the universal joints on the end effector (moving platform).
*/
#define END_EFFECTOR_HORIZONTAL_OFFSET 33
#define END_EFFECTOR_HORIZONTAL_OFFSET 0

/** \brief Horizontal offset of the universal joints on the vertical carriages.
*/
#define CARRIAGE_HORIZONTAL_OFFSET 18
#define CARRIAGE_HORIZONTAL_OFFSET 0

/** \brief Printer radius in mm, measured from the center of the print area to the vertical smooth rod.
/** \brief Printer radius in mm,
measured from the center of the print area to the vertical smooth tower.
Alternatly set this to the pivot to pivot horizontal rod distance, when head is at (0,0)
*/
#define PRINTER_RADIUS 175
#define PRINTER_RADIUS 124

/** Remove comment for more precise delta moves. Needs a bit more computation time. */
//#define EXACT_DELTA_MOVES
/** 1 for more precise delta moves. 0 for faster computation.
Needs a bit more computation time. */
#define EXACT_DELTA_MOVES 1

/** \brief Horizontal distance bridged by the diagonal push rod when the end effector is in the center. It is pretty close to 50% of the push rod length (250 mm).
*/
#define DELTA_RADIUS (PRINTER_RADIUS-END_EFFECTOR_HORIZONTAL_OFFSET-CARRIAGE_HORIZONTAL_OFFSET)
/* ========== END Delta calibation data ==============*/

/** When true the delta will home to z max when reset/powered over cord. That way you start with well defined coordinates.
Expand All @@ -800,12 +807,6 @@ you can also change the values online and autoleveling will store the results he
#define DELTA_Y_ENDSTOP_OFFSET_STEPS 0
#define DELTA_Z_ENDSTOP_OFFSET_STEPS 0


/** \brief Experimental calibration utility for delta printers
* Change 1 to 0 to disable
*/
#define SOFTWARE_LEVELING (1 && (DRIVE_SYSTEM==DELTA))

#endif
#if DRIVE_SYSTEM==TUGA
// ========== Tuga special settings =============
Expand All @@ -818,7 +819,7 @@ Increasing this figure can use a lot of memory since 7 bytes * size of line buff
will be allocated for the delta buffer.
PrintLine PrintLine::lines[PRINTLINE_CACHE_SIZE (default 16?)];
Printline is about 200 bytes + 7 * DELTASEGMENTS_PER_PRINTLINE
or 16 * (200 + (7*22=154) = 354) = 5664 bytes!!!!!!!1
or 16 * (200 + (7*22=154) = 354) = 5664 bytes! !1
min is 5 * (200 + (7*10=70) =270) = 1350
This leaves ~1K free RAM on an Arduino which has only 8k
Mega. Used only for nonlinear systems like delta or tuga. */
Expand Down Expand Up @@ -1004,8 +1005,8 @@ to activate the quadratic term. Only adds lots of computations and storage usage
Overridden if EEPROM activated.
*/
//#define BAUDRATE 76800
#define BAUDRATE 115200
//#define BAUDRATE 250000
//#define BAUDRATE 115200
#define BAUDRATE 250000

/**
Some boards like Gen7 have a power on pin, to enable the atx power supply. If this is defined,
Expand Down Expand Up @@ -1146,6 +1147,12 @@ is always running and is not hung up for some unknown reason. */
#define Z_PROBE_X3 20
#define Z_PROBE_Y3 170


/** \brief Experimental calibration utility for delta printers
* Change 1 to 0 to disable
*/
#define FEATURE_SOFTWARE_LEVELING 0

/* Babystepping allows to change z height during print without changing official z height */
#define FEATURE_BABYSTEPPING 0
/* If you have a threaded rod, you want a higher multiplicator to see an effect. Limit value to 50 or you get easily overflows.*/
Expand All @@ -1155,14 +1162,9 @@ is always running and is not hung up for some unknown reason. */
#define CASE_LIGHTS_PIN -1
#define CASE_LIGHT_DEFAULT_ON 1

/** Set to false to disable SD support: */
#ifndef SDSUPPORT // Some boards have sd support on board. These define the values already in pins.h
#define SDSUPPORT 0
// Uncomment to enable or change card detection pin. With card detection the card is mounted on insertion.
#define SDCARDDETECT -1
// Change to true if you get a inserted message on removal.
#define SDCARDDETECTINVERTED 0
#endif
//sdcarddetect moved to ui.h where it is set by feature_controller, or set to default,
// ui.h now always sets the flags.

/** Show extended directory including file length. Don't use this with Pronterface! */
#define SD_EXTENDED_DIR 1
// If you want support for G2/G3 arc commands set to true, otherwise false.
Expand Down
Binary file added src/ArduinoAVR/Repetier/Direct-Calibrate.pdf
Binary file not shown.
Loading