aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Android_Studio/Tango.Core/src/main/java
ModeNameSize
d---------com / twine / tango / core32logstatsplain
#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"
#include "PMR/Hardware/HardwareDancer.pb-c.h"
#include "PMR/Hardware/HardwareDancerType.pb-c.h"
#include "PMR/Hardware/HardwareWinder.pb-c.h"
#include "PMR/Hardware/HardwarePidControl.pb-c.h"
#include "PMR/Printing/JobSpool.pb-c.h"
#include "PMR/Printing/JobSpoolType.pb-c.h"

#include "drivers/Motors/Motor.h"
#include "drivers/Danser_SSI/ssi_comm.h"

#include "thread_ex.h"

typedef struct
{
    uint32_t startoffsetpulses;
    uint32_t spoolbackingrate;
    uint32_t segmentoffsetpulses;// the spool winding initial length in mm
    uint32_t milimetersperrotation;
    uint32_t SpoolBottomBackingRate;// the angle of the bottom of the spool
    double NumberOfRotationPerPassage;  // how many rotations per spool passage
    double diameter;
}InternalWinderConfigStruc;


typedef enum threadMotorsEnum
{
    FEEDER_MOTOR,
    DRYER_MOTOR,
    POOLER_MOTOR,
    WINDER_MOTOR,
    SCREW_MOTOR,
    MAX_THREAD_MOTORS_NUM
}threadMotorsEnum;

#define MAX_THREAD_FEED_MOTORS WINDER_MOTOR+1
#define MAX_SYSTEM_DANCERS HARDWARE_DANCER_TYPE__RightDancer+1

extern TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM];
extern HardwareDancerType ThreadMotorIdToDancerId[MAX_THREAD_MOTORS_NUM];
extern HardwarePidControlType ThreadMotorIdToControlId[MAX_THREAD_MOTORS_NUM];

extern HardwareMotor                MotorsCfg[NUM_OF_MOTORS];
extern HardwarePidControl           MotorsControl[MAX_THREAD_MOTORS_NUM];
//extern InternalWinderConfigStruc    InternalWinderCfg;
extern HardwareDancer               DancersCfg[MAX_SYSTEM_DANCERS];

#define MAX_CONTROL_SAMPLES 10
extern int32_t MotorSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES];
extern int MotorSamplePointer[MAX_THREAD_MOTORS_NUM];
extern double NormalizedErrorCoEfficient[MAX_THREAD_MOTORS_NUM];
extern int DancerStopActivityLimit[MAX_THREAD_MOTORS_NUM];


uint32_t InternalWinderConfigMessage(HardwareWinder* request);
uint32_t MotorsConfigMessage(HardwareMotor * request);
uint32_t InternalWindingConfigMessage(JobSpool* request);
uint32_t ThreadInitialTestStub(HardwareMotor * request);
uint32_t MotorPidRequestMessage(HardwarePidControl* request);

uint32_t DancerConfigMessage(HardwareDancer * request);

#endif //MODULES_THREAD_THREAD_H_