diff options
-rw-r--r-- | lights/gta04_lights.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lights/gta04_lights.c b/lights/gta04_lights.c index b01c1fe..845a17d 100644 --- a/lights/gta04_lights.c +++ b/lights/gta04_lights.c @@ -139,9 +139,9 @@ int gta04_lights_set_light_notifications(struct light_device_t *device, if (state == NULL) return -EINVAL; - // GTA04 only has red and green - red = state->color & 0x00ff0000; - green = state->color & 0x0000ff00; + // GTA04 only has red and green: blue is merged to green + red = (state->color & 0x00ff0000) >> 16; + green = (state->color & 0x0000ff00) >> 8 | (state->color & 0x000000ff); pthread_mutex_lock(&lights_mutex); @@ -173,9 +173,9 @@ int gta04_lights_set_light_battery(struct light_device_t *device, if (state == NULL) return -EINVAL; - // GTA04 only has red and green - red = state->color & 0x00ff0000; - green = state->color & 0x0000ff00; + // GTA04 only has red and green: blue is merged to green + red = (state->color & 0x00ff0000) >> 16; + green = (state->color & 0x0000ff00) >> 8 | (state->color & 0x000000ff); pthread_mutex_lock(&lights_mutex); |