Rev 718 | Rev 766 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 718 | Rev 721 | ||
---|---|---|---|
- | 1 | #include <stdio.h> |
|
- | 2 | #include <stdarg.h> |
|
1 | #include <string.h> |
3 | #include <string.h> |
2 | #include "91x_lib.h" |
4 | #include "91x_lib.h" |
3 | #include "91x_can.h" |
5 | #include "91x_can.h" |
4 | #include "timer1.h" |
6 | #include "timer1.h" |
5 | #include "led.h" |
7 | #include "led.h" |
6 | #include "canbus.h" |
8 | #include "canbus.h" |
7 | #include "compass.h" |
9 | #include "compass.h" |
8 | #include "main.h" |
10 | #include "main.h" |
9 | #include "uart0.h" |
11 | #include "uart0.h" |
10 | #include "uart1.h" |
12 | #include "uart1.h" |
11 | #include "GPS.h" |
13 | #include "GPS.h" |
12 | 14 | ||
13 | canmsg CanMsg; |
15 | canmsg CanMsg; |
14 | canmsg RxCanMsg; |
16 | canmsg RxCanMsg; |
15 | volatile u32 AllMsgsReceived; |
17 | volatile u32 AllMsgsReceived; |
16 | u32 CanbusTimeOut = 0; |
18 | u32 CanbusTimeOut = 0; |
17 | 19 | ||
18 | GPIO_InitTypeDef GPIO_InitStructure; |
20 | GPIO_InitTypeDef GPIO_InitStructure; |
19 | CAN_InitTypeDef CAN_InitStructure; |
21 | CAN_InitTypeDef CAN_InitStructure; |
20 | 22 | ||
21 | 23 | ||
22 | typedef enum { |
24 | typedef enum { |
23 | NA, |
25 | NA, |
24 | Priority_1, |
26 | Priority_1, |
25 | Priority_2, |
27 | Priority_2, |
26 | Priority_3 |
28 | Priority_3 |
27 | }VIC_Priority; |
29 | }VIC_Priority; |
28 | 30 | ||
29 | /* buffer for receive messages */ |
31 | /* buffer for receive messages */ |
30 | canmsg RxCanTxMsg; |
32 | canmsg RxCanTxMsg; |
31 | 33 | ||
32 | /* used message object numbers */ |
34 | /* used message object numbers */ |
33 | enum { |
35 | enum { |
34 | CAN_TX_MSGOBJ = 0, |
36 | CAN_TX_MSGOBJ = 0, |
35 | CAN_RX_MSGOBJ = 1 |
37 | CAN_RX_MSGOBJ = 1 |
36 | }; |
38 | }; |
37 | 39 | ||
38 | #define CAN_MSG_ADR_MA 0x200 |
40 | #define CAN_MSG_ADR_MA 0x200 |
39 | #define CAN_MSG_ADR_SL 0x300 |
41 | #define CAN_MSG_ADR_SL 0x300 |
40 | 42 | ||
41 | u32 CAN_IdTx; // I am Sending in this ID-Range |
43 | u32 CAN_IdTx; // I am Sending in this ID-Range |
42 | u32 CAN_IdRx; // I am Receiving in this ID-Range |
44 | u32 CAN_IdRx; // I am Receiving in this ID-Range |
43 | 45 | ||
44 | CanMessage_t CanTxMessage[MAX_CAN_MSG]; |
46 | CanMessage_t CanTxMessage[MAX_CAN_MSG]; |
45 | CanMessage_t CanRxMessage[MAX_CAN_MSG]; |
47 | CanMessage_t CanRxMessage[MAX_CAN_MSG]; |
46 | 48 | ||
47 | void CAN_IO_Init(void) |
49 | void CAN_IO_Init(void) |
48 | { |
50 | { |
49 | // P5.0 alternate input 1, CAN_RX pin |
51 | // P5.0 alternate input 1, CAN_RX pin |
50 | GPIO_StructInit(&GPIO_InitStructure); |
52 | GPIO_StructInit(&GPIO_InitStructure); |
51 | GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0; |
53 | GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0; |
52 | GPIO_InitStructure.GPIO_Direction=GPIO_PinInput; |
54 | GPIO_InitStructure.GPIO_Direction=GPIO_PinInput; |
53 | GPIO_InitStructure.GPIO_IPInputConnected=GPIO_IPInputConnected_Enable; |
55 | GPIO_InitStructure.GPIO_IPInputConnected=GPIO_IPInputConnected_Enable; |
54 | GPIO_InitStructure.GPIO_Alternate=GPIO_InputAlt1; |
56 | GPIO_InitStructure.GPIO_Alternate=GPIO_InputAlt1; |
55 | GPIO_Init(GPIO5,&GPIO_InitStructure); |
57 | GPIO_Init(GPIO5,&GPIO_InitStructure); |
56 | // P5.1 CAN_TX |
58 | // P5.1 CAN_TX |
57 | GPIO_StructInit(&GPIO_InitStructure); |
59 | GPIO_StructInit(&GPIO_InitStructure); |
58 | GPIO_InitStructure.GPIO_Pin=GPIO_Pin_1; |
60 | GPIO_InitStructure.GPIO_Pin=GPIO_Pin_1; |
59 | GPIO_InitStructure.GPIO_Direction=GPIO_PinOutput; |
61 | GPIO_InitStructure.GPIO_Direction=GPIO_PinOutput; |
60 | GPIO_InitStructure.GPIO_Type=GPIO_Type_PushPull; |
62 | GPIO_InitStructure.GPIO_Type=GPIO_Type_PushPull; |
61 | GPIO_InitStructure.GPIO_Alternate=GPIO_OutputAlt2; |
63 | GPIO_InitStructure.GPIO_Alternate=GPIO_OutputAlt2; |
62 | GPIO_Init(GPIO5,&GPIO_InitStructure); |
64 | GPIO_Init(GPIO5,&GPIO_InitStructure); |
63 | } |
65 | } |
64 | 66 | ||
65 | 67 | ||
66 | 68 | ||
67 | /******************************************************************************* |
69 | /******************************************************************************* |
68 | * Function Name : CAN_IRQHandler |
70 | * Function Name : CAN_IRQHandler |
69 | * Description : This function handles the CAN interrupt request |
71 | * Description : This function handles the CAN interrupt request |
70 | *******************************************************************************/ |
72 | *******************************************************************************/ |
71 | void CAN_IRQHandler(void) |
73 | void CAN_IRQHandler(void) |
72 | { |
74 | { |
73 | u32 msgobj = 0; |
75 | u32 msgobj = 0; |
74 | if(CAN->IDR == 0x8000) /* status interrupt */ |
76 | if(CAN->IDR == 0x8000) /* status interrupt */ |
75 | { |
77 | { |
76 | (void)CAN->SR; /* read the status register to clear*/ |
78 | (void)CAN->SR; /* read the status register to clear*/ |
77 | } |
79 | } |
78 | else if(CAN->IDR >= 1 && CAN->IDR <= 32) |
80 | else if(CAN->IDR >= 1 && CAN->IDR <= 32) |
79 | { |
81 | { |
80 | /* get the message object number that caused the interrupt to occur */ |
82 | /* get the message object number that caused the interrupt to occur */ |
81 | switch(msgobj = CAN->IDR - 1) |
83 | switch(msgobj = CAN->IDR - 1) |
82 | { |
84 | { |
83 | case 0 /* CAN_TX_MSGOBJ */: |
85 | case 0 /* CAN_TX_MSGOBJ */: |
84 | CAN_ReleaseTxMessage(msgobj); |
86 | CAN_ReleaseTxMessage(msgobj); |
85 | break; |
87 | break; |
86 | 88 | ||
87 | case 1 /* CAN_RX_MSGOBJ */: |
89 | case 1 /* CAN_RX_MSGOBJ */: |
88 | CAN_ReceiveMessage(msgobj, FALSE, &RxCanMsg); |
90 | CAN_ReceiveMessage(msgobj, FALSE, &RxCanMsg); |
89 | CAN_ReleaseRxMessage(msgobj); |
91 | CAN_ReleaseRxMessage(msgobj); |
90 | 92 | ||
91 | if(RxCanMsg.Id >= CAN_IdRx && RxCanMsg.Id < CAN_IdRx + MAX_CAN_MSG) |
93 | if(RxCanMsg.Id >= CAN_IdRx && RxCanMsg.Id < CAN_IdRx + MAX_CAN_MSG) |
92 | { |
94 | { |
93 | memcpy(&CanRxMessage[RxCanMsg.Id - CAN_IdRx], &RxCanMsg,sizeof(RxCanMsg)); |
95 | memcpy(&CanRxMessage[RxCanMsg.Id - CAN_IdRx], &RxCanMsg,sizeof(RxCanMsg)); |
94 | } |
96 | } |
95 | if(RxCanMsg.Id == CAN_IdRx + MAX_CAN_MSG - 1) |
97 | if(RxCanMsg.Id == CAN_IdRx + MAX_CAN_MSG - 1) |
96 | { |
98 | { |
97 | AllMsgsReceived = 1; |
99 | AllMsgsReceived = 1; |
98 | } |
100 | } |
99 | // DebugOut.Analog[] = RxCanMsg.Id; |
101 | // DebugOut.Analog[] = RxCanMsg.Id; |
100 | break; |
102 | break; |
101 | 103 | ||
102 | default: |
104 | default: |
103 | CAN_ReleaseMessage(msgobj); |
105 | CAN_ReleaseMessage(msgobj); |
104 | break; |
106 | break; |
105 | } |
107 | } |
106 | } |
108 | } |
107 | 109 | ||
108 | /*write any value to VIC0 VAR*/ |
110 | /*write any value to VIC0 VAR*/ |
109 | VIC0->VAR = 0xFF; |
111 | VIC0->VAR = 0xFF; |
110 | 112 | ||
111 | } |
113 | } |
112 | 114 | ||
113 | void CanSend(void) |
115 | void CanSend(void) |
114 | { |
116 | { |
115 | static u32 index = 1; |
117 | static u32 index = 1; |
116 | 118 | ||
117 | if(CAN_SendMessage(CAN_TX_MSGOBJ, (canmsg*) &CanTxMessage[index]) == SUCCESS) |
119 | if(CAN_SendMessage(CAN_TX_MSGOBJ, (canmsg*) &CanTxMessage[index]) == SUCCESS) |
118 | { |
120 | { |
119 | if(++index >= MAX_CAN_MSG) |
121 | if(++index >= MAX_CAN_MSG) |
120 | { |
122 | { |
121 | u32 i; |
123 | u32 i; |
122 | index = 0; |
124 | index = 0; |
123 | CanTxMessage[CAN_ID_STATUS].D.Byte[0] = ErrorCode; |
125 | CanTxMessage[CAN_ID_STATUS].D.Byte[0] = ErrorCode; |
124 | 126 | ||
125 | CanTxMessage[CAN_ID_FS_LON].D.sLong = GPS_FailsafePosition.Longitude; |
127 | CanTxMessage[CAN_ID_FS_LON].D.sLong = GPS_FailsafePosition.Longitude; |
126 | CanTxMessage[CAN_ID_FS_LAT].D.sLong = GPS_FailsafePosition.Latitude; |
128 | CanTxMessage[CAN_ID_FS_LAT].D.sLong = GPS_FailsafePosition.Latitude; |
127 | 129 | ||
128 | CanTxMessage[CAN_ID_STATUS].D.Byte[0] = ErrorCode; |
130 | CanTxMessage[CAN_ID_STATUS].D.Byte[0] = ErrorCode; |
129 | CanTxMessage[CAN_ID_STATUS].D.Byte[1] = FC.StatusFlags; |
131 | CanTxMessage[CAN_ID_STATUS].D.Byte[1] = FC.StatusFlags; |
130 | CanTxMessage[CAN_ID_STATUS].D.Byte[2] = FC.StatusFlags2; |
132 | CanTxMessage[CAN_ID_STATUS].D.Byte[2] = FC.StatusFlags2; |
131 | CanTxMessage[CAN_ID_STATUS].D.Byte[3] = FC.StatusFlags3; |
133 | CanTxMessage[CAN_ID_STATUS].D.Byte[3] = FC.StatusFlags3; |
132 | CanTxMessage[CAN_ID_STATUS].D.Byte[4] = NC_To_FC_Flags; |
134 | CanTxMessage[CAN_ID_STATUS].D.Byte[4] = NC_To_FC_Flags; |
133 | CanTxMessage[CAN_ID_STATUS].D.Byte[5] = EarthMagneticField/5; // in % |
135 | CanTxMessage[CAN_ID_STATUS].D.Byte[5] = EarthMagneticField/5; // in % |
134 | CanTxMessage[CAN_ID_STATUS].D.Int[3] = GyroCompassCorrected; |
136 | CanTxMessage[CAN_ID_STATUS].D.Int[3] = GyroCompassCorrected; |
135 | 137 | ||
136 | for(i=0; i<8;i++) |
138 | for(i=0; i<8;i++) |
137 | { |
139 | { |
138 | CanTxMessage[CAN_ID_TEXT1].D.Byte[i] = ErrorMSG[i]; |
140 | CanTxMessage[CAN_ID_TEXT1].D.Byte[i] = ErrorMSG[i]; |
139 | CanTxMessage[CAN_ID_TEXT2].D.Byte[i] = ErrorMSG[i + 8]; |
141 | CanTxMessage[CAN_ID_TEXT2].D.Byte[i] = ErrorMSG[i + 8]; |
140 | CanTxMessage[CAN_ID_TEXT3].D.Byte[i] = ErrorMSG[i + 16]; |
142 | CanTxMessage[CAN_ID_TEXT3].D.Byte[i] = ErrorMSG[i + 16]; |
141 | } |
143 | } |
142 | } |
144 | } |
143 | } |
145 | } |
144 | } |
146 | } |
145 | 147 | ||
146 | void CanReceive(void) |
148 | void CanReceive(void) |
147 | { |
149 | { |
148 | 150 | ||
149 | } |
151 | } |
150 | 152 | ||
151 | 153 | ||
152 | void CanbusInit(void) |
154 | void CanbusInit(void) |
153 | { |
155 | { |
154 | UART1_PutString("\r\n Canbus init..."); |
156 | UART1_PutString("\r\n Canbus init..."); |
155 | CAN_IO_Init(); |
157 | CAN_IO_Init(); |
156 | SCU_APBPeriphClockConfig(__CAN, ENABLE); |
158 | SCU_APBPeriphClockConfig(__CAN, ENABLE); |
157 | SCU_APBPeriphReset(__CAN, DISABLE); |
159 | SCU_APBPeriphReset(__CAN, DISABLE); |
158 | 160 | ||
159 | VIC_Config(CAN_ITLine, VIC_IRQ, Priority_1); |
161 | VIC_Config(CAN_ITLine, VIC_IRQ, Priority_1); |
160 | CAN_InitStructure.CAN_ConfigParameters=CAN_CR_IE; |
162 | CAN_InitStructure.CAN_ConfigParameters=CAN_CR_IE; |
161 | CAN_InitStructure.CAN_Bitrate = CAN_BITRATE_1M; |
163 | CAN_InitStructure.CAN_Bitrate = CAN_BITRATE_1M; |
162 | CAN_Init(&CAN_InitStructure); |
164 | CAN_Init(&CAN_InitStructure); |
163 | VIC_ITCmd(CAN_ITLine, ENABLE); |
165 | VIC_ITCmd(CAN_ITLine, ENABLE); |
164 | 166 | ||
165 | CAN_SetUnusedAllMsgObj(); |
167 | CAN_SetUnusedAllMsgObj(); |
166 | CAN_SetTxMsgObj(CAN_TX_MSGOBJ, CAN_STD_ID, DISABLE); |
168 | CAN_SetTxMsgObj(CAN_TX_MSGOBJ, CAN_STD_ID, DISABLE); |
167 | CAN_SetRxMsgObj(CAN_RX_MSGOBJ, CAN_STD_ID, 0, CAN_LAST_STD_ID, TRUE); |
169 | CAN_SetRxMsgObj(CAN_RX_MSGOBJ, CAN_STD_ID, 0, CAN_LAST_STD_ID, TRUE); |
168 | 170 | ||
169 | u32 i; |
171 | u32 i; |
170 | 172 | ||
171 | if(IamMaster == SLAVE) |
173 | if(IamMaster == SLAVE) |
172 | { |
174 | { |
173 | CAN_IdRx = CAN_MSG_ADR_MA; |
175 | CAN_IdRx = CAN_MSG_ADR_MA; |
174 | CAN_IdTx = CAN_MSG_ADR_SL; |
176 | CAN_IdTx = CAN_MSG_ADR_SL; |
175 | } |
177 | } |
176 | else |
178 | else |
177 | { |
179 | { |
178 | CAN_IdRx = CAN_MSG_ADR_SL; |
180 | CAN_IdRx = CAN_MSG_ADR_SL; |
179 | CAN_IdTx = CAN_MSG_ADR_MA; |
181 | CAN_IdTx = CAN_MSG_ADR_MA; |
180 | } |
182 | } |
181 | 183 | ||
182 | for(i=0; i< MAX_CAN_MSG;i++) |
184 | for(i=0; i< MAX_CAN_MSG;i++) |
183 | { |
185 | { |
184 | // clear TX Buffer |
186 | // clear TX Buffer |
185 | CanTxMessage[i].IdType = CAN_STD_ID; |
187 | CanTxMessage[i].IdType = CAN_STD_ID; |
186 | CanTxMessage[i].Id = i + CAN_IdTx; |
188 | CanTxMessage[i].Id = i + CAN_IdTx; |
187 | CanTxMessage[i].Length = 8; |
189 | CanTxMessage[i].Length = 8; |
188 | CanTxMessage[i].D.Long = 0; |
190 | CanTxMessage[i].D.Long = 0; |
189 | 191 | ||
190 | // clear receiving Buffer |
192 | // clear receiving Buffer |
191 | CanRxMessage[i].Id = 0; |
193 | CanRxMessage[i].Id = 0; |
192 | CanRxMessage[i].D.Long = 0; |
194 | CanRxMessage[i].D.Long = 0; |
193 | } |
195 | } |
194 | 196 | ||
195 | CanTxMessage[CAN_ID_VERSION].D.Byte[0] = 0; |
197 | CanTxMessage[CAN_ID_VERSION].D.Byte[0] = 0; |
196 | CanTxMessage[CAN_ID_VERSION].D.Byte[1] = Parameter.ActiveSetting; |
198 | CanTxMessage[CAN_ID_VERSION].D.Byte[1] = Parameter.ActiveSetting; |
197 | CanTxMessage[CAN_ID_VERSION].D.Byte[2] = GPS_Version/1000; |
199 | CanTxMessage[CAN_ID_VERSION].D.Byte[2] = GPS_Version/1000; |
198 | CanTxMessage[CAN_ID_VERSION].D.Byte[3] = UART_VersionInfo.HWMajor; |
200 | CanTxMessage[CAN_ID_VERSION].D.Byte[3] = UART_VersionInfo.HWMajor; |
199 | CanTxMessage[CAN_ID_VERSION].D.Byte[4] = CAN_SLAVE_COMPATIBLE; |
201 | CanTxMessage[CAN_ID_VERSION].D.Byte[4] = CAN_SLAVE_COMPATIBLE; |
200 | CanTxMessage[CAN_ID_VERSION].D.Byte[5] = VERSION_PATCH; |
202 | CanTxMessage[CAN_ID_VERSION].D.Byte[5] = VERSION_PATCH; |
201 | CanTxMessage[CAN_ID_VERSION].D.Byte[6] = VERSION_MINOR; |
203 | CanTxMessage[CAN_ID_VERSION].D.Byte[6] = VERSION_MINOR; |
202 | CanTxMessage[CAN_ID_VERSION].D.Byte[7] = VERSION_MAJOR; |
204 | CanTxMessage[CAN_ID_VERSION].D.Byte[7] = VERSION_MAJOR; |
203 | 205 | ||
204 | UART1_PutString("ok"); |
206 | UART1_PutString("ok"); |
205 | } |
207 | } |
206 | 208 | ||
207 | void ProcessCanBus(void) |
209 | void ProcessCanBus(void) |
208 | { |
210 | { |
209 | u32 errorcnt = 0; |
211 | u32 errorcnt = 0; |
210 | 212 | ||
211 | CanSend(); |
213 | CanSend(); |
212 | CanReceive(); |
214 | CanReceive(); |
213 | 215 | ||
214 | errorcnt = CAN_GetTransmitErrorCounter(); |
216 | errorcnt = CAN_GetTransmitErrorCounter(); |
215 | //if(errorcnt > 200) CanbusInit(); |
217 | //if(errorcnt > 200) CanbusInit(); |
216 | 218 | ||
217 | if(CanbusTimeOut < 3) |
219 | if(CanbusTimeOut < 3) |
218 | { |
220 | { |
219 | if(CanbusTimeOut == 1) Partner.ErrorCode = 39; // ERR: Canbus |
221 | if(CanbusTimeOut == 1) Partner.ErrorCode = 39; // ERR: Canbus |
220 | Partner.StatusFlags = 0; |
222 | Partner.StatusFlags = 0; |
221 | Partner.StatusFlags2 = 0; |
223 | Partner.StatusFlags2 = 0; |
222 | Partner.StatusFlags3 = 0; |
224 | Partner.StatusFlags3 = 0; |
223 | Partner.NC_To_FC_Flags = 0; |
225 | Partner.NC_To_FC_Flags = 0; |
224 | Partner.MagnetField = 0; |
226 | Partner.MagnetField = 0; |
225 | Partner.GyroCompassCorrected = -1; |
227 | Partner.GyroCompassCorrected = -1; |
226 | sprintf(PartnerErrorMSG," --- \0"); |
228 | sprintf(PartnerErrorMSG," --- "); |
227 | } |
229 | } |
228 | 230 | ||
229 | if(CanRxMessage[CAN_ID_VERSION].D.Byte[6] == 13) // dann ist der Testdummy angeschlossen -> nur zum Testen von EXT2 |
231 | if(CanRxMessage[CAN_ID_VERSION].D.Byte[6] == 13) // dann ist der Testdummy angeschlossen -> nur zum Testen von EXT2 |
230 | { |
232 | { |
231 | if((PartnerErrorMSG[17] + PartnerErrorMSG[18]) & 1) EXT2_ON; |
233 | if((PartnerErrorMSG[17] + PartnerErrorMSG[18]) & 1) EXT2_ON; |
232 | else EXT2_OFF; |
234 | else EXT2_OFF; |
233 | } |
235 | } |
234 | 236 | ||
235 | if(AllMsgsReceived) |
237 | if(AllMsgsReceived) |
236 | { |
238 | { |
237 | u32 i; |
239 | u32 i; |
238 | AllMsgsReceived = 0; |
240 | AllMsgsReceived = 0; |
239 | CanbusTimeOut = 1000; |
241 | CanbusTimeOut = 1000; |
240 | for(i=0; i<8;i++) |
242 | for(i=0; i<8;i++) |
241 | { |
243 | { |
242 | PartnerErrorMSG[i] = CanRxMessage[CAN_ID_TEXT1].D.Byte[i]; |
244 | PartnerErrorMSG[i] = CanRxMessage[CAN_ID_TEXT1].D.Byte[i]; |
243 | PartnerErrorMSG[i+8] = CanRxMessage[CAN_ID_TEXT2].D.Byte[i]; |
245 | PartnerErrorMSG[i+8] = CanRxMessage[CAN_ID_TEXT2].D.Byte[i]; |
244 | PartnerErrorMSG[i+16] = CanRxMessage[CAN_ID_TEXT3].D.Byte[i]; |
246 | PartnerErrorMSG[i+16] = CanRxMessage[CAN_ID_TEXT3].D.Byte[i]; |
245 | } |
247 | } |
246 | Partner.ErrorCode = CanRxMessage[CAN_ID_STATUS].D.Byte[0]; |
248 | Partner.ErrorCode = CanRxMessage[CAN_ID_STATUS].D.Byte[0]; |
247 | Partner.StatusFlags = CanRxMessage[CAN_ID_STATUS].D.Byte[1]; |
249 | Partner.StatusFlags = CanRxMessage[CAN_ID_STATUS].D.Byte[1]; |
248 | Partner.StatusFlags2 = CanRxMessage[CAN_ID_STATUS].D.Byte[2]; |
250 | Partner.StatusFlags2 = CanRxMessage[CAN_ID_STATUS].D.Byte[2]; |
249 | Partner.StatusFlags3 = CanRxMessage[CAN_ID_STATUS].D.Byte[3]; |
251 | Partner.StatusFlags3 = CanRxMessage[CAN_ID_STATUS].D.Byte[3]; |
250 | Partner.NC_To_FC_Flags = CanRxMessage[CAN_ID_STATUS].D.Byte[4]; |
252 | Partner.NC_To_FC_Flags = CanRxMessage[CAN_ID_STATUS].D.Byte[4]; |
251 | Partner.MagnetField = CanRxMessage[CAN_ID_STATUS].D.Byte[5]; |
253 | Partner.MagnetField = CanRxMessage[CAN_ID_STATUS].D.Byte[5]; |
252 | Partner.GyroCompassCorrected = CanRxMessage[CAN_ID_STATUS].D.Int[3]; |
254 | Partner.GyroCompassCorrected = CanRxMessage[CAN_ID_STATUS].D.Int[3]; |
253 | 255 | ||
254 | CanTxMessage[CAN_ID_VERSION].D.Byte[1] = Parameter.ActiveSetting; |
256 | CanTxMessage[CAN_ID_VERSION].D.Byte[1] = Parameter.ActiveSetting; |
255 | 257 | ||
256 | if(IamMaster == SLAVE) |
258 | if(IamMaster == SLAVE) |
257 | { |
259 | { |
258 | GPS_FailsafePosition.Longitude = CanRxMessage[CAN_ID_FS_LON].D.sLong; |
260 | GPS_FailsafePosition.Longitude = CanRxMessage[CAN_ID_FS_LON].D.sLong; |
259 | GPS_FailsafePosition.Latitude = CanRxMessage[CAN_ID_FS_LAT].D.sLong; |
261 | GPS_FailsafePosition.Latitude = CanRxMessage[CAN_ID_FS_LAT].D.sLong; |
260 | } |
262 | } |
261 | } |
263 | } |
262 | } |
264 | } |
263 | 265 | ||
264 | 266 | ||
265 | 267 | ||
266 | 268 | ||
267 | 269 | ||
268 | 270 |