Fixed HW validation menu

Fixed some minor issues/bugs

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@284 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-11-21 12:36:16 +00:00
parent 5ccc28e32d
commit ff01d92ea8
23 changed files with 395 additions and 182 deletions

View File

@@ -33,6 +33,10 @@
#include "FreeRTOS.h"
#include "task.h"
#include "stm32f10x.h"
#include "misc.h"
#include "ADConverters.h"
#include "DAConverters.h"
#include "DeviceParameters.h"
@@ -40,35 +44,20 @@
#include "Error.h"
#include "hsb-mrts.h"
#include "hwValidationMenu.h"
#include "repairMenu.h"
#include "repairMenus.h"
#include "repairProcess.h"
#include "repairProcesses.h"
#include "Warning.h"
#include "misc.h"
#include "stm32f10x_rcc.h"
#include "CachedStorage.h"
#include "DisplayDevice.h"
#include "KeyboardDevice.h"
#include "MAX5715.h"
#include "nhd0420.h"
#include "platform.h"
#include "CathodeMCP.h"
#include "CoverSolenoid.h"
#include "Interlock.h"
#include "internalADC.h"
#include "InternalFlash.h"
#include "gpio.h"
#include "IODevice.h"
#include "keypadMatrix.h"
#include "Logger.h"
#include "MemoryDevice.h"
#include "nhd0420.h"
#include "Power6V5Supply.h"
#include "TeslaGunSafety.h"
#include "PCBA.h"
#include "uart.h"
#include "spi.h"
#include "spiDevice.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
@@ -89,6 +78,7 @@ struct LedTaskArguments
int frequency;
};
// -----------------------------------------------------------------------------
// File-scope variables
// -----------------------------------------------------------------------------
@@ -102,9 +92,9 @@ static xTaskHandle initTaskHandle;
static xTaskHandle ledTaskHandle;
static xTaskHandle sysTaskHandle;
//static struct HwValidationMenu _hwValidation = {.initialized = false};
//static struct HwValidationMenuItems hwTestItems;
//struct HwValidationMenu* hwValidation = &_hwValidation;
static struct HwValidationMenu _hwValidation = {.initialized = false};
static struct HwValidationMenuItems hwTestItems;
struct HwValidationMenu* hwValidation = &_hwValidation;
static struct CachedStorage cs = {.initialized = false};
static struct CachedStorage deviceParameters = {.initialized = false};
@@ -153,7 +143,7 @@ void vApplicationTickHook ()
static void printSystemInfoTask(void* parameters)
{
// while (1)
while (1)
{
LOGGER_INFO(mainLog, "---------------------------------------");
systeminfoCommandHandler();
@@ -168,25 +158,9 @@ static ErrorStatus systeminfoCommandHandler(void)
char text[128];
freeMemory = xPortGetFreeHeapSize();
snprintf(text, sizeof(text), "Free heap memory: %d bytes", freeMemory);
snprintf(text, sizeof(text), "Free heap memory: %d bytes", (int)freeMemory);
LOGGER_INFO(mainLog, text);
vTaskDelay(10);
OS_logTaskInfo(initTaskHandle);
vTaskDelay(10);
OS_logTaskInfo(ledTaskHandle);
vTaskDelay(10);
OS_logTaskInfo(sysTaskHandle);
vTaskDelay(10);
OS_logTaskInfo(interlock->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(keypad->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(mainDisplay->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(repairMenus_getMainRepairMenu()->menuCore->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(repairProcesses_getMainRepairProcess()->taskHandle);
return errorStatus;
@@ -194,65 +168,101 @@ static ErrorStatus systeminfoCommandHandler(void)
static void initTask(void* parameters)
{
// Create the error handler
Error_construct();
ErrorStatus returnValue = SUCCESS;
// Create the warning handler
Warning_construct();
if (returnValue == SUCCESS)
{
// Create the error handler
Error_construct();
}
// Initialize the platform first
// All IO is initialized here
// Also, all periphery and platform-specifics are initialized here
// IRQs are defined here
initPlatform();
if (returnValue == SUCCESS)
{
// Create the warning handler
Warning_construct();
}
// Create a small task that only blinks a LED and flashes the identification letter on the display
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 100, &ledTaskArguments, 0, &ledTaskHandle);
if (returnValue == SUCCESS)
{
// Initialize the platform first
// All IO is initialized here
// Also, all periphery and platform-specifics are initialized here
// IRQs are defined here
initPlatform();
}
// Construct the displays
Displays_construct();
if (returnValue == SUCCESS)
{
// Construct the displays
Displays_construct();
}
// Construct the AD Converters
ADConverters_construct();
if (returnValue == SUCCESS)
{
// Construct the AD Converters
ADConverters_construct();
}
// Construct the DA Converters
DAConverters_construct();
if (returnValue == SUCCESS)
{
// Construct the DA Converters
DAConverters_construct();
}
hsb_generateStartScreen(mainDisplay);
// Let start screen stay for 5 seconds
vTaskDelay(INIT_START_SCREEN_DELAY);
if (returnValue == SUCCESS)
{
hsb_generateStartScreen(mainDisplay);
// Let start screen stay for 5 seconds
vTaskDelay(INIT_START_SCREEN_DELAY);
}
// Construct/Load the device parameters
DeviceParameters_construct(&deviceParameters, &iFlash->memoryDevice);
if (returnValue == SUCCESS)
{
// Construct/Load the device parameters
DeviceParameters_construct(&deviceParameters, &iFlash->memoryDevice);
}
// Construct the repair presets
RepairPresets_construct(&cs, &iFlash->memoryDevice);
if (returnValue == SUCCESS)
{
// Construct the repair presets
RepairPresets_construct(&cs, &iFlash->memoryDevice);
}
///TODO MUST BE UPDATED
// hwTestItems.display = &nhd0420->displayDevice;
// hwTestItems.internalADC = adc1;
// hwTestItems.externalDAC = max5715;
// hwTestItems.power6v5Enable = power6v5Enable;
// hwTestItems.interlockNO = interlockNO;
// hwTestItems.interlockNC = interlockNC;
// hwTestItems.solenoid = solenoid;
// hwTestItems.mcp0Relay = mcp0Relay;
// hwTestItems.mcp1Relay = mcp1Relay;
// hwTestItems.mcp2Relay = mcp2Relay;
// hwTestItems.cat0Relay = cat0Relay;
// hwTestItems.cat1Relay = cat1Relay;
// hwTestItems.cat2Relay = cat2Relay;
// hwTestItems.pcba = PCBA_getInstance();
// hwTestItems.keypad = keypad;
// EEPROM TO BE DONE
// HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 1, 1024);
if (returnValue == SUCCESS)
{
hwTestItems.display = &nhd0420->displayDevice;
hwTestItems.internalADC = adc1;
hwTestItems.externalDAC = max5715;
hwTestItems.power6v5Enable = Power6V5Supply_getGPIO();
hwTestItems.interlockNO = interlock->NO.io;
hwTestItems.interlockNC = interlock->NC.io;
hwTestItems.TeslaSecurity = TeslaGunSafety_getGpio();
hwTestItems.solenoid = CoverSolenoid_getGpio();
hwTestItems.mcp0Relay = CathodeMCP_getInstance()->mcp0;
hwTestItems.mcp1Relay = CathodeMCP_getInstance()->mcp1;
hwTestItems.mcp2Relay = CathodeMCP_getInstance()->mcp2;
hwTestItems.cat0Relay = CathodeMCP_getInstance()->cat0;
hwTestItems.cat1Relay = CathodeMCP_getInstance()->cat1;
hwTestItems.cat2Relay = CathodeMCP_getInstance()->cat2;
hwTestItems.pcba = PCBA_getInstance();
hwTestItems.keypad = keypad;
// EEPROM TO BE DONE
HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 1, 1024);
}
// Construct the repair menu
repairMenus_construct();
if (returnValue == SUCCESS)
{
// Create task that repeats to print out TASK information on the logger
xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 0, &sysTaskHandle);
// Create a small task that only blinks a LED and flashes the identification letter on the display
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 100, &ledTaskArguments, 0, &ledTaskHandle);
}
// Create task that repeats to print out TASK information on the logger
xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 0, &sysTaskHandle);
if (returnValue == SUCCESS)
{
// Construct the repair menu
repairMenus_construct();
}
// Delete this init task
vTaskDelete(NULL);