Commit for SWO for HW validation menu updates
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@245 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -131,6 +131,23 @@ extern void Display_destruct(struct Display* self);
|
||||
extern ErrorStatus Display_clearScreen(struct Display* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Display_clearLine
|
||||
* Clears one particular line on the display
|
||||
*
|
||||
* @param self The display information to use
|
||||
* @param line Linenumber to clear
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if clearing line was OK
|
||||
* ERROR otherwise, e.g. line number out of
|
||||
* bound
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus Display_clearLine(struct Display* self, size_t line);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Display_setState
|
||||
* Sets the display state
|
||||
|
||||
@@ -136,6 +136,12 @@ ErrorStatus Display_clearScreen(struct Display* self)
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus Display_clearLine(struct Display* self, size_t line)
|
||||
{
|
||||
return DisplayDevice_clearLine(self->displayDevice, line);
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus Display_setState(struct Display* self, DisplayDevice_functionalState state)
|
||||
{
|
||||
return DisplayDevice_setState(self->displayDevice, state);
|
||||
|
||||
@@ -42,8 +42,10 @@
|
||||
#include "stm32f10x_rcc.h"
|
||||
|
||||
#include "DisplayDevice.h"
|
||||
#include "KeyboardDevice.h"
|
||||
#include "MAX5715.h"
|
||||
#include "nhd0420.h"
|
||||
#include "storm700.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "internalADC.h"
|
||||
@@ -104,6 +106,9 @@ struct MAX5715* dac = &max5715;
|
||||
struct RepairMenu* rm = &_rm;
|
||||
struct HwValidationMenu* hwValidation = &_hwValidation;
|
||||
|
||||
static struct Storm700 _storm700 = {.initialized = false};
|
||||
struct Storm700* storm700 = &_storm700;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -194,6 +199,8 @@ static void initTask(void* parameters)
|
||||
|
||||
Logger_construct(mainLog, &uart3->device, 1, 512);
|
||||
|
||||
Storm700_construct(storm700, &keypad->device);
|
||||
|
||||
NHD0420_construct(&nhd0420, &spiDisplay->device);
|
||||
|
||||
Display_construct(display, &nhd0420.displayDevice, 2, 256, 10, 1000, 10000);
|
||||
@@ -249,9 +256,10 @@ static void initTask(void* parameters)
|
||||
// EEPROM TO BE DONE
|
||||
HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 1, 512);
|
||||
|
||||
// Construct the repair menu
|
||||
repairMenu_construct(rm, display, 2, 512);
|
||||
// Delete this init task
|
||||
|
||||
// Delete this init task
|
||||
vTaskDelete(NULL);
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#include "internalADC.h"
|
||||
#include "MAX5715.h"
|
||||
|
||||
#include "KeyboardDevice.h"
|
||||
#include "storm700.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -134,11 +137,24 @@ void repairMenu_feedSecondsCounterFromISR(struct RepairMenu* self)
|
||||
static struct RepairProcess _rp = {.initialized = false};
|
||||
struct RepairProcess* rp = &_rp;
|
||||
extern struct MAX5715* dac;
|
||||
extern struct Storm700* storm700;
|
||||
static void repairMenu_task(void* parameters)
|
||||
{
|
||||
struct RepairMenu* self = (struct RepairMenu*)parameters;
|
||||
|
||||
Display_write(self->display, " ", 20, 3, 1);
|
||||
Display_clearLine(self->display, 3);
|
||||
|
||||
char key;
|
||||
Keypad_KeyState keyState;
|
||||
if (Storm700_readKey(storm700, &key, &keyState) == SUCCESS)
|
||||
{
|
||||
LOGGER_DEBUG(mainLog, "Got key %c %d", key, keyState);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER_ERROR(mainLog, "Getting key failed");
|
||||
}
|
||||
|
||||
|
||||
struct RepairProcessParameters rpParameters;
|
||||
rpParameters.adcRow1 = &adc1->channel[0];
|
||||
@@ -148,10 +164,8 @@ static void repairMenu_task(void* parameters)
|
||||
rpParameters.dacRow2 = &dac->dac[1];
|
||||
rpParameters.dacRow3 = &dac->dac[2];
|
||||
|
||||
MAX5715Channel_setValue(&dac->dac[1], 0xE00);
|
||||
|
||||
struct RepairPresetParameters presetStage1 = {.voltage = 0xA00, .duration = 5000, .softstartDuration = 1000};
|
||||
struct RepairPresetParameters presetStage2 = {.voltage = 0xE00, .duration = 1000, .softstartDuration = 2000};
|
||||
struct RepairPresetParameters presetStage1 = {.voltage = 0xA00, .duration = 300, .softstartDuration = 120};
|
||||
struct RepairPresetParameters presetStage2 = {.voltage = 0xE00, .duration = 120, .softstartDuration = 30};
|
||||
|
||||
struct RepairPreset repairPreset;
|
||||
repairPreset.numberOfStages = 2;
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
|
||||
static void repairProcess_task(void* parameters);
|
||||
|
||||
static void calculateSoftStartStep (uint32_t currentTime, uint32_t softStartDuration, int targetVoltage, uint16_t* dacValue);
|
||||
static void SignalProfileGenerator();
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
@@ -209,24 +211,24 @@ static void repairProcess_task(void* parameters)
|
||||
{
|
||||
// Perform softstart / ramp-up
|
||||
|
||||
if (PCBA_getInstance()->pcba == Tesla)
|
||||
{
|
||||
// Tesla repair only runs ADC row2 and DAC row2
|
||||
calculateSoftStartStep(self->secondsCounter, softStartTimer, voltageTarget, &voltageRow2);
|
||||
LOGGER_DEBUG(mainLog, "Softstart running -> new target is %x", voltageRow2);
|
||||
MAX5715Channel_setValue(self->dacRow2, voltageRow2);
|
||||
}
|
||||
else if ((PCBA_getInstance()->pcba == Anode) || (PCBA_getInstance()->pcba == CathodeMCP))
|
||||
{
|
||||
calculateSoftStartStep(self->secondsCounter, softStartTimer, voltageTarget, &voltageRow1);
|
||||
calculateSoftStartStep(self->secondsCounter, softStartTimer, voltageTarget, &voltageRow2);
|
||||
calculateSoftStartStep(self->secondsCounter, softStartTimer, voltageTarget, &voltageRow3);
|
||||
LOGGER_DEBUG(mainLog, "Softstart running -> new target is %x %x %x", voltageRow1, voltageRow2, voltageRow3);
|
||||
|
||||
MAX5715Channel_setValue(self->dacRow1, voltageRow1);
|
||||
MAX5715Channel_setValue(self->dacRow2, voltageRow2);
|
||||
MAX5715Channel_setValue(self->dacRow3, voltageRow3);
|
||||
}
|
||||
// if (PCBA_getInstance()->pcba == Tesla)
|
||||
// {
|
||||
// // Tesla repair only runs ADC row2 and DAC row2
|
||||
// calculateSoftStartStep(self->secondsCounter, softStartTimer, voltageTarget, &voltageRow2);
|
||||
// LOGGER_DEBUG(mainLog, "Softstart running -> new target is %x", voltageRow2);
|
||||
// MAX5715Channel_setValue(self->dacRow2, voltageRow2);
|
||||
// }
|
||||
// else if ((PCBA_getInstance()->pcba == Anode) || (PCBA_getInstance()->pcba == CathodeMCP))
|
||||
// {
|
||||
// calculateSoftStartStep(self->secondsCounter, softStartTimer, voltageTarget, &voltageRow1);
|
||||
// calculateSoftStartStep(self->secondsCounter, softStartTimer, voltageTarget, &voltageRow2);
|
||||
// calculateSoftStartStep(self->secondsCounter, softStartTimer, voltageTarget, &voltageRow3);
|
||||
// LOGGER_DEBUG(mainLog, "Softstart running -> new target is %x %x %x", voltageRow1, voltageRow2, voltageRow3);
|
||||
//
|
||||
// MAX5715Channel_setValue(self->dacRow1, voltageRow1);
|
||||
// MAX5715Channel_setValue(self->dacRow2, voltageRow2);
|
||||
// MAX5715Channel_setValue(self->dacRow3, voltageRow3);
|
||||
// }
|
||||
|
||||
// Check for end of softstart
|
||||
if (softStartTimer < self->secondsCounter)
|
||||
@@ -282,6 +284,12 @@ static void repairProcess_task(void* parameters)
|
||||
// A next stage is available
|
||||
presetIndex++;
|
||||
self->currentState = PREPARE;
|
||||
LOGGER_DEBUG(mainLog, "Another stage is available");
|
||||
}
|
||||
else
|
||||
{
|
||||
self->currentState = FINISHED;
|
||||
LOGGER_DEBUG(mainLog, "last stage reached");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -313,13 +321,4 @@ static void repairProcess_task(void* parameters)
|
||||
}
|
||||
|
||||
|
||||
static void calculateSoftStartStep (uint32_t currentTime, uint32_t softStartDuration, int targetVoltage, uint16_t* dacValue)
|
||||
{
|
||||
int value;
|
||||
|
||||
value = ((currentTime * 1000) / softStartDuration) * targetVoltage;
|
||||
|
||||
value = value / 1000;
|
||||
|
||||
*dacValue = (uint16_t)value;
|
||||
}
|
||||
|
||||
@@ -89,11 +89,14 @@ void IRQ_setInterruptProperties(uint8_t irqChannel, uint8_t preemptionPriority,
|
||||
|
||||
void IRQ_setKeypadEXTI(struct Keypad* self, FunctionalState command)
|
||||
{
|
||||
int colCounter;
|
||||
for (colCounter = 0; colCounter < KEYPAD_NUMBER_OF_COLUMNS; colCounter++)
|
||||
if (self->initialized)
|
||||
{
|
||||
self->column[colCounter].EXTI_InitStruct.EXTI_LineCmd = command;
|
||||
EXTI_Init(&self->column[colCounter].EXTI_InitStruct);
|
||||
int colCounter;
|
||||
for (colCounter = 0; colCounter < self->numberOfColumns; colCounter++)
|
||||
{
|
||||
self->column[colCounter].EXTI_InitStruct.EXTI_LineCmd = command;
|
||||
EXTI_Init(&self->column[colCounter].EXTI_InitStruct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user