Rev 190 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 190 | Rev 192 | ||
|---|---|---|---|
| 1 | /** |
1 | /** |
| 2 | * CAN Relay. |
2 | * CAN Relay. |
| 3 | * |
3 | * |
| 4 | * |
4 | * |
| 5 | * @date 2006-12-17 |
5 | * @date 2006-12-17 |
| 6 | * @author Erik Larsson |
6 | * @author Erik Larsson |
| 7 | * |
7 | * |
| 8 | * Observera! Applikationen är endast testad på labplatta med m88, pot och lysdiod |
8 | * Observera! Applikationen är endast testad på labplatta med m88, pot och lysdiod |
| 9 | * |
9 | * |
| 10 | * ADC=Vin*1024/Vref |
10 | * ADC=Vin*1024/Vref |
| 11 | * Vout=( 10 mV/C )( Temperature C ) + 500 mV |
11 | * Vout=( 10 mV/C )( Temperature C ) + 500 mV |
| 12 | * |
12 | * |
| 13 | * Transmitts: DATA: <temperature low byte> <temperature high byte> <relay status> <failsafe mode> |
13 | * Transmitts: DATA: <temperature low byte> <temperature high byte> <relay status> <failsafe mode> |
| 14 | * |
14 | * |
| 15 | * |
15 | * |
| 16 | */ |
16 | */ |
| 17 | 17 | ||
| 18 | #define DEBUG |
18 | #define DEBUG 1 /* Prints debug messages to uart */ |
| - | 19 | #define TWO_BUTTON_MODE 1 /* If using two (or just one but nothing more) auxiliary buttons */ |
|
| 19 | 20 | ||
| 20 | /*----------------------------------------------------------------------------- |
21 | /*----------------------------------------------------------------------------- |
| 21 | * Includes |
22 | * Includes |
| 22 | *---------------------------------------------------------------------------*/ |
23 | *---------------------------------------------------------------------------*/ |
| 23 | /* system files */ |
24 | /* system files */ |
| 24 | #include <avr/io.h> |
25 | #include <avr/io.h> |
| 25 | #include <avr/interrupt.h> |
26 | #include <avr/interrupt.h> |
| 26 | #include <avr/wdt.h> |
27 | #include <avr/wdt.h> |
| 27 | #include <stdio.h> |
28 | #include <stdio.h> |
| 28 | /* lib files */ |
29 | /* lib files */ |
| 29 | #include <can.h> |
30 | #include <can.h> |
| 30 | #include <serial.h> |
31 | #include <serial.h> |
| 31 | #include <timebase.h> |
32 | #include <timebase.h> |
| 32 | 33 | ||
| 33 | #include <tc1047.h> |
34 | #include <tc1047.h> |
| 34 | 35 | ||
| 35 | /* defines */ |
36 | /* defines */ |
| 36 | #define RELAY_OFF 0x01 |
37 | #define RELAY_OFF 0x01 |
| 37 | #define RELAY_ON 0x02 |
38 | #define RELAY_ON 0x02 |
| 38 | #define FAILSAFE_MODE 0x0F |
39 | #define FAILSAFE_MODE 0x0F |
| 39 | #define FAILSAFE_TRESHOLD 60 /* Degrees when nodeRelay goes into failsafe mode */ |
40 | #define FAILSAFE_TRESHOLD 60 /* Degrees when nodeRelay goes into failsafe mode */ |
| 40 | 41 | ||
| 41 | #define RELAY_CMD_GET 0x1200 |
42 | #define RELAY_CMD_GET 0x1200 |
| 42 | #define RELAY_CMD_SEND 0x1201 |
43 | #define RELAY_CMD_SEND 0x1201 |
| 43 | #define RELAY_CMD_ON 0x01 |
44 | #define RELAY_CMD_ON 0x01 |
| 44 | #define RELAY_CMD_OFF 0x02 |
45 | #define RELAY_CMD_OFF 0x02 |
| 45 | #define RELAY_CMD_TOGGLE 0x03 |
46 | #define RELAY_CMD_TOGGLE 0x03 |
| 46 | #define RELAY_CMD_STATUS 0x04 |
47 | #define RELAY_CMD_STATUS 0x04 |
| 47 | #define RELAY_CMD_RESET 0x05 |
48 | #define RELAY_CMD_RESET 0x05 |
| 48 | #define STATUS_SEND_PERIOD 10000 /* milliseconds */ |
49 | #define STATUS_SEND_PERIOD 10000 /* milliseconds */ |
| 49 | #define FAILSAFE_SEND_PERIOD 10000 /* milliseconds */ |
50 | #define FAILSAFE_SEND_PERIOD 10000 /* milliseconds */ |
| - | 51 | #define BOUNCE_TIME 10 /* milliseconds */ |
|
| - | 52 | #define BUTTON_ID 0x1202 |
|
| - | 53 | #define BUTTON1 1 |
|
| - | 54 | #define BUTTON2 2 |
|
| - | 55 | ||
| - | 56 | /*------------------------------------------------------------------------- |
|
| - | 57 | * Global variables |
|
| - | 58 | * -----------------------------------------------------------------------*/ |
|
| - | 59 | #if TWO_BUTTON_MODE |
|
| - | 60 | Can_Message_t txMsg_Button; |
|
| - | 61 | #endif |
|
| 50 | 62 | ||
| 51 | /*---------------------------------------------------------------------------- |
63 | /*---------------------------------------------------------------------------- |
| 52 | * Functions |
64 | * Functions |
| 53 | * -------------------------------------------------------------------------*/ |
65 | * -------------------------------------------------------------------------*/ |
| 54 | uint8_t relayOff(); |
66 | uint8_t relayOff(); |
| 55 | uint8_t relayOn(); |
67 | uint8_t relayOn(); |
| 56 | void relayFailsafe(); |
68 | void relayFailsafe(); |
| - | 69 | ||
| - | 70 | /*---------------------------------------------------------------------------- |
|
| - | 71 | * Interrupt routines |
|
| - | 72 | * -------------------------------------------------------------------------*/ |
|
| - | 73 | #if TWO_BUTTON_MODE |
|
| - | 74 | ISR( PCINT2_vect ) |
|
| - | 75 | { |
|
| - | 76 | /* |
|
| - | 77 | * Auxiliary button pressed and released |
|
| - | 78 | * Check time between press and release to eliminate bounces |
|
| - | 79 | */ |
|
| - | 80 | static uint32_t buttonTime[2]; |
|
| - | 81 | ||
| - | 82 | txMsg_Button.RemoteFlag = 0; |
|
| - | 83 | txMsg_Button.ExtendedFlag = 1; |
|
| - | 84 | ||
| - | 85 | if( (PIND & (1<<PD6)) == 0){ |
|
| - | 86 | /* Button pressed */ |
|
| - | 87 | buttonTime[0] = Timebase_CurrentTime(); |
|
| - | 88 | #if DEBUG |
|
| - | 89 | printf("Button 1 pressed\n"); |
|
| - | 90 | #endif |
|
| - | 91 | }else if( (PIND & (1<<PD6)) == 1){ |
|
| - | 92 | if( Timebase_PassedTimeMillis( buttonTime[0] ) >= BOUNCE_TIME ){ |
|
| - | 93 | /* No bounce, send message */ |
|
| - | 94 | txMsg_Button.Id = BUTTON_ID; |
|
| - | 95 | txMsg_Button.DataLength = 1; |
|
| - | 96 | txMsg_Button.Data.bytes[0] = BUTTON1; |
|
| - | 97 | #if DEBUG |
|
| - | 98 | printf("Button 1 pressed: message sent\n"); |
|
| - | 99 | #endif |
|
| - | 100 | return; |
|
| - | 101 | }else{ |
|
| - | 102 | /* Just bounces, ignore it */ |
|
| - | 103 | #if DEBUG |
|
| - | 104 | printf("Button 1 just bounced\n"); |
|
| - | 105 | #endif |
|
| - | 106 | return; |
|
| - | 107 | } |
|
| - | 108 | } |
|
| - | 109 | if( (PIND & (1<<PD7)) == 0){ |
|
| - | 110 | /* Button pressed */ |
|
| - | 111 | buttonTime[1] = Timebase_CurrentTime(); |
|
| - | 112 | #if DEBUG |
|
| - | 113 | printf("Button 2 pressed\n"); |
|
| - | 114 | #endif |
|
| - | 115 | }else if( (PIND & (1<<PD7)) == 1){ |
|
| - | 116 | if( Timebase_PassedTimeMillis( buttonTime[1] ) >= BOUNCE_TIME ){ |
|
| - | 117 | /* No bounce, send message */ |
|
| - | 118 | txMsg_Button.Id = BUTTON_ID; |
|
| - | 119 | txMsg_Button.DataLength = 1; |
|
| - | 120 | txMsg_Button.Data.bytes[0] = BUTTON2; |
|
| - | 121 | #if DEBUG |
|
| - | 122 | printf("Button 2 pressed: message sent\n"); |
|
| - | 123 | #endif |
|
| - | 124 | return; |
|
| - | 125 | }else{ |
|
| - | 126 | /* Just bounces, ignore it */ |
|
| - | 127 | #if DEBUG |
|
| - | 128 | printf("Button 2 just bounced\n"); |
|
| - | 129 | #endif |
|
| - | 130 | return; |
|
| - | 131 | } |
|
| - | 132 | } |
|
| - | 133 | } |
|
| - | 134 | #endif |
|
| - | 135 | ||
| - | 136 | //ISR( ADC_vect ) |
|
| - | 137 | //{ |
|
| - | 138 | /* |
|
| - | 139 | * ADC conversion completed |
|
| - | 140 | */ |
|
| - | 141 | // TODO använd denna rutin för att läsa värde när omvandlingen är klar |
|
| - | 142 | ||
| - | 143 | //} |
|
| 57 | 144 | ||
| 58 | /*----------------------------------------------------------------------------- |
145 | /*----------------------------------------------------------------------------- |
| 59 | * Main Program |
146 | * Main Program |
| 60 | *---------------------------------------------------------------------------*/ |
147 | *---------------------------------------------------------------------------*/ |
| 61 | int main(void) { |
148 | int main(void) { |
| 62 | 149 | ||
| 63 | uint8_t relayStatus; |
150 | uint8_t relayStatus; |
| 64 | uint32_t boardTemperature = 0; |
151 | uint32_t boardTemperature = 0; |
| 65 | 152 | ||
| 66 | adcTemperatureInit(); |
153 | adcTemperatureInit(); |
| 67 | 154 | ||
| 68 | Timebase_Init(); |
155 | Timebase_Init(); |
| 69 | #if DEBUG |
156 | #if DEBUG |
| 70 | Serial_Init(); |
157 | Serial_Init(); |
| 71 | #endif |
158 | #endif |
| - | 159 | ||
| - | 160 | #if TWO_BUTTON_MODE |
|
| - | 161 | /* |
|
| - | 162 | * Initialize buttons |
|
| - | 163 | * It is possible to use ie. sensors instead |
|
| - | 164 | * but then change this |
|
| - | 165 | */ |
|
| - | 166 | /* Set as input and enable pull-up */ |
|
| - | 167 | DDRD &= ~( (1<<DDD6)|(1<<DDD7) ); |
|
| - | 168 | PORTD |= (1<<PD6)|(1<<PD7); |
|
| - | 169 | ||
| - | 170 | /* Enable IO-pin interrupt */ |
|
| - | 171 | PCICR |= (1<<PCIE1); |
|
| - | 172 | /* Unmask PD6 and PD7 */ |
|
| - | 173 | PCMSK2 |= (1<<PCINT22) | (1<<PCINT23); |
|
| - | 174 | /* Button pressed */ |
|
| - | 175 | #endif |
|
| - | 176 | ||
| - | 177 | ||
| 72 | sei(); |
178 | sei(); |
| 73 | 179 | ||
| 74 | /* Turn relay off */ |
180 | /* Turn relay off */ |
| 75 | relayStatus = relayOff(); |
181 | relayStatus = relayOff(); |
| 76 | 182 | ||
| 77 | #if DEBUG |
183 | #if DEBUG |
| 78 | printf("\n------------------------------------------------------------\n"); |
184 | printf("\n------------------------------------------------------------\n"); |
| 79 | printf( " CAN: Relay\n"); |
185 | printf( " CAN: Relay\n"); |
| 80 | printf( "------------------------------------------------------------\n"); |
186 | printf( "------------------------------------------------------------\n"); |
| 81 | 187 | ||
| 82 | 188 | ||
| 83 | printf("CanInit..."); |
189 | printf("CanInit..."); |
| 84 | if (Can_Init() != CAN_OK) { |
190 | if (Can_Init() != CAN_OK) { |
| 85 | printf("FAILED!\n"); |
191 | printf("FAILED!\n"); |
| 86 | }else{ |
192 | }else{ |
| 87 | printf("OK!\n"); |
193 | printf("OK!\n"); |
| 88 | } |
194 | } |
| 89 | #else |
195 | #else |
| 90 | Can_Init(); |
196 | Can_Init(); |
| 91 | #endif |
197 | #endif |
| 92 | uint32_t timeStamp = 0; |
198 | uint32_t timeStamp = 0; |
| 93 | 199 | ||
| 94 | Can_Message_t txMsg; |
200 | Can_Message_t txMsg; |
| 95 | Can_Message_t rxMsg; |
201 | Can_Message_t rxMsg; |
| 96 | txMsg.Id = RELAY_CMD_SEND; |
202 | txMsg.Id = RELAY_CMD_SEND; |
| 97 | txMsg.RemoteFlag = 0; |
203 | txMsg.RemoteFlag = 0; |
| 98 | txMsg.ExtendedFlag = 1; |
204 | txMsg.ExtendedFlag = 1; |
| 99 | txMsg.DataLength = 3; |
205 | txMsg.DataLength = 3; |
| 100 | 206 | ||
| 101 | /* main loop */ |
207 | /* main loop */ |
| 102 | while (1) { |
208 | while (1) { |
| 103 | /* service the CAN routines */ |
209 | /* service the CAN routines */ |
| 104 | Can_Service(); |
210 | Can_Service(); |
| 105 | 211 | ||
| 106 | /* check if any messages have been received */ |
212 | /* check if any messages have been received */ |
| 107 | while (Can_Receive(&rxMsg) == CAN_OK) { |
213 | while (Can_Receive(&rxMsg) == CAN_OK) { |
| 108 | /* This relay is adressed*/ |
214 | /* This relay is adressed*/ |
| 109 | if( rxMsg.Id == RELAY_CMD_GET ){ |
215 | if( rxMsg.Id == RELAY_CMD_GET ){ |
| 110 | 216 | ||
| 111 | if( rxMsg.Data.bytes[0] == RELAY_CMD_ON ){ |
217 | if( rxMsg.Data.bytes[0] == RELAY_CMD_ON ){ |
| 112 | /* Turn relay on */ |
218 | /* Turn relay on */ |
| 113 | relayStatus = relayOn(); |
219 | relayStatus = relayOn(); |
| 114 | 220 | ||
| 115 | }else if(rxMsg.Data.bytes[0] == RELAY_CMD_OFF){ |
221 | }else if(rxMsg.Data.bytes[0] == RELAY_CMD_OFF){ |
| 116 | /* Turn relay off */ |
222 | /* Turn relay off */ |
| 117 | relayStatus = relayOff(); |
223 | relayStatus = relayOff(); |
| 118 | 224 | ||
| 119 | }else if(rxMsg.Data.bytes[0] == RELAY_CMD_TOGGLE ){ |
225 | }else if(rxMsg.Data.bytes[0] == RELAY_CMD_TOGGLE ){ |
| 120 | /* Toggle relay */ |
226 | /* Toggle relay */ |
| 121 | 227 | ||
| 122 | if(relayStatus == RELAY_OFF){ |
228 | if(relayStatus == RELAY_OFF){ |
| 123 | relayStatus = relayOn(); |
229 | relayStatus = relayOn(); |
| 124 | }else{ |
230 | }else{ |
| 125 | relayStatus = relayOff(); |
231 | relayStatus = relayOff(); |
| 126 | } |
232 | } |
| 127 | 233 | ||
| 128 | }else if(rxMsg.Data.bytes[0] == RELAY_CMD_STATUS){ |
234 | }else if(rxMsg.Data.bytes[0] == RELAY_CMD_STATUS){ |
| 129 | /* Send relay status to CAN */ |
235 | /* Send relay status to CAN */ |
| 130 | 236 | ||
| 131 | boardTemperature = getTC1047temperature(); |
237 | boardTemperature = getTC1047temperature(); |
| 132 | 238 | ||
| 133 | if( (int32_t)boardTemperature >= FAILSAFE_TRESHOLD ){ |
239 | if( (int32_t)boardTemperature >= FAILSAFE_TRESHOLD ){ |
| 134 | relayFailsafe(); |
240 | relayFailsafe(); |
| 135 | }else{ |
241 | }else{ |
| 136 | txMsg.Data.bytes[0] = boardTemperature & 0x00FF; |
242 | txMsg.Data.bytes[0] = boardTemperature & 0x00FF; |
| 137 | txMsg.Data.bytes[1] = (boardTemperature & 0xFF00)>>8; |
243 | txMsg.Data.bytes[1] = (boardTemperature & 0xFF00)>>8; |
| 138 | txMsg.Data.bytes[2] = relayStatus; |
244 | txMsg.Data.bytes[2] = relayStatus; |
| 139 | 245 | ||
| 140 | Can_Send( &txMsg ); |
246 | Can_Send( &txMsg ); |
| 141 | } |
247 | } |
| 142 | } |
248 | } |
| 143 | } |
249 | } |
| 144 | } |
250 | } |
| 145 | 251 | ||
| 146 | if( Timebase_PassedTimeMillis(timeStamp) >= STATUS_SEND_PERIOD ){ |
252 | if( Timebase_PassedTimeMillis(timeStamp) >= STATUS_SEND_PERIOD ){ |
| 147 | timeStamp = Timebase_CurrentTime(); |
253 | timeStamp = Timebase_CurrentTime(); |
| 148 | /* Send relay status to CAN */ |
254 | /* Send relay status to CAN */ |
| 149 | 255 | ||
| 150 | boardTemperature = getTC1047temperature(); |
256 | boardTemperature = getTC1047temperature(); |
| 151 | 257 | ||
| 152 | if( (int32_t)boardTemperature >= FAILSAFE_TRESHOLD ){ |
258 | if( (int32_t)boardTemperature >= FAILSAFE_TRESHOLD ){ |
| 153 | relayFailsafe(); |
259 | relayFailsafe(); |
| 154 | }else{ |
260 | }else{ |
| 155 | txMsg.Data.bytes[0] = boardTemperature & 0x00FF; |
261 | txMsg.Data.bytes[0] = boardTemperature & 0x00FF; |
| 156 | txMsg.Data.bytes[1] = (boardTemperature & 0xFF00)>>8; |
262 | txMsg.Data.bytes[1] = (boardTemperature & 0xFF00)>>8; |
| 157 | txMsg.Data.bytes[2] = relayStatus; |
263 | txMsg.Data.bytes[2] = relayStatus; |
| 158 | 264 | ||
| 159 | Can_Send( &txMsg ); |
265 | Can_Send( &txMsg ); |
| 160 | #if DEBUG |
266 | #if DEBUG |
| 161 | printf("Periodic message sent...\n"); |
267 | printf("Periodic message sent...\n"); |
| 162 | printf("Temperature: %d\nRelay status: %u\n", boardTemperature, relayStatus); |
268 | printf("Temperature: %d\nRelay status: %u\n", boardTemperature, relayStatus); |
| 163 | #endif |
269 | #endif |
| 164 | } |
270 | } |
| 165 | } |
271 | } |
| 166 | } |
272 | } |
| 167 | return 0; |
273 | return 0; |
| 168 | } |
274 | } |
| 169 | 275 | ||
| 170 | uint8_t relayOff() |
276 | uint8_t relayOff() |
| 171 | { |
277 | { |
| 172 | /* Set as output and sink */ |
278 | /* Set as output and sink */ |
| 173 | PORTC &= ~(1<<PC1); |
279 | PORTC &= ~(1<<PC1); |
| 174 | DDRC |= (1<<DDC1); |
280 | DDRC |= (1<<DDC1); |
| 175 | 281 | ||
| 176 | #if DEBUG |
282 | #if DEBUG |
| 177 | printf("relay turned off\n"); |
283 | printf("relay turned off\n"); |
| 178 | #endif |
284 | #endif |
| 179 | 285 | ||
| 180 | return RELAY_OFF; |
286 | return RELAY_OFF; |
| 181 | } |
287 | } |
| 182 | 288 | ||
| 183 | uint8_t relayOn() |
289 | uint8_t relayOn() |
| 184 | { |
290 | { |
| 185 | /* Set as input and enable pull-up */ |
291 | /* Set as input and enable pull-up */ |
| 186 | DDRC &= ~(1<<DDC1); |
292 | DDRC &= ~(1<<DDC1); |
| 187 | PORTC |= (1<<PC1); |
293 | PORTC |= (1<<PC1); |
| 188 | 294 | ||
| 189 | #if DEBUG |
295 | #if DEBUG |
| 190 | printf("relay turned on\n"); |
296 | printf("relay turned on\n"); |
| 191 | #endif |
297 | #endif |
| 192 | 298 | ||
| 193 | return RELAY_ON; |
299 | return RELAY_ON; |
| 194 | } |
300 | } |
| 195 | 301 | ||
| 196 | void relayFailsafe() |
302 | void relayFailsafe() |
| 197 | { |
303 | { |
| 198 | uint8_t relayStatus; |
304 | uint8_t relayStatus; |
| 199 | uint32_t boardTemperature = 0, timeStamp = 0; |
305 | uint32_t boardTemperature = 0, timeStamp = 0; |
| 200 | 306 | ||
| 201 | Can_Message_t txMsg; |
307 | Can_Message_t txMsg; |
| 202 | Can_Message_t rxMsg; |
308 | Can_Message_t rxMsg; |
| 203 | txMsg.Id = RELAY_CMD_SEND; |
309 | txMsg.Id = RELAY_CMD_SEND; |
| 204 | txMsg.RemoteFlag = 0; |
310 | txMsg.RemoteFlag = 0; |
| 205 | txMsg.ExtendedFlag = 1; |
311 | txMsg.ExtendedFlag = 1; |
| 206 | txMsg.DataLength = 4; |
312 | txMsg.DataLength = 4; |
| 207 | 313 | ||
| 208 | relayStatus = relayOff(); |
314 | relayStatus = relayOff(); |
| 209 | 315 | ||
| 210 | while(1){ |
316 | while(1){ |
| 211 | /* service the CAN routines */ |
317 | /* service the CAN routines */ |
| 212 | Can_Service(); |
318 | Can_Service(); |
| 213 | 319 | ||
| 214 | /* check if any messages have been received */ |
320 | /* check if any messages have been received */ |
| 215 | while (Can_Receive(&rxMsg) == CAN_OK) { |
321 | while (Can_Receive(&rxMsg) == CAN_OK) { |
| 216 | /* This relay is adressed*/ |
322 | /* This relay is adressed*/ |
| 217 | if( rxMsg.Id == RELAY_CMD_GET ){ |
323 | if( rxMsg.Id == RELAY_CMD_GET ){ |
| 218 | if( rxMsg.Data.bytes[0] == RELAY_CMD_RESET ){ |
324 | if( rxMsg.Data.bytes[0] == RELAY_CMD_RESET ){ |
| 219 | /* Return from failsafe mode */ |
325 | /* Return from failsafe mode */ |
| 220 | return |
326 | return; |
| 221 | } |
327 | } |
| 222 | } |
328 | } |
| 223 | } |
329 | } |
| 224 | 330 | ||
| 225 | if( Timebase_PassedTimeMillis(timeStamp) >= FAILSAFE_SEND_PERIOD ){ |
331 | if( Timebase_PassedTimeMillis(timeStamp) >= FAILSAFE_SEND_PERIOD ){ |
| 226 | timeStamp = Timebase_CurrentTime(); |
332 | timeStamp = Timebase_CurrentTime(); |
| 227 | /* Send relay status to CAN */ |
333 | /* Send relay status to CAN */ |
| 228 | #if DEBUG |
334 | #if DEBUG |
| 229 | printf("Failsafe mode!\n"); |
335 | printf("Failsafe mode!\n"); |
| 230 | #endif |
336 | #endif |
| 231 | boardTemperature = getTC1047temperature(); |
337 | boardTemperature = getTC1047temperature(); |
| 232 | 338 | ||
| 233 | txMsg.Data.bytes[0] = boardTemperature & 0x00FF; |
339 | txMsg.Data.bytes[0] = boardTemperature & 0x00FF; |
| 234 | txMsg.Data.bytes[1] = (boardTemperature & 0xFF00)>>8; |
340 | txMsg.Data.bytes[1] = (boardTemperature & 0xFF00)>>8; |
| 235 | txMsg.Data.bytes[2] = relayStatus; |
341 | txMsg.Data.bytes[2] = relayStatus; |
| 236 | txMsg.Data.bytes[3] = FAILSAFE_MODE; |
342 | txMsg.Data.bytes[3] = FAILSAFE_MODE; |
| 237 | 343 | ||
| 238 | Can_Send( &txMsg ); |
344 | Can_Send( &txMsg ); |
| 239 | } |
345 | } |
| 240 | } |
346 | } |
| 241 | } |
347 | } |
| 242 | 348 | ||
| 243 | 349 | ||