From fd908a23d470ac3156c72b093920d4c14a04c5f6 Mon Sep 17 00:00:00 2001 From: Joe Kearney Date: Sat, 20 Sep 2025 20:55:45 +0000 Subject: [PATCH] Ensure IR LEDs are off before reprogramming. (#7) Co-authored-by: Joe Kearney Reviewed-on: https://git.ktag.clubk.club/Software/2024A-SW/pulls/7 --- components/IR/IR.c | 16 ++++++++++++++-- components/IR/IR.h | 4 +++- components/Reprogramming/CMakeLists.txt | 1 + components/Reprogramming/Reprogramming.c | 3 +++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/components/IR/IR.c b/components/IR/IR.c index 9c54d99..3c754da 100644 --- a/components/IR/IR.c +++ b/components/IR/IR.c @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -410,8 +411,7 @@ SystemKResult_T Prepare_Tag(void) KLOG_INFO(TAG, "Tag prepared (%u pulses):", Shot_Buffer->count); PrintPulseTrainToConsole(Shot_Buffer); - gpio_set_level(IR_TX_RIGHT_ENABLE, 0); - gpio_set_level(IR_TX_LEFT_ENABLE, 0); + Enable_IR_Transmit(); return SYSTEMK_RESULT_SUCCESS; } @@ -429,3 +429,15 @@ SystemKResult_T Send_Tag(void) return SYSTEMK_RESULT_SUCCESS; } + +void Enable_IR_Transmit() +{ + gpio_set_level(IR_TX_RIGHT_ENABLE, 0); + gpio_set_level(IR_TX_LEFT_ENABLE, 0); +} + +void Disable_IR_Transmit() +{ + gpio_set_level(IR_TX_RIGHT_ENABLE, 1); + gpio_set_level(IR_TX_LEFT_ENABLE, 1); +} \ No newline at end of file diff --git a/components/IR/IR.h b/components/IR/IR.h index 6ad3b87..632b091 100644 --- a/components/IR/IR.h +++ b/components/IR/IR.h @@ -22,4 +22,6 @@ #include "esp_err.h" -void Initialize_IR(SemaphoreHandle_t init_complete); \ No newline at end of file +void Initialize_IR(SemaphoreHandle_t init_complete); +void Enable_IR_Transmit(); +void Disable_IR_Transmit(); \ No newline at end of file diff --git a/components/Reprogramming/CMakeLists.txt b/components/Reprogramming/CMakeLists.txt index 6c2ced5..72b9e21 100644 --- a/components/Reprogramming/CMakeLists.txt +++ b/components/Reprogramming/CMakeLists.txt @@ -11,4 +11,5 @@ idf_component_register( "esp_https_ota" "app_update" "NVM" + "IR" ) \ No newline at end of file diff --git a/components/Reprogramming/Reprogramming.c b/components/Reprogramming/Reprogramming.c index 55f2342..cc1f0f6 100644 --- a/components/Reprogramming/Reprogramming.c +++ b/components/Reprogramming/Reprogramming.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "esp_log.h" #include "esp_ota_ops.h" #include "esp_spiffs.h" @@ -264,6 +265,8 @@ SystemKResult_T Maybe_Reprogram_From_USB(void) static void Reprogramming_Task(void *pvParameters) { + Disable_IR_Transmit(); + SystemKResult_T result = Maybe_Reprogram_From_USB(); static All_On_Data_T data;