From bab0c181bd4c7aca3f36e86d01b1fe15b3aed8ea Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov Date: Sun, 5 Oct 2025 10:58:44 +0300 Subject: [PATCH] wip: --- src/ate0003.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/ate0003.c b/src/ate0003.c index ae7c1bc..a364ba3 100644 --- a/src/ate0003.c +++ b/src/ate0003.c @@ -7,13 +7,12 @@ #include "ate0003.h" // Must set to #define configMINIMAL_STACK_SIZE 70 -// Must set to #define configTOTAL_HEAP_SIZE 1408 -// #define DEBUG +// #define DEBUG // Must set to #define configTOTAL_HEAP_SIZE 1408 and #define configCHECK_FOR_STACK_OVERFLOW 1. #define SYSTEM_SETUP_STACK 170 -#define ENCODER_STACK 166 -#define PCF8574_STACK 109 +#define ENCODER_STACK 170 +#define PCF8574_STACK 110 const char *component_cmm[] = {component_1_cmm, component_2_cmm, component_3_cmm, component_4_cmm, component_5_cmm}; const char *component_line_1[] = {component_1_line_1, component_2_line_1, component_3_line_1, component_4_line_1, component_5_line_1}; @@ -56,9 +55,9 @@ volatile static uint8_t used_channels = 0; // Permitted channels. Depends of t volatile static bool is_initialized = false; // Normal loading status. volatile static bool is_num1_fixed = false; // NUM 1 button FIX status. -volatile static bool is_num2_fixed = false; // NUM 1 button FIX status. -volatile static bool is_num3_fixed = false; // NUM 1 button FIX status. -volatile static bool is_num4_fixed = false; // NUM 1 button FIX status. +volatile static bool is_num2_fixed = false; // NUM 2 button FIX status. +volatile static bool is_num3_fixed = false; // NUM 3 button FIX status. +volatile static bool is_num4_fixed = false; // NUM 4 button FIX status. int main(void) { @@ -74,6 +73,14 @@ int main(void) return 0; } +#ifdef DEBUG +void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName) +{ + printf("Task %s Stack Owerflow.\n", pcTaskName); + printf("Free Heap %d.\n", xPortGetFreeHeapSize()); +} +#endif + void system_setup_task(void *pvParameters) { char text_buffer[LCD_TEXT_BUFFER]; @@ -164,10 +171,6 @@ void system_setup_task(void *pvParameters) ac_dimmer_init_config.triac_gpio = PORTD4; zh_avr_ac_dimmer_init(&ac_dimmer_init_config); is_initialized = true; -#ifdef DEBUG - printf("System Setup Task Remaining Stack Size %d.\n", uxTaskGetStackHighWaterMark(NULL)); - printf("Free Heap %d.\n", xPortGetFreeHeapSize()); -#endif vTaskDelete(NULL); } @@ -295,10 +298,6 @@ void zh_avr_pcf8574_event_handler(zh_avr_pcf8574_event_on_isr_t *event) default: break; } -#ifdef DEBUG - printf("PCF8574 Interrupt Task Remaining Stack Size %d.\n", uxTaskGetStackHighWaterMark(NULL)); - printf("Free Heap %d.\n", xPortGetFreeHeapSize()); -#endif } void zh_avr_encoder_event_handler(zh_avr_encoder_event_on_isr_t *event) @@ -317,10 +316,6 @@ void zh_avr_encoder_event_handler(zh_avr_encoder_event_on_isr_t *event) default: break; } -#ifdef DEBUG - printf("Encoder Interrupt Task Remaining Stack Size %d.\n", uxTaskGetStackHighWaterMark(NULL)); - printf("Free Heap %d.\n", xPortGetFreeHeapSize()); -#endif } ISR(PCINT1_vect)