aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Control
diff options
context:
space:
mode:
authorShai Frieder <Shai.Frieder@twine-s.com>2019-11-12 15:23:00 +0200
committerShai Frieder <Shai.Frieder@twine-s.com>2019-11-12 15:23:00 +0200
commit1d5da0064e2e82db6cf5544a2ea7836556d730c9 (patch)
treefac39137a9b0528a9d966fa259f9713590cdfdb5 /Software/Embedded_SW/Embedded/Modules/Control
parent9dcd1a18c22a9eb8c6e7c6409ea785f4ed0fed1f (diff)
parent81ad4efdc9ec8593a75bf68fb3b39b97aa35aaa6 (diff)
downloadTango-1d5da0064e2e82db6cf5544a2ea7836556d730c9.tar.gz
Tango-1d5da0064e2e82db6cf5544a2ea7836556d730c9.zip
take remote
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Control')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c78
1 files changed, 54 insertions, 24 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 7e5020336..28febe8f2 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -54,7 +54,7 @@
#include "Communication/Connection.h"
#include "Modules/General/buttons.h"
-#include "Drivers/I2C_Communication/Head_Card/PT100/PT100_ADC.h"
+#include "Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.h"
Task_Handle Millisecond_Task_Handle;
/******************** Definitions ********************************************/
@@ -83,7 +83,7 @@ typedef struct MillisecMessage{
}MillisecMessageStruc;
//uint32_t ADC_Data[MAX_ADC_DEVICES] = {0};
-//uint32_t TemperatureSensor_Data[MAX_TEMPERATURE_SENSOR_ID] = {0};
+//uint32_t TemperatureSensor_Data[MAX_MAIN_CARD_TEMPERATURE_SENSOR_ID] = {0};
//uint32_t MotorSpeed_Data[NUM_OF_MOTORS] = {0};
//uint32_t MotorStatus_Data[NUM_OF_MOTORS] = {0};
//uint32_t MotorPosition_Data[NUM_OF_MOTORS] = {0};
@@ -103,7 +103,7 @@ MillisecMotorDataStruc ScrewSetMaxSpeedPending = {0};
MillisecMotorDataStruc ScrewMovePending = {0};
MillisecMotorDataStruc MotorData[NUM_OF_MOTORS] = {0};
MillisecMotorDataStruc SpeedSetPending[NUM_OF_MOTORS] = {0};
-MillisecMotorDataStruc PT100Data[MAX_TEMPERATURE_SENSOR_ID] = {0};
+MillisecMotorDataStruc PT100Data[MAX_MAIN_CARD_TEMP_SENS_ID] = {0};
/******************** GLOBAL PARAMETERS ********************************************/
Mailbox_Handle MillisecMsgQ = NULL;
Mailbox_Handle TenMillisecMsgQ = NULL;
@@ -228,7 +228,7 @@ void OneMilliSecondMillisecInterrupt(UArg arg0)
uint32_t PT100Activity = 0;
int32_t MillisecReadFromTempSensor(uint32_t TempSensorId, MSecFptr Callback)
{
- if (TempSensorId >= MAX_TEMPERATURE_SENSOR_ID) return -1;
+ if (TempSensorId >= MAX_MAIN_CARD_TEMP_SENS_ID) return -1;
PT100Activity++; //read request
PT100Data[TempSensorId].Callback = Callback;
PT100Data[TempSensorId].Active = true;
@@ -408,10 +408,11 @@ uint32_t MillisecLoop(uint32_t tick)
}
}
//FPGA_GetTempSensorBusy();
- //int PT100Busy[MAX_TEMPERATURE_SENSOR_ID] = {0,0,0,0,0,0,0,0,0,0};
+ //int PT100Busy[MAX_MAIN_CARD_TEMPERATURE_SENSOR_ID] = {0,0,0,0,0,0,0,0,0,0};
if (PT100Activity)
{
- for (Sensor_i = 0;Sensor_i < MAX_TEMPERATURE_SENSOR_ID;Sensor_i++)
+
+ for (Sensor_i = 0;Sensor_i < MAX_TANGO_TEMPERATURE_SENSOR_ID;Sensor_i++)
{
/*if (TempSensorResponse[Sensor_i].Busy == true)
{
@@ -420,19 +421,35 @@ uint32_t MillisecLoop(uint32_t tick)
}*/
if (PT100Data[Sensor_i].Active == true)
{
- #ifndef Use_Head_Card
+ if(Sensor_i < MAX_MAIN_CARD_TEMP_SENS_ID)
+ {
TemperatureSendSensorDummyClk(Sensor_i);
- #endif
+ }
PT100Data[Sensor_i].Active = false;
PT100Data[Sensor_i].WaitForData = true; // mark the motor for data request next round
break; // one PT100 activitiy per MS
}
else if (PT100Data[Sensor_i].WaitForData == true) //Read request sent, data is waiting
{
- #ifdef Use_Head_Card
- HeadADCPT100_SendReadDataCommand(Sensor_i);
- #endif
+ if(Sensor_i < MAX_MAIN_CARD_TEMP_SENS_ID)
+ {
TemperatureSensorReadFromFPGA_Res(Sensor_i); //got the data from the FPGA
+ }
+ else if(Sensor_i < MAX_HEAD_CARD_TEMP_SENS_ID)
+ {
+ HeadCard_Toggle_PT100(Sensor_i);
+ //deley??
+ HeadADCPT100_SendReadDataCommand(Sensor_i);
+ }
+ else if(Sensor_i < MAX_WHS_CARD_TEMP_SENS_ID)
+ {
+ //for WHS...
+ }
+ else
+ {
+ //TBD
+ }
+
PT100Data[Sensor_i].WaitForData = false;
PT100Data[Sensor_i].SyncRequired = true;
if (PT100Data[Sensor_i].Callback)
@@ -441,10 +458,23 @@ uint32_t MillisecLoop(uint32_t tick)
}
else if (PT100Data[Sensor_i].SyncRequired == true)
{
- #ifdef Use_Head_Card
+ if(Sensor_i < MAX_MAIN_CARD_TEMP_SENS_ID)
+ {
+ TemperatureSensorSync(Sensor_i);
+ }
+ else if(Sensor_i < MAX_HEAD_CARD_TEMP_SENS_ID)
+ {
HeadADCPT100_StartSync(Sensor_i);
- #endif
- TemperatureSensorSync(Sensor_i);
+ }
+ else if(Sensor_i < MAX_WHS_CARD_TEMP_SENS_ID)
+ {
+ //StartSync WHS...
+ }
+ else
+ {
+ //TBD...
+ }
+
PT100Data[Sensor_i].SyncRequired = false;
PT100Activity--;
@@ -461,11 +491,11 @@ uint32_t MillisecLoop(uint32_t tick)
#endif
return OK;
}
-int TemperatureSum[MAX_TEMPERATURE_SENSOR_ID];
-int TemperatureMin[MAX_TEMPERATURE_SENSOR_ID];
-int TemperatureMax[MAX_TEMPERATURE_SENSOR_ID];
-int TemperatureCount[MAX_TEMPERATURE_SENSOR_ID];
-int TemperatureCalc[MAX_TEMPERATURE_SENSOR_ID];
+int TemperatureSum[MAX_MAIN_CARD_TEMP_SENS_ID];
+int TemperatureMin[MAX_MAIN_CARD_TEMP_SENS_ID];
+int TemperatureMax[MAX_MAIN_CARD_TEMP_SENS_ID];
+int TemperatureCount[MAX_MAIN_CARD_TEMP_SENS_ID];
+int TemperatureCalc[MAX_MAIN_CARD_TEMP_SENS_ID];
void MillisecUpdateTemperatures (TEMPERATURE_SENSOR_ID_ENUM SensorId,int temperature)
{
//if(TemperatureCount[SensorId]++>=10)
@@ -525,13 +555,13 @@ uint32_t MillisecLowLoop(uint32_t tick)
{
//Speed_Data = Calculate_Speed_Sensor_Velocity();
//MillisecReadFromTempSensor(Sensor_Read, NULL);
- //if (Sensor_Read++ >= MAX_TEMPERATURE_SENSOR_ID) Sensor_Read = 0;
+ //if (Sensor_Read++ >= MAX_MAIN_CARD_TEMPERATURE_SENSOR_ID) Sensor_Read = 0;
if(Machine_Idle_Mode == true)
Machine_Idle_Breathing_Led();
}
if (m90msecTick)
{
- for (Sensor_i = 0;Sensor_i < MAX_TEMPERATURE_SENSOR_ID;Sensor_i++)
+ for (Sensor_i = 0;Sensor_i < MAX_MAIN_CARD_TEMP_SENS_ID;Sensor_i++)
{
MillisecReadFromTempSensor(Sensor_i, NULL);
}
@@ -541,7 +571,7 @@ uint32_t MillisecLowLoop(uint32_t tick)
Speed_Data = Calculate_Speed_Sensor_Velocity();
Read_Buttons_Reg();
//Ink_Cart_Led();
- for (Sensor_i = 0;Sensor_i < MAX_TEMPERATURE_SENSOR_ID;Sensor_i++)
+ for (Sensor_i = 0;Sensor_i < MAX_MAIN_CARD_TEMP_SENS_ID;Sensor_i++)
{
MillisecUpdateTemperatures (Sensor_i,TemperatureSensorRead(Sensor_i));
}
@@ -599,7 +629,7 @@ uint32_t MillisecLowLoop(uint32_t tick)
Read_Heaters_Current(Heater_i);
}*/
}
- for (Sensor_i = 0;Sensor_i < MAX_TEMPERATURE_SENSOR_ID;Sensor_i++)
+ for (Sensor_i = 0;Sensor_i < MAX_MAIN_CARD_TEMP_SENS_ID;Sensor_i++)
{
TemperatureCalc[Sensor_i] = MillisecCalculateTemperatures ( Sensor_i);
}
@@ -707,7 +737,7 @@ void MillisecLowTask(UArg arg0, UArg arg1)
*/
/*uint32_t getTemperatureSensorData(int SensorId)
{
- assert (SensorId < MAX_TEMPERATURE_SENSOR_ID);
+ assert (SensorId < MAX_MAIN_CARD_TEMPERATURE_SENSOR_ID);
return TemperatureSensor_Data[SensorId];
}*/