aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2020-02-26 13:24:31 +0200
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2020-02-26 13:24:31 +0200
commit6b223bcd7f7e1e0b76a33ecd00c17d7b846c91a9 (patch)
tree832169bbbb3fb93063230b8c767f6f6ac777f3ca /Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
parenta64cfe8b7dec8417a3d380b55f4ae79c5459f49d (diff)
parent5cedf7cc7de176c6b3ecdcef9b7ad1382400e880 (diff)
downloadTango-6b223bcd7f7e1e0b76a33ecd00c17d7b846c91a9.tar.gz
Tango-6b223bcd7f7e1e0b76a33ecd00c17d7b846c91a9.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c60
1 files changed, 38 insertions, 22 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index fd53d6da2..9e0a2ac7f 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -28,6 +28,7 @@
#include "drivers/Heater/Heater.h"
#include "drivers/Motors/Motor.h"
#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
+#include "drivers/FPGA/FPGA_SPI_Comm.h"
#include "modules/heaters/heaters.h"
#include "modules/General/process.h"
#include "modules/ids/ids_ex.h"
@@ -117,8 +118,8 @@ uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Rea
if (Current_Read < Previous_Read)
{
- ReportWithPackageFilter(ThreadFilter,"Length rollover",__FILE__,__LINE__,(int)Current_Read,RpWarning,(int)Previous_Read,0);
Time_Pass = (MAX_COUNTER - Previous_Read) + Current_Read + 1;
+ ReportWithPackageFilter(ThreadFilter,"Length rollover",__FILE__,Time_Pass,(int)Current_Read,RpWarning,(int)Previous_Read,0);
}
else
Time_Pass = Current_Read - Previous_Read;
@@ -178,7 +179,10 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
initialpos = 0;
}
prevprev = PreviousPosition;
- positionDiff = Control_Delta_Position_Pass(CurrentPosition,PreviousPosition);
+ if (Extended_Motor_Param[ThreadMotorIdToMotorId[index]] == true) //powerstep driver reverses the direction
+ positionDiff = Control_Delta_Position_Pass(PoolerPreviousPosition,PoolerCurrentPosition);
+ else
+ positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition);
//positionDiff = positionDiff / MotorsCfg[ThreadMotorIdToMotorId[index]].microstep;
PreviousPosition = CurrentPosition;
@@ -268,7 +272,10 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
Poolerinitialpos = 0;
}
prevprev = PoolerPreviousPosition;
- positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition);
+ if (Extended_Motor_Param[ThreadMotorIdToMotorId[index]] == true) //powerstep driver reverses the direction
+ positionDiff = Control_Delta_Position_Pass(PoolerPreviousPosition,PoolerCurrentPosition);
+ else
+ positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition);
//positionDiff = positionDiff / MotorsCfg[ThreadMotorIdToMotorId[index]].microstep;
PoolerPreviousPosition = PoolerCurrentPosition;
@@ -435,7 +442,6 @@ void testDancersControl()
ThreadControlActive = false;
}
#endif
-bool dancerinvalid = false;
int MotorFailedSample[MAX_THREAD_MOTORS_NUM] = {0,0,0,0,0};
char TMessage[150];
//char time[150];
@@ -474,21 +480,20 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//if (MotorDriverResponse[ThreadMotorIdToMotorId[index]].Busy == true)
// return OK;
DancerId = ThreadMotorIdToDancerId[index];
- if (ReadValue < 10)
+/* if (ReadValue < 10)
{
MotorFailedSample[index]++;
ReportWithPackageFilter(ThreadFilter,"Dancer value read too small.",__FILE__,__LINE__,DancerId,RpError,ReadValue,0);
return OK;
- }
+ }*/
if (ReadValue == 0x3FFF)
{
- MotorFailedSample[index]++;
- if (dancerinvalid == false)
+ if (Read_Dryer_Status(DancerId) != OK)
{
- dancerinvalid = true;
- ReportWithPackageFilter(ThreadFilter,"Dancer value invalid.",__FILE__,__LINE__,(int)IfIndex,RpError,(int)ReadValue,0);
+ ReportWithPackageFilter(ThreadFilter,"Dancer value invalid.",__FILE__,ReadValue,(int)DancerId,RpError,(int)Read_Dryer_Status(DancerId),0);
+ MotorFailedSample[index]++;
+ return OK;
}
- return OK;
}
KeepReadValue = ReadValue;
TranslatedReadValue = ReadValue - DancersCfg[DancerId].zeropoint;
@@ -958,6 +963,15 @@ uint32_t ThreadDryerRampUp(uint32_t IfIndex, uint32_t BusyFlag)
return OK;
}
+bool Thread_Rockers_Bypass = false;
+bool Set_Thread_Rockers_Bypass (int value)
+{
+ if (value == 0)
+ Thread_Rockers_Bypass = false;
+ else
+ Thread_Rockers_Bypass = true;
+ return Thread_Rockers_Bypass;
+}
//********************************************************************************************************************
uint32_t ThreadPreSegmentState(void *SegmentDetails, uint32_t SegmentId)
@@ -995,17 +1009,19 @@ uint32_t ThreadPreSegmentState(void *SegmentDetails, uint32_t SegmentId)
#ifdef HUNDRED_MICROSECONDS_DANCER_READ
MillisecLogInit();
#endif
-
- if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].maxfrequency > 0)
- {
- MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize);
- MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 1);
- }
- if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].maxfrequency > 0)
- {
- MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize);
- MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 1);
- }
+ if (Thread_Rockers_Bypass == false)
+ {
+ if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].maxfrequency > 0)
+ {
+ MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize);
+ MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 1);
+ }
+ if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].maxfrequency > 0)
+ {
+ MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize);
+ MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 1);
+ }
+ }
if (EnableLubrication == true)
{
IDS_StartLubrication();