Rev 579 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 579 | Rev 797 | ||
|---|---|---|---|
| Line 138... | Line 138... | ||
| 138 | uint16_t acttype; |
138 | uint16_t acttype; |
| 139 | 139 | ||
| 140 | uint8_t //blindsStatus, /* Position (-128 to 127) */ |
140 | uint8_t //blindsStatus, /* Position (-128 to 127) */ |
| 141 | servoToTurn, |
141 | servoToTurn, |
| 142 | turnDirection = BLINDS_TURN_STOP; /* Specifies direction to turn or stopped */ |
142 | turnDirection = BLINDS_TURN_STOP; /* Specifies direction to turn or stopped */ |
| 143 |
|
143 | uint16_t boardTemperature = 0; |
| 144 | uint32_t timeStamp = 0, timeStampTurn = 0, servoFeed_timeStamp = 0; |
144 | uint32_t timeStamp = 0, timeStampTurn = 0, servoFeed_timeStamp = 0; |
| 145 | 145 | ||
| 146 | Can_Message_t txMsg; |
146 | Can_Message_t txMsg; |
| 147 | 147 | ||
| 148 | // Set up callback for CAN messages |
148 | // Set up callback for CAN messages |
| Line 232... | Line 232... | ||
| 232 | 232 | ||
| 233 | turnDirection = BLINDS_TURN_STOP; |
233 | turnDirection = BLINDS_TURN_STOP; |
| 234 | 234 | ||
| 235 | }/*else if(rxMsg.Data.bytes[0] == BLINDS_CMD_STATUS){ |
235 | }/*else if(rxMsg.Data.bytes[0] == BLINDS_CMD_STATUS){ |
| 236 | // Send blinds status to CAN |
236 | // Send blinds status to CAN |
| 237 | boardTemperature = getTC1047temperature(); |
237 | boardTemperature = getTC1047temperature(TC1047_AD); |
| 238 | - | ||
| 239 | if |
238 | if (boardTemperature >= FAILSAFE_TRESHOLD ){ |
| 240 | blindsFailsafe(); |
239 | blindsFailsafe(); |
| 241 | }else{ |
240 | } else { |
| 242 | txMsg.Data.bytes[0] = boardTemperature |
241 | txMsg.Data.bytes[0] = boardTemperature&0&ff; |
| 243 | txMsg.Data.bytes[1] = (boardTemperature |
242 | txMsg.Data.bytes[1] = ((boardTemperature>>8)&0xff); |
| 244 | txMsg.Data.bytes[2] = 0x00; |
243 | txMsg.Data.bytes[2] = 0x00; |
| 245 | txMsg.Data.bytes[3] = getPosition(1); |
244 | txMsg.Data.bytes[3] = getPosition(1); |
| 246 | txMsg.Data.bytes[4] = getPosition(2); |
245 | txMsg.Data.bytes[4] = getPosition(2); |
| 247 | txMsg.Data.bytes[5] = getPosition(3); |
246 | txMsg.Data.bytes[5] = getPosition(3); |
| 248 | txMsg.DataLength = 6; |
247 | txMsg.DataLength = 6; |
| Line 257... | Line 256... | ||
| 257 | 256 | ||
| 258 | if( (Timebase_CurrentTime() - timeStamp) >= STATUS_SEND_PERIOD ){ |
257 | if( (Timebase_CurrentTime() - timeStamp) >= STATUS_SEND_PERIOD ){ |
| 259 | timeStamp = Timebase_CurrentTime(); |
258 | timeStamp = Timebase_CurrentTime(); |
| 260 | // Send blinds status to CAN periodically |
259 | // Send blinds status to CAN periodically |
| 261 | 260 | ||
| 262 | boardTemperature = getTC1047temperature(); |
261 | boardTemperature = getTC1047temperature(TC1047_AD); |
| 263 | 262 | ||
| 264 | if |
263 | if ( boardTemperature >= FAILSAFE_TRESHOLD ){ |
| 265 | blindsFailsafe(); |
264 | blindsFailsafe(); |
| 266 | }else{ |
265 | }else{ |
| 267 | txMsg.Data.bytes[0] = boardTemperature |
266 | txMsg.Data.bytes[0] = boardTemperature&0xff; |
| 268 | txMsg.Data.bytes[1] = (boardTemperature |
267 | txMsg.Data.bytes[1] = ((boardTemperature>>8)&0xff); |
| 269 | txMsg.Data.bytes[2] = 0x00; |
268 | txMsg.Data.bytes[2] = 0x00; |
| 270 | txMsg.Data.bytes[3] = getPosition(1); |
269 | txMsg.Data.bytes[3] = getPosition(1); |
| 271 | txMsg.Data.bytes[4] = getPosition(2); |
270 | txMsg.Data.bytes[4] = getPosition(2); |
| 272 | txMsg.Data.bytes[5] = getPosition(3); |
271 | txMsg.Data.bytes[5] = getPosition(3); |
| 273 | txMsg.DataLength = 6; |
272 | txMsg.DataLength = 6; |
| Line 301... | Line 300... | ||
| 301 | return 0; |
300 | return 0; |
| 302 | } |
301 | } |
| 303 | 302 | ||
| 304 | void blindsFailsafe() |
303 | void blindsFailsafe() |
| 305 | { |
304 | { |
| 306 | /* |
305 | /* uint16_t boardTemperature = 0, timeStamp = 0; |
| 307 | 306 | ||
| 308 | // Turn of servo current feed |
307 | // Turn of servo current feed |
| 309 | SERVO_FEED_PORT &= ~(1<<SERVO_FEED_PIN); |
308 | SERVO_FEED_PORT &= ~(1<<SERVO_FEED_PIN); |
| 310 | 309 | ||
| 311 | 310 | ||
| Line 320... | Line 319... | ||
| 320 | } |
319 | } |
| 321 | 320 | ||
| 322 | if( Timebase_CurrentTime() - timeStamp >= FAILSAFE_SEND_PERIOD ){ |
321 | if( Timebase_CurrentTime() - timeStamp >= FAILSAFE_SEND_PERIOD ){ |
| 323 | timeStamp = Timebase_CurrentTime(); |
322 | timeStamp = Timebase_CurrentTime(); |
| 324 | // Send relay status to CAN |
323 | // Send relay status to CAN |
| 325 | boardTemperature = getTC1047temperature(); |
324 | boardTemperature = getTC1047temperature(TC1047_AD); |
| 326 | 325 | ||
| 327 | txMsg.Data.bytes[0] = boardTemperature |
326 | txMsg.Data.bytes[0] = boardTemperature&0xff; |
| 328 | txMsg.Data.bytes[1] = (boardTemperature |
327 | txMsg.Data.bytes[1] = ((boardTemperature>>8)&0xff); |
| 329 | txMsg.Data.bytes[2] = FAILSAFE_MODE; |
328 | txMsg.Data.bytes[2] = FAILSAFE_MODE; |
| 330 | #if NUMBER_OF_RCS >0 |
329 | #if NUMBER_OF_RCS >0 |
| 331 | txMsg.Data.bytes[3] = getPosition(1); |
330 | txMsg.Data.bytes[3] = getPosition(1); |
| 332 | #endif |
331 | #endif |
| 333 | #if NUMBER_OF_RCS >1 |
332 | #if NUMBER_OF_RCS >1 |