aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2019-03-10 09:06:35 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2019-03-10 09:06:35 +0200
commitabc70316f80a9cb05b320828051bb7dcbfeaad1b (patch)
treea334c1cc23b307710f6338523e5c20fb09017665 /Software/Embedded_SW/Embedded/Modules/Thread
parentcbdd79778764ce38017790e1e1f9316e52ec8104 (diff)
parent7256fe1c07cf5ecbe485c3cdac238b88dfc2cd1d (diff)
downloadTango-abc70316f80a9cb05b320828051bb7dcbfeaad1b.tar.gz
Tango-abc70316f80a9cb05b320828051bb7dcbfeaad1b.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c26
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c10
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c17
3 files changed, 41 insertions, 12 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
index 2689ea34a..a82fe37e6 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
@@ -199,6 +199,7 @@
return OK;
}
uint8_t CallbackCounter = 0;
+ uint8_t TimeoutsCounter = 0;
uint32_t Thread_Load_HomingCallback(uint32_t MotorId, uint32_t ReadValue)
{
Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
@@ -206,12 +207,25 @@
if (CallbackCounter)
{
CallbackCounter--;
+ if (ReadValue != LIMIT)
+ {
+ //returned with a timeout
+ TimeoutsCounter++;
+ }
if (CallbackCounter == 0)
{
- LoadStages++;
- if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call
+ if (TimeoutsCounter)
{
- //ThreadLoadStateMachine(LoadStages);
+ LOG_ERROR(LoadStages,"Load sequence timeout");
+ TimeoutsCounter = 0;
+ }
+ else
+ {
+ LoadStages++;
+ if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call
+ {
+ ThreadLoadStateMachine(LoadStages);
+ }
}
}
}
@@ -326,7 +340,7 @@
{
Control_Dryer_Fan(START,75);//use START or STOP, 0 - 100%
LoadStages++;
- //ThreadLoadStateMachine(LoadStages);
+ ThreadLoadStateMachine(LoadStages);
}
return OK;
}
@@ -357,7 +371,7 @@
LoadStages++;
if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call
{
- //ThreadLoadStateMachine(LoadStages);
+ ThreadLoadStateMachine(LoadStages);
}
}
}
@@ -414,7 +428,7 @@
ControlId = 0xFF;
ThreadAbortJoggingFunc();
LoadStages++;
- //ThreadLoadStateMachine(LoadStages);
+ ThreadLoadStateMachine(LoadStages);
return OK;
}
uint32_t Thread_Load_Jog_Thread(void)
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
index 435d7aef3..a1e91f6fc 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
@@ -17,6 +17,8 @@
#include "drivers/Flash_Memory/fatfs/ff.h"
#include "drivers/SSI_Comm/Dancer/Dancer.h"
+#include "drivers/FPGA/Moters_Driver/PowerSTEP01.h"
+
#include "thread.h"
MotorDriverConfigStruc MotorsCfg[NUM_OF_MOTORS]={0};
HardwarePidControl MotorsControl[MAX_THREAD_MOTORS_NUM] = {0};
@@ -52,6 +54,14 @@ uint32_t MotorsConfigMessage(HardwareMotor * request)
MotorsCfg[Motor_i].pulseperround = request->pulseperround;
MotorsCfg[Motor_i].pulleyradius = request->pulleyradius;
MotorsCfg[Motor_i].configword = request->configword;
+ if(MotorDriverResponse[Motor_i].DriverType == VoltageCombinedMotDriver)
+ {
+ MotorsCfg[Motor_i].directionthreadwize = !(request->directionthreadwize);//PowerSTEP01
+ }
+ else
+ {
+ MotorsCfg[Motor_i].directionthreadwize = request->directionthreadwize;//L6470 + L6472
+ }
MotorsCfg[Motor_i].directionthreadwize = request->directionthreadwize;
MotorsCfg[Motor_i].kvalhold = request->kvalhold;
MotorsCfg[Motor_i].kvalrun = request->kvalrun;
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index ee49d56f3..6a8474438 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -427,9 +427,9 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
JobEndReason = JOB_THREAD_BREAK;
ThreadControlActive = false;
SendJobProgress(0.0,0,false, TMessage);
- //SegmentReady(Module_Thread,ModuleFail);
- AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_BREAK,true);
- EndState(CurrentJob,"ReadBreakSensor Error" );
+ SegmentReady(Module_Thread,ModuleFail);
+ //AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_BREAK,true);
+ //EndState(CurrentJob,"ReadBreakSensor Error" );
LOG_ERROR(index, "ReadBreakSensor Error");
return OK;
} //passed limit
@@ -458,7 +458,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
SendJobProgress(0.0,0,false, TMessage);
//EndState(CurrentJob,TMessage );
SegmentReady(Module_Thread,ModuleFail);
- switch (index)
+ /*switch (index)
{
case POOLER_MOTOR:
AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_PULLER_DANCER,true);
@@ -469,7 +469,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
case WINDER_MOTOR:
AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_WINDER_DANCER,true);
break;
- }
+ }*/
LOG_ERROR (DancerId, "Dancer Failure");
return OK;
}
@@ -694,6 +694,9 @@ uint32_t ThreadPreSegmentState(void *JobDetails, uint32_t SegmentId)
PrepareState = false;
// set the new speed in the dryer motor to the speed of the new segment
MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING, OriginalMotorSpd_2PPS[DRYER_MOTOR]);
+#ifdef HUNDRED_MICROSECONDS_DANCER_READ
+ MillisecLogInit();
+#endif
if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].maxfrequency > 0)
{
@@ -775,7 +778,9 @@ char Endstr[150];
ThreadUpdateProcessLength (0.0,(void *)NULL);
SetOriginMotorSpeed(0);
-
+#ifdef HUNDRED_MICROSECONDS_DANCER_READ
+ MillisecLogClose();
+#endif
if (SpeedControlId != 0xFF)
{
if(RemoveControlCallback(SpeedControlId,ThreadLengthCBFunction)!=OK)