Skip to content

Commit

Permalink
Screensaver tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
connornishijima committed May 10, 2024
1 parent b9b981b commit add451a
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 6 deletions.
84 changes: 84 additions & 0 deletions src/EMOTISCOPE_FIRMWARE.ino.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 1 "C:\\Users\\conno\\AppData\\Local\\Temp\\tmp1coerdz4"
#include <Arduino.h>
# 1 "C:/Users/conno/Emotiscope/src/EMOTISCOPE_FIRMWARE.ino"
# 55 "C:/Users/conno/Emotiscope/src/EMOTISCOPE_FIRMWARE.ino"
#define SOFTWARE_VERSION_MAJOR ( 1 )
#define SOFTWARE_VERSION_MINOR ( 1 )
#define SOFTWARE_VERSION_PATCH ( 0 )







#include <PsychicHttp.h>
#include <HTTPClient.h>
#include <ESPmDNS.h>
#include <Ticker.h>
#include <DNSServer.h>
#include <Preferences.h>
#include <Update.h>
#include <WiFi.h>
#include <esp_dsp.h>
#include <esp_wifi.h>


#include "global_defines.h"
#include "hardware_version.h"
#include "types.h"
#include "profiler.h"
#include "sliders.h"
#include "toggles.h"
#include "menu_toggles.h"
#include "menu_dropdowns.h"
#include "filesystem.h"
#include "configuration.h"
#include "utilities.h"
#include "system.h"
#include "led_driver.h"
#include "leds.h"
#include "touch.h"
#include "indicator.h"
#include "ui.h"
#include "microphone.h"
#include "vu.h"
#include "goertzel.h"
#include "tempo.h"
#include "audio_debug.h"
#include "screensaver.h"
#include "standby.h"
#include "light_modes.h"
#include "commands.h"
#include "wireless.h"
#include "ota.h"


#include "cpu_core.h"
#include "gpu_core.h"
#include "web_core.h"
# 119 "C:/Users/conno/Emotiscope/src/EMOTISCOPE_FIRMWARE.ino"
void loop();
void loop_gpu(void *param);
void setup();
#line 119 "C:/Users/conno/Emotiscope/src/EMOTISCOPE_FIRMWARE.ino"
void loop() {
run_cpu();
run_web();
}


void loop_gpu(void *param) {
for (;;) {
run_gpu();
}
}


void setup() {

init_system();


(void)xTaskCreatePinnedToCore(loop_gpu, "loop_gpu", 4096, NULL, 0, NULL, 0);
}
2 changes: 1 addition & 1 deletion src/cpu_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void run_cpu() {

read_touch();

//check_serial();
check_serial();

check_boot_button();

Expand Down
4 changes: 2 additions & 2 deletions src/gpu_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ void run_gpu() {
// This is a super hacky way to fake a true fade transition between modes
lpf_drag *= 0.9975;

if(lpf_drag < screensaver_mix*0.95){
lpf_drag = screensaver_mix*0.95;
if(lpf_drag < screensaver_mix*0.8){
lpf_drag = screensaver_mix*0.8;
}

// Apply a low pass filter to every color channel of every pixel on every frame
Expand Down
4 changes: 2 additions & 2 deletions src/screensaver.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void run_screensaver(){
}

if(screensaver_mix > 0.001){
scale_CRGBF_array_by_constant(leds, 1.0-(screensaver_mix*screensaver_mix), NUM_LEDS);
scale_CRGBF_array_by_constant(leds, 1.0-(screensaver_mix), NUM_LEDS);

const float push_val = 0.005;
CRGBF screensaver_colors[4] = {
Expand All @@ -69,7 +69,7 @@ void run_screensaver(){

for(uint16_t i = 0; i < 4; i++){
sine_positions[i] += push_val+(0.0001*i);
draw_dot(leds, SCREENSAVER_1 + i, screensaver_colors[i], sin(sine_positions[i]) * (0.5*screensaver_mix) + 0.5, screensaver_mix*screensaver_mix);
draw_dot(leds, SCREENSAVER_1 + i, screensaver_colors[i], sin(sine_positions[i]) * (0.5*screensaver_mix) + 0.5, screensaver_mix);
}
}
}, __func__);
Expand Down
6 changes: 5 additions & 1 deletion src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ void init_serial(uint32_t baud_rate) {
//for(uint16_t i = 0; i < 10; i++){ printf("WAITING FOR %d SECONDS...\n", 10-i); delay(1000); }

memset(serial_buffer, 0, 256);
uint16_t serial_buffer_index = 0;

Serial.begin(baud_rate);
}

void check_serial() {
extern bool queue_command(const char* command, uint16_t length, uint8_t client_slot);

while(Serial.available() > 0){
if(Serial.available() > 0){
char c = Serial.read();

printf("READ CHAR: %c\n", c);

if(c == '\n'){
printf("Serial command received: %s\n", serial_buffer);
queue_command(serial_buffer, serial_buffer_index, 255);
Expand Down

0 comments on commit add451a

Please sign in to comment.