 typedef struct packet_tag {
     uint16_t header;
     uint8_t command;
-    uint8_t endpoint;
-    uint8_t rgb[3];
+    uint8_t data[3];
 } packet_t;
 
-//Serial protocol
+// Serial protocol
 #define MAX_SERIAL_LINE_LEN 20
 
-//Firmware information
-#define VERSION                 0 //The firmware version number
-#define ENDPOINT_ID_LOCATION    0x000 //The address in EEPROM to store the ID
+// Firmware information
+#define VERSION                 0 // The firmware version number
+#define ENDPOINT_ID_LOCATION    0x000 // The address in EEPROM to store the ID
 
 
 void networkRead(void);

unsigned long lastPingTime;

/**
 * Initialize SPI, radio, and serial.
 */
void setup() {
    // Initialize the radio
    radio.begin();
    radio.setDataRate(RF24_250KBPS); // 250kbps is good enough
    radio.setChannel(80); // Channel center frequency = 2.4005 GHz + (Channel# * 1 MHz)
    radio.setPALevel(RF24_PA_MAX); // Range is important, not low power consumption
    radio.setRetries(0, 0); // Real-time is critical - not retransmission
    radio.setAutoAck(false); // It doesn't matter if packets don't get through
    radio.setCRCLength(RF24_CRC_8); // Minimal error detection is fine
    radio.setPayloadSize(sizeof(packet_t));
    radio.openReadingPipe(0, NODE_RF_ADDRESS);
    radio.startListening();

    // Initialize serial console

        return;
    }

    switch (packet.command) {

        case CMD_SET_RGB: {
            // Update the color
            setRGB(packet.data[0], packet.data[1], packet.data[2]);
            break;
        }

        case CMD_PING: {
            // Respond to the ping with the endpoint ID and version
            packet_t response = {
                HEADER,
                CMD_PING_RESPONSE,
                {endpointID, VERSION, 0}
            };

            radio.stopListening();
            radio.write(&response, sizeof(response));
            radio.startListening();

            break;
        }
