From e2c71c9d0dde389ee187673abcab552298fe1968 Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov Date: Sun, 5 Oct 2025 17:27:58 +0300 Subject: [PATCH] wip: --- src/ate0003.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/ate0003.c b/src/ate0003.c index 3e9b7e0..3ded743 100644 --- a/src/ate0003.c +++ b/src/ate0003.c @@ -8,11 +8,11 @@ // Must set to #define configMINIMAL_STACK_SIZE 70 -// #define DEBUG // Must set to #define configTOTAL_HEAP_SIZE 1408 and #define configCHECK_FOR_STACK_OVERFLOW 1. +#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 190 -#define PCF8574_STACK 110 +#define ENCODER_STACK 166 +#define PCF8574_STACK 109 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}; @@ -73,14 +73,6 @@ 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]; @@ -148,7 +140,7 @@ void system_setup_task(void *pvParameters) //** Encoders init **/ zh_avr_encoder_init_config_t encoder_init_config = ZH_AVR_ENCODER_INIT_CONFIG_DEFAULT(); encoder_init_config.stack_size = ENCODER_STACK; - encoder_init_config.queue_size = 3; + encoder_init_config.queue_size = 5; encoder_init_config.gpio_port = AVR_PORTC; encoder_init_config.a_gpio_number = PORTC0; encoder_init_config.b_gpio_number = PORTC1; @@ -175,6 +167,10 @@ 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); } @@ -338,6 +334,10 @@ 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) @@ -356,6 +356,10 @@ 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)