diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-06 18:29:34 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-06 18:29:34 +0200 |
| commit | ae28ff2b4d331102f1d9becfdea169ed9e9806b3 (patch) | |
| tree | dd143656b78ce85c0756c060d5889f85bb75be8a /Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c | |
| parent | 4e48c569f1cae820ffade8a786354b2ba79b50b4 (diff) | |
| parent | 0df96ebfc354b1342da578bd5eeecab0b3b4c745 (diff) | |
| download | Tango-ae28ff2b4d331102f1d9becfdea169ed9e9806b3.tar.gz Tango-ae28ff2b4d331102f1d9becfdea169ed9e9806b3.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c new file mode 100644 index 000000000..f32026ca8 --- /dev/null +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -0,0 +1,94 @@ +/************************************************************************************************************************ + **************************************************************************************************************************/ + +#include "include.h" + +#include <Modules/Stubs_Handler/DataDef.h> +#include "PMR/Hardware/HardwareMotor.pb-c.h" +#include "PMR/Hardware/HardwareDancer.pb-c.h" +#include "PMR/Hardware/HardwareWinder.pb-c.h" +#include "PMR/Printing/JobSpool.pb-c.h" +#include "PMR/common/MessageContainer.pb-c.h" + +#include "thread.h" +#define MAX_SYSTEM_DANCERS HARDWARE_DANCER_TYPE__RightDancer+1 +MotorConfigStruc MotorsCfg[MAX_THREAD_MOTORS_NUM]; +InternalWinderConfigStruc InternalWinderCfg; +DancerConfigStruc DancersCfg[MAX_SYSTEM_DANCERS]; + + + +uint32_t InternalWinderConfigMessage(HardwareWinder* request) +{ + uint32_t status = PASSED; + + InternalWinderCfg.milimetersperrotation = request->millimeterperrotation; + + return status; +} +uint32_t InternalWindingConfigMessage(JobSpool* request) +{ + uint32_t status = PASSED; + + InternalWinderCfg.segmentoffsetpulses = request->segmentoffsetpulses; + InternalWinderCfg.spoolbackingrate = request->backingrate; + InternalWinderCfg.startoffsetpulses = request->startoffsetpulses; + + return status; +} + +//******************************************************************************************************************** +uint32_t MotorsConfigMessage(HardwareMotor * request) +{ + uint32_t status = PASSED; + int Motor_i; + + Motor_i = request->hardwaremotortype; + if ((Motor_i)&&(Motor_i< MAX_THREAD_MOTORS_NUM)) + { + MotorsCfg[Motor_i].id = request->hardwaremotortype; + MotorsCfg[Motor_i].minfreq = request->minfrequency; + MotorsCfg[Motor_i].maxfreq = request->maxfrequency; + MotorsCfg[Motor_i].minmicrostep = request->minmicrostep; + MotorsCfg[Motor_i].maxmicrostep = request->maxmicrostep; + MotorsCfg[Motor_i].linearratio = request->linearratio; + MotorsCfg[Motor_i].medianposition = request->medianposition; + MotorsCfg[Motor_i].correctiongain = request->correctiongain; + MotorsCfg[Motor_i].ratio2dryerspeed = request->ratiotodryerspeed; + MotorsCfg[Motor_i].kp = request->kp; + MotorsCfg[Motor_i].ki = request->ki; + MotorsCfg[Motor_i].kd = request->kd; + MotorsCfg[Motor_i].changeslope = request->changeslope; + MotorsCfg[Motor_i].hightimeoutusec = request->highlengthmicrosecond; + return status; + } + else return Motor_i; + +} +uint32_t DancerConfigMessage(HardwareDancer * request) +{ + uint32_t status = PASSED; + int Dancer_i; + + Dancer_i = request->hardwaredancertype; + if ((Dancer_i)&&(Dancer_i<MAX_SYSTEM_DANCERS )) + { + DancersCfg[Dancer_i].id = Dancer_i; + DancersCfg[Dancer_i].fixorgradual = request->gradual; + DancersCfg[Dancer_i].k = request->k; + DancersCfg[Dancer_i].x = request->x; + DancersCfg[Dancer_i].pulsepermmspring = request->pulsepermmspring; + return status; + } + else + return Dancer_i; + +} + +uint32_t thread_init(void) +{ + memset (MotorsCfg,0,sizeof(MotorsCfg)); + memset (&InternalWinderCfg,0,sizeof(InternalWinderConfigStruc)); + + return OK; +} |
