diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-19 18:16:48 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-19 18:16:48 +0200 |
| commit | 00f6e78e425fa184855acc293d29e7ebcfd76f5d (patch) | |
| tree | 3cf8b62f4f921104582a6ea10eceb45050512437 /Software/Embedded_SW/Embedded/Modules/Thread | |
| parent | c16f47eb401a12f034eecf75924680262285e1f4 (diff) | |
| parent | 102fcff171fb309a92b65df755285f7f4e0654ff (diff) | |
| download | Tango-00f6e78e425fa184855acc293d29e7ebcfd76f5d.tar.gz Tango-00f6e78e425fa184855acc293d29e7ebcfd76f5d.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread.h | 21 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 28 |
2 files changed, 32 insertions, 17 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h index 475f63795..f568f9816 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h @@ -1,3 +1,7 @@ + +#ifndef MODULES_THREAD_THREAD_H_ +#define MODULES_THREAD_THREAD_H_ + #include "PMR/common/MessageContainer.pb-c.h" #include "PMR/Hardware/HardwareMotor.pb-c.h" #include "PMR/Hardware/HardwareMotorType.pb-c.h" @@ -41,7 +45,18 @@ typedef struct int32_t pulsepermmspring; int id; //HardwareDancerType }DancerConfigStruc; -#define MAX_THREAD_MOTORS_NUM HARDWARE_MOTOR_TYPE__WinderMotor +1 + +typedef enum threadMotorsEnum +{ + FEEDER_MOTOR, + DRYER_MOTOR, + POOLER_MOTOR, + WINDER_MOTOR, + SCREW_MOTOR, + MAX_THREAD_MOTORS_NUM +}threadMotorsEnum; + +extern uint32_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM]; extern MotorConfigStruc MotorsCfg[MAX_THREAD_MOTORS_NUM]; @@ -53,3 +68,7 @@ uint32_t MotorsConfigMessage(HardwareMotor * request); uint32_t InternalWindingConfigMessage(JobSpool* request); uint32_t DancerConfigMessage(HardwareDancer * request); + + +#endif //MODULES_THREAD_THREAD_H_ + diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 13c81fb39..89ff63363 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -10,6 +10,9 @@ #include "../control/pidalgo.h" #include "PMR/Hardware/HardwareMotor.pb-c.h" #include "PMR/Hardware/HardwareMotorType.pb-c.h" +#include "drivers/Motors/Motor.h" +#include "drivers/Heater/TemperatureSensor.h" +#include "drivers/Heater/Heater.h" ////////////////////////////////State machine operation//////////////////////////////////// //the state machine operation is used to operate in runtime correct profile flow execution //by recieved esign flow of the user from the UI @@ -23,6 +26,9 @@ typedef enum Stop } ReturnCode; + +uint32_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM] = {MOTOR_RDRIVING,MOTOR_DRYER_DRIVING,MOTOR_LDRIVING,MOTOR_WINDER,MOTOR_SCREW}; + /******************************************************************************************** * functions describes motor operation flow and movement state during profile execution * used to operate in runtime correct profileflow execution @@ -186,8 +192,9 @@ static ReturnCode PrepareState(void *JobDetails) MotorControlConfig[Motor_i].m_mesuredParam = 0; MotorControlConfig[Motor_i].m_preError = 0; MotorControlConfig[Motor_i].m_SetParam = 0;//need to update SetParams on presegment stage - AddControlCallback(DeviceId2Motor[Motor_i], ThreadControlCBFunction, eOneMillisecond,TemplateDataReadCBFunction,Motor_i); + AddControlCallback(ThreadControlCBFunction, eOneMillisecond,TemplateDataReadCBFunction,Motor_i,0); } + //set 3 dancers to the profile positions return NextState; } @@ -196,10 +203,10 @@ static ReturnCode PrepareState(void *JobDetails) static ReturnCode PreSegmentState(void *JobDetails) { - int Motor_i; + TimerMotors_t Motor_i; for (Motor_i = 0;Motor_i < MAX_THREAD_MOTORS_NUM;Motor_i++) { - MotorControlConfig[Motor_i].m_SetParam = getMotorFreq(Motor_i);//need to update SetParams on presegment stage + MotorControlConfig[Motor_i].m_SetParam = MotorGetSpeed(getMotorId(Motor_i));//need to update SetParams on presegment stage } // set the new speed in the dryer motor to the speed of the new segment // activate control fr all motors @@ -278,20 +285,9 @@ bool ThreadPrintingIterate(void *JobDetails) // screw_movement[gPrintingState[_motorId]]++; ReturnCode returnCode = state_fun(JobDetails); - /*if ((_motorId == SCREW_MOTOR)&&(pause_active)) - { - tick = UsersysTickGet(); - len = usnprintf(str, 60, "\r\n PrintingIterate tick %d state %d retcode %d ",tick, gPrintingState[_motorId],returnCode); - cb_push_back (str, len); - //SendInterruptMessageToHost(10+gPrintingState[_motorId],returnCode); - }*/ gPrintingState = LookupTransitions(gPrintingState, returnCode); - if (keepstate != gPrintingState){ - tick = UsersysTickGet(); - len = usnprintf(str, 60, "\r\n changed state tick %d state %d retcode %d ", tick, gPrintingState,returnCode); - cb_push_back (str, len); - - } +// if (keepstate != gPrintingState){ +// } // // Enable all interrupts. |
