117,6 → 117,7 |
uint8_t i,j; |
// Write configuration data to the DC/BC/FC/UD registers |
uint8_t DCS[GCS_LAYER_SIZE] = {0}; |
|
for (i = 0; i < 8; i++) { |
uint16_t offset = i * GCS_REG_SIZE; |
|
124,7 → 125,7 |
DCS[offset + j] = 0xFF; // Dot correction |
} |
|
// Warning: do not set BC > 0x6F |
// Warning: do not set BC > 0x6F ?? NEED TO VERIFY THIS !! |
DCS[offset + 21] = BC; // Global red brightness |
DCS[offset + 22] = BC; // Global green brightness |
DCS[offset + 23] = BC; // Global blue brightness |
855,26 → 856,31 |
// Read and process the ethernet packet |
if (!ETH_Read_Packet(buffer, &length)) { |
// Check the opcode (first byte) to determine what to do |
if (buffer[0] == 0x1) { |
|
if (buffer[0] == 0x1) { // 0x1 - Reset into Ethernet mode |
Reset_Board(BOARD_MODE_ETHERNET); |
} |
if (buffer[0] == 0x2) { |
} else if (buffer[0] == 0x2) { // 0x2 - Reset back to idle mode |
Reset_Board(BOARD_MODE_IDLE); |
} |
if (buffer[0] == 0xA) { |
} else if (buffer[0] == 0xA) { // 0xA - Clear the entire cube |
Cube_Clear(); |
} |
if (buffer[0] == 0xB) { |
ClearWDT(); |
// Update the cube |
for (i = 0; i < CUBE_LAYER_COUNT; i++) { |
for (j = 0; j < CUBE_COLUMN_COUNT; j++) { |
for (k = 0; k < CUBE_ROW_COUNT; k++) { |
Cube_Set_Pixel(i, k, j, buffer[index], buffer[index+1], buffer[index+2]); |
index = index + 3; |
} else if (buffer[0] == 0xB) { // 0xB - Set the global brightness value |
Cube_Write_DCS(buffer[1]); |
} else if (buffer[0] == 0xC) { // 0xC - Set the entire cube |
if (length == 0x0601) { |
ClearWDT(); |
for (i = 0; i < CUBE_LAYER_COUNT; i++) { |
for (j = 0; j < CUBE_COLUMN_COUNT; j++) { |
for (k = 0; k < CUBE_ROW_COUNT; k++) { |
Cube_Set_Pixel(i, k, j, buffer[index], buffer[index+1], buffer[index+2]); |
index = index + 3; |
} |
} |
} |
} |
} else if (buffer[0] == 0xD) { // 0xD - Rotate the cube |
Cube_Rotate(buffer[1]); |
} else if (buffer[0] == 0xE) { // 0xE - Rotate a layer |
Cube_Rotate_Shell(buffer[1], buffer[2]); |
} |
} |
} |