Port flame.lua to "Musiclight Mini"

This commit is contained in:
Thomas Kolb 2019-12-17 22:09:53 +01:00
parent b3c1e3c895
commit 3741a9dd12
5 changed files with 12 additions and 12 deletions

View file

@ -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

View file

@ -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

2
main.c
View file

@ -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;

View file

@ -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;

View file

@ -14,7 +14,7 @@
struct __attribute__((__packed__)) SK6812Packet {
uint8_t action;
uint8_t strip;
uint16_t module;
uint8_t module;
uint8_t data[4];
};