- Re-located repairprocessrow information in dedicated object - added error conditions to repair row and added condition handling to repair process git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@260 05563f52-14a8-4384-a975-3d1654cca0fa
98 lines
3.2 KiB
C
98 lines
3.2 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"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// File-scope variables
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
ErrorStatus repairProcessRow_construct(struct RepairProcessRow* self, const struct AdcChannel* adcChannel, const struct MAX5715_DAC* dacChannel, int outOfLimitsDuration, int outOfLimitsValue)
|
|
{
|
|
ErrorStatus returnValue = SUCCESS;
|
|
|
|
if (!self->initialized)
|
|
{
|
|
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)
|
|
{
|
|
returnValue = PID_construct(&self->pid, 3000, 2000, 0, 0, 100000000);
|
|
}
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
self->initialized = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
returnValue = ERROR;
|
|
}
|
|
return returnValue;
|
|
}
|
|
|
|
|
|
void repairProcessRow_destruct(struct RepairProcessRow* self)
|
|
{
|
|
PID_destruct(&self->pid);
|
|
self->initialized = false;
|
|
}
|