sync0CycleTime static member of StepGen

This commit is contained in:
Hakan Bastedt
2024-01-11 10:54:13 +01:00
parent a4488da9fa
commit 5df911296c
4 changed files with 6 additions and 7 deletions

View File

@@ -16,7 +16,7 @@ public:
volatile double_t requestedPosition; volatile double_t requestedPosition;
HardwareTimer *MyTim; HardwareTimer *MyTim;
uint32_t stepsPerMM; uint32_t stepsPerMM;
uint32_t sync0CycleTime; static uint32_t sync0CycleTime;
uint8_t dirPin; uint8_t dirPin;
uint8_t stepPin; uint8_t stepPin;
uint8_t timerChan; uint8_t timerChan;
@@ -27,7 +27,6 @@ public:
double actPos(); double actPos();
double reqPos(); double reqPos();
void handleStepper(void); void handleStepper(void);
void setCycleTime(uint32_t cycleTime);
void makePulses(uint64_t cycleTime /* in usecs */, int32_t pulsesAtEnd /* end position*/); void makePulses(uint64_t cycleTime /* in usecs */, int32_t pulsesAtEnd /* end position*/);
void timerCB(); void timerCB();
void setScale(int32_t spm); void setScale(int32_t spm);

View File

@@ -99,3 +99,4 @@ void MyEncoder::setLatch(uint8_t latchEnable)
} }
oldLatchCEnable = latchEnable; oldLatchCEnable = latchEnable;
} }

View File

@@ -57,10 +57,6 @@ void StepGen::handleStepper(void)
int32_t pulsesAtEndOfCycle = stepsPerMM * requestedPosition; // From Turner.hal X:5000 Z:2000 ps/mm int32_t pulsesAtEndOfCycle = stepsPerMM * requestedPosition; // From Turner.hal X:5000 Z:2000 ps/mm
makePulses(sync0CycleTime, pulsesAtEndOfCycle); // Make the pulses using hardware timer makePulses(sync0CycleTime, pulsesAtEndOfCycle); // Make the pulses using hardware timer
} }
void StepGen::setCycleTime(uint32_t cycleTime)
{
sync0CycleTime = cycleTime;
}
void StepGen::makePulses(uint64_t cycleTime /* in usecs */, int32_t pulsesAtEnd /* end position*/) void StepGen::makePulses(uint64_t cycleTime /* in usecs */, int32_t pulsesAtEnd /* end position*/)
{ {
@@ -134,3 +130,5 @@ void StepGen::setScale(int32_t spm)
{ {
stepsPerMM = spm; stepsPerMM = spm;
} }
uint32_t StepGen::sync0CycleTime = 0;

View File

@@ -150,6 +150,7 @@ uint16_t dc_checker(void)
{ {
// Indicate we run DC // Indicate we run DC
ESCvar.dcsync = 0; ESCvar.dcsync = 0;
Step1.setCycleTime(ESC_SYNC0cycletime() / 1000); // nsec to usec //Step1.setCycleTime(ESC_SYNC0cycletime() / 1000); // nsec to usec
StepGen::sync0CycleTime = ESC_SYNC0cycletime() / 1000;
return 0; return 0;
} }