+ // Interconnect broadcasting
+#if defined(ConnectEnabled_define)
+ uint8_t send_packet = 0;
+ uint8_t ignore_node = 0;
+
+ // By default send to the *next* node, which will determine where to go next
+ extern uint8_t Connect_id; // connect_scan.c
+ uint8_t addr = Connect_id + 1;
+
+ switch ( control->mode )
+ {
+ // Calculate the led address to send
+ // If greater than the Total hannels
+ // Set address - Total channels
+ // Otherwise, ignore
+ case LedControlMode_brightness_decrease:
+ case LedControlMode_brightness_increase:
+ case LedControlMode_brightness_set:
+ // Ignore if led is on this node
+ if ( control->index < LED_TotalChannels )
+ break;
+
+ // Calculate new led index
+ control->index -= LED_TotalChannels;
+
+ ignore_node = 1;
+ send_packet = 1;
+ break;
+
+ // Broadcast to all nodes
+ // XXX Do not set broadcasting address
+ // Will send command twice
+ case LedControlMode_brightness_decrease_all:
+ case LedControlMode_brightness_increase_all:
+ case LedControlMode_brightness_set_all:
+ send_packet = 1;
+ break;
+ }
+
+ // Only send interconnect remote capability packet if necessary
+ if ( send_packet )
+ {
+ // generatedKeymap.h
+ extern const Capability CapabilitiesList[];
+
+ // Broadcast layerStackExact remote capability (0xFF is the broadcast id)
+ Connect_send_RemoteCapability(
+ addr,
+ LED_control_capability_index,
+ state,
+ stateType,
+ CapabilitiesList[ LED_control_capability_index ].argCount,
+ args
+ );
+ }
+
+ // If there is nothing to do on this node, ignore
+ if ( ignore_node )
+ return;
+#endif
+
+ // Modify led state of this node