Rev 1395 | Rev 1910 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1395 | Rev 1762 | ||
|---|---|---|---|
| Line 284... | Line 284... | ||
| 284 | txMsg.Header.ModuleType = CAN_MODULE_TYPE_ACT_SOFTPWM; |
284 | txMsg.Header.ModuleType = CAN_MODULE_TYPE_ACT_SOFTPWM; |
| 285 | txMsg.Header.ModuleId = act_softPWM_ID; |
285 | txMsg.Header.ModuleId = act_softPWM_ID; |
| 286 | txMsg.Header.Command = CAN_MODULE_CMD_PHYSICAL_PWM; |
286 | txMsg.Header.Command = CAN_MODULE_CMD_PHYSICAL_PWM; |
| 287 | txMsg.Length = 3; |
287 | txMsg.Length = 3; |
| 288 | txMsg.Data[0] = currentSendChannelId; |
288 | txMsg.Data[0] = currentSendChannelId; |
| 289 | txMsg.Data[1] = ( |
289 | txMsg.Data[1] = (pwmValueCAN[currentSendChannelId]>>8)&0xff; |
| 290 | txMsg.Data[2] = ( |
290 | txMsg.Data[2] = (pwmValueCAN[currentSendChannelId])&0xff; |
| 291 | while (StdCan_Put(&txMsg) != StdCan_Ret_OK); |
291 | while (StdCan_Put(&txMsg) != StdCan_Ret_OK); |
| 292 | //printf("sent pwm2: %d %d\n",pwmValueCAN[currentSendChannelId],currentSendChannelId); |
292 | //printf("sent pwm2: %d %d\n",pwmValueCAN[currentSendChannelId],currentSendChannelId); |
| 293 | #if act_softPWM_ACTIVATE_AUTOOFF != 0 |
293 | #if act_softPWM_ACTIVATE_AUTOOFF != 0 |
| 294 | offCounter[currentSendChannelId]--; |
294 | offCounter[currentSendChannelId]--; |
| 295 | if (offCounter[currentSendChannelId] == 0) { |
295 | if (offCounter[currentSendChannelId] == 0) { |
| Line 323... | Line 323... | ||
| 323 | //printf("3\n"); |
323 | //printf("3\n"); |
| 324 | if (rxMsg->Data[0] < NUMBEROFCHANNELS) { |
324 | if (rxMsg->Data[0] < NUMBEROFCHANNELS) { |
| 325 | pwmValueCAN[rxMsg->Data[0]] = ((uint16_t)((rxMsg->Data[1]<<8) + rxMsg->Data[2])); |
325 | pwmValueCAN[rxMsg->Data[0]] = ((uint16_t)((rxMsg->Data[1]<<8) + rxMsg->Data[2])); |
| 326 | if (pwmValueCAN[rxMsg->Data[0]] >= 10000) { |
326 | if (pwmValueCAN[rxMsg->Data[0]] >= 10000) { |
| 327 | pwmValue[rxMsg->Data[0]] = maxTimer+1; |
327 | pwmValue[rxMsg->Data[0]] = maxTimer+1; |
| - | 328 | pwmValueCAN[rxMsg->Data[0]] = 10000; |
|
| 328 | } else { |
329 | } else { |
| 329 | pwmValue[rxMsg->Data[0]] = ((uint16_t)((((uint32_t)pwmValueCAN[rxMsg->Data[0]])*(maxTimer))/10000)); |
330 | pwmValue[rxMsg->Data[0]] = ((uint16_t)((((uint32_t)pwmValueCAN[rxMsg->Data[0]])*(maxTimer))/10000)); |
| 330 | } |
331 | } |
| 331 | rxMsg->Data[1] = (uint8_t)(0x00ff & (pwmValueCAN[rxMsg->Data[0]]>>8)); |
332 | rxMsg->Data[1] = (uint8_t)(0x00ff & (pwmValueCAN[rxMsg->Data[0]]>>8)); |
| 332 | rxMsg->Data[2] = (uint8_t)(0x00ff & pwmValueCAN[rxMsg->Data[0]]); |
333 | rxMsg->Data[2] = (uint8_t)(0x00ff & pwmValueCAN[rxMsg->Data[0]]); |