From 5e67333d1231c2020e8d4ea062fc74418be9f3e5 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 29 May 2018 18:50:18 +0300 Subject: State machine and job handling. motor speed/position is not clean --- Software/Embedded_SW/Embedded/Modules/Control/control.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 40eee95c8..a0ba50078 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -55,7 +55,7 @@ #include "MillisecTask.h" /******************** Definitions ********************************************/ #define INVALID_MSG_ID 0xFFFF -#define MAX_TANGO_CONTROL_DEVICES 200 +#define MAX_TANGO_CONTROL_DEVICES 80 /******************** STRUCTURES AND ENUMs ********************************************/ @@ -221,7 +221,7 @@ int RemoveControlCallback(uint32_t deviceId , ControlCBFunction Callback) } - +uint32_t millisecondCounter = 0; void OneMilliSecondControlInterrupt(UArg arg0) { ControlMessageStruc Message; @@ -235,11 +235,12 @@ void OneMilliSecondControlInterrupt(UArg arg0) //send message to the control task Message.messageId = OneMillisec; - Message.tick = UsersysTickGet(); + Message.tick = millisecondCounter++; Message.msglen = sizeof(ControlMessageStruc); if (ControlMsgQ != NULL) Mailbox_post(ControlMsgQ , &Message, BIOS_NO_WAIT); - + if (millisecondCounter == 1000000000) + millisecondCounter = 0; ROM_TimerIntClear(Control_timerBase, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt // // Enable all interrupts. @@ -258,7 +259,7 @@ uint32_t ControlLoop(uint32_t tick) Ten_msTick = (tick%eTenMilliSecond == 0) ?true:false; Hundred_msTick = (tick%eHundredMillisecond == 0) ?true:false; Onesecond_Tick = (tick%eOneSecond == 0) ?true:false; - Tick98 = (tick%eHundredMillisecond == 98) ?true:false; + Tick98 = (tick%eHundredMillisecond == 99) ?true:false; Tick998 = (tick%eOneSecond == 998) ?true:false; for (Device_i = 0; Device_i < MAX_TANGO_CONTROL_DEVICES;Device_i++) -- cgit v1.3.1