Define acceleration in mm/s^2 instead of some unspecified value.
This units thing nicely covers the fact we need the ACCELERATION to precalculate ramping steps later.
This commit is contained in:
parent
f555887eb5
commit
26fb18d178
|
|
@ -129,10 +129,9 @@
|
|||
*/
|
||||
#define ACCELERATION_RAMPING
|
||||
|
||||
/// how fast to accelerate when using ACCELERATION_RAMPING
|
||||
/// smaller values give quicker acceleration
|
||||
/// valid range = 1 to 8,000,000; 500,000 is a good starting point
|
||||
#define ACCELERATION_STEEPNESS 500000
|
||||
/// how fast to accelerate when using ACCELERATION_RAMPING, given in mm/s^2
|
||||
/// decimal allowed, useful range 1. to 10'000, typical range 10. to 100.
|
||||
#define ACCELERATION 10.
|
||||
|
||||
/** \def ACCELERATION_TEMPORAL
|
||||
temporal step algorithm
|
||||
|
|
|
|||
|
|
@ -128,10 +128,9 @@
|
|||
*/
|
||||
#define ACCELERATION_RAMPING
|
||||
|
||||
/// how fast to accelerate when using ACCELERATION_RAMPING
|
||||
/// smaller values give quicker acceleration
|
||||
/// valid range = 1 to 8,000,000; 500,000 is a good starting point
|
||||
#define ACCELERATION_STEEPNESS 500000
|
||||
/// how fast to accelerate when using ACCELERATION_RAMPING, given in mm/s^2
|
||||
/// decimal allowed, useful range 1. to 10'000, typical range 10. to 100.
|
||||
#define ACCELERATION 10.
|
||||
|
||||
/** \def ACCELERATION_TEMPORAL
|
||||
temporal step algorithm
|
||||
|
|
|
|||
|
|
@ -126,10 +126,9 @@
|
|||
*/
|
||||
#define ACCELERATION_RAMPING
|
||||
|
||||
/// how fast to accelerate when using ACCELERATION_RAMPING
|
||||
/// smaller values give quicker acceleration
|
||||
/// valid range = 1 to 8,000,000; 500,000 is a good starting point
|
||||
#define ACCELERATION_STEEPNESS 500000
|
||||
/// how fast to accelerate when using ACCELERATION_RAMPING, given in mm/s^2
|
||||
/// decimal allowed, useful range 1. to 10'000, typical range 10. to 100.
|
||||
#define ACCELERATION 10.
|
||||
|
||||
/** \def ACCELERATION_TEMPORAL
|
||||
temporal step algorithm
|
||||
|
|
|
|||
|
|
@ -133,10 +133,9 @@
|
|||
*/
|
||||
#define ACCELERATION_RAMPING
|
||||
|
||||
/// how fast to accelerate when using ACCELERATION_RAMPING
|
||||
/// smaller values give quicker acceleration
|
||||
/// valid range = 1 to 8,000,000; 500,000 is a good starting point
|
||||
#define ACCELERATION_STEEPNESS 500000
|
||||
/// how fast to accelerate when using ACCELERATION_RAMPING, given in mm/s^2
|
||||
/// decimal allowed, useful range 1. to 10'000, typical range 10. to 100.
|
||||
#define ACCELERATION 10.
|
||||
|
||||
/** \def ACCELERATION_TEMPORAL
|
||||
temporal step algorithm
|
||||
|
|
|
|||
10
dda.c
10
dda.c
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "timer.h"
|
||||
|
|
@ -335,8 +336,13 @@ void dda_create(DDA *dda, TARGET *target) {
|
|||
// add the last bit of dda->total_steps to always round up
|
||||
dda->ramp_steps = dda->total_steps / 2 + (dda->total_steps & 1);
|
||||
dda->step_no = 0;
|
||||
// c is initial step time in IOclk ticks
|
||||
dda->c = ACCELERATION_STEEPNESS << 8;
|
||||
// remove this when people have swallowed the new config item
|
||||
#ifdef ACCELERATION_STEEPNESS
|
||||
#error ACCELERATION_STEEPNESS is gone, review your config.h and use ACCELERATION
|
||||
#endif
|
||||
// c is initial step time in IOclk ticks (currently, IOclk ticks = F_CPU)
|
||||
// yes, this assumes always the x axis as the critical one regarding acceleration. If we want to implement per-axis acceleration, things get tricky ...
|
||||
dda->c = ((uint32_t)((double)F_CPU / sqrt((double)(STEPS_PER_MM_X * ACCELERATION)))) << 8;
|
||||
dda->c_min = (move_duration / target->F) << 8;
|
||||
if (dda->c_min < c_limit)
|
||||
dda->c_min = c_limit;
|
||||
|
|
|
|||
Loading…
Reference in New Issue