Changeset - 45c4b4d15fc5
[Not reviewed]
default
0 4 0
Ethan Zonca - 8 months ago 2024-09-28 13:14:57
ez@ethanzonca.com
Add squeeze sensing. Update chase to only do one rep.
4 files changed with 22 insertions and 6 deletions:
0 comments (0 inline, 0 general)
main/CMakeLists.txt
Show inline comments
 
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 .)
main/ledstrip.c
Show inline comments
 
@@ -95,14 +95,19 @@ void ledstrip_refresh(void)
 
          if(process_effect_rainbow() & 0x01)
 
            led_strip_refresh(led_strip);
 
        } break;
 
        
 
        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:
 
        {
 
          if(process_effect_cauldron() & 0x01)
 
            led_strip_refresh(led_strip);
 
@@ -190,13 +195,16 @@ static uint8_t process_effect_singlechas
 
    }
 
    else
 
      ESP_ERROR_CHECK(led_strip_set_pixel(led_strip, j, 0,0,0));
 
  }
 
  countloc = (countloc + 1) % LED_STRIP_NUM_LEDS;
 

	
 
  return 0x01;
 
  if(countloc == 0)
 
    return 0b11;
 
  else
 
    return 0b01;
 
}
 

	
 

	
 

	
 

	
 
//127, 122
main/main.c
Show inline comments
 
@@ -13,12 +13,13 @@
 
#include "sdkconfig.h"
 
#include "osc_control.h"
 
#include "wifi.h"
 
// #include "usb_cdc.h"
 
#include "can.h"
 
#include "display.h"
 
#include "squeeze.h"
 
#include "ledstrip.h"
 
#include "display_gui.h"
 

	
 

	
 
// Private variables
 
static const char *TAG = "main";
 
@@ -48,12 +49,13 @@ void app_main(void)
 
    ledstrip_init();
 

	
 

	
 
    // Initialize OSC
 
    osc_init();
 

	
 
    squeeze_init();
 

	
 
    // Initialize canbus
 
    //can_init();
 

	
 
    // Start tasks
 
    xTaskCreatePinnedToCore(ledstrip_refresh,    "ledstrip_refresh", 4096, NULL, 10, NULL, 1);
main/osc_control.c
Show inline comments
 
@@ -68,32 +68,38 @@ static bool callback(const char *topic, 
 
      {
 
        ESP_LOGI(TAG, "==> h: %lld", values[i].h);
 
      }  break;
 

	
 
      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);
 
        }
 
        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;
 

	
 
      case 'd':
 
      {
 
        ESP_LOGI(TAG, "==> d: %f", values[i].d);
0 comments (0 inline, 0 general)