Skip to content

Commit

Permalink
Changed "Blue Filter" to "Warmth"
Browse files Browse the repository at this point in the history
  • Loading branch information
connornishijima committed May 11, 2024
1 parent add451a commit 5ab6743
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 215 deletions.
2 changes: 1 addition & 1 deletion data/js/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let information = {
"color" : "The base color of the current mode.",
"color_range" : "How much the color can vary from the base color.",
"saturation" : "The intensity of the color of the display.",
"blue_filter" : "Applies a filter to the display which limits the brightness of blue colors, similar to the look of incandenscent light bulbs that were tinted by a colored film.",
"warmth" : "Applies a filter which limits the brightness of blue colors, similar to the look of incandenscent light bulbs that were tinted by a colored film.",
"background" : "The intensity of the background color.",
"mirror_mode" : "Scales the display to 1/2 size and mirrors it to be symmetrical",
"reverse_color_range" : "Reverses the direction of the color range, meaning that if your base color is red, the color range extends towards blue instead of green.",
Expand Down
84 changes: 0 additions & 84 deletions src/EMOTISCOPE_FIRMWARE.ino.cpp

This file was deleted.

57 changes: 8 additions & 49 deletions src/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ void parse_command(uint32_t t_now_ms, command com) {
bool setting_value = (bool)atoi(substring);
configuration.mirror_mode = setting_value;
}
else if (fastcmp(substring, "blue_filter")) {
// Get blue_filter value
else if (fastcmp(substring, "warmth")) {
// Get warmth value
fetch_substring(com.command, '|', 2);
float setting_value = atof(substring);
configuration.blue_filter = setting_value;
configuration.warmth = setting_value;

update_ui(UI_NEEDLE_EVENT, configuration.blue_filter);
update_ui(UI_NEEDLE_EVENT, configuration.warmth);
}
else if (fastcmp(substring, "color_range")) {
// Get color_range value
Expand Down Expand Up @@ -180,44 +180,6 @@ void parse_command(uint32_t t_now_ms, command com) {
transmit_to_client_in_slot("mode_selected", com.origin_client_slot);
}
}

else if (fastcmp(substring, "touch_thresholds")){
/*
// Get ambient threshold values
fetch_substring(com.command, '|', 2);
uint32_t ambient_left_threshold = atol(substring);
fetch_substring(com.command, '|', 3);
uint32_t ambient_center_threshold = atol(substring);
fetch_substring(com.command, '|', 4);
uint32_t ambient_right_threshold = atol(substring);
// Get touch threshold values
fetch_substring(com.command, '|', 5);
uint32_t touch_left_threshold = atol(substring);
fetch_substring(com.command, '|', 6);
uint32_t touch_center_threshold = atol(substring);
fetch_substring(com.command, '|', 7);
uint32_t touch_right_threshold = atol(substring);
configuration.ambient_left_threshold = ambient_left_threshold;
configuration.ambient_center_threshold = ambient_center_threshold;
configuration.ambient_right_threshold = ambient_right_threshold;
configuration.touch_left_threshold = touch_left_threshold;
configuration.touch_center_threshold = touch_center_threshold;
configuration.touch_right_threshold = touch_right_threshold;
touch_pins[TOUCH_LEFT].threshold = configuration.touch_left_threshold;
touch_pins[TOUCH_CENTER].threshold = configuration.touch_center_threshold;
touch_pins[TOUCH_RIGHT].threshold = configuration.touch_right_threshold;
touch_pins[TOUCH_LEFT].ambient = configuration.ambient_left_threshold;
touch_pins[TOUCH_CENTER].ambient = configuration.ambient_center_threshold;
touch_pins[TOUCH_RIGHT].ambient = configuration.ambient_right_threshold;
printf("Ambient thresholds set to: %lu | %lu | %lu\n", configuration.ambient_left_threshold, configuration.ambient_center_threshold, configuration.ambient_right_threshold);
printf("Touch thresholds set to: %lu | %lu | %lu\n", configuration.touch_left_threshold, configuration.touch_center_threshold, configuration.touch_right_threshold);
*/
}
else{
unrecognized_command_error(substring);
}
Expand Down Expand Up @@ -321,9 +283,6 @@ void parse_command(uint32_t t_now_ms, command com) {
printf("Device was instructed to reboot into WiFi config mode! Please wait...\n");
reboot_into_wifi_config_mode();
}
else if (fastcmp(substring, "noise_cal")) {
start_noise_calibration();
}
else if (fastcmp(substring, "button_tap")) {
printf("REMOTE TAP TRIGGER\n");
if(EMOTISCOPE_ACTIVE == true){
Expand Down Expand Up @@ -364,6 +323,10 @@ void parse_command(uint32_t t_now_ms, command com) {
transmit_to_client_in_slot("no_updates", com.origin_client_slot);
}
}
else if (fastcmp(substring, "perform_update")) {
extern void perform_update(int16_t client_slot);
perform_update(com.origin_client_slot);
}
else if (fastcmp(substring, "self_test")) {
if(t_now_ms >= 1000){ // Wait 1 second before checking boot button
if(self_test_step == SELF_TEST_INACTIVE){ // Self test is not already running
Expand All @@ -373,10 +336,6 @@ void parse_command(uint32_t t_now_ms, command com) {
}
}
}
else if (fastcmp(substring, "perform_update")) {
extern void perform_update(int16_t client_slot);
perform_update(com.origin_client_slot);
}
else if (fastcmp(substring, "start_debug_recording")) {
audio_recording_index = 0;
memset(audio_debug_recording, 0, sizeof(int16_t)*MAX_AUDIO_RECORDING_SAMPLES);
Expand Down
40 changes: 5 additions & 35 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void load_config(){
// Color Range
configuration.color_range = preferences.getFloat("color_range", 0.00);

// Blue Filter
configuration.blue_filter = preferences.getFloat("blue_filter", 0.00);
// Warmth
configuration.warmth = preferences.getFloat("warmth", 0.50);

// Speed
configuration.speed = preferences.getFloat("speed", 0.75);
Expand All @@ -67,27 +67,6 @@ void load_config(){
// VU Floor
configuration.vu_floor = preferences.getFloat("vu_floor", 0.00);

/*
// Ambient Left Threshold
configuration.ambient_left_threshold = preferences.getULong("al_threshold", 33000);
// Ambient Center Threshold
configuration.ambient_center_threshold = preferences.getULong("ac_threshold", 95000);
// Ambient Right Threshold
configuration.ambient_right_threshold = preferences.getULong("ar_threshold", 64000);
// Touch Left Threshold
configuration.touch_left_threshold = preferences.getULong("tl_threshold", 33000*2);
// Touch Center Threshold
configuration.touch_center_threshold = preferences.getULong("tc_threshold", 95000*2);
// Touch Right Threshold
configuration.touch_right_threshold = preferences.getULong("tr_threshold", 64000*2);
*/

// Reverse Color
configuration.reverse_color_range = preferences.getBool("reverse_color", false);

Expand Down Expand Up @@ -130,9 +109,9 @@ void sync_configuration_to_client() {
snprintf(config_item_buffer, 120, "new_config|mirror_mode|int|%d", configuration.mirror_mode);
websocket_handler.sendAll(config_item_buffer);

// blue_filter
// warmth
memset(config_item_buffer, 0, 120);
snprintf(config_item_buffer, 120, "new_config|blue_filter|float|%.3f", configuration.blue_filter);
snprintf(config_item_buffer, 120, "new_config|warmth|float|%.3f", configuration.warmth);
websocket_handler.sendAll(config_item_buffer);

// color_range
Expand Down Expand Up @@ -179,7 +158,7 @@ bool save_config() {
preferences.putFloat("softness", configuration.softness);
preferences.putFloat("color", configuration.color);
preferences.putFloat("color_range", configuration.color_range);
preferences.putFloat("blue_filter", configuration.blue_filter);
preferences.putFloat("warmth", configuration.warmth);
preferences.putFloat("speed", configuration.speed);
preferences.putFloat("saturation", configuration.saturation);
preferences.putFloat("background", configuration.background);
Expand All @@ -188,15 +167,6 @@ bool save_config() {
preferences.putBool("screensaver", configuration.screensaver);
preferences.putBool("dithering", configuration.temporal_dithering);
preferences.putFloat("vu_floor", configuration.vu_floor);
/*
preferences.putULong("al_threshold", configuration.ambient_left_threshold);
preferences.putULong("ac_threshold", configuration.ambient_center_threshold);
preferences.putULong("ar_threshold", configuration.ambient_right_threshold);
preferences.putULong("tl_threshold", configuration.touch_left_threshold);
preferences.putULong("tc_threshold", configuration.touch_center_threshold);
preferences.putULong("tr_threshold", configuration.touch_right_threshold);
*/

preferences.putBool("reverse_color", configuration.reverse_color_range);
preferences.putBool("auto_color", configuration.auto_color_cycle);

Expand Down
27 changes: 12 additions & 15 deletions src/gpu_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ void run_gpu() {
// Update auto color cycling
update_auto_color(); // (leds.h)

run_indicator_light();

// RUN THE CURRENT MODE
// ------------------------------------------------------------

Expand All @@ -50,27 +52,19 @@ void run_gpu() {

apply_background(configuration.background);

// Apply an incandescent LUT to reduce harsh blue tones
apply_blue_light_filter(configuration.blue_filter); // (leds.h)
draw_ui_overlay(); // (ui.h)

if( EMOTISCOPE_ACTIVE == true && configuration.screensaver == true){
run_screensaver();
}

// Restrict CRGBF values to 0.0-1.0 range
clip_leds(); // (leds.h)

apply_brightness();

run_indicator_light();
render_touches(); // (touch.h)

if( EMOTISCOPE_ACTIVE == false ){
run_standby();
}

render_touches(); // (touch.h)

draw_ui_overlay();

// This value decays itself non linearly toward zero all the time,
// *really* slowing down the LPF when it's set to 1.0.
Expand All @@ -80,7 +74,7 @@ void run_gpu() {
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
// at hundreds of frames per second
//
Expand All @@ -92,14 +86,17 @@ void run_gpu() {
lpf_cutoff_frequency = lpf_cutoff_frequency * (1.0 - lpf_drag) + 0.5 * lpf_drag;
apply_image_lpf(lpf_cutoff_frequency);

//apply_frame_blending( configuration.softness );
clip_leds();
//apply_tonemapping();

//apply_phosphor_decay(configuration.softness);
//apply_frame_blending( configuration.softness );
//apply_phosphor_decay( configuration.softness );

clip_leds(); // (leds.h)
// Apply an incandescent LUT to reduce harsh blue tones
apply_warmth( configuration.warmth ); // (leds.h)

// Apply white balance
//multiply_CRGBF_array_by_LUT( leds, WHITE_BALANCE, NUM_LEDS );
multiply_CRGBF_array_by_LUT( leds, WHITE_BALANCE, NUM_LEDS );

apply_gamma_correction();

Expand Down
Loading

0 comments on commit 5ab6743

Please sign in to comment.