Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/Qbead.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,21 @@ const uint8_t QB_UUID_TAP_CHAR[] =
const uint8_t zerobuffer20[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};

// TODO manage namespaces better
// Colors are ordered RBG
static uint32_t color(uint8_t r, uint8_t g, uint8_t b) {
return ((uint32_t)r << 16) | ((uint32_t)g << 8) | b;
return ((uint32_t)r << 16) | ((uint32_t)b << 8) | g;
}

static uint8_t redch(uint32_t rgb) {
return rgb >> 16;
}

static uint8_t greench(uint32_t rgb) {
return (0x00ff00 & rgb) >> 8;
return 0x0000ff & rgb;
}

static uint8_t bluech(uint32_t rgb) {
return 0x0000ff & rgb;
return (0x00ff00 & rgb) >> 8;
}

uint32_t colorWheel(uint8_t wheelPos) {
Expand Down Expand Up @@ -302,8 +303,8 @@ class Qbead {
uint8_t bc = bluech(c);
uint8_t gc = greench(c);

setLegPixelColor(phi_int, theta_int, color(q * rc, q * bc, q * gc));
setLegPixelColor(phi_int, theta_int + theta_direction, color(p * rc, p * bc, p * gc));
setLegPixelColor(phi_int, theta_int, color(q * rc, q * gc, q * bc));
setLegPixelColor(phi_int, theta_int + theta_direction, color(p * rc, p * gc, p * bc));
}

void readIMU(bool print=true) {
Expand Down