diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -1,2 +1,2 @@ -idf_component_register(SRCS "main.c" "wifi.c" "usb_cdc.c" "can.c" "display.c" "display_gui.c" "osc_control.c" "ledstrip.c" +idf_component_register(SRCS "main.c" "wifi.c" "usb_cdc.c" "can.c" "display.c" "display_gui.c" "osc_control.c" "ledstrip.c" "squeeze.c" INCLUDE_DIRS .) diff --git a/main/ledstrip.c b/main/ledstrip.c --- a/main/ledstrip.c +++ b/main/ledstrip.c @@ -98,8 +98,13 @@ void ledstrip_refresh(void) case EFFECT_SINGLECHASE: { - if(process_effect_singlechase() & 0x01) + uint8_t ret = process_effect_singlechase(); + if(ret & 0x01) led_strip_refresh(led_strip); + // Chase complete, return to manual mode + if(ret & 0x02) + current_effect = EFFECT_NONE; + } break; case EFFECT_CAULDRON: @@ -193,7 +198,10 @@ static uint8_t process_effect_singlechas } countloc = (countloc + 1) % LED_STRIP_NUM_LEDS; - return 0x01; + if(countloc == 0) + return 0b11; + else + return 0b01; } diff --git a/main/main.c b/main/main.c --- a/main/main.c +++ b/main/main.c @@ -16,6 +16,7 @@ // #include "usb_cdc.h" #include "can.h" #include "display.h" +#include "squeeze.h" #include "ledstrip.h" #include "display_gui.h" @@ -51,6 +52,7 @@ void app_main(void) // Initialize OSC osc_init(); + squeeze_init(); // Initialize canbus //can_init(); diff --git a/main/osc_control.c b/main/osc_control.c --- a/main/osc_control.c +++ b/main/osc_control.c @@ -71,8 +71,14 @@ static bool callback(const char *topic, case 'f': { + if(values[i].f > 1.0) + values[i].f = 1.0; + if(values[i].f < 0.0) + values[i].f = 0.0; + snprintf(out+strlen(out), 128-strlen(out), "Value: %f", values[i].f); ESP_LOGI(TAG, "==> f: %f", values[i].f); + if(strcmp(topic, "/led_modifier") == 0) { ledstrip_set_modifier(values[i].f); @@ -80,17 +86,17 @@ static bool callback(const char *topic, else if(strcmp(topic, "/led_manual_r") == 0) { r_man = values[i].f * 255.0; - ledstrip_set(r_man, g_man, b_man); + ledstrip_set(g_man, r_man, b_man); } else if(strcmp(topic, "/led_manual_g") == 0) { g_man = values[i].f * 255.0; - ledstrip_set(r_man, g_man, b_man); + ledstrip_set(g_man, r_man, b_man); } else if(strcmp(topic, "/led_manual_b") == 0) { b_man = values[i].f * 255.0; - ledstrip_set(r_man, g_man, b_man); + ledstrip_set(g_man, r_man, b_man); } } break;