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

	
 

	
main/main.c
Show inline comments
 
@@ -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();
main/osc_control.c
Show inline comments
 
@@ -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;
 

	
0 comments (0 inline, 0 general)