- Debounced the interlocks - Created a specified screen for pre-compliance tests ADCs must be averaged menu handling of screens is not OK destructing tasks is not OK git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@257 05563f52-14a8-4384-a975-3d1654cca0fa
117 lines
3.6 KiB
C
117 lines
3.6 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file repairProcesses.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 repairProcesses.c
|
|
/// @ingroup {group_name}
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include "hsb-mrts.h"
|
|
#include "repairProcesses.h"
|
|
|
|
#include "Interlock.h"
|
|
#include "Logger.h"
|
|
#include "PCBA.h"
|
|
#include "rtc.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// File-scope variables
|
|
// -----------------------------------------------------------------------------
|
|
|
|
static struct RepairProcess mainRepairProcess;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
static ErrorStatus repairProcesses_feedMainRepairProcessSecondsCounter(const void* const data);
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
ErrorStatus repairProcesses_startMainRepairProcess(const struct RepairPreset* repairPreset, struct RepairProcessParameters* rpParameters)
|
|
{
|
|
ErrorStatus returnValue = SUCCESS;
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = repairProcess_construct(&mainRepairProcess, rpParameters, repairPreset, HSB_MAINREPR_TASK_PRIORITY, HSB_MAINREPR_TASK_STACKSIZE);
|
|
}
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = Observable_addObserver(RTC_getObservable(rtc), repairProcesses_feedMainRepairProcessSecondsCounter);
|
|
}
|
|
return returnValue;
|
|
}
|
|
|
|
|
|
void repairProcesses_abortMainRepairProcess(void)
|
|
{
|
|
Interlock_setEXTI(interlock, DISABLE);
|
|
if (PCBA_getInstance()->pcba == Tesla)
|
|
{
|
|
Interlock_setEXTI(teslalock, DISABLE);
|
|
}
|
|
|
|
// DISABLE external power
|
|
GPIO_setValue(power6v5Enable, true);
|
|
|
|
repairProcess_destruct(&mainRepairProcess);
|
|
}
|
|
|
|
|
|
static ErrorStatus repairProcesses_feedMainRepairProcessSecondsCounter(const void* const data)
|
|
{
|
|
repairProcess_feedSecondsCounterFromISR(&mainRepairProcess);
|
|
return SUCCESS;
|
|
}
|
|
|
|
|
|
ErrorStatus repairProcesses_mainRepairProcessAddObserver (const Observer observer)
|
|
{
|
|
return Observable_addObserver(&mainRepairProcess.observable, observer);
|
|
}
|
|
|
|
|
|
void repairProcesses_mainRepairProcessRemoveObserver (const Observer observer)
|
|
{
|
|
Observable_deleteObserver(&mainRepairProcess.observable, observer);
|
|
}
|
|
|
|
|
|
struct RepairProcess* repairProcesses_getMainRepairProcess(void)
|
|
{
|
|
return &mainRepairProcess;
|
|
}
|