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:
@@ -347,7 +347,7 @@ static void DisplayTask(void* parameters)
|
||||
if (DisplayContent_isCharacterUpdated(&self->displayContent, rowCounter, colCounter))
|
||||
{
|
||||
buffer = DisplayContent_getCharacter(&self->displayContent, rowCounter, colCounter);
|
||||
DisplayDevice_write(self->displayDevice, &buffer, 1, rowCounter + 1, colCounter + 1);
|
||||
DisplayDevice_writeCharacter(self->displayDevice, &buffer, rowCounter + 1, colCounter + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ typedef enum
|
||||
CONSOLE_TEST_ADC,
|
||||
CONSOLE_TEST_DAC,
|
||||
CONSOLE_TEST_INTERLOCK,
|
||||
CONSOLE_TEST_TESLA_SECURITY,
|
||||
CONSOLE_TEST_SOLENOID,
|
||||
CONSOLE_TEST_RELAY,
|
||||
CONSOLE_TEST_GENERIC,
|
||||
@@ -74,6 +75,7 @@ typedef enum
|
||||
DISPLAY_MENU_ADC,
|
||||
DISPLAY_MENU_DAC,
|
||||
DISPLAY_MENU_INTERLOCK,
|
||||
DISPLAY_MENU_TESLA_SECURITY,
|
||||
DISPLAY_MENU_SOLENOID,
|
||||
DISPLAY_MENU_RELAY,
|
||||
DISPLAY_MENU_GENERIC
|
||||
@@ -97,7 +99,7 @@ typedef enum
|
||||
|
||||
static const char conInfHeader[] =
|
||||
"*******************************************************************************\r\n"
|
||||
"** Photonis - something **\r\n"
|
||||
"** Photonis - HSB MRTS **\r\n"
|
||||
"** **\r\n"
|
||||
"*******************************************************************************\r\n"
|
||||
" \r\n";
|
||||
@@ -111,10 +113,11 @@ static const char conInfMainMenu[] =
|
||||
" [%c] Test Display \r\n"
|
||||
" [%c] Test ADCs \r\n"
|
||||
" [%c] Test DACs \r\n"
|
||||
" [%c] Test Interlocks \r\n"
|
||||
" [%c] Test Interlock \r\n"
|
||||
" [%c] Test Tesla security \r\n"
|
||||
" [%c] Test Solenoids \r\n"
|
||||
" [%c] Test relays \r\n"
|
||||
" [%c] Test Keypad/EEPROM/PCB variant \r\n"
|
||||
" [%c] Test Keypad/PCB variant \r\n"
|
||||
" \r\n";
|
||||
|
||||
enum
|
||||
@@ -124,6 +127,7 @@ enum
|
||||
MENU_MAIN_ADC,
|
||||
MENU_MAIN_DAC,
|
||||
MENU_MAIN_INTERLOCK,
|
||||
MENU_MAIN_TESLA_SECURITY,
|
||||
MENU_MAIN_SOLENOID,
|
||||
MENU_MAIN_RELAY,
|
||||
MENU_MAIN_GENERIC,
|
||||
@@ -159,9 +163,9 @@ static const char conTestDisplay[] =
|
||||
" \r\n"
|
||||
" Test the display and backlight \r\n"
|
||||
" \r\n"
|
||||
" [%c] Set backlight to 10%% \r\n"
|
||||
" [%c] Set backlight to 50%% \r\n"
|
||||
" [%c] Set backlight to 100%% \r\n"
|
||||
" [%c] Set backlight to 10%% \r\n"
|
||||
" [%c] Set backlight to 50%% \r\n"
|
||||
" [%c] Set backlight to 100%% \r\n"
|
||||
" [%c] Show text on display \r\n"
|
||||
" [%c] Clear display content \r\n"
|
||||
" [%c] Back \r\n"
|
||||
@@ -248,18 +252,34 @@ static const char conTestInterlock[] =
|
||||
" Test the interlock [1-2] \r\n"
|
||||
" \r\n"
|
||||
" [%c] Read Interlock 1 \r\n"
|
||||
" [%c] Read Interlock 2 (Tesla only) \r\n"
|
||||
" [%c] Back \r\n"
|
||||
" \r\n";
|
||||
|
||||
enum
|
||||
{
|
||||
MENU_TEST_INTERLOCK_1,
|
||||
MENU_TEST_INTERLOCK_2,
|
||||
MENU_TEST_INTERLOCK_BACK,
|
||||
MENU_TEST_INTERLOCK_LAST
|
||||
};
|
||||
|
||||
static const char conTestTeslaSecurity[] =
|
||||
ANSI_TERMINAL_RESET
|
||||
ANSI_TERMINAL_HOME
|
||||
" TEST Tesla security \r\n"
|
||||
" \r\n"
|
||||
" Test the Tesla security relais \r\n"
|
||||
" \r\n"
|
||||
" [%c] Toggle relais \r\n"
|
||||
" [%c] Back \r\n"
|
||||
" \r\n";
|
||||
|
||||
enum
|
||||
{
|
||||
MENU_TEST_TESLA_TOGGLE,
|
||||
MENU_TEST_TESLA_BACK,
|
||||
MENU_TEST_TESLA_LAST
|
||||
};
|
||||
|
||||
static const char conTestSolenoid[] =
|
||||
ANSI_TERMINAL_RESET
|
||||
ANSI_TERMINAL_HOME
|
||||
@@ -310,12 +330,11 @@ enum
|
||||
static const char conTestGeneric[] =
|
||||
ANSI_TERMINAL_RESET
|
||||
ANSI_TERMINAL_HOME
|
||||
" TEST KEYPAD/EEPROM/PCB VARIANT \r\n"
|
||||
" TEST KEYPAD/PCB VARIANT \r\n"
|
||||
" \r\n"
|
||||
" Test the relays [1-6] \r\n"
|
||||
" Test keypad / PCBa \r\n"
|
||||
" \r\n"
|
||||
" [%c] Read keypad \r\n"
|
||||
" [%c] Test EEPROM \r\n"
|
||||
" [%c] Get PCB variant \r\n"
|
||||
" [%c] Back \r\n"
|
||||
" \r\n";
|
||||
@@ -323,7 +342,6 @@ static const char conTestGeneric[] =
|
||||
enum
|
||||
{
|
||||
MENU_TEST_GENERIC_KEYPAD,
|
||||
MENU_TEST_GENERIC_EEPROM,
|
||||
MENU_TEST_GENERIC_PCB_VARIANT,
|
||||
MENU_TEST_GENERIC_BACK,
|
||||
MENU_TEST_GENERIC_LAST
|
||||
@@ -518,7 +536,13 @@ static void hwValidationMenuSM(struct HwValidationMenu* self, Button_Pressed_t b
|
||||
self->menuItemSelected = 0;
|
||||
menuState = CONSOLE_TEST_INTERLOCK;
|
||||
hwValidationMenuDisplay(self, DISPLAY_MENU_INTERLOCK );
|
||||
}
|
||||
}
|
||||
else if( self->menuItemSelected == MENU_MAIN_TESLA_SECURITY )
|
||||
{
|
||||
self->menuItemSelected = 0;
|
||||
menuState = CONSOLE_TEST_TESLA_SECURITY;
|
||||
hwValidationMenuDisplay(self, DISPLAY_MENU_TESLA_SECURITY );
|
||||
}
|
||||
else if( self->menuItemSelected == MENU_MAIN_SOLENOID )
|
||||
{
|
||||
self->menuItemSelected = 0;
|
||||
@@ -892,28 +916,6 @@ static void hwValidationMenuSM(struct HwValidationMenu* self, Button_Pressed_t b
|
||||
}
|
||||
IODevice_write(self->ioDevice, self->outputBuffer, outputBufferLength);
|
||||
}
|
||||
else if (self->menuItemSelected == MENU_TEST_INTERLOCK_2 )
|
||||
{
|
||||
|
||||
if(self->testItems->pcba->pcba == PCBA_Tesla)
|
||||
{
|
||||
|
||||
if( GPIO_getValue(self->testItems->teslaNO, &value1) == SUCCESS &&
|
||||
GPIO_getValue(self->testItems->teslaNC, &value2) == SUCCESS
|
||||
){
|
||||
outputBufferLength = sprintf(self->outputBuffer, "Interlock (tesla): NO: %d - NC: %d\r\n", value1, value2);
|
||||
}
|
||||
else
|
||||
{
|
||||
outputBufferLength = sprintf(self->outputBuffer, "Interlock: Failure\r\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outputBufferLength = sprintf(self->outputBuffer, "Interlock: Only available on Tesla PCBA\r\n");
|
||||
}
|
||||
IODevice_write(self->ioDevice, self->outputBuffer, outputBufferLength);
|
||||
}
|
||||
else if (self->menuItemSelected == MENU_TEST_INTERLOCK_BACK )
|
||||
{
|
||||
// Back to main menu
|
||||
@@ -924,6 +926,59 @@ static void hwValidationMenuSM(struct HwValidationMenu* self, Button_Pressed_t b
|
||||
}
|
||||
break;
|
||||
|
||||
case CONSOLE_TEST_TESLA_SECURITY:
|
||||
if( button == BUTTON_UP )
|
||||
{
|
||||
if( self->menuItemSelected == 0 )
|
||||
self->menuItemSelected = (MENU_TEST_TESLA_LAST- 1);
|
||||
else
|
||||
self->menuItemSelected--;
|
||||
|
||||
hwValidationMenuDisplay(self, DISPLAY_MENU_TESLA_SECURITY );
|
||||
}
|
||||
else if( button == BUTTON_DOWN )
|
||||
{
|
||||
if( self->menuItemSelected == (MENU_TEST_TESLA_LAST - 1) )
|
||||
self->menuItemSelected = 0;
|
||||
else
|
||||
self->menuItemSelected++;
|
||||
|
||||
hwValidationMenuDisplay(self, DISPLAY_MENU_TESLA_SECURITY );
|
||||
}
|
||||
else if( button == BUTTON_ENTER )
|
||||
{
|
||||
bool value = false;
|
||||
if( self->menuItemSelected == MENU_TEST_TESLA_TOGGLE)
|
||||
{
|
||||
if( GPIO_getValue(self->testItems->TeslaSecurity, &value) == SUCCESS)
|
||||
{
|
||||
// Invert current value
|
||||
value = !value;
|
||||
if( GPIO_setValue(self->testItems->TeslaSecurity, value) == SUCCESS)
|
||||
{
|
||||
outputBufferLength = sprintf(self->outputBuffer, "TESLA relais: Toggled\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
outputBufferLength = sprintf(self->outputBuffer, "TESLA relais: Failed to set value\r\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outputBufferLength = sprintf(self->outputBuffer, "TESLA relais: Failed to get value\r\n");
|
||||
}
|
||||
IODevice_write(self->ioDevice, self->outputBuffer, outputBufferLength);
|
||||
}
|
||||
else if (self->menuItemSelected == MENU_TEST_TESLA_BACK )
|
||||
{
|
||||
// Back to main menu
|
||||
self->menuItemSelected = 0;
|
||||
menuState = CONSOLE_MAIN_MENU;
|
||||
hwValidationMenuDisplay(self, DISPLAY_MENU_MAIN );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CONSOLE_TEST_SOLENOID:
|
||||
if( button == BUTTON_UP )
|
||||
{
|
||||
@@ -1157,11 +1212,6 @@ static void hwValidationMenuSM(struct HwValidationMenu* self, Button_Pressed_t b
|
||||
outputBufferLength = sprintf(self->outputBuffer, "Keypad test exited\r\n");
|
||||
IODevice_write(self->ioDevice, self->outputBuffer, outputBufferLength);
|
||||
}
|
||||
else if( self->menuItemSelected == MENU_TEST_GENERIC_EEPROM)
|
||||
{
|
||||
outputBufferLength = sprintf(self->outputBuffer, "[TODO] EEPROM TEST\r\n");
|
||||
IODevice_write(self->ioDevice, self->outputBuffer, outputBufferLength);
|
||||
}
|
||||
else if( self->menuItemSelected == MENU_TEST_GENERIC_PCB_VARIANT)
|
||||
{
|
||||
if(self->testItems->pcba)
|
||||
@@ -1214,6 +1264,7 @@ static void hwValidationMenuDisplay(struct HwValidationMenu* self, Display_State
|
||||
menuItems[MENU_MAIN_ADC],
|
||||
menuItems[MENU_MAIN_DAC],
|
||||
menuItems[MENU_MAIN_INTERLOCK],
|
||||
menuItems[MENU_MAIN_TESLA_SECURITY],
|
||||
menuItems[MENU_MAIN_SOLENOID],
|
||||
menuItems[MENU_MAIN_RELAY],
|
||||
menuItems[MENU_MAIN_GENERIC]
|
||||
@@ -1326,7 +1377,6 @@ static void hwValidationMenuDisplay(struct HwValidationMenu* self, Display_State
|
||||
char interlockMenuBuffer[ sizeof( conTestInterlock ) ];
|
||||
menu_length = sprintf( interlockMenuBuffer, conTestInterlock,
|
||||
menuItems[MENU_TEST_INTERLOCK_1],
|
||||
menuItems[MENU_TEST_INTERLOCK_2],
|
||||
menuItems[MENU_TEST_INTERLOCK_BACK]
|
||||
);
|
||||
|
||||
@@ -1334,6 +1384,24 @@ static void hwValidationMenuDisplay(struct HwValidationMenu* self, Display_State
|
||||
IODevice_write(self->ioDevice, interlockMenuBuffer, menu_length);
|
||||
break;
|
||||
|
||||
case DISPLAY_MENU_TESLA_SECURITY:
|
||||
// Put an asterisk (*) at the selected item in the menu
|
||||
for( menuIndex = 0; menuIndex < MENU_TEST_TESLA_LAST; menuIndex++ )
|
||||
{
|
||||
MENU_DRAW_SELECTED(menuIndex);
|
||||
}
|
||||
|
||||
// Fill buffer with menu items
|
||||
char teslaSecurityMenuBuffer[ sizeof( conTestTeslaSecurity ) ];
|
||||
menu_length = sprintf( teslaSecurityMenuBuffer, conTestTeslaSecurity,
|
||||
menuItems[MENU_TEST_TESLA_TOGGLE],
|
||||
menuItems[MENU_TEST_TESLA_BACK]
|
||||
);
|
||||
|
||||
// Write message to debout interface
|
||||
IODevice_write(self->ioDevice, teslaSecurityMenuBuffer, menu_length);
|
||||
break;
|
||||
|
||||
case DISPLAY_MENU_SOLENOID:
|
||||
|
||||
// Put an asterisk (*) at the selected item in the menu
|
||||
@@ -1398,7 +1466,6 @@ static void hwValidationMenuDisplay(struct HwValidationMenu* self, Display_State
|
||||
char genericMenuBuffer[ sizeof( conTestGeneric) ];
|
||||
menu_length = sprintf( genericMenuBuffer, conTestGeneric,
|
||||
menuItems[MENU_TEST_GENERIC_KEYPAD],
|
||||
menuItems[MENU_TEST_GENERIC_EEPROM],
|
||||
menuItems[MENU_TEST_GENERIC_PCB_VARIANT],
|
||||
menuItems[MENU_TEST_GENERIC_BACK]
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -318,13 +318,13 @@ static void repairMenu_printWarning(struct MenuCore* self)
|
||||
|
||||
static void repairMenu_printRepair(struct MenuCore* self)
|
||||
{
|
||||
int loopCounter = 0;
|
||||
char buffer[20];
|
||||
|
||||
struct RepairMenu* repairMenu = repairMenus_getMainRepairMenu();
|
||||
struct RepairProcess* repairProcess = repairProcesses_getMainRepairProcess();
|
||||
if (repairProcess_isProcessRunning(repairProcess))
|
||||
{
|
||||
int loopCounter = 0;
|
||||
char buffer[20];
|
||||
if (xSemaphoreTake(repairMenu->repairScreenUpdateSemaphore, 0) != pdTRUE)
|
||||
{
|
||||
// Taking semaphore failed - no update on the screen
|
||||
|
||||
@@ -83,7 +83,10 @@ ErrorStatus repairMenus_construct(void)
|
||||
{
|
||||
// Create the Menu core
|
||||
returnValue = MenuCore_construct(menuCore, mainDisplay, &storm700->keyboardDevice, HSB_MAINMENU_TASK_PRIORITY, HSB_MAINMENU_TASK_STACKSIZE, repairMenu_createMenuEntries, repairMenu_menuStateHandle);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Create first repair menu
|
||||
returnValue = repairMenu_construct(mainMenu, menuCore,&iFlash->memoryDevice, repairMenus_freeMainMenuRepairScreenUpdateSemaphore);
|
||||
}
|
||||
|
||||
@@ -229,12 +229,10 @@ static void repairProcess_task(void* parameters)
|
||||
|
||||
while(self->runTask)
|
||||
{
|
||||
// LOGGER_DEBUG(mainLog, "----------------------------------------");
|
||||
xSemaphoreTake(self->secondsSyncronisation, portMAX_DELAY);
|
||||
|
||||
// The signal profile is identical for all rows in the regulation process
|
||||
SignalProfileGenerator_calculate(&self->signalProfileGenerator);
|
||||
// LOGGER_DEBUG(mainLog, "Signal: %d, TimeToRemain %d", self->signalProfileGenerator.signal, (unsigned int)SignalProfileGenerator_getRemainingTime(&self->signalProfileGenerator));
|
||||
|
||||
// Check for correct signal
|
||||
if (!SignalProfileGenerator_isPaused(&self->signalProfileGenerator))
|
||||
@@ -278,8 +276,7 @@ static void repairProcess_task(void* parameters)
|
||||
// Send the PID value to the DAC
|
||||
DAConverter_setOutputVoltage(self->row[loopCounter].dacChannel, self->row[loopCounter].lastDACValue);
|
||||
|
||||
// LOGGER_DEBUG(mainLog, "Row %d --- ADC: %d Error: %d PID: %d", loopCounter, self->row[loopCounter].lastADCValue, self->row[loopCounter].pidError, self->row[loopCounter].lastDACValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ROW is in error state
|
||||
@@ -289,6 +286,15 @@ static void repairProcess_task(void* parameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Process is paused
|
||||
// RESET the PIDs
|
||||
for (loopCounter = ((PCBA_getInstance()->pcba == PCBA_Tesla) ? 1 : 0); loopCounter <= ((PCBA_getInstance()->pcba == PCBA_Tesla) ? 1 : 2); loopCounter++)
|
||||
{
|
||||
PID_reset(&self->row[loopCounter].pid);
|
||||
}
|
||||
}
|
||||
|
||||
// Notify observers that an update is available
|
||||
Observable_notifyObservers(&self->observable, NULL);
|
||||
|
||||
@@ -60,11 +60,10 @@ ErrorStatus repairProcessRow_construct(struct RepairProcessRow* self, const stru
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
int iMin = 0;
|
||||
int iMax = 0;
|
||||
|
||||
if (!self->initialized)
|
||||
{
|
||||
int iMin = 0;
|
||||
int iMax = 0;
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
self->adcChannel = adcChannel;
|
||||
|
||||
Reference in New Issue
Block a user