diff --git a/config.lua b/config.lua index 4464c5d..26b9c5a 100644 --- a/config.lua +++ b/config.lua @@ -1,7 +1,7 @@ WS2801_HOST = "10.42.6.183" WS2801_PORT = 2703 -NUM_MODULES = 60 -CENTER_MODULE = 30 +NUM_MODULES = 16 +CENTER_MODULE = 8 GAMMA = 2.0 diff --git a/flame.lua b/flame.lua index 45c9dbe..fc05a29 100644 --- a/flame.lua +++ b/flame.lua @@ -3,12 +3,12 @@ OVERDRIVE = 1.70 EXPONENT = 1.5 W_EXPONENT = 2.2 -M = 2.3 -- mass +M = 10.0 -- mass D = 1 -- spring strength DAMPING = {} -- filled in init() -num_modules = 60 -center_module = 60 +num_modules = 16 +center_module = 16 num_masses = math.floor(num_modules/2) excitement_pos = 1 @@ -164,7 +164,7 @@ function periodic() white[i] = limit(OVERDRIVE * math.pow(w_tmp[i], W_EXPONENT)) end - -- return the 3 color arrays + -- return the 4 color arrays return red, green, blue, white end @@ -198,7 +198,7 @@ function init(nmod, cmod) acc_b[i] = 0 acc_w[i] = 0 - DAMPING[i] = 1 - 0.10 * math.pow(math.abs((i - excitement_pos) / num_masses), 2) + DAMPING[i] = 1 - 0.15 * math.abs((i - excitement_pos) / num_masses)^2 end -- don't use fading diff --git a/main.c b/main.c index e6da90b..50f3bdb 100644 --- a/main.c +++ b/main.c @@ -36,7 +36,7 @@ // Number of new samples put into the buffer each frame #define READ_SAMPLES (BLOCK_LEN / BUFFER_PARTS) -#define NUM_SK6812 4 +#define NUM_SK6812 8 value_type fft[BLOCK_LEN]; value_type rms; diff --git a/sk6812.c b/sk6812.c index a7f0e09..056051f 100644 --- a/sk6812.c +++ b/sk6812.c @@ -64,7 +64,7 @@ int sk6812_init(struct sk6812_ctx *ctx, const char *host, unsigned short port) { void sk6812_set_color(struct sk6812_ctx *ctx, uint8_t strip, uint16_t module, uint8_t r, uint8_t g, uint8_t b, uint8_t w) { ctx->packetQueue[ctx->queueIndex].action = SET_COLOR; - ctx->packetQueue[ctx->queueIndex].module = htons(module); + ctx->packetQueue[ctx->queueIndex].module = (uint8_t)(module); ctx->packetQueue[ctx->queueIndex].strip = strip; ctx->packetQueue[ctx->queueIndex].data[0] = r; ctx->packetQueue[ctx->queueIndex].data[1] = g; @@ -75,7 +75,7 @@ void sk6812_set_color(struct sk6812_ctx *ctx, uint8_t strip, uint16_t module, ui void sk6812_fade_color(struct sk6812_ctx *ctx, uint8_t strip, uint16_t module, uint8_t r, uint8_t g, uint8_t b, uint8_t w) { ctx->packetQueue[ctx->queueIndex].action = FADE_COLOR; - ctx->packetQueue[ctx->queueIndex].module = htons(module); + ctx->packetQueue[ctx->queueIndex].module = (uint8_t)(module); ctx->packetQueue[ctx->queueIndex].strip = strip; ctx->packetQueue[ctx->queueIndex].data[0] = r; ctx->packetQueue[ctx->queueIndex].data[1] = g; @@ -86,7 +86,7 @@ void sk6812_fade_color(struct sk6812_ctx *ctx, uint8_t strip, uint16_t module, u void sk6812_add_color(struct sk6812_ctx *ctx, uint8_t strip, uint16_t module, uint8_t r, uint8_t g, uint8_t b, uint8_t w) { ctx->packetQueue[ctx->queueIndex].action = ADD_COLOR; - ctx->packetQueue[ctx->queueIndex].module = htons(module); + ctx->packetQueue[ctx->queueIndex].module = (uint8_t)(module); ctx->packetQueue[ctx->queueIndex].strip = strip; ctx->packetQueue[ctx->queueIndex].data[0] = r; ctx->packetQueue[ctx->queueIndex].data[1] = g; diff --git a/sk6812.h b/sk6812.h index cd2f8fa..8e8794c 100644 --- a/sk6812.h +++ b/sk6812.h @@ -14,7 +14,7 @@ struct __attribute__((__packed__)) SK6812Packet { uint8_t action; uint8_t strip; - uint16_t module; + uint8_t module; uint8_t data[4]; };