From fd351d0934407c829956aab958231d058fba62af Mon Sep 17 00:00:00 2001 From: Mitchell M Date: Wed, 28 Aug 2024 17:59:29 -0500 Subject: [PATCH] fix warnings --- main/steps/step1.cpp | 12 ++++++------ main/steps/step3.cpp | 2 +- main/steps/step4.cpp | 5 +---- main/steps/step6.cpp | 1 - 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/main/steps/step1.cpp b/main/steps/step1.cpp index d8cd5b5..c124942 100644 --- a/main/steps/step1.cpp +++ b/main/steps/step1.cpp @@ -3,14 +3,14 @@ __attribute__((unused)) static const char *TAG = "step1"; -static char* COLOR_NAMES[] = { +static const char* COLOR_NAMES[] = { "green", "red", "yellow", "blue" }; -static char* NUM_NAMES[] = { +static const char* NUM_NAMES[] = { "one", "two", "three", @@ -120,7 +120,7 @@ static void generate_switch_leds(void) { led_strip_refresh(leds); } -static void set_text_and_color(char* text_str, int color) { +static void set_text_and_color(const char* text_str, int color) { if (xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdTRUE) { ESP_LOGI(TAG, "set_text_and_color: setting text: %s", text_str); lv_label_set_text(text, text_str); @@ -144,7 +144,7 @@ static int generate_part_a(void) { int text_color = zero_to_three(my_gen); int text_idx = zero_to_three(my_gen); - char* text_string = COLOR_NAMES[text_idx]; + const char* text_string = COLOR_NAMES[text_idx]; set_text_and_color(text_string, text_color); generate_switch_leds(); @@ -162,7 +162,7 @@ static int generate_part_b(void) { int text_color = zero_to_three(my_gen); int text_number = zero_to_three(my_gen); - char* text_string = NUM_NAMES[text_number]; + const char* text_string = NUM_NAMES[text_number]; set_text_and_color(text_string, text_color); generate_switch_leds(); @@ -178,7 +178,7 @@ static int generate_part_c(void) { } int text_color = zero_to_three(my_gen); - char* text_string = "switch"; + const char* text_string = "switch"; set_text_and_color(text_string, text_color); generate_switch_leds(); diff --git a/main/steps/step3.cpp b/main/steps/step3.cpp index ca3dde3..d8ee2ee 100644 --- a/main/steps/step3.cpp +++ b/main/steps/step3.cpp @@ -33,7 +33,7 @@ static const char* LCD_STRINGS[] = { static int indicator_led_idxs[LED_COUNT] = {0}; static bool contains_coconut = false; -static char* COCONUT = "coconut"; +static const char* COCONUT = "coconut"; static char lcd_random_char_set[] = "aeiou tnsrhldm"; static char random_lcd_text[21] = {0}; diff --git a/main/steps/step4.cpp b/main/steps/step4.cpp index 932ad66..42d965d 100644 --- a/main/steps/step4.cpp +++ b/main/steps/step4.cpp @@ -3,8 +3,6 @@ __attribute__((unused)) static const char *TAG = "step4"; -static lv_obj_t* scr; -static lv_style_t scr_style; static lv_obj_t* img; static bool invisible_blocks = false; @@ -14,7 +12,7 @@ static const int height = 22; static const int width = 10; static int board[height][width] = {0}; -static lv_obj_t* visual_board[height][width] = {0}; +// static lv_obj_t* visual_board[height][width] = {0}; static lv_obj_t* line_clear_img; static lv_style_t game_over_style; @@ -567,7 +565,6 @@ static void place_piece(void) { } if (xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdTRUE) { for (int i = 0; i < sizeof(piece_nodes)/sizeof(piece_nodes[0]); i++) { - int* p = piece_nodes[i]; lv_obj_align(piece_imgs[i], LV_ALIGN_BOTTOM_LEFT, 159, -(height*16)); } xSemaphoreGive(xGuiSemaphore); diff --git a/main/steps/step6.cpp b/main/steps/step6.cpp index 8e6f5b0..fb5f62a 100644 --- a/main/steps/step6.cpp +++ b/main/steps/step6.cpp @@ -15,7 +15,6 @@ void step6(void) { solve_wires(wires, solution); while (1) { - uint8_t new_cut_wires = get_cut_wires(); uint8_t just_cut_wires = new_cut_wires & ~cut_wires; cut_wires |= new_cut_wires;