This commit is contained in:
2025-10-11 12:24:25 +03:00
parent bfdd6ee8a1
commit 05ed2c3bb9
3 changed files with 20 additions and 19 deletions

View File

@@ -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);
}