cleanup and removing StepGen from active code

This commit is contained in:
Hakan Bastedt
2024-02-08 21:33:31 +01:00
parent fe3de876fa
commit d0433b29cf
2 changed files with 4 additions and 39 deletions

View File

@@ -10,19 +10,14 @@ private:
volatile int32_t nSteps; volatile int32_t nSteps;
volatile uint32_t timerPulseSteps; volatile uint32_t timerPulseSteps;
volatile float Tstart; volatile float Tstart;
volatile float Tstop;
volatile float Tstep;
const float maxAllowedFrequency = 100000; // 100 kHz for now const float maxAllowedFrequency = 100000; // 100 kHz for now
HardwareTimer *pulseTimer; HardwareTimer *pulseTimer;
uint32_t pulseTimerChan; uint32_t pulseTimerChan;
HardwareTimer *startTimer; // 10,11,13,14 HardwareTimer *startTimer; // 10,11,13,14
uint8_t dirPin; uint8_t dirPin;
PinName stepPin; PinName stepPin;
const uint32_t maxFreq = 100000;
const float Tjitter = 50.0; // Time unit is microseconds const float Tjitter = 50.0; // Time unit is microseconds
uint32_t err = 0;
public: public:
volatile double_t commandedPosition; // End position when this cycle is completed volatile double_t commandedPosition; // End position when this cycle is completed
volatile int32_t commandedStepPosition; // End step position when this cycle is completed volatile int32_t commandedStepPosition; // End step position when this cycle is completed

View File

@@ -17,21 +17,7 @@ void indexPulseEncoderCB1(void)
{ {
Encoder1.indexPulse(); Encoder1.indexPulse();
} }
#if 0
#include "StepGen.h"
void timerCallbackStep1(void);
StepGen Step1(TIM1, 4, PA_11, PA12, timerCallbackStep1);
void timerCallbackStep1(void)
{
Step1.timerCB();
}
void timerCallbackStep2(void);
StepGen Step2(TIM3, 4, PC_9, PC10, timerCallbackStep2);
void timerCallbackStep2(void)
{
Step2.timerCB();
}
#endif
#include "StepGen2.h" #include "StepGen2.h"
void pulseTimerCallback(void); void pulseTimerCallback(void);
void startTimerCallback(void); void startTimerCallback(void);
@@ -45,25 +31,15 @@ void cb_set_outputs(void) // Master outputs gets here, slave inputs, first opera
{ {
Encoder1.setLatch(Obj.IndexLatchEnable); Encoder1.setLatch(Obj.IndexLatchEnable);
Encoder1.setScale(Obj.EncPosScale); Encoder1.setScale(Obj.EncPosScale);
#if 0
Step1.reqPos(Obj.StepGenIn1.CommandedPosition);
Step1.setScale(Obj.StepGenIn1.StepsPerMM);
Step1.enable(Obj.Enable1);
Step2.reqPos(Obj.StepGenIn2.CommandedPosition);
Step2.setScale(Obj.StepGenIn2.StepsPerMM);
Step2.enable(Obj.Enable1);
#endif
} }
void handleStepper(void) void handleStepper(void)
{ {
Step.enabled = true; Step.enabled = true;
Step.commandedPosition = Obj.StepGenIn1.CommandedPosition; Step.commandedPosition = Obj.StepGenIn1.CommandedPosition;
Obj.StepGenOut1.ActualPosition = Step.commandedPosition;
#if 0 Step.handleStepper();
Step1.handleStepper();
Step2.handleStepper();
#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
@@ -72,10 +48,7 @@ void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation
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();
#if 0
Obj.StepGenOut1.ActualPosition = Step1.actPos();
Obj.StepGenOut2.ActualPosition = Step2.actPos();
#endif
uint32_t dTim = nowTime - thenTime; // Debug. Getting jitter over the last 200 milliseconds uint32_t dTim = nowTime - thenTime; // Debug. Getting jitter over the last 200 milliseconds
Tim.push(dTim); Tim.push(dTim);
uint32_t max_Tim = 0, min_Tim = UINT32_MAX; uint32_t max_Tim = 0, min_Tim = UINT32_MAX;
@@ -189,9 +162,6 @@ uint16_t dc_checker(void)
{ {
// Indicate we run DC // Indicate we run DC
ESCvar.dcsync = 1; ESCvar.dcsync = 1;
#if 0
StepGen::sync0CycleTime = ESC_SYNC0cycletime() / 1000; // usecs
#endif
StepGen2::sync0CycleTime = ESC_SYNC0cycletime() / 1000; // usecs StepGen2::sync0CycleTime = ESC_SYNC0cycletime() / 1000; // usecs
return 0; return 0;
} }