aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/CSharpProject.cs
blob: 62e830d0651d04dfa12bcb771929fe39313d22d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.Scripting.IDE.Projects
{
    public abstract class CSharpProject : Project
    {

    }
}
#0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#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/Hardware/HardwareConfiguration.pb-c.h"
#include "PMR/Printing/JobSpool.pb-c.h"
#include "PMR/Printing/JobSpoolType.pb-c.h"

#include "drivers/Motors/Motor.h"
#include "../control/pidalgo.h"

#include "thread_ex.h"

#define NORMAL_COEF_DIVIDER 100
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 struct
{
    bool                m_isEnabled;
    int32_t             m_SetParam;
    float               m_mesuredParam;
    float               m_preError;
    float               m_integral;
    float               m_calculatedError;
    bool                m_isReady;
    uint32_t            m_ingnoreValue;
    PID_Config_Params   m_params;
}MotorControlConfig_t;


#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 bool BreakSensorenabled;
extern int32_t BreakSensordebouncetimemilli;

extern bool SampleWinding;


//extern MotorDriverConfigStruc                MotorsCfg[NUM_OF_MOTORS];
extern HardwarePidControl           MotorsControl[MAX_THREAD_MOTORS_NUM];
//extern InternalWinderConfigStruc    InternalWinderCfg;
extern HardwareDancer               DancersCfg[MAX_SYSTEM_DANCERS];
extern double CurrentControlledSpeed[MAX_THREAD_MOTORS_NUM];
extern double OriginalMotorSpd_2PPS[MAX_THREAD_MOTORS_NUM];

#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];
extern    MotorControlConfig_t MotorControlConfig[MAX_THREAD_MOTORS_NUM];
extern double MotorSpeedSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES];
extern int MotorSpeedSamplePointer[MAX_THREAD_MOTORS_NUM];


uint32_t InternalWinderConfigMessage(HardwareWinder* request);
uint32_t MotorsConfigMessage( HardwareConfiguration* HW_request);
uint32_t InternalWindingConfigMessage(JobSpool* request);
uint32_t ThreadInitialTestStub(HardwareMotor * request);
uint32_t MotorPidRequestMessage(HardwarePidControl* request);
void     SetKeepWindingCone(bool value);
void SetWinderBackToBaseTime(uint32_t value);

uint32_t DancerConfigMessage(HardwareDancer * request);

void SetOriginMotorSpeed(float process_speed);

#endif //MODULES_THREAD_THREAD_H_