aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-12-03 12:29:57 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-12-03 12:29:57 +0200
commit64acdf2b43affc3403d6d40c96a6d48cfc5c5e23 (patch)
tree735ac691a4f055dc984e5e477ef49f60f4e71e2a /Software/Embedded_SW/Embedded
parentaf782aca2364948527c1107a02428897fb8382a1 (diff)
parent907aa0cd6c29c182d4647f8d2dab89750fd23bc9 (diff)
downloadTango-64acdf2b43affc3403d6d40c96a6d48cfc5c5e23.tar.gz
Tango-64acdf2b43affc3403d6d40c96a6d48cfc5c5e23.zip
merge
Diffstat (limited to 'Software/Embedded_SW/Embedded')
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c34
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c13
2 files changed, 20 insertions, 27 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c
index 75f68d00c..81e62746a 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c
+++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c
@@ -249,10 +249,10 @@ uint32_t MotorRunWithCallback (TimerMotors_t MotorId,bool direction, uint32_t Fr
MotorControlCallback[MotorId] = MotorMoveCallBackFunction;
return MotorControlId[MotorId];
}
-uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t ReadValue) //TODO
+uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO
{
uint32_t MotorId,encoder,temp = 0;
- uint32_t RunningContinues = true;
+ uint32_t Busy = BUSY;
int angle;
if (IfIndex>>8 != IfTypeMotors)
@@ -314,17 +314,17 @@ uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t ReadValue) //TODO
{
Report("MotorRunCallBackFunction temp curr prev small",__FILE__,encoder,InitialArmLocation,RpWarning,temp,0);
failCounter++;
- if (failCounter>=5)
+ if (failCounter>=20)
{
Report("arm stopped",__FILE__,failCounter,encoder,RpWarning,temp,0);
MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Hiz);
- RunningContinues = false;
+ Busy = NOTBUSY;
}
}
else
{
failCounter = 0;
- RunningContinues = true;
+ Busy = BUSY;
}
if (CallbackCalls%50 == 0)
{
@@ -347,7 +347,7 @@ uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t ReadValue) //TODO
}
MotorTimeout[MotorId]+=MotorTimeLag[MotorId];
- if ((RunningContinues == false)||((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0)))
+ if ((Busy == NOTBUSY)||((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0)))
{
if (MotorId == HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
{
@@ -355,17 +355,17 @@ uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t ReadValue) //TODO
if (abs(angle)<400)
{
- RunningContinues = false;
+ Busy = NOTBUSY;
}
else
{
- RunningContinues = true;
+ Busy = BUSY;
}
Report("arm stopped call",__FILE__,failCounter,encoder,RpWarning,abs(DrierZeroPosition-encoder),0);
- Report("arm stopped call 2",__FILE__,MotorTimeout[MotorId],RunningContinues,RpWarning,angle,0);
+ Report("arm stopped call 2",__FILE__,MotorTimeout[MotorId],Busy,RpWarning,angle,0);
}
//stop this control loop
- Report("MotorControlGetnBusyState stop",__FILE__,MotorId,RunningContinues,RpMessage,MotorCallback[MotorId],0);
+ Report("MotorControlGetnBusyState stop",__FILE__,MotorId,Busy,RpMessage,MotorCallback[MotorId],0);
SafeRemoveControlCallback(MotorControlId[MotorId], MotorRunCallBackFunction );
MotorControlCallback[MotorId] = 0;
MotorControlId[MotorId] = 0xFF;
@@ -374,13 +374,13 @@ uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t ReadValue) //TODO
if ((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0))
{
Report("motor timeout",__FILE__,__LINE__,MotorId,RpMessage,MotorTimeout[MotorId],0);
- RunningContinues = true;
+ Busy = BUSY;
}
Report("MotorRunCallBackFunction curr prev return",__FILE__,encoder,temp,RpWarning,AccumulatedArmMovement,0);
//call the module callback
if (MotorCallback[MotorId])
{
- MotorCallback[MotorId](MotorId,RunningContinues);
+ MotorCallback[MotorId](MotorId,Busy);
}
}
@@ -620,8 +620,8 @@ uint32_t MotorMovetoEncoderPosition (TimerMotors_t MotorId, callback_fptr callb
currentposition = Control_Read_Dryer_Position(0,0);
MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&DrierZeroPosition);
Report("MotorMovetoEncoderPosition",__FILE__,__LINE__,DrierZeroPosition,RpWarning,currentposition,0);
- Report("MotorMovetoEncoderPosition callback",__FILE__,__LINE__,direction,RpWarning,speed,0);
- if (abs(currentposition - DrierZeroPosition)<2)
+ Report("MotorMovetoEncoderPosition callback",__FILE__,__LINE__,callback,RpWarning,speed,0);
+ if (abs(currentposition - DrierZeroPosition)<5)
{
if (callback)
callback(MotorId,0);
@@ -669,7 +669,7 @@ uint32_t MotorMoveCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO
{
Read_Dryer_ENC_Position();
if (CallbackCalls<50)
- return OK;
+ return;
if (CallbackCalls%200 == 0)
{
Report("MotorMoveCallBackFunction",__FILE__,__LINE__,MotorId,RpWarning,Read_Dryer_ENC_Position(0,0),0);
@@ -1170,11 +1170,11 @@ uint32_t LoadingArmReset_Callback(uint32_t MotorId, uint32_t ReadValue)
//if (fabs(angle)<0.2)
{
ReportWithPackageFilter(DiagnosticsFilter,"drier center proximity",__FILE__,temp,Arm_Drier_Center,RpMessage,angle,0);
- if (angle>0)
+ if (angle<400)
direction = 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize;
else
direction = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize;
- MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,LoadingArmReset_Callback_Stopper_Callback,/*3000*/16000,direction,5);
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,LoadingArmReset_Callback_Stopper_Callback,/*3000*/16000,direction,10);
}
else
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
index ffbb504db..f327ef3b2 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
@@ -247,8 +247,7 @@
}
uint32_t Thread_Load_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag)
{
- uint32_t temp = Read_Dryer_ENC_Position();
- int angle;
+ uint32_t angle, temp = Read_Dryer_ENC_Position();
ReportWithPackageFilter(DiagnosticsFilter,"Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,(int)numberOfCycles,(int)DrierPrevLocation,RpMessage,temp,0);
@@ -259,7 +258,7 @@
{
CallbackCounter--;
}
- if (abs(angle)<10 ) // OK
+ if ((abs(angle)<200 )&&(BusyFlag == NOTBUSY)) // OK
{
Report("Thread_Load_Set_Load_Arm_To_Stopper time",__FILE__,msec_millisecondCounter - UnloadingStart,msec_millisecondCounter,RpMessage,UnloadingStart,0);
@@ -275,7 +274,7 @@
else
{
load.color = fastBILNK;
- usnprintf(LoadErrorMsg, 100, "^Stage %s - %s timeout",LoadStagesStr[LoadStages], MotorStr[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM]);
+ usnprintf(LoadErrorMsg, 100, "*Stage %s - %s timeout",LoadStagesStr[LoadStages], MotorStr[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM]);
Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0);
LoadStatus = ERROR;
@@ -1532,12 +1531,6 @@ uint32_t TryThreadLoadingFunc(MessageContainer* requestContainer)
{
responseContainer = createContainer(MESSAGE_TYPE__TryThreadLoadingResponse, requestContainer->token, true, &Cresponse, &try_thread_loading_response__pack, &try_thread_loading_response__get_packed_size);
responseContainer.continuous = false;
- if (JobIsActive()||(MachineReadyForHeating == false)||(FPGABurningActive==true))
- {
- responseContainer.has_error = true;
- responseContainer.error = ERROR_CODE__GENERAL_ERROR;
- responseContainer.errormessage = "The machine is not ready for loading";
- }
uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer));
size_t container_size = message_container__pack(&responseContainer, container_buffer);
my_free(responseContainer.data.data);