140 lines
2.0 KiB
Plaintext
140 lines
2.0 KiB
Plaintext
//DEFINES-------------------------------------------------------------
|
|
|
|
#ifndef GLOBAL
|
|
|
|
#ifndef GLOBAL
|
|
#message "link global inside"
|
|
#define GLOBAL
|
|
#else
|
|
#message "link global not defined"
|
|
#endif
|
|
|
|
#define VERSION "2.0b_1908151511"
|
|
#define MAX_FIFO_SIZE 20
|
|
#define BRAKER_COUNT 3
|
|
|
|
|
|
//INCLUDES------------------------------------------------------------
|
|
#if PLATFORM_ID==TPP2WG2
|
|
#include "tpp2.th"
|
|
#endif
|
|
#if PLATFORM_ID==TPP3WG2
|
|
#include "tpp3.th"
|
|
#endif
|
|
#if PLATFORM_ID==SIMULATOR
|
|
#include "simulator.th"
|
|
#endif
|
|
|
|
void d(string mess);
|
|
void t(string mess);
|
|
|
|
|
|
|
|
|
|
enum STORELOCATION{
|
|
NONE,
|
|
EEPROM,
|
|
FLASH
|
|
};
|
|
|
|
typedef struct BrakerConfig{
|
|
bool Enable;
|
|
unsigned char SensPort;
|
|
unsigned char DropPort;
|
|
unsigned char Relay;
|
|
unsigned long Timeout;
|
|
unsigned char Mode;
|
|
};
|
|
|
|
typedef struct BounceConfig{
|
|
bool Enable;
|
|
unsigned char Port;
|
|
unsigned int Timeout;
|
|
};
|
|
|
|
typedef struct BrakerProcess{
|
|
BrakerConfig *config;
|
|
bool State;
|
|
unsigned long OnTime;
|
|
string <MAX_FIFO_SIZE>Fifo;
|
|
};
|
|
|
|
typedef struct EncoderConfig{
|
|
unsigned char encoderPort;
|
|
unsigned char encoderMode;
|
|
unsigned int encoderInterval;
|
|
unsigned char reinitInterval;
|
|
unsigned char windowWidth;
|
|
string workedPorts;
|
|
};
|
|
|
|
typedef struct EncoderProcess{
|
|
bool Enabled;
|
|
EncoderConfig *config;
|
|
bool Inited;
|
|
bool State;
|
|
unsigned int Count;
|
|
unsigned int Point;
|
|
unsigned char WorkPort;
|
|
};
|
|
|
|
typedef struct DebugConf{
|
|
bool SensorsLook;
|
|
bool ShowTime;
|
|
int EncoderDebug;
|
|
bool RelayReply;
|
|
bool RelayShow;
|
|
bool EncoderStateMode;
|
|
};
|
|
|
|
typedef struct Configuration{
|
|
string IP;
|
|
STORELOCATION STORE_LOCATON;
|
|
unsigned int FLASH_SIZE;
|
|
unsigned char FLASH_FILES;
|
|
bool STORE_BRAKER;
|
|
bool STORE_ENCODER;
|
|
BrakerConfig BRAKERS[BRAKER_COUNT];
|
|
BounceConfig BOUNCE[SENSORS];
|
|
EncoderConfig EncoderCfg;
|
|
DebugConf debug;
|
|
};
|
|
|
|
//#include "config_work.th"
|
|
#include "net.th"
|
|
//#include "braker.th"
|
|
|
|
#endif
|
|
|
|
//DECLARATIONS--------------------------------------------------------
|
|
|
|
|
|
extern Configuration config;
|
|
|
|
extern unsigned char state[SENSORS];
|
|
extern BrakerProcess brakers[BRAKER_COUNT];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|