aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Control/control.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-10-29 15:55:21 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-10-29 15:55:21 +0200
commit4b789f33eadfc5cc1d937a80ce03ea8425955ffe (patch)
tree7dbbd0529a24f9ca064cab688a0d6d2b8b762ea1 /Software/Embedded_SW/Embedded/Modules/Control/control.c
parent8f3baa0d9097aa6ed800863a4680608e867c809a (diff)
parent11fb700fcbc4627162a9c3f84b03b5016248bd97 (diff)
downloadTango-4b789f33eadfc5cc1d937a80ce03ea8425955ffe.tar.gz
Tango-4b789f33eadfc5cc1d937a80ce03ea8425955ffe.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Control/control.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/control.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c
index 0f9848ba1..0a092821e 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/control.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c
@@ -170,6 +170,7 @@ void ControlStop(void)
ControlRestart = false;
ADCAcquireStop();
}
+int FPGA_ReInit_Count = 0; ///avoid too many reinitializations of motors as happens when FPGA is corrupted
uint32_t ControlActivityLed( uint32_t Parameter1)
{
static bool flag = false;
@@ -189,19 +190,39 @@ uint32_t ControlActivityLed( uint32_t Parameter1)
if (JobIsActive())
{
JobEndReason = JOB_MOTOR_ALARM;
+ usnprintf(AlarmReasonStr, 100, "Hardware Failure Error");
SendJobProgress(0.0,0,false, "Hardware Failure Error");
AbortJob("FPGA Watchdog Error");
}
- ReportWithPackageFilter(FPGAFilter, "FPGA Watchdog Error",__FILE__,__LINE__,0,RpError, 0,0);
+ if (FPGA_ReInit_Count++<20)
+ {
+ ReportWithPackageFilter(FPGAFilter, "FPGA Watchdog Error",__FILE__,__LINE__,0,RpError, 0,0);
+
+ ACTIVITY_GREEN_LED_ON;
+ MotorConfiguredTimeout = 100;
- ACTIVITY_GREEN_LED_ON;
- FPGA_SetMotorsInit();
- Motor_ReconfigAllMotors();
+ FPGA_SetMotorsInit();
+ Motor_ReconfigAllMotors();
+ }
}
}
else
ACTIVITY_GREEN_LED_OFF;
+ if(power.color == colorOFF) Pannel_Leds(POWER_ON_OFF,MODE_OFF);
+ if(jog.color == colorOFF) Pannel_Leds(THREAD_JOGGING,MODE_OFF);
+ if(load.color == colorOFF) Pannel_Leds(THREAD_JOGGING,MODE_OFF);
+ if(cart1.color == colorOFF) Pannel_Leds(CART_1,MODE_OFF);
+ if(cart2.color == colorOFF) Pannel_Leds(CART_2,MODE_OFF);
+ if(cart3.color == colorOFF) Pannel_Leds(CART_3,MODE_OFF);
+
+ if(power.color == colorON) Pannel_Leds(POWER_ON_OFF,MODE_ON);
+ if(jog.color == colorON) Pannel_Leds(THREAD_JOGGING,MODE_ON);
+ if(load.color == colorON) Pannel_Leds(THREAD_JOGGING,MODE_ON);
+ if(cart1.color == colorON) Pannel_Leds(CART_1,MODE_ON);
+ if(cart2.color == colorON) Pannel_Leds(CART_2,MODE_ON);
+ if(cart3.color == colorON) Pannel_Leds(CART_3,MODE_ON);
+
if(power.color == fastBILNK)
Pannel_Leds(POWER_ON_OFF,MODE_OFF);
else
@@ -593,6 +614,9 @@ uint32_t ControlLowLoop(uint32_t tick)
continue;
if (ControlArray[ControlLowDevice_i].ControlTiming == eOneMillisecond)
continue;
+ if (ControlArray[ControlLowDevice_i].StartTick == tick)
+ continue;
+
if (((tick - ControlArray[ControlLowDevice_i].StartTick)%ControlArray[ControlLowDevice_i].ControlTiming)<=skipped_ticks) // run the control on exact intervals
{
ControlBacklog[backlogindex]=ControlLowDevice_i;