aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-06-21 18:12:50 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-06-21 18:12:50 +0300
commit99c3ca5c084ebee576dea0adc64b498133ff6939 (patch)
treef5a332ffd7bb948acd7347a061da796fbab7bb3b /Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
parentb361b1ca7d7bf63b3bc1496cb3351d6332ea25d3 (diff)
downloadTango-99c3ca5c084ebee576dea0adc64b498133ff6939.tar.gz
Tango-99c3ca5c084ebee576dea0adc64b498133ff6939.zip
warnings
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 1f48d5953..a00c23739 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -80,13 +80,15 @@ Mailbox_Handle MotorsMsgQ[NUM_OF_MOTORS] = {NULL};
bool MillisecRestart;
static GateMutex_Handle gateMillisecDB;
-uint32_t MillisecDatalog[MAX_TANGO_CONTROL_DEVICES];
uint32_t Millisec_timerBase = TIMER1_BASE; //Timer handle
/******************** Functions ********************************************/
uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Read);
//**********************************************************************
/******************** CODE ********************************************/
//**********************************************************************
+uint32_t MSBacklog[1000]={0};
+uint8_t Motor_Id[1000]={0};
+uint16_t MsecLogindex = 0;
void MillisecInit(void)
{
@@ -103,7 +105,6 @@ void MillisecInit(void)
MillisecRestart = false;
- memset(MillisecDatalog,0,sizeof(uint32_t)*MAX_TANGO_CONTROL_DEVICES);
gateMillisecDB = GateMutex_create(NULL, &eb);
if (gateMillisecDB == NULL)
@@ -182,6 +183,14 @@ uint32_t MotorActivity = 0;
int32_t MillisecSetMotorSpeed(TimerMotors_t MotorId, unsigned long Data, int Length, MSecFptr Callback)
{
if (MotorId >= NUM_OF_MOTORS) return -1;
+ //==========================
+ MSBacklog[MsecLogindex]=Data;
+ Motor_Id[MsecLogindex]=MotorId;
+ MsecLogindex++;
+ if (MsecLogindex>=999)
+ MsecLogindex = 0;
+ //==========================
+
SpeedSetPending[MotorId].Callback = Callback;
SpeedSetPending[MotorId].Data = Data;
SpeedSetPending[MotorId].Length = Length;
@@ -209,6 +218,13 @@ int MillisecFlushMsgQ(TimerMotors_t MotorId)
int32_t MillisecWriteToMotor(TimerMotors_t MotorId, unsigned long Data, int Length, MSecFptr Callback)
{
MillisecMotorDataStruc MotorData = {0};
+ //==========================
+ MSBacklog[MsecLogindex]=Data;
+ Motor_Id[MsecLogindex]=MotorId;
+ MsecLogindex++;
+ if (MsecLogindex>=999)
+ MsecLogindex = 0;
+ //==========================
if (MotorId >= NUM_OF_MOTORS) return -1;
MotorActivity++;
MotorData.Callback = Callback;
@@ -223,6 +239,13 @@ int32_t MillisecReadFromMotor(TimerMotors_t MotorId, unsigned long Data, int Len
{
MillisecMotorDataStruc MotorData = {0};
if (MotorId >= NUM_OF_MOTORS) return -1;
+//==========================
+ MSBacklog[MsecLogindex]=Data;
+ Motor_Id[MsecLogindex]=MotorId;
+ MsecLogindex++;
+ if (MsecLogindex>=999)
+ MsecLogindex = 0;
+ //==========================
MotorActivity++;
MotorActivity++;
MotorData.Callback = Callback;