aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-10-03 10:04:11 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-10-03 10:04:11 +0300
commit2ccc5a2e78f306d3c434c764e34509d4db92d8d8 (patch)
tree399f8c061fa698c36d06da9ebc101d65b02df26e /Software/Embedded_SW/Embedded/Modules/Thread
parentb9e2c008322ce474ce6e0b18da9a786c128de8d9 (diff)
parenta6496a02892d653a70bc9e0d37856b1a7d3cd74b (diff)
downloadTango-2ccc5a2e78f306d3c434c764e34509d4db92d8d8.tar.gz
Tango-2ccc5a2e78f306d3c434c764e34509d4db92d8d8.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.c9
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c18
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c8
3 files changed, 24 insertions, 11 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
index c59a95180..c68156e68 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
@@ -567,13 +567,13 @@
{
REPORT_MSG(LoadStages, "Thread UnLoad State Machine step");
LoadArmInfo.LoadArmRounds = 0;
- uint32_t numberOfSteps = 0;
+ //uint32_t numberOfSteps = 0;
//Start Feeder Pid, Rotate Loading Arm Counter Thread Direction X Circles According To Rml. Feeder Speed Is 40
SetOriginMotorSpeed(19);
// OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000;
// CurrentControlledSpeed[FEEDER_MOTOR] = 1000;
- numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmInfo.LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
+ //numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmInfo.LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
MotorControlConfig[POOLER_MOTOR].m_params.MAX = 1;
MotorControlConfig[POOLER_MOTOR].m_params.MIN = MotorsControl[POOLER_MOTOR].outputproportionalpowerlimit*-1;
MotorControlConfig[POOLER_MOTOR].m_params.Kd = MotorsControl[POOLER_MOTOR].derivativetime;
@@ -719,6 +719,11 @@
}
uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue)
{
+ if (JobIsActive())
+ {
+ Report("ThreadLoadButton called on job",__FILE__,__LINE__,LoadStages,RpMessage,ReadValue,0);
+ return ERROR;
+ }
Report("ThreadLoadButton",__FILE__,__LINE__,LoadStages,RpMessage,ReadValue,0);
if (LoadStages > ReadValue)
{
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 4cbe1f70f..32dea353a 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -54,6 +54,8 @@ uint32_t ScrewNumberOfSteps = 0; //holds the current number of steps for the
bool SCREW_TimerActivated = false;
uint32_t ScrewControlId = 0xFF;
+
+
static bool KeepWindingCone = false;
static uint32_t WindingConeLocation;
static uint32_t WinderBackToBaseTime = 800;
@@ -63,6 +65,8 @@ InternalWinderConfigStruc InternalWinderCfg = {0};
#ifdef READ_SCREW_ENCODER
uint32_t ScrewLocationLimitSwitch = 0,ScrewLocationStart = 0;
uint32_t ScrewLocationRun[3];
+float WinderRunAverage = 0.0,WinderRunSum = 0.0;
+int WinderRunSamples = 0;
#endif
bool SampleWinding = false;
uint32_t Winder_Init(void)
@@ -141,6 +145,10 @@ uint32_t Winder_Prepare(void *JobDetails)
#ifdef READ_SCREW_ENCODER
ScrewLocationRun[0] = 0;
ScrewLocationRun[1] = 0;
+ WinderRunAverage = 0.0;
+ WinderRunSum = 0.0;
+ WinderRunSamples = 0;
+
#endif
if (( KeepWindingCone == false)||(WindingConeLocation == 0))
{
@@ -272,10 +280,6 @@ int flipflop = 0;
uint32_t motspeed;
float speedf;
int WinderCalculation = 0;
-#ifdef READ_SCREW_ENCODER
-float WinderRunAverage = 0.0,WinderRunSum = 0.0;
-int WinderRunSamples = 0;
-#endif
uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
{
//uint32_t Steps;
@@ -322,11 +326,11 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
#ifdef READ_SCREW_ENCODER
int WinderRun;
WinderRun = abs(ScrewLocationRun[1] - ScrewLocationRun[0]);
- if ((WinderRun < 50000)&&(Add100 == false))
+ if ((WinderRun < 30000)&&(WinderMotorSpeedRollOver == true))
{
- WinderRunSum+=WinderRun;
WinderRunSamples++;
- WinderRunAverage = WinderRunSum/WinderRunSamples;
+ WinderRunSum+=WinderRun;
+ WinderRunAverage = WinderRunSum/(WinderRunSamples);
if ((fabs(WinderRun-WinderRunAverage)>=30)||(WinderRunSamples%100 == 0))
{
usnprintf(ScrewStr, 150, "curr,sum,avg,samples {Winder Encoder:, %d, %d, %d, %d, %d}",WinderRun,(int)WinderRunSum,(int)WinderRunAverage,(int)WinderRunSamples,
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
index 38c0f86f1..88d62a495 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
@@ -11,6 +11,9 @@
#include "PMR/Hardware/HardwareDancer.pb-c.h"
#include "PMR/Hardware/HardwareWinder.pb-c.h"
#include "PMR/Hardware/HardwareBreakSensor.pb-c.h"
+#include <PMR/Diagnostics/EventType.pb-c.h>
+
+#include "Modules/AlarmHandling/AlarmHandling.h"
#include "PMR/Printing/JobSpool.pb-c.h"
#include "PMR/common/MessageContainer.pb-c.h"
@@ -49,6 +52,8 @@ uint32_t MotorsConfigMessage(HardwareConfiguration * HWrequest)
HardwareMotor *request;
if (HWrequest == NULL)
return ERROR;
+ AlarmHandlingSetAlarm (EVENT_TYPE__MACHINE_STATE_HW_CONFIG_FAILED,OFF);
+
for (MotorId = 0; MotorId < HWrequest->n_motors ; MotorId++)
{
request = HWrequest->motors[MotorId];
@@ -69,13 +74,12 @@ uint32_t MotorsConfigMessage(HardwareConfiguration * HWrequest)
MotorsCfg[Motor_i].configword = request->configword;
if(MotorDriverResponse[Motor_i].DriverType == CombinrdMotDriver)
{
- MotorsCfg[Motor_i].directionthreadwize = !(request->directionthreadwize);//PowerSTEP01
+ MotorsCfg[Motor_i].directionthreadwize = request->directionthreadwize ^ 1;//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;
MotorsCfg[Motor_i].kvalacc = request->kvalacc;