slimmed down nuts_bolts

This commit is contained in:
Simen Svale Skogsrud 2011-02-11 23:53:58 +01:00
parent 977c4948bd
commit bfd8cfa7dd
3 changed files with 6 additions and 11 deletions

View File

@ -22,22 +22,14 @@
#define nuts_bolts_h #define nuts_bolts_h
#include <string.h> #include <string.h>
#define ONE_MINUTE_OF_MICROSECONDS 60000000.0
#define TICKS_PER_MICROSECOND (F_CPU/1000000)
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define FALSE 0 #define FALSE 0
#define TRUE 1 #define TRUE 1
// Decide the sign of a value
#define signof(a) (((a)>0) ? 1 : (((a)<0) ? -1 : 0))
#define clear_vector(a) memset(a, 0, sizeof(a))
#define X_AXIS 0 #define X_AXIS 0
#define Y_AXIS 1 #define Y_AXIS 1
#define Z_AXIS 2 #define Z_AXIS 2
#define clear_vector(a) memset(a, 0, sizeof(a))
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif #endif

View File

@ -75,6 +75,8 @@ int32_t position[3];
static uint8_t acceleration_manager_enabled; // Acceleration management active? static uint8_t acceleration_manager_enabled; // Acceleration management active?
#define ONE_MINUTE_OF_MICROSECONDS 60000000.0
// Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the // Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the
// given acceleration: // given acceleration:
inline double estimate_acceleration_distance(double initial_rate, double target_rate, double acceleration) { inline double estimate_acceleration_distance(double initial_rate, double target_rate, double acceleration) {

View File

@ -39,6 +39,7 @@
#define STEPPING_MASK (STEP_MASK | DIRECTION_MASK) // All stepping-related bits (step/direction) #define STEPPING_MASK (STEP_MASK | DIRECTION_MASK) // All stepping-related bits (step/direction)
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits #define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits
#define TICKS_PER_MICROSECOND (F_CPU/1000000)
#define CYCLES_PER_ACCELERATION_TICK ((TICKS_PER_MICROSECOND*1000000)/ACCELERATION_TICKS_PER_SECOND) #define CYCLES_PER_ACCELERATION_TICK ((TICKS_PER_MICROSECOND*1000000)/ACCELERATION_TICKS_PER_SECOND)
#define MINIMUM_STEPS_PER_MINUTE 1200 // The stepper subsystem will never run slower than this, exept when sleeping #define MINIMUM_STEPS_PER_MINUTE 1200 // The stepper subsystem will never run slower than this, exept when sleeping