From c7af67df366a73820f367f7d179937cf29907e6d Mon Sep 17 00:00:00 2001 From: Mitchell M Date: Tue, 6 Aug 2024 23:47:22 -0500 Subject: [PATCH] led driver --- main/drivers/leds.h | 22 +++++++++++++++++++++- main/drivers/wires.cpp | 1 + main/steps/step6.hpp | 2 ++ main/steps/wires_puzzle.cpp | 24 ++++++++++++------------ 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/main/drivers/leds.h b/main/drivers/leds.h index 3735b0a..907012a 100644 --- a/main/drivers/leds.h +++ b/main/drivers/leds.h @@ -11,7 +11,27 @@ extern led_strip_handle_t leds; typedef enum { - + shape1 = 0, + shape2 = 1, + shape3 = 2, + shape4 = 3, + module_sseg = 4, + game_sseg = 5, + tft = 6, + mic = 7, + ir_led = 8, + speaker = 9, + rfid = 10, + keypad = 11, + char_lcd = 12, + s4 = 13, + s3 = 14, + s2 = 15, + s1 = 16, + b1 = 17, + b2 = 18, + b3 = 19, + b4 = 20, } Led; void init_leds(void); diff --git a/main/drivers/wires.cpp b/main/drivers/wires.cpp index c504144..a5009eb 100644 --- a/main/drivers/wires.cpp +++ b/main/drivers/wires.cpp @@ -70,6 +70,7 @@ bool get_button_released(void) { } void strike(char* reason) { + ESP_LOGW("strike!", "%s", reason); uint8_t reg = 6; ESP_ERROR_CHECK_WITHOUT_ABORT(i2c_master_write_to_device(WIRES_I2C_NUM, WIRES_I2C_ADDR, ®, 1, (100 / portTICK_PERIOD_MS))); } diff --git a/main/steps/step6.hpp b/main/steps/step6.hpp index 6c9ea50..431fdc5 100644 --- a/main/steps/step6.hpp +++ b/main/steps/step6.hpp @@ -28,8 +28,10 @@ void step6(void) { for (int i = 0; i < NUM_WIRES; i++) { if (just_cut_wires & (1< green_pos_len && black_pos_len > 0) { out_cut[black_pos[0]] = true; - ESP_LOGI(TAG, "7. cutting %d", black_pos[0]); + // ESP_LOGI(TAG, "7. cutting %d", black_pos[0]); } // 8. cut all wires in an alternating pattern of 2 colors at least 4 wires long @@ -254,7 +254,7 @@ void solve_wires(WireColor* wires, bool* out_cut) { out_cut[i+1] = true; out_cut[i+2] = true; out_cut[i+3] = true; - ESP_LOGI(TAG, "8. cutting %d, %d, %d, %d", i, i+1, i+2, i+3); + // ESP_LOGI(TAG, "8. cutting %d, %d, %d, %d", i, i+1, i+2, i+3); } } @@ -262,7 +262,7 @@ void solve_wires(WireColor* wires, bool* out_cut) { for (int i = 0; i < NUM_WIRES; i++) { if (color_name_len[wires[i]] == i+1) { out_cut[i] = true; - ESP_LOGI(TAG, "9. cutting %d", i); + // ESP_LOGI(TAG, "9. cutting %d", i); } } @@ -270,14 +270,14 @@ void solve_wires(WireColor* wires, bool* out_cut) { if (max_len <= 2) { for (int i = 0; i < red_pos_len; i++) { out_cut[red_pos[i]] = true; - ESP_LOGI(TAG, "10. cutting %d", red_pos[i]); + // ESP_LOGI(TAG, "10. cutting %d", red_pos[i]); } } // 11. cut the last wire if it is the same color as the first wire if (wires[0] == wires[NUM_WIRES-1]) { out_cut[NUM_WIRES-1] = true; - ESP_LOGI(TAG, "11. cutting %d", NUM_WIRES-1); + // ESP_LOGI(TAG, "11. cutting %d", NUM_WIRES-1); } // 12. cut any wire adjacent to both a yellow and blue wire @@ -287,7 +287,7 @@ void solve_wires(WireColor* wires, bool* out_cut) { (wires[i] == WireColor::blue && wires[i+2] == WireColor::white) ) { out_cut[i+1] = true; - ESP_LOGI(TAG, "12. cutting %d", i+1); + // ESP_LOGI(TAG, "12. cutting %d", i+1); } }