Skip to content

Commit

Permalink
Added "Show Interface" Menu Toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
connornishijima committed May 28, 2024
1 parent 1e683df commit 0825a4a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ void parse_command(uint32_t t_now_ms, command com) {
bool setting_value = (bool)atoi(substring);
configuration.auto_color_cycle = setting_value;
}
else if (fastcmp(substring, "show_interface")){
// Get show_interface value
fetch_substring(com.command, '|', 2);
bool setting_value = (bool)atoi(substring);
configuration.show_interface = setting_value;
}

else if (fastcmp(substring, "mode")) {
// Get mode name
Expand Down Expand Up @@ -320,7 +326,6 @@ void parse_command(uint32_t t_now_ms, command com) {
}
else if (fastcmp(substring, "slider_touch_start")) {
slider_touch_active = true;
//update_ui(UI_SHOW_EVENT);
}
else if (fastcmp(substring, "slider_touch_end")) {
slider_touch_active = false;
Expand Down
9 changes: 9 additions & 0 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ void load_config(){

// Blur
configuration.blur = preferences.getFloat("blur", 0.00);

// Show Interface
configuration.show_interface = preferences.getBool("show_interface", false);
}

void sync_configuration_to_client() {
Expand Down Expand Up @@ -154,6 +157,11 @@ void sync_configuration_to_client() {
snprintf(config_item_buffer, 120, "new_config|blur|float|%.3f", configuration.blur);
websocket_handler.sendAll(config_item_buffer);

// show_interface
memset(config_item_buffer, 0, 120);
snprintf(config_item_buffer, 120, "new_config|show_interface|int|%d", configuration.show_interface);
websocket_handler.sendAll(config_item_buffer);

websocket_handler.sendAll("config_ready");
}

Expand All @@ -174,6 +182,7 @@ bool save_config() {
preferences.putBool("reverse_color", configuration.reverse_color_range);
preferences.putBool("auto_color", configuration.auto_color_cycle);
preferences.putFloat("blur", configuration.blur);
preferences.putBool("show_interface", configuration.show_interface);

return true;
}
Expand Down
1 change: 1 addition & 0 deletions src/menu_toggles.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ void load_menu_toggles() {
clear_menu_toggles();

register_menu_toggle("screensaver");
register_menu_toggle("show_interface");
register_menu_toggle("temporal_dithering");
}
1 change: 1 addition & 0 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,5 @@ struct config {
bool auto_color_cycle;
bool reverse_color_range;
float blur;
bool show_interface;
};
1 change: 1 addition & 0 deletions src/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ float ui_needle_position = 0.0;
void draw_ui_overlay(){
profile_function([&]() {
if(light_modes[configuration.current_mode].type == LIGHT_MODE_TYPE_SYSTEM){ return; }
if(configuration.show_interface == false){ return; }

if(overlay_size >= 0.01){
// -----------------------------
Expand Down

0 comments on commit 0825a4a

Please sign in to comment.