Progress on the menu
- Debounced the interlocks - Created a specified screen for pre-compliance tests ADCs must be averaged menu handling of screens is not OK destructing tasks is not OK git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@257 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -34,25 +34,31 @@
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define ERROR_QUEUE_SIZE (10)
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
struct ErrorQueueItem
|
||||
{
|
||||
T_ErrorCode errorCode;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static struct Observable observable;
|
||||
static TaskHandle_t errorTaskHandle;
|
||||
static QueueHandle_t errorQueue;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
static void ErrorTask (void* parameters);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
@@ -63,6 +69,9 @@ ErrorStatus Error_construct(void)
|
||||
{
|
||||
Observable_construct(&observable);
|
||||
|
||||
errorQueue = xQueueCreate(ERROR_QUEUE_SIZE, sizeof(struct ErrorQueueItem));
|
||||
xTaskCreate(ErrorTask, "ErrorTask", 256, NULL, 1, &errorTaskHandle);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -76,7 +85,9 @@ struct Observable* Error_getObservable(void)
|
||||
void Error_postError(T_ErrorCode errorCode)
|
||||
{
|
||||
LOGGER_ERROR(mainLog, "ERROR POSTED WITH CODE %d", errorCode);
|
||||
Observable_notifyObservers(&observable, (const void* const)errorCode);
|
||||
struct ErrorQueueItem queueItem;
|
||||
queueItem.errorCode = errorCode;
|
||||
xQueueSend(errorQueue, &queueItem, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +95,22 @@ void Error_postErrorFromISR(T_ErrorCode errorCode)
|
||||
{
|
||||
portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
|
||||
LOGGER_ERROR_ISR(mainLog, "ERROR POSTED FROM ISR");
|
||||
Observable_notifyObservers(&observable, (const void* const)errorCode);
|
||||
|
||||
struct ErrorQueueItem queueItem;
|
||||
queueItem.errorCode = errorCode;
|
||||
xQueueSendFromISR(errorQueue, &queueItem, &higherPriorityTaskWoken);
|
||||
|
||||
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
|
||||
static void ErrorTask (void* parameters)
|
||||
{
|
||||
struct ErrorQueueItem queueItem;
|
||||
while (1)
|
||||
{
|
||||
xQueueReceive(errorQueue, &queueItem, portMAX_DELAY);
|
||||
Observable_notifyObservers(&observable, (const void* const)queueItem.errorCode);
|
||||
vTaskDelay(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user