fix RGBLED offsets

This commit is contained in:
true 2024-10-26 06:16:13 -07:00
parent 0d9e96180a
commit 5abf09b69d
2 changed files with 32 additions and 6 deletions

View File

@ -45,10 +45,32 @@ static const uint16_t pwm_cie_256in_1024out[] = {
};
*/
static const uint8_t rgbled_map[12] = {
0, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11
/*
* there are various RGBLED arrangements to consider:
* addressed order: 0 1 2 3 4 5 6 7 8 9 10 11
* off by one: 1 2 3 4 5 6 7 8 9 10 11 12
* connected order: 5 4 6 2 1 3 11 10 12 8 7 9
* clockwise from TL: 6 3 5 2 4 1 10 7 11 8 12 9
* these form the following conversion map:
*/
/*
// rgb output order:
static const uint8_t led_map[12] = {
2, 5, 0, 3, 1, 4,
7, 10, 6, 9, 8, 11
};
*/
/*
// program input order:
static const uint8_t led_map[12] = {
4, 3, 5, 1, 0, 2,
10, 9, 11, 7, 6, 8
};
*/
// manually figured out order because I can't math when sleep deprived:
@ -104,7 +126,10 @@ void rgbled_send()
memset(awled_fade, 0x00, sizeof(awled_fade));
} else {
for (i = 0; i < RGBLED_COUNT; i++) {
hsv2rgb(hsv_out[i].h, hsv_out[i].s, hsv_out[i].v, fade+0, fade+1, fade+2);
hsv2rgb(hsv_out[i].h,
hsv_out[i].s,
hsv_out[i].v,
fade+0, fade+1, fade+2);
fade += 3;
}
}

View File

@ -24,9 +24,10 @@
#include "user_config.h"
const uint8_t rgb_map[RGBLED_COUNT] = {
3, 5, 7, 9, 0, 1,
2, 4, 6, 8, 1, 1
2, 5, 0, 3, 1, 4,
7, 10, 6, 9, 8, 11
};
static uint8_t timeout;