aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Control
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-10-31 10:16:10 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-10-31 10:16:10 +0200
commitcd18fb27a2499072f18cb0320ddeb85a0500a93e (patch)
treeb1bf1984813bc70ea4784e0e956497fd4fd35805 /Software/Embedded_SW/Embedded/Modules/Control
parent4aca8247565596d6c12ba73242d599dc42887625 (diff)
downloadTango-cd18fb27a2499072f18cb0320ddeb85a0500a93e.tar.gz
Tango-cd18fb27a2499072f18cb0320ddeb85a0500a93e.zip
version 1.4.6.0 - going forward
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Control')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/DriverWithCallbackExample.c4
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c19
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/control.c10
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/control.h2
4 files changed, 21 insertions, 14 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/DriverWithCallbackExample.c b/Software/Embedded_SW/Embedded/Modules/Control/DriverWithCallbackExample.c
index 881034e40..9dcb3affb 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/DriverWithCallbackExample.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/DriverWithCallbackExample.c
@@ -26,7 +26,7 @@ uint32_t DriverActionWithCallback (uint32_t deviceId, uint32_t parameter, callba
ModuleCallback = callback;
//start control:
- uint32_t ControlId = AddControlCallback( callback, eOneMillisecond, NULL, (IfTypeNone*0x100+deviceId),deviceId, parameter );
+ uint32_t ControlId = AddControlCallback(NULL, callback, eOneMillisecond, NULL, (IfTypeNone*0x100+deviceId),deviceId, parameter );
return ControlId;
}
@@ -38,7 +38,7 @@ uint32_t ControlCallBackFunction(uint32_t deviceId, uint32_t ReadValue)
//stop this control loop
RemoveControlCallback(deviceId, ControlCallBackFunction );
//possibly: start regular control (speed etc)
- //uint32_t ControlId = AddControlCallback(ControlCBFunction Callback, eOneMillisecond, NULL, deviceId, Parameter );
+ //uint32_t ControlId = AddControlCallback(NULL,ControlCBFunction Callback, eOneMillisecond, NULL, deviceId, Parameter );
//call the module callback
ModuleCallback(deviceId,ReadValue);
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 53ddda9f9..7e5020336 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -38,6 +38,7 @@
#include <drivers/FPGA/FPGA_Comm.h>
#include "drivers/Valves/Valve.h"
#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
+#include "Drivers/I2C_Communication/I2C.h"
#include "modules/thread/thread_ex.h"
#include "modules/ids/ids_ex.h"
@@ -557,7 +558,6 @@ uint32_t MillisecLowLoop(uint32_t tick)
for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++)
{
CalculateDispenserPressure(Disp_i);
- //Read_MidTank_Pressure_Sensor(Disp_i);
}
ADC_TriggerCollection();
}
@@ -576,13 +576,13 @@ uint32_t MillisecLowLoop(uint32_t tick)
for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++)
{
CalculateDispenserPressure(Disp_i);
- //Read_MidTank_Pressure_Sensor(Disp_i);
}
}
FPGA_GetAllDispensersValveBusyOCD();
temp = Read_Fans_Tacho();
DrawerFansStatus = temp & 0x1F;
SystemFansStatus = temp & 0xE0;
+ MachineUpdateResponseFunc();
//KeepAliveOneSecondCall();
for (Motor_i = 0;Motor_i < NUM_OF_MOTORS;Motor_i++)
{
@@ -593,24 +593,25 @@ uint32_t MillisecLowLoop(uint32_t tick)
}
if (!(OneMinute_Tick))
{
- for (Heater_i = 0;Heater_i < NUM_OF_CURRENT_HEATERS;Heater_i++)
+ Trigger_Heater_Current_Read();
+ /*for (Heater_i = 0;Heater_i < NUM_OF_CURRENT_HEATERS;Heater_i++)
{
- //Read_Heaters_Current(Heater_i);
- }
+ Read_Heaters_Current(Heater_i);
+ }*/
}
for (Sensor_i = 0;Sensor_i < MAX_TEMPERATURE_SENSOR_ID;Sensor_i++)
{
TemperatureCalc[Sensor_i] = MillisecCalculateTemperatures ( Sensor_i);
}
- MachineUpdateResponseFunc();
}
if (OneMinute_Tick)
{
- for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++)
+ Trigger_MidTank_Pressure_Read();
+ /*for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++)
{
Read_MidTank_Pressure_Sensor(Disp_i);
- }
- //MachineUpdateResponseFunc();
+ }*/
+// MachineUpdateResponseFunc();
/* for (Motor_i = 0;Motor_i < NUM_OF_MOTORS;Motor_i++)
{
if (Motor_i == HARDWARE_MOTOR_TYPE__MOTO_SCREW)
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c
index 80afb7ac6..b7d117efe 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/control.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c
@@ -71,6 +71,7 @@ typedef struct
DataReadCBFunction ControlDataReadPtr;
ControlCBFunction ControlCallbackPtr;
uint32_t ControlTiming;
+ char *Name;
}ControlDeviceStruc;
typedef enum
@@ -132,6 +133,7 @@ void ControlInit(void)
ControlArray[Device_i].ControlCallbackPtr = NULL;
ControlArray[Device_i].ControlDataReadPtr = NULL;
ControlArray[Device_i].ControlTiming = eNoControl;
+ ControlArray[Device_i].Name = NULL;
}
gateControlDB = GateMutex_create(NULL, &eb);
if (gateControlDB == NULL)
@@ -166,7 +168,10 @@ uint32_t ControlActivityLed( uint32_t Parameter1)
COMM_RED_LED_ON;
ACTIVITY_RED_LED_OFF; // Heaters indication - all the Heaters OFF
if(FPGA_WD_Occurred == true)
+ {
ACTIVITY_GREEN_LED_ON;
+ HWConfigurationInit();
+ }
if(power.color == fastBILNK)
Pannel_Leds(POWER_ON_OFF,MODE_OFF);
@@ -298,7 +303,7 @@ void ControlStart(void)
TimerEnable(Control_timerBase, TIMER_A);
ADCAcquireStart(0,1);
- AddControlCallback( ControlEmptyCBFunction, eHundredMillisecond, ControlActivityLed,0, 0, 0 );
+ AddControlCallback("ControlActivityLed", ControlEmptyCBFunction, eHundredMillisecond, ControlActivityLed,0, 0, 0 );
SysCtlDelay(12000000);
MillisecStart();
@@ -313,7 +318,7 @@ void ControlStart(void)
* both these callbacks can be removed. if a new call is arriving, it invalidates the previous one (no dual control or data)
*
***************************************************************************************************************************************************/
-uint32_t AddControlCallback( ControlCBFunction Callback, uint32_t CtrlFrequency, DataReadCBFunction DriverfPtr, uint16_t IfIndex, uint32_t Parameter1, uint32_t Parameter2 )
+uint32_t AddControlCallback(char* Name, ControlCBFunction Callback, uint32_t CtrlFrequency, DataReadCBFunction DriverfPtr, uint16_t IfIndex, uint32_t Parameter1, uint32_t Parameter2 )
{
assert(Callback);
assert(DriverfPtr);
@@ -364,6 +369,7 @@ uint32_t AddControlCallback( ControlCBFunction Callback, uint32_t CtrlFrequency
ControlArray[deviceId].Parameter1 = Parameter1;
ControlArray[deviceId].IfIndex = IfIndex;
ControlArray[deviceId].StartTick = millisecondCounter;
+ ControlArray[deviceId].Name = Name;
GateMutex_leave(gateControlDB, key);
//LOG_ERROR(deviceId, "Add Callback");
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.h b/Software/Embedded_SW/Embedded/Modules/Control/control.h
index 450646a68..4b82aab30 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/control.h
+++ b/Software/Embedded_SW/Embedded/Modules/Control/control.h
@@ -38,7 +38,7 @@ typedef enum
void ControlInit(void);
void ControlStop(void);
void ControlStart(void);
-uint32_t AddControlCallback( ControlCBFunction Callback, uint32_t CtrlFrequency, DataReadCBFunction DriverfPtr, uint16_t IfIndex, uint32_t Parameter1, uint32_t Parameter2 );
+uint32_t AddControlCallback(char *Name, ControlCBFunction Callback, uint32_t CtrlFrequency, DataReadCBFunction DriverfPtr, uint16_t IfIndex, uint32_t Parameter1, uint32_t Parameter2 );
int RemoveControlCallback(uint32_t deviceId, ControlCBFunction Callback );
//The safe remove command can be used ONLY when called from the control callback itself
int SafeRemoveControlCallback(uint32_t deviceId , ControlCBFunction Callback);