diff --git a/lib/zh_avr_ac_dimmer b/lib/zh_avr_ac_dimmer index 40f352b..4bad258 160000 --- a/lib/zh_avr_ac_dimmer +++ b/lib/zh_avr_ac_dimmer @@ -1 +1 @@ -Subproject commit 40f352bcc74db6a8caffef9415d094e11589a92e +Subproject commit 4bad25892a7bb6b3649d3962f5b723ad740f32dc diff --git a/lib/zh_avr_free_rtos b/lib/zh_avr_free_rtos index fd75370..abfe2ea 160000 --- a/lib/zh_avr_free_rtos +++ b/lib/zh_avr_free_rtos @@ -1 +1 @@ -Subproject commit fd753705dd3031d5b38ad4cdc1d7ee487c4ba856 +Subproject commit abfe2ea922a4d4cf5d39934916c25be3cd6bcfe5 diff --git a/src/ate0003.c b/src/ate0003.c index 2e82eae..b1fd0bd 100644 --- a/src/ate0003.c +++ b/src/ate0003.c @@ -46,11 +46,12 @@ zh_avr_pcf8574_handle_t lcd_handle = {0}; zh_avr_encoder_handle_t power_encoder_handle = {0}; zh_avr_encoder_handle_t component_encoder_handle = {0}; -volatile static bool is_work = false; // Work status. -volatile static bool is_dmm = false; // DMM using status. -volatile static bool is_fix = false; // FIX button status. -volatile static uint8_t used_channels = 0; // Permitted channels. Depends of the selected component. -volatile static bool is_initialized = false; // Normal loading status. +volatile static bool is_work = false; // Work status. +volatile static bool is_dmm = false; // DMM using status. +volatile static bool is_fix = false; // FIX button status. +volatile static uint8_t permitted_channels = 0; // Permitted channels. Depends of the selected component. +volatile static uint8_t used_channels = 0; // Counter of currently enabled channels. +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 2 button FIX status. @@ -71,13 +72,13 @@ int main(void) return 0; } +#ifdef DEBUG void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName) { -#ifdef DEBUG - printf("Task %s Remaining Stack Size %d.\n", pcTaskName, uxTaskGetStackHighWaterMark(xTask)); + printf("Task %s Stack Owerflow %d.\n", pcTaskName); printf("Free Heap %d.\n", xPortGetFreeHeapSize()); -#endif } +#endif void system_setup_task(void *pvParameters) { @@ -218,7 +219,7 @@ void zh_avr_pcf8574_event_handler(zh_avr_pcf8574_event_on_isr_t *event) } break; case NUM1_BUTTON: - if ((used_channels & CHANNEL1) == 0) + if ((permitted_channels & CHANNEL1) == 0) { break; } @@ -255,7 +256,7 @@ void zh_avr_pcf8574_event_handler(zh_avr_pcf8574_event_on_isr_t *event) } break; case NUM2_BUTTON: - if ((used_channels & CHANNEL2) == 0) + if ((permitted_channels & CHANNEL2) == 0) { break; } @@ -291,7 +292,7 @@ void zh_avr_pcf8574_event_handler(zh_avr_pcf8574_event_on_isr_t *event) } break; case NUM3_BUTTON: - if ((used_channels & CHANNEL3) == 0) + if ((permitted_channels & CHANNEL3) == 0) { break; } @@ -321,7 +322,7 @@ void zh_avr_pcf8574_event_handler(zh_avr_pcf8574_event_on_isr_t *event) } break; case NUM4_BUTTON: - if ((used_channels & CHANNEL4) == 0) + if ((permitted_channels & CHANNEL4) == 0) { break; } @@ -428,7 +429,7 @@ ISR(PCINT2_vect) void component_setup_function(uint8_t component) { char text_buffer[LCD_TEXT_BUFFER]; - used_channels = component_channel[component]; + permitted_channels = component_channel[component]; zh_avr_160x_set_cursor(&lcd_handle, 1, 10); strcpy_P(text_buffer, component_cmm[component]); zh_avr_160x_print_char(&lcd_handle, text_buffer); @@ -440,19 +441,19 @@ void component_setup_function(uint8_t component) zh_avr_160x_print_char(&lcd_handle, text_buffer); zh_avr_pcf8574_write(&led1_handle, is_dmm == true ? 0xF9 : 0xFA); zh_avr_pcf8574_write(&led2_handle, 0x0F); - if ((used_channels & CHANNEL1) == CHANNEL1) + if ((permitted_channels & CHANNEL1) == CHANNEL1) { zh_avr_pcf8574_write_gpio(&led1_handle, NUM1_LED_BLUE, LED_ON); } - if ((used_channels & CHANNEL2) == CHANNEL2) + if ((permitted_channels & CHANNEL2) == CHANNEL2) { zh_avr_pcf8574_write_gpio(&led1_handle, NUM2_LED_BLUE, LED_ON); } - if ((used_channels & CHANNEL3) == CHANNEL3) + if ((permitted_channels & CHANNEL3) == CHANNEL3) { zh_avr_pcf8574_write_gpio(&led2_handle, NUM3_LED_BLUE, LED_ON); } - if ((used_channels & CHANNEL4) == CHANNEL4) + if ((permitted_channels & CHANNEL4) == CHANNEL4) { zh_avr_pcf8574_write_gpio(&led2_handle, NUM4_LED_BLUE, LED_ON); }