-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomms.h
104 lines (97 loc) · 3.41 KB
/
comms.h
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
99
100
101
102
103
#include <Arduino.h>
#define details(name) (uint8_t*)&name,sizeof(name)
#pragma pack(1)
typedef struct
{
byte id;
byte M1;
byte M2;
byte M3;
}HandShakePacket;
typedef struct
{
byte id; //1
float AP; //2
float PE; //3
float SemiMajorAxis; //4
float SemiMinorAxis; //5
float VVI; //6
float e; //7
float inc; //8
float G; //9
long TAp; //10
long TPe; //11
float TrueAnomaly; //12
float Density; //13
long period; //14
float RAlt; //15
float Alt; //16
float Vsurf; //17
float Lat; //18
float Lon; //19
float LiquidFuelTot; //20
float LiquidFuel; //21
float OxidizerTot; //22
float Oxidizer; //23
float EChargeTot; //24
float ECharge; //25
float MonoPropTot; //26
float MonoProp; //27
float IntakeAirTot; //28
float IntakeAir; //29
float SolidFuelTot; //30
float SolidFuel; //31
float XenonGasTot; //32
float XenonGas; //33
float LiquidFuelTotS; //34
float LiquidFuelS; //35
float OxidizerTotS; //36
float OxidizerS; //37
uint32_t MissionTime; //38
float deltaTime; //39
float VOrbit; //40
uint32_t MNTime; //41
float MNDeltaV; //42
float Pitch; //43
float Roll; //44
float Heading; //45
uint16_t ActionGroups; //46 status bit order:SAS, RCS, Light, Gear, Brakes, Abort, Custom01 - 10
byte SOINumber; //47 SOI Number (decimal format: sun-planet-moon e.g. 130 = kerbin, 131 = mun)
byte MaxOverHeat; //48 Max part overheat (% percent)
float MachNumber; //49
float IAS; //50 Indicated Air Speed
byte CurrentStage; //51 Current stage number
byte TotalStage; //52 TotalNumber of stages
float TargetDist; //53 Distance to targeted vessel (m)
float TargetV; //54 Target vessel relative velocity (m/s)
byte SASMode; //55 First four bits indicate AutoPilot mode:
}VData_s;
typedef struct {
byte id;
byte MainControls; //SAS RCS Lights Gear Brakes Precision Abort Stage
byte Mode; //0 = stage, 1 = docking, 2 = map
unsigned int ControlGroup; //control groups 1-10 in 2 bytes
byte AdditionalControlByte1; //other stuff
byte AdditionalControlByte2;
int Pitch; //-1000 -> 1000
int Roll; //-1000 -> 1000
int Yaw; //-1000 -> 1000
int TX; //-1000 -> 1000
int TY; //-1000 -> 1000
int TZ; //-1000 -> 1000
int WheelSteer; //-1000 -> 1000
int Throttle; // 0 -> 1000
int WheelThrottle; // 0 -> 1000
}ControlPacket;
#pragma pack(0)
extern HandShakePacket HPacket;
extern ControlPacket CPacket;
extern VData_s VData;
extern byte id;
extern boolean Connected;
void InitTxPackets();
void SerialHelper(void);
boolean KSPBoardReceiveData();
void KSPBoardSendData(uint8_t * address, uint8_t len);
int input();
void output();