Fixed some minor issues/bugs git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@284 05563f52-14a8-4384-a975-3d1654cca0fa
117 lines
3.6 KiB
C
117 lines
3.6 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file repairProcessRow.c
|
|
/// @brief Description
|
|
// -----------------------------------------------------------------------------
|
|
// Micro-Key bv
|
|
// Industrieweg 28, 9804 TG Noordhorn
|
|
// Postbus 92, 9800 AB Zuidhorn
|
|
// The Netherlands
|
|
// Tel: +31 594 503020
|
|
// Fax: +31 594 505825
|
|
// Email: support@microkey.nl
|
|
// Web: www.microkey.nl
|
|
// -----------------------------------------------------------------------------
|
|
/// $Revision$
|
|
/// $Author$
|
|
/// $Date$
|
|
// (c) 2017 Micro-Key bv
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/// @file repairProcessRow.c
|
|
/// @ingroup {group_name}
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include "repairProcessRow.h"
|
|
|
|
#include "PCBA.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// File-scope variables
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
ErrorStatus repairProcessRow_construct(struct RepairProcessRow* self, const struct ADConverter* adcChannel, const struct DAConverter* dacChannel, int outOfLimitsDuration, int outOfLimitsValue)
|
|
{
|
|
ErrorStatus returnValue = SUCCESS;
|
|
|
|
if (!self->initialized)
|
|
{
|
|
int iMin = 0;
|
|
int iMax = 0;
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
self->adcChannel = adcChannel;
|
|
self->dacChannel = dacChannel;
|
|
self->lastADCValue = 0;
|
|
self->lastDACValue = 0;
|
|
self->pid.initialized = false;
|
|
self->errorData.rowHasError = false;
|
|
self->errorData.outOfLimitsCounter = 0;
|
|
self->errorData.outOfLimitsDuration = outOfLimitsDuration;
|
|
self->errorData.outOfLimitsValue = outOfLimitsValue;
|
|
}
|
|
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
if (PCBA_getInstance()->pcba == PCBA_Anode)
|
|
{
|
|
iMin = 0;
|
|
iMax = 100000000;
|
|
}
|
|
else if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
|
{
|
|
iMin = -100000000;
|
|
iMax = 0;
|
|
}
|
|
else if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
|
{
|
|
iMin = 0;
|
|
iMax = 100000000;
|
|
}
|
|
returnValue = PID_construct(&self->pid, 3000, 2000, 0, iMin, iMax);
|
|
}
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
self->initialized = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
returnValue = ERROR;
|
|
}
|
|
return returnValue;
|
|
}
|
|
|
|
|
|
void repairProcessRow_destruct(struct RepairProcessRow* self)
|
|
{
|
|
PID_destruct(&self->pid);
|
|
self->initialized = false;
|
|
}
|