micros() in irq is suspicous. Some optomization of stepper parameters. Comments.

This commit is contained in:
Hakan Bastedt
2024-01-23 22:40:15 +01:00
parent f8cec1ac69
commit e7fc20fec5
2 changed files with 25 additions and 13 deletions

View File

@@ -66,7 +66,7 @@ void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation
Obj.StepGenOut1.ActualPosition = Step1.actPos();
Obj.StepGenOut2.ActualPosition = Step2.actPos();
uint32_t dTim = nowTime - thenTime; // Debug. Getting jitter over the last 200 microseconds
uint32_t dTim = nowTime - thenTime; // Debug. Getting jitter over the last 200 milliseconds
Tim.push(dTim);
uint32_t max_Tim = 0, min_Tim = UINT32_MAX;
for (decltype(Tim)::index_t i = 0; i < Tim.size(); i++)
@@ -119,19 +119,19 @@ void loop(void)
{
if (serveIRQ)
{
nowTime = micros();
DIG_process(DIG_PROCESS_WD_FLAG | DIG_PROCESS_OUTPUTS_FLAG |
DIG_PROCESS_APP_HOOK_FLAG | DIG_PROCESS_INPUTS_FLAG);
serveIRQ = 0;
ESCvar.PrevTime = ESCvar.Time;
}
uint32_t dTime=micros()-nowTime;
if ((dTime > 100 && dTime < 800) || dTime > 1500) // Don't run ecat_slv_poll when expecting to server interrupt
ecat_slv_poll();
uint32_t dTime = micros() - nowTime;
if ((dTime > 200 && dTime < 500) || dTime > 1500) // Don't run ecat_slv_poll when expecting to serve interrupt
ecat_slv_poll();
}
void sync0Handler(void)
{
nowTime = micros();
serveIRQ = 1;
}