blob: 5b0f034f4fab792c10a7c0d2f25296fd498ce6b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/************************************************************************************************************************
**************************************************************************************************************************/
#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]={0};
InternalWinderConfigStruc InternalWinderCfg = {0};
DancerConfigStruc DancersCfg[MAX_SYSTEM_DANCERS] = {0};
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;
InternalWinderCfg.SpoolBottomBackingRate = request->spoolbottombackingrate;
InternalWinderCfg.NumberOfRotationPerPassage = request->numberofrotationperpassage;
InternalWinderCfg.diameter = request->diameter;
return status;
}
//********************************************************************************************************************
uint32_t MotorsConfigMessage(HardwareMotor * request)
{
uint32_t status = PASSED;
int Motor_i;
Motor_i = request->hardwaremotortype;
if (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;
ThreadInitialTestStub(request);
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<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;
}
|