syncTimer can be on flawed time units

This commit is contained in:
Hakan Bastedt
2024-04-03 20:40:58 +02:00
parent 9e00caf7c5
commit 5c128f49b5

View File

@@ -104,7 +104,7 @@ void handleStepper(void)
delayT = 500 - diffT;
if (delayT > 0 && delayT < 900)
{
setFrequencyAdjustedMicrosSeconds(syncTimer, delayT);
syncTimer->setOverflow(delayT, MICROSEC_FORMAT);
syncTimer->refresh();
syncTimer->resume();
}
@@ -177,6 +177,7 @@ static esc_cfg_t config =
.esc_hw_eep_handler = NULL,
.esc_check_dc_handler = dc_checker,
};
void measureCrystalFrequency(void);
volatile byte serveIRQ = 0;
@@ -184,8 +185,6 @@ volatile byte serveIRQ = 0;
void setup(void)
{
Serial1.begin(115200);
delay(2000);
Serial1.printf("Hello world\n");
#if 0
measureCrystalFrequency(); // Calibrate crystal frequency
#endif
@@ -200,7 +199,7 @@ void setup(void)
Step = new StepGen3;
baseTimer = new HardwareTimer(TIM1); // The base period timer
uint32_t usecs = BASE_PERIOD/1000;
uint32_t usecs = BASE_PERIOD / 1000;
setFrequencyAdjustedMicrosSeconds(baseTimer, usecs);
baseTimer->attachInterrupt(basePeriodCB);