Rev 901 | Rev 967 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 901 | Rev 950 | ||
|---|---|---|---|
| Line 211... | Line 211... | ||
| 211 | ///TODO: Stuff that needs doing is done here |
211 | ///TODO: Stuff that needs doing is done here |
| 212 | } |
212 | } |
| 213 | 213 | ||
| 214 | void act_dimmer230_HandleMessage(StdCan_Msg_t *rxMsg) |
214 | void act_dimmer230_HandleMessage(StdCan_Msg_t *rxMsg) |
| 215 | { |
215 | { |
| 216 | if ( StdCan_Ret_class(rxMsg->Header) == |
216 | if ( StdCan_Ret_class(rxMsg->Header) == CAN_MODULE_CLASS_ACT && |
| 217 | StdCan_Ret_direction(rxMsg->Header) == |
217 | StdCan_Ret_direction(rxMsg->Header) == DIRECTIONFLAG_TO_OWNER && |
| 218 | rxMsg->Header.ModuleType == |
218 | rxMsg->Header.ModuleType == CAN_MODULE_TYPE_ACT_DIMMER230 && |
| 219 | rxMsg->Header.ModuleId == act_dimmer230_ID) |
219 | rxMsg->Header.ModuleId == act_dimmer230_ID) |
| 220 | { |
220 | { |
| 221 | switch (rxMsg->Header.Command) |
221 | switch (rxMsg->Header.Command) |
| 222 | { |
222 | { |
| 223 | case |
223 | case CAN_MODULE_CMD_DIMMER230_DEMO: // Demo(channel, speed, steps) |
| 224 | if (rxMsg->Length == 3) { |
224 | if (rxMsg->Length == 3) { |
| 225 | 225 | ||
| 226 | } |
226 | } |
| 227 | break; |
227 | break; |
| 228 | 228 | ||
| 229 | case |
229 | case CAN_MODULE_CMD_DIMMER230_START_FADE: // StartFade(channel, speed, direction), just an alias of ABS_FADE |
| 230 | if (rxMsg->Length == 3) { |
230 | if (rxMsg->Length == 3) { |
| 231 | uint8_t channel = rxMsg->Data[0]; |
231 | uint8_t channel = rxMsg->Data[0]; |
| 232 | uint8_t speed = rxMsg->Data[1]; |
232 | uint8_t speed = rxMsg->Data[1]; |
| 233 | uint8_t direction = rxMsg->Data[2]; |
233 | uint8_t direction = rxMsg->Data[2]; |
| 234 | 234 | ||
| Line 259... | Line 259... | ||
| 259 | } |
259 | } |
| 260 | } |
260 | } |
| 261 | } |
261 | } |
| 262 | break; |
262 | break; |
| 263 | 263 | ||
| 264 | case |
264 | case CAN_MODULE_CMD_DIMMER230_STOP_FADE: // StopFade(channel) |
| 265 | if (rxMsg->Length == 1) { |
265 | if (rxMsg->Length == 1) { |
| 266 | fadeSpeedCh1 = 0; |
266 | fadeSpeedCh1 = 0; |
| 267 | } |
267 | } |
| 268 | break; |
268 | break; |
| 269 | 269 | ||
| 270 | case |
270 | case CAN_MODULE_CMD_DIMMER230_ABS_FADE: // AbsFade(channel, speed, endValue) |
| 271 | if (rxMsg->Length == 3) { |
271 | if (rxMsg->Length == 3) { |
| 272 | uint8_t channel = rxMsg->Data[0]; |
272 | uint8_t channel = rxMsg->Data[0]; |
| 273 | uint8_t speed = rxMsg->Data[1]; |
273 | uint8_t speed = rxMsg->Data[1]; |
| 274 | uint8_t endValue = rxMsg->Data[2]; |
274 | uint8_t endValue = rxMsg->Data[2]; |
| 275 | 275 | ||
| Line 293... | Line 293... | ||
| 293 | } |
293 | } |
| 294 | } |
294 | } |
| 295 | } |
295 | } |
| 296 | break; |
296 | break; |
| 297 | 297 | ||
| 298 | case |
298 | case CAN_MODULE_CMD_DIMMER230_REL_FADE: // RelFade(channel, speed, direction, steps) |
| 299 | if (rxMsg->Length == 4) { |
299 | if (rxMsg->Length == 4) { |
| 300 | uint8_t channel = rxMsg->Data[0]; |
300 | uint8_t channel = rxMsg->Data[0]; |
| 301 | uint8_t speed = rxMsg->Data[1]; |
301 | uint8_t speed = rxMsg->Data[1]; |
| 302 | uint8_t direction = rxMsg->Data[2]; |
302 | uint8_t direction = rxMsg->Data[2]; |
| 303 | uint8_t steps = rxMsg->Data[3]; |
303 | uint8_t steps = rxMsg->Data[3]; |
| Line 344... | Line 344... | ||
| 344 | 344 | ||
| 345 | void act_dimmer230_List(uint8_t ModuleSequenceNumber) |
345 | void act_dimmer230_List(uint8_t ModuleSequenceNumber) |
| 346 | { |
346 | { |
| 347 | StdCan_Msg_t txMsg; |
347 | StdCan_Msg_t txMsg; |
| 348 | 348 | ||
| 349 | StdCan_Set_class(txMsg.Header, |
349 | StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_ACT); |
| 350 | StdCan_Set_direction(txMsg.Header, |
350 | StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER); |
| 351 | txMsg.Header.ModuleType = |
351 | txMsg.Header.ModuleType = CAN_MODULE_TYPE_ACT_DIMMER230; |
| 352 | txMsg.Header.ModuleId = act_dimmer230_ID; |
352 | txMsg.Header.ModuleId = act_dimmer230_ID; |
| 353 | txMsg.Header.Command = |
353 | txMsg.Header.Command = CAN_MODULE_CMD_GLOBAL_LIST; |
| 354 | txMsg.Length = 6; |
354 | txMsg.Length = 6; |
| 355 | 355 | ||
| 356 | txMsg.Data[0] = NODE_HW_ID_BYTE0; |
356 | txMsg.Data[0] = NODE_HW_ID_BYTE0; |
| 357 | txMsg.Data[1] = NODE_HW_ID_BYTE1; |
357 | txMsg.Data[1] = NODE_HW_ID_BYTE1; |
| 358 | txMsg.Data[2] = NODE_HW_ID_BYTE2; |
358 | txMsg.Data[2] = NODE_HW_ID_BYTE2; |