aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Control
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-02-18 18:18:48 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-02-18 18:18:48 +0200
commitc6b123db60b1b51135cc10ed92b1113c5f1277de (patch)
tree62e25236913cad7b1602c153a6329bb758b82b49 /Software/Embedded_SW/Embedded/Modules/Control
parent2d509ae1127acfef2b94e83bc65c742d140a1908 (diff)
parent1f1080370a2416d0ef6f762e273cad51758340db (diff)
downloadTango-c6b123db60b1b51135cc10ed92b1113c5f1277de.tar.gz
Tango-c6b123db60b1b51135cc10ed92b1113c5f1277de.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Control')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c5
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/control.c36
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/control.h4
3 files changed, 44 insertions, 1 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 4f78d2134..e0462eb6c 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -458,9 +458,12 @@ uint32_t MillisecLowLoop(uint32_t tick)
{
MillisecReadFromTempSensor(Sensor_i, NULL);
}
- if (watchdogCriticalAlarm == false)
+ if (GeneralHwReady == true)
{
+ if (watchdogCriticalAlarm == false)
+ {
Control_WD(ENABLE,5); //activate heaters/dispenser watchdog, 0.5 seconds
+ }
}
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c
index b7521d796..93c989ab5 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/control.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c
@@ -282,6 +282,42 @@ uint32_t AddControlCallback( ControlCBFunction Callback, CTRL_TIMING_ENUM CtrlF
return deviceId;
}
+int SafeRemoveHighControlCallback(uint32_t deviceId , ControlCBFunction Callback)
+{
+ if (RemoveControlCallback(deviceId, Callback )!=OK)
+ {
+ Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlDevice_i(),RpWarning,(int)deviceId,0);
+ if (RemoveControlCallback(GetControlDevice_i(),Callback)==OK)
+ {
+ Report("Remove control callback fixed",__FILE__,__LINE__,(int)GetControlDevice_i(),RpWarning,(int)deviceId,0);
+ }
+ else
+ {
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)GetControlDevice_i(),RpWarning,(int)deviceId,0);
+ return ERROR;
+ }
+ }
+ return OK;
+}
+
+int SafeRemoveControlCallback(uint32_t deviceId , ControlCBFunction Callback)
+{
+ if (RemoveControlCallback(deviceId, Callback )!=OK)
+ {
+ Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)deviceId,0);
+ if (RemoveControlCallback(GetControlLowDevice_i(),Callback)==OK)
+ {
+ Report("Remove control callback fixed",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)deviceId,0);
+ }
+ else
+ {
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)deviceId,0);
+ return ERROR;
+ }
+ }
+ return OK;
+}
+
int RemoveControlCallback(uint32_t deviceId , ControlCBFunction Callback)
{
if (deviceId == 0xFF)
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.h b/Software/Embedded_SW/Embedded/Modules/Control/control.h
index 0bcaecb03..8d7e219ac 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/control.h
+++ b/Software/Embedded_SW/Embedded/Modules/Control/control.h
@@ -39,6 +39,10 @@ void ControlStop(void);
void ControlStart(void);
uint32_t AddControlCallback( ControlCBFunction Callback, CTRL_TIMING_ENUM 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);
+int SafeRemoveHighControlCallback(uint32_t deviceId , ControlCBFunction Callback);
+
uint32_t TemplateDataReadCBFunction (uint32_t deviceId, uint32_t Parameter1);
uint32_t GetControlDevice_i(void);
uint32_t GetControlLowDevice_i(void);