diff options
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Control/control.c')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Control/control.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 0a4a8b791..a56457bdb 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -254,10 +254,12 @@ uint32_t ControlLoop(uint32_t tick) //test dancers and speed encoders //check all callback units (state machine waiting for completion of a change) uint32_t Device_i; - bool Ten_msTick, Hundred_msTick, Onesecond_Tick; + bool Ten_msTick, Hundred_msTick, Onesecond_Tick,Tick98,Tick998; Ten_msTick = (tick%eTenMilliSecond == 0) ?true:false; - Hundred_msTick = (tick%eHunderdMillisecond == 0) ?true:false; + Hundred_msTick = (tick%eHundredMillisecond == 0) ?true:false; Onesecond_Tick = (tick%eOneSecond == 0) ?true:false; + Tick98 = (tick%eHundredMillisecond == 98) ?true:false; + Tick998 = (tick%eOneSecond == 998) ?true:false; for (Device_i = 0; Device_i < MAX_TANGO_CONTROL_DEVICES;Device_i++) { @@ -276,17 +278,25 @@ uint32_t ControlLoop(uint32_t tick) ControlArray[Device_i].ControlCallbackPtr(ControlArray[Device_i].IfIndex, ControlDatalog[Device_i]); } break; - case eHunderdMillisecond: - if (Hundred_msTick) + case eHundredMillisecond: + if (Tick98) { + //there is a need to trigger the data collection from FPGA, from I2C or from ADC 1.5 milliseconds to collect the data ControlDatalog[Device_i] = ControlArray[Device_i].ControlDataReadPtr( ControlArray[Device_i].Parameter1,ControlArray[Device_i].Parameter2); + } + if (Hundred_msTick) + { + //there is a need to trigger the data collection from FPGA, from I2C or from ADC 1.5 milliseconds to collect the data ControlArray[Device_i].ControlCallbackPtr(ControlArray[Device_i].IfIndex, ControlDatalog[Device_i]); } break; case eOneSecond: - if (Onesecond_Tick) + if (Tick998) { ControlDatalog[Device_i] = ControlArray[Device_i].ControlDataReadPtr( ControlArray[Device_i].Parameter1,ControlArray[Device_i].Parameter2); + } + if (Onesecond_Tick) + { ControlArray[Device_i].ControlCallbackPtr(ControlArray[Device_i].IfIndex, ControlDatalog[Device_i]); } break; |
