Shortest BASE_PERIOD is 12000 as it is now. Plus some cleanup
This commit is contained in:
@@ -143,11 +143,11 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// For the example
|
// For the example
|
||||||
#define BASE_PERIOD 50000
|
#define BASE_PERIOD 15000 // 12 i smax
|
||||||
#define SERVO_PERIOD 1000000
|
#define SERVO_PERIOD 1000000
|
||||||
#define JOINT_X_STEPGEN_MAXACCEL 520.0
|
#define JOINT_X_STEPGEN_MAXACCEL 520.0
|
||||||
#define JOINT_X_SCALE 200
|
#define JOINT_X_SCALE -200
|
||||||
#define JOINT_Z_STEPGEN_MAXACCEL 520.0
|
#define JOINT_Z_STEPGEN_MAXACCEL 520.0
|
||||||
#define JOINT_Z_SCALE 80
|
#define JOINT_Z_SCALE -80
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ monitor_speed = 115200
|
|||||||
build_flags = -Wl,--no-warn-rwx-segment
|
build_flags = -Wl,--no-warn-rwx-segment
|
||||||
lib_deps =
|
lib_deps =
|
||||||
SPI
|
SPI
|
||||||
rlogiacco/CircularBuffer@^1.3.3
|
rlogiacco/CircularBuffer
|
||||||
|
|||||||
@@ -51,21 +51,18 @@ void handleStepper(void)
|
|||||||
{
|
{
|
||||||
Step->updateStepGen(pos);
|
Step->updateStepGen(pos);
|
||||||
Obj.ActualPosition1 = Step->stepgen_array[0].pos_fb;
|
Obj.ActualPosition1 = Step->stepgen_array[0].pos_fb;
|
||||||
Obj.ActualPosition1 = Step->stepgen_array[1].pos_fb;
|
Obj.ActualPosition2 = Step->stepgen_array[1].pos_fb;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation
|
void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
// Obj.IndexStatus = Encoder1.indexHappened();
|
// Obj.IndexStatus = Encoder1.indexHappened();
|
||||||
// Obj.EncPos = Encoder1.currentPos();
|
// Obj.EncPos = Encoder1.currentPos();
|
||||||
// Obj.EncFrequency = Encoder1.frequency(ESCvar.Time);
|
// Obj.EncFrequency = Encoder1.frequency(ESCvar.Time);
|
||||||
// Obj.IndexByte = Encoder1.getIndexState();
|
// Obj.IndexByte = Encoder1.getIndexState();
|
||||||
float_t ap2 = Obj.ActualPosition2;
|
float_t ap2 = Obj.ActualPosition2;
|
||||||
Obj.ActualPosition1 = Obj.CommandedPosition1; // Step1.actPos();
|
|
||||||
Obj.ActualPosition2 = Obj.CommandedPosition2; // Step2.actPos();
|
|
||||||
#if 0
|
#if 0
|
||||||
uint64_t dTim = nowTime - thenTime; // Debug. Getting jitter over the last 200 milliseconds
|
uint64_t dTim = nowTime - thenTime; // Debug. Getting jitter over the last 200 milliseconds
|
||||||
Tim.push(dTim);
|
Tim.push(dTim);
|
||||||
@@ -85,7 +82,6 @@ void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation
|
|||||||
Obj.D2 = 0;
|
Obj.D2 = 0;
|
||||||
Obj.D3 = abs(1000 * (ap2 - Obj.CommandedPosition2)); // Step2.actPos();
|
Obj.D3 = abs(1000 * (ap2 - Obj.CommandedPosition2)); // Step2.actPos();
|
||||||
Obj.D4 = 0;
|
Obj.D4 = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESC_interrupt_enable(uint32_t mask);
|
void ESC_interrupt_enable(uint32_t mask);
|
||||||
@@ -140,12 +136,8 @@ void setup(void)
|
|||||||
|
|
||||||
pinMode(PA11, OUTPUT);
|
pinMode(PA11, OUTPUT);
|
||||||
pinMode(PA12, OUTPUT);
|
pinMode(PA12, OUTPUT);
|
||||||
digitalWrite(PA11, HIGH);
|
|
||||||
digitalWrite(PA12, HIGH);
|
|
||||||
pinMode(PC9, OUTPUT);
|
pinMode(PC9, OUTPUT);
|
||||||
pinMode(PC10, OUTPUT);
|
pinMode(PC10, OUTPUT);
|
||||||
digitalWrite(PC9, HIGH);
|
|
||||||
digitalWrite(PC10, HIGH);
|
|
||||||
Step = new StepGen3;
|
Step = new StepGen3;
|
||||||
|
|
||||||
HardwareTimer *MyTim = new HardwareTimer(TIM1); // The base period timer
|
HardwareTimer *MyTim = new HardwareTimer(TIM1); // The base period timer
|
||||||
@@ -157,14 +149,6 @@ void setup(void)
|
|||||||
double pos = 0;
|
double pos = 0;
|
||||||
void loop(void)
|
void loop(void)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
pinMode(PC9, OUTPUT);
|
|
||||||
|
|
||||||
digitalWrite(PC9, LOW);
|
|
||||||
delay(10);
|
|
||||||
digitalWrite(PC9, HIGH);
|
|
||||||
delay(10);
|
|
||||||
#endif
|
|
||||||
uint64_t dTime;
|
uint64_t dTime;
|
||||||
if (serveIRQ)
|
if (serveIRQ)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user