Added buzzer
Added powerloss detector Added buzzer behaviour to system. Added powerloss behaviour to system Added french translation to menu texts git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@359 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -24,6 +24,7 @@ ARFLAGS = rs
|
|||||||
|
|
||||||
OBJECTS = \
|
OBJECTS = \
|
||||||
ADCDevice.o \
|
ADCDevice.o \
|
||||||
|
Buzzer.o \
|
||||||
CachedStorage.o \
|
CachedStorage.o \
|
||||||
CoverSolenoid.o \
|
CoverSolenoid.o \
|
||||||
crc32.o \
|
crc32.o \
|
||||||
|
|||||||
@@ -0,0 +1,161 @@
|
|||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
/// @file Buzzer.h
|
||||||
|
/// @brief File 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) 2015 Micro-Key bv
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// @defgroup {group_name} {group_description}
|
||||||
|
/// Description
|
||||||
|
|
||||||
|
/// @file Buzzer.h
|
||||||
|
/// @ingroup {group_name}
|
||||||
|
|
||||||
|
#ifndef INC_BUZZER_H_
|
||||||
|
#define INC_BUZZER_H_
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Include files
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "semphr.h"
|
||||||
|
|
||||||
|
#include "stm32f10x.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Constant and macro definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define BUZZER_MIN_PULSEWIDTH_MS (10)
|
||||||
|
#define BUZZER_KEYPAD_PULSEWIDTH_MS (60)
|
||||||
|
#define BUZZER_ERROR_PULSEWIDTH_MS (1000)
|
||||||
|
#define BUZZER_WARNING_PULSEWIDTH_MS (500)
|
||||||
|
|
||||||
|
#define BUZZER_KEYPAD_ACKNOWLEDGE(self) \
|
||||||
|
Buzzer_singleTone(self, BUZZER_KEYPAD_PULSEWIDTH_MS)
|
||||||
|
|
||||||
|
#define BUZZER_ERROR(self) \
|
||||||
|
Buzzer_start(self, BUZZER_ERROR_PULSEWIDTH_MS)
|
||||||
|
|
||||||
|
#define BUZZER_WARNING(self) \
|
||||||
|
Buzzer_start(self, BUZZER_WARNING_PULSEWIDTH_MS)
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Type definitions.
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
struct Buzzer
|
||||||
|
{
|
||||||
|
// General
|
||||||
|
bool initialized;
|
||||||
|
struct Gpio* gpio;
|
||||||
|
// Functionary properties
|
||||||
|
unsigned int pulseWidth;
|
||||||
|
// Task properties
|
||||||
|
bool runTask;
|
||||||
|
bool runPeriodically;
|
||||||
|
SemaphoreHandle_t semaphore;
|
||||||
|
xTaskHandle taskHandle;
|
||||||
|
int taskPriority;
|
||||||
|
uint16_t stackSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Function declarations
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* Buzzer_construct
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
* @param self
|
||||||
|
* @param gpio
|
||||||
|
* @param taskPriority
|
||||||
|
* @param stackSize
|
||||||
|
*
|
||||||
|
* @return ErrorStatus
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern ErrorStatus Buzzer_construct(struct Buzzer* self, struct Gpio* gpio, int taskPriority, uint16_t stackSize);
|
||||||
|
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* Buzzer_destruct
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
* @param self
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern void Buzzer_destruct(struct Buzzer* self);
|
||||||
|
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* Buzzer_start
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
* @param self
|
||||||
|
* @param pulseWidth
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern void Buzzer_start(struct Buzzer* self, unsigned int pulseWidth);
|
||||||
|
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* Buzzer_stop
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
* @param self
|
||||||
|
* @param
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern void Buzzer_stop(struct Buzzer* self);
|
||||||
|
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* Buzzer_singleTone
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
* @param self
|
||||||
|
* @param pulseWidth
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern void Buzzer_singleTone(struct Buzzer* self, unsigned int pulseWidth);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* INC_BUZZER_H_ */
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
/// @file Buzzer.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 Buzzer.c
|
||||||
|
/// @ingroup {group_name}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Include files
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "Buzzer.h"
|
||||||
|
#include "gpio.h"
|
||||||
|
#include "IODevice.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Constant and macro definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Type definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// File-scope variables
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Function declarations
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void BuzzerTask(void* parameters);
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Function definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ErrorStatus Buzzer_construct(struct Buzzer* self, struct Gpio* gpio, int taskPriority, uint16_t stackSize)
|
||||||
|
{
|
||||||
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
|
if (!self->initialized)
|
||||||
|
{
|
||||||
|
if (returnValue == SUCCESS)
|
||||||
|
{
|
||||||
|
if (gpio != NULL)
|
||||||
|
{
|
||||||
|
self->gpio = gpio;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnValue = ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (returnValue == SUCCESS)
|
||||||
|
{
|
||||||
|
self->taskPriority = taskPriority;
|
||||||
|
self->stackSize = stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (returnValue == SUCCESS)
|
||||||
|
{
|
||||||
|
vSemaphoreCreateBinary(self->semaphore);
|
||||||
|
self->runPeriodically = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BaseType_t ctReturn = 0;
|
||||||
|
if (returnValue == SUCCESS)
|
||||||
|
{
|
||||||
|
self->runTask = true;
|
||||||
|
ctReturn = xTaskCreate(BuzzerTask, (const char*)"BuzzerTask", self->stackSize, self, self->taskPriority, &self->taskHandle);
|
||||||
|
}
|
||||||
|
if (ctReturn != pdPASS)
|
||||||
|
{
|
||||||
|
returnValue = ERROR;
|
||||||
|
LOGGER_ERROR(mainLog, "Buzzer task failed to create with error %d", (int)ctReturn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self->initialized = true;
|
||||||
|
LOGGER_INFO(mainLog, "Buzzer task created successfully");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnValue = ERROR;
|
||||||
|
}
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern void Buzzer_destruct(struct Buzzer* self)
|
||||||
|
{
|
||||||
|
self->runTask = false;
|
||||||
|
self->initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Buzzer_start(struct Buzzer* self, unsigned int pulseWidth)
|
||||||
|
{
|
||||||
|
if (self->initialized)
|
||||||
|
{
|
||||||
|
if (pulseWidth >= BUZZER_MIN_PULSEWIDTH_MS)
|
||||||
|
{
|
||||||
|
self->pulseWidth = pulseWidth;
|
||||||
|
xSemaphoreGive(self->semaphore);
|
||||||
|
self->runPeriodically = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Buzzer_stop(struct Buzzer* self)
|
||||||
|
{
|
||||||
|
if (self->initialized)
|
||||||
|
{
|
||||||
|
self->runPeriodically = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Buzzer_singleTone(struct Buzzer* self, unsigned int pulseWidth)
|
||||||
|
{
|
||||||
|
if (self->initialized)
|
||||||
|
{
|
||||||
|
self->runPeriodically = false;
|
||||||
|
self->pulseWidth = pulseWidth;
|
||||||
|
xSemaphoreGive(self->semaphore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void BuzzerTask(void* parameters)
|
||||||
|
{
|
||||||
|
char cTrue = (char)true;
|
||||||
|
char cFalse = (char)false;
|
||||||
|
struct Buzzer* self = (struct Buzzer*)parameters;
|
||||||
|
|
||||||
|
while (self->runTask)
|
||||||
|
{
|
||||||
|
xSemaphoreTake(self->semaphore, portMAX_DELAY);
|
||||||
|
|
||||||
|
IODevice_write(&self->gpio->device, &cTrue, 1);
|
||||||
|
vTaskDelay(self->pulseWidth);
|
||||||
|
IODevice_write(&self->gpio->device, &cFalse, 1);
|
||||||
|
vTaskDelay(self->pulseWidth);
|
||||||
|
|
||||||
|
// For periodic use, give semaphore
|
||||||
|
if (self->runPeriodically)
|
||||||
|
{
|
||||||
|
xSemaphoreGive(self->semaphore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOGGER_INFO(mainLog, "Deleting task %s", pcTaskGetTaskName(self->taskHandle));
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
@@ -42,9 +42,9 @@
|
|||||||
|
|
||||||
struct HighVoltageDetection
|
struct HighVoltageDetection
|
||||||
{
|
{
|
||||||
struct IODevice* hv0;
|
struct Gpio* hv0;
|
||||||
struct IODevice* hv1;
|
struct Gpio* hv1;
|
||||||
struct IODevice* hv2;
|
struct Gpio* hv2;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -71,9 +71,9 @@ ErrorStatus HighVoltageDetection_construct(struct Gpio* HV0_gpio, struct Gpio* H
|
|||||||
|
|
||||||
if (!hvDetection->initialized)
|
if (!hvDetection->initialized)
|
||||||
{
|
{
|
||||||
hvDetection->hv0 = &HV0_gpio->device;
|
hvDetection->hv0 = HV0_gpio;
|
||||||
hvDetection->hv1 = &HV1_gpio->device;
|
hvDetection->hv1 = HV1_gpio;
|
||||||
hvDetection->hv2 = &HV2_gpio->device;
|
hvDetection->hv2 = HV2_gpio;
|
||||||
hvDetection->initialized = true;
|
hvDetection->initialized = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -102,10 +102,11 @@ bool HighVoltageDetection_isVoltagePresent(void)
|
|||||||
char value0;
|
char value0;
|
||||||
char value1;
|
char value1;
|
||||||
char value2;
|
char value2;
|
||||||
|
size_t al;
|
||||||
|
|
||||||
IODevice_read(hvDetection->hv0, &value0, 1, NULL);
|
IODevice_read((struct IODevice*)hvDetection->hv0, &value0, 1, &al);
|
||||||
IODevice_read(hvDetection->hv1, &value1, 1, NULL);
|
IODevice_read((struct IODevice*)hvDetection->hv1, &value1, 1, &al);
|
||||||
IODevice_read(hvDetection->hv2, &value2, 1, NULL);
|
IODevice_read((struct IODevice*)hvDetection->hv2, &value2, 1, &al);
|
||||||
|
|
||||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||||
{
|
{
|
||||||
@@ -127,5 +128,6 @@ bool HighVoltageDetection_isVoltagePresent(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,8 +157,9 @@ extern bool Led_getStatus(Led led)
|
|||||||
{
|
{
|
||||||
char valueRed;
|
char valueRed;
|
||||||
char valueGreen;
|
char valueGreen;
|
||||||
IODevice_read(self.leds[LED_BICOLOR_RED].ioDevice, &valueRed, 1, NULL);
|
size_t al;
|
||||||
IODevice_read(self.leds[LED_BICOLOR_GREEN].ioDevice, &valueGreen, 1, NULL);
|
IODevice_read(self.leds[LED_BICOLOR_RED].ioDevice, &valueRed, 1, &al);
|
||||||
|
IODevice_read(self.leds[LED_BICOLOR_GREEN].ioDevice, &valueGreen, 1, &al);
|
||||||
if ((valueRed != (char)false) && (valueGreen != (char)false))
|
if ((valueRed != (char)false) && (valueGreen != (char)false))
|
||||||
{
|
{
|
||||||
returnValue = true;
|
returnValue = true;
|
||||||
@@ -167,7 +168,8 @@ extern bool Led_getStatus(Led led)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char value;
|
char value;
|
||||||
IODevice_read(self.leds[led].ioDevice, &value, 1, NULL);
|
size_t al;
|
||||||
|
IODevice_read(self.leds[led].ioDevice, &value, 1, &al);
|
||||||
if (value != (char)false)
|
if (value != (char)false)
|
||||||
{
|
{
|
||||||
returnValue = true;
|
returnValue = true;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ typedef struct
|
|||||||
GPIO_InitTypeDef GPIO_InitStruct;
|
GPIO_InitTypeDef GPIO_InitStruct;
|
||||||
} T_PL_GPIO;
|
} T_PL_GPIO;
|
||||||
|
|
||||||
|
extern struct Buzzer* mainBuzzer;
|
||||||
extern struct Logger* mainLog;
|
extern struct Logger* mainLog;
|
||||||
|
|
||||||
// Export of ADCs
|
// Export of ADCs
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ ErrorStatus Keypad_construct(struct Keypad* self, size_t numberOfRows, size_t nu
|
|||||||
|
|
||||||
if(returnValue == SUCCESS)
|
if(returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
|
///TODO THIS SHOULD BE SELF INSTEAD OF KEYPAD, RIGHT?
|
||||||
xTaskCreate(KeypadTask, (const char*)"keypadTask", self->stackSize, keypad, self->taskPriority, &self->taskHandle);
|
xTaskCreate(KeypadTask, (const char*)"keypadTask", self->stackSize, keypad, self->taskPriority, &self->taskHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
#include "Buzzer.h"
|
||||||
#include "CathodeMCP.h"
|
#include "CathodeMCP.h"
|
||||||
#include "CoverSolenoid.h"
|
#include "CoverSolenoid.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
@@ -85,6 +86,10 @@
|
|||||||
#define SPI_LCD_RX_QUEUE (32)
|
#define SPI_LCD_RX_QUEUE (32)
|
||||||
#define SPI_LCD_TX_QUEUE (32)
|
#define SPI_LCD_TX_QUEUE (32)
|
||||||
|
|
||||||
|
// Buzzer Settings
|
||||||
|
#define BUZZER_STACK_SIZE (128)
|
||||||
|
#define BUZZER_TASK_PRIORITY (3)
|
||||||
|
|
||||||
// Keypad Settings
|
// Keypad Settings
|
||||||
#define KEYPAD_DEBOUNCE_TIME_MS (20)
|
#define KEYPAD_DEBOUNCE_TIME_MS (20)
|
||||||
#define KEYPAD_STACK_SIZE (128)
|
#define KEYPAD_STACK_SIZE (128)
|
||||||
@@ -107,6 +112,8 @@
|
|||||||
|
|
||||||
// Logger
|
// Logger
|
||||||
static struct Logger _mainLog = {.initialized = false};
|
static struct Logger _mainLog = {.initialized = false};
|
||||||
|
// Buzzer
|
||||||
|
static struct Buzzer _mainBuzzer = {.initialized = false};
|
||||||
|
|
||||||
// ADC
|
// ADC
|
||||||
static struct Adc _adc1 = {.initialized = false};
|
static struct Adc _adc1 = {.initialized = false};
|
||||||
@@ -170,6 +177,8 @@ static struct MAX5715 _max5715 = {.initialized = false};
|
|||||||
|
|
||||||
struct Logger* mainLog = &_mainLog;
|
struct Logger* mainLog = &_mainLog;
|
||||||
|
|
||||||
|
struct Buzzer* mainBuzzer = &_mainBuzzer;
|
||||||
|
|
||||||
struct Adc* const adc1 = &_adc1;
|
struct Adc* const adc1 = &_adc1;
|
||||||
struct AdcParameters* adc1Parameters = &_adc1Parameters;
|
struct AdcParameters* adc1Parameters = &_adc1Parameters;
|
||||||
|
|
||||||
@@ -349,20 +358,20 @@ static ErrorStatus initIO (void)
|
|||||||
// Init LED Orange on DevKit
|
// Init LED Orange on DevKit
|
||||||
ledInternOrange->gpio = configureGPIO(GPIOC, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_7);
|
ledInternOrange->gpio = configureGPIO(GPIOC, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_7);
|
||||||
// Init LED Green of BiColour led
|
// Init LED Green of BiColour led
|
||||||
ledBicolourGreen->gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource11);
|
ledBicolourGreen->gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_11);
|
||||||
// Init LED Red of BiColour led
|
// Init LED Red of BiColour led
|
||||||
ledBicolourRed->gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource13);
|
ledBicolourRed->gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_13);
|
||||||
|
|
||||||
/* BUZZER initialisation -------------------------------------------------*/
|
/* BUZZER initialisation -------------------------------------------------*/
|
||||||
buzzer->gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource12);
|
buzzer->gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_12);
|
||||||
|
|
||||||
/* HIGH VOLTAGE PRESENT initialisation -----------------------------------*/
|
/* HIGH VOLTAGE PRESENT initialisation -----------------------------------*/
|
||||||
// HV0 Present
|
// HV0 Present
|
||||||
hv0Present->gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource12);
|
hv0Present->gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_12);
|
||||||
// HV1 Present
|
// HV1 Present
|
||||||
hv1Present->gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource13);
|
hv1Present->gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_13);
|
||||||
// HV2 Present
|
// HV2 Present
|
||||||
hv2Present->gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource14);
|
hv2Present->gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_4);
|
||||||
|
|
||||||
/* ADC1 initialisation ---------------------------------------------------*/
|
/* ADC1 initialisation ---------------------------------------------------*/
|
||||||
// Channel 0 - PA0
|
// Channel 0 - PA0
|
||||||
@@ -654,6 +663,9 @@ static ErrorStatus initPeriphery(void)
|
|||||||
// Solenoid
|
// Solenoid
|
||||||
GPIO_construct(solenoid, OUTPUT, solenoid->gpio);
|
GPIO_construct(solenoid, OUTPUT, solenoid->gpio);
|
||||||
|
|
||||||
|
// Buzzer
|
||||||
|
GPIO_construct(buzzer, OUTPUT, buzzer->gpio);
|
||||||
|
|
||||||
// HV detection
|
// HV detection
|
||||||
GPIO_construct(hv0Present, INPUT, hv0Present->gpio);
|
GPIO_construct(hv0Present, INPUT, hv0Present->gpio);
|
||||||
GPIO_construct(hv1Present, INPUT, hv1Present->gpio);
|
GPIO_construct(hv1Present, INPUT, hv1Present->gpio);
|
||||||
@@ -814,6 +826,14 @@ static ErrorStatus initPlatformDevices (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------*/
|
||||||
|
/* SIMPLE IO BUZZER */
|
||||||
|
/* --------------------------------------------------------------------*/
|
||||||
|
if (returnValue == SUCCESS)
|
||||||
|
{
|
||||||
|
returnValue = Buzzer_construct(mainBuzzer, buzzer, BUZZER_TASK_PRIORITY, BUZZER_STACK_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ MenuCore.o \
|
|||||||
MenuElements.o \
|
MenuElements.o \
|
||||||
PIDParameters.o \
|
PIDParameters.o \
|
||||||
PIN.o \
|
PIN.o \
|
||||||
|
PowerLossDetector.o \
|
||||||
repairMenu.o \
|
repairMenu.o \
|
||||||
repairMenus.o \
|
repairMenus.o \
|
||||||
RepairPreset.o \
|
RepairPreset.o \
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
ERROR_POWER_LOSS,
|
||||||
GPIO_FAIL,
|
GPIO_FAIL,
|
||||||
INTERLOCK_COMMON_FAIL,
|
INTERLOCK_COMMON_FAIL,
|
||||||
POWERENABLE_FAIL,
|
POWERENABLE_FAIL,
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
|
|
||||||
|
#include "Buzzer.h"
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
#include "KeyboardDevice.h"
|
#include "KeyboardDevice.h"
|
||||||
#include "MenuStates.h"
|
#include "MenuStates.h"
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
|
|
||||||
#define MENUCORE_MAX_NUMBER_OF_ROWS (11)
|
#define MENUCORE_MAX_NUMBER_OF_ROWS (11)
|
||||||
#define MENUCORE_MAX_NUMBER_OF_KEYS (16)
|
#define MENUCORE_MAX_NUMBER_OF_KEYS (16)
|
||||||
#define MENUCORE_DISPLAY_ROW_LENGTH (20)
|
#define MENUCORE_DISPLAY_ROW_LENGTH (21)
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Type definitions.
|
// Type definitions.
|
||||||
@@ -100,6 +101,7 @@ struct MenuCore
|
|||||||
struct MenuPage menuArray[RM_NUMBER_OF_MENUS];
|
struct MenuPage menuArray[RM_NUMBER_OF_MENUS];
|
||||||
struct Display* display;
|
struct Display* display;
|
||||||
struct KeyboardDevice* keyboardDevice;
|
struct KeyboardDevice* keyboardDevice;
|
||||||
|
struct Buzzer* buzzer;
|
||||||
char errorMessage[MENUCORE_DISPLAY_ROW_LENGTH + 1];
|
char errorMessage[MENUCORE_DISPLAY_ROW_LENGTH + 1];
|
||||||
char warningMessage[MENUCORE_DISPLAY_ROW_LENGTH + 1];
|
char warningMessage[MENUCORE_DISPLAY_ROW_LENGTH + 1];
|
||||||
TaskHandle_t taskHandle;
|
TaskHandle_t taskHandle;
|
||||||
@@ -130,6 +132,8 @@ struct MenuCore
|
|||||||
* @param self Menu core object to construct
|
* @param self Menu core object to construct
|
||||||
* @param display Display device to use for output
|
* @param display Display device to use for output
|
||||||
* @param keyboardDevice KeyboardDevice for menu input
|
* @param keyboardDevice KeyboardDevice for menu input
|
||||||
|
* @param buzzer A buzzer that gives audible feedback
|
||||||
|
* when a VALID key is pressed
|
||||||
* @param taskPriority Priority for the menu task
|
* @param taskPriority Priority for the menu task
|
||||||
* @param stacksize Task stacksize
|
* @param stacksize Task stacksize
|
||||||
* @param createMenu Functionpointer to a function that
|
* @param createMenu Functionpointer to a function that
|
||||||
@@ -149,7 +153,7 @@ struct MenuCore
|
|||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
extern ErrorStatus MenuCore_construct(struct MenuCore* self, struct Display* display, struct KeyboardDevice* keyboardDevice, int taskPriority, uint16_t stackSize, MenuCoreFunctionCall createMenu, MenuCoreFunctionCall stateHandle);
|
extern ErrorStatus MenuCore_construct(struct MenuCore* self, struct Display* display, struct KeyboardDevice* keyboardDevice, struct Buzzer* buzzer, int taskPriority, uint16_t stackSize, MenuCoreFunctionCall createMenu, MenuCoreFunctionCall stateHandle);
|
||||||
|
|
||||||
|
|
||||||
/** ----------------------------------------------------------------------------
|
/** ----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ static const char MenuText_WARNING[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_ROW1_P
|
|||||||
"!!WARNING!!"
|
"!!WARNING!!"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"!!ATTENTION!!"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ static const char MenuText_WARNING_COVER_OPEN[MENUTEXT_NUMBER_OF_LANGUAGES][MENU
|
|||||||
"COVER OPEN"
|
"COVER OPEN"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"CAPOT OUVERT"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ static const char MenuText_ERROR[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_ROW1_POP
|
|||||||
"!!ERROR!!"
|
"!!ERROR!!"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"ERREUR!!"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -98,10 +98,20 @@ static const char MenuText_ERROR_COVER_OPEN[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTE
|
|||||||
"COVER OPEN"
|
"COVER OPEN"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"CAPOT OUVERT"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char MenuText_ERROR_POWER_LOSS[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_POPUP_MESSAGE_LENGTH] =
|
||||||
|
{
|
||||||
|
// MAX 20 CHARACTERS
|
||||||
|
{
|
||||||
|
"POWERLOSS DETECTED"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
//FRENCH TBW
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static const char MenuText_ERROR_PROCESS_FAILED[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_POPUP_MESSAGE_LENGTH] =
|
static const char MenuText_ERROR_PROCESS_FAILED[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_POPUP_MESSAGE_LENGTH] =
|
||||||
{
|
{
|
||||||
@@ -110,7 +120,7 @@ static const char MenuText_ERROR_PROCESS_FAILED[MENUTEXT_NUMBER_OF_LANGUAGES][ME
|
|||||||
"PROCESS FAILED"
|
"PROCESS FAILED"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"PROCESS ECHOUE"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -121,7 +131,7 @@ static const char MenuText_ERROR_CRC_PIN[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_
|
|||||||
"PIN CRC ERROR"
|
"PIN CRC ERROR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"ERREUR PIN CRC"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -132,7 +142,7 @@ static const char MenuText_ERROR_CRC_PARAMETERS[MENUTEXT_NUMBER_OF_LANGUAGES][ME
|
|||||||
"PARAMETERS CRC ERROR"
|
"PARAMETERS CRC ERROR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"ERREUR PARAMETRE CRC"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -143,7 +153,7 @@ static const char MenuText_ERROR_CRC_PRESETS[MENUTEXT_NUMBER_OF_LANGUAGES][MENUT
|
|||||||
"PRESETS CRC ERROR"
|
"PRESETS CRC ERROR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"ERREUR PREREGL. CRC"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -158,7 +168,7 @@ static const char MenuText_X_CONTINUE[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_POP
|
|||||||
"Hit X to continue"
|
"Hit X to continue"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Continuer : touche X"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -172,7 +182,10 @@ static const char MenuText_REPAIR_SCREEN[MENUTEXT_NUMBER_OF_LANGUAGES][4][MENUTE
|
|||||||
"ERROR" // Error identifier in case a ROW is in error-state. Will be written instead of the current voltage
|
"ERROR" // Error identifier in case a ROW is in error-state. Will be written instead of the current voltage
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"total",
|
||||||
|
"reste",
|
||||||
|
"R",
|
||||||
|
"ERREUR"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -183,7 +196,7 @@ static const char MenuText_REPAIR_SCREEN_INIT[MENUTEXT_NUMBER_OF_LANGUAGES][MENU
|
|||||||
"Initialising" // Indicates start of a repair
|
"Initialising" // Indicates start of a repair
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Initialisation"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -198,7 +211,11 @@ static const char MenuText_PAUSE[MENUTEXT_NUMBER_OF_LANGUAGES][5][MENUTEXT_POPUP
|
|||||||
"Hit X to RESET"
|
"Hit X to RESET"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"TRAITEMENT EN COURS",
|
||||||
|
"Pause : touche x",
|
||||||
|
"!!PAUSE!!",
|
||||||
|
"Continuer: ENTREE",
|
||||||
|
"R<EFBFBD>init : touche X"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -210,7 +227,8 @@ static const char MenuText_FINISH[MENUTEXT_NUMBER_OF_LANGUAGES][2][MENUTEXT_POPU
|
|||||||
"Hit ENT to continue",
|
"Hit ENT to continue",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"TRAITEMENT TERMINE",
|
||||||
|
"Continuer : ENTREE"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -225,7 +243,11 @@ static const char MenuText_PRINT_PRESET[MENUTEXT_NUMBER_OF_LANGUAGES][5][MENUTEX
|
|||||||
"Volt:"
|
"Volt:"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Preset",
|
||||||
|
"info",
|
||||||
|
"Start:",
|
||||||
|
"Temps:",
|
||||||
|
"Volt:"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -237,7 +259,8 @@ static const char MenuText_CHANGE_PIN[MENUTEXT_NUMBER_OF_LANGUAGES][2][MENUTEXT_
|
|||||||
" Repeat PIN:"
|
" Repeat PIN:"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
" Nouveau PIN:",
|
||||||
|
"Confirmer PIN:"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -250,7 +273,9 @@ static const char MenuText_INTERLOCK_STATUS[MENUTEXT_NUMBER_OF_LANGUAGES][3][MEN
|
|||||||
"open"
|
"open"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Le capot est :",
|
||||||
|
"ferme",
|
||||||
|
"ouvert"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -262,7 +287,8 @@ static const char MenuText_CONFIRM_PIN[MENUTEXT_NUMBER_OF_LANGUAGES][2][MENUTEXT
|
|||||||
"PIN DENIED"
|
"PIN DENIED"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"PIN OK",
|
||||||
|
"PIN REFUSE"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -274,7 +300,8 @@ static const char MenuText_CONFIRM_NEW_PIN[MENUTEXT_NUMBER_OF_LANGUAGES][2][MENU
|
|||||||
"New PIN denied"
|
"New PIN denied"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Nouveau PIN accept<70>",
|
||||||
|
"Nouveau PIN refus<75>"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -285,7 +312,7 @@ static const char MenuText_SAFE_PRESET[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_PO
|
|||||||
"Preset saved"
|
"Preset saved"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Pr<EFBFBD>r<EFBFBD>gl. sauvegard<72>"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -296,7 +323,7 @@ static const char MenuText_SELECT_PRESET[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_
|
|||||||
"Selected preset:"
|
"Selected preset:"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Pr<EFBFBD>r<EFBFBD>glage n<> :"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -308,7 +335,7 @@ static const char MenuText_SAFE_CONSTANTS[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT
|
|||||||
"Constants saved"
|
"Constants saved"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Valeurs sauvegard<72>es"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -319,7 +346,7 @@ static const char MenuText_INSERT_PIN[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_POP
|
|||||||
"Insert PIN"
|
"Insert PIN"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Ecrire PIN"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -330,7 +357,7 @@ static const char MenuText_VOLTAGE_IN_HEADER[MENUTEXT_NUMBER_OF_LANGUAGES][MENUT
|
|||||||
"Get voltage in"
|
"Get voltage in"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Lecture tension"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -341,7 +368,7 @@ static const char MenuText_VOLTAGE_OUT_HEADER[MENUTEXT_NUMBER_OF_LANGUAGES][MENU
|
|||||||
"Set voltage out"
|
"Set voltage out"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"R<EFBFBD>glage tension"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -352,7 +379,7 @@ static const char MenuText_VOLTAGE_ROW[MENUTEXT_NUMBER_OF_LANGUAGES][5] =
|
|||||||
"Row"
|
"Row"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Ligne"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -363,7 +390,7 @@ static const char MenuText_CONSTANTS_HEADER[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTE
|
|||||||
"PID constants"
|
"PID constants"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Valeurs du PID"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -375,7 +402,8 @@ static const char MenuText_VOLTAGE_OUT_CLEANUP[MENUTEXT_NUMBER_OF_LANGUAGES][2][
|
|||||||
"Press X to continue"
|
"Press X to continue"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Ttes les lignes <20> 0V",
|
||||||
|
"Continuer : touche X"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -392,7 +420,10 @@ static const char MenuText_MAINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_N
|
|||||||
" 3.Calibration"
|
" 3.Calibration"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"",
|
||||||
|
" 1.Traitement tubes",
|
||||||
|
" 2.Mode Admin",
|
||||||
|
" 3.Mode Calibration"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -405,7 +436,9 @@ static const char MenuText_CATHODEMCP_SELECT[MENUTEXT_NUMBER_OF_LANGUAGES][MENUC
|
|||||||
" 2.MCP repair",
|
" 2.MCP repair",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Traitement tubes",
|
||||||
|
" 1.Traitement Pk",
|
||||||
|
" 2.Traitement GMC"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -418,7 +451,9 @@ static const char MenuText_ADMIN_CATHODEMCP_SELECT[MENUTEXT_NUMBER_OF_LANGUAGES]
|
|||||||
" 2.MCP",
|
" 2.MCP",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Mode Administrateur",
|
||||||
|
" 1.Photocathode",
|
||||||
|
" 2.GMC"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -432,7 +467,9 @@ static const char MenuText_REPAIRMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX
|
|||||||
" 2.Start",
|
" 2.Start",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Traitement tubes",
|
||||||
|
" 1.S<>lection pr<70>r<EFBFBD>g",
|
||||||
|
" 2.D<>marrer"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -453,7 +490,17 @@ static const char MenuText_PRESETMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX
|
|||||||
" 9.Preset 9",
|
" 9.Preset 9",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"S<EFBFBD>lection pr<70>r<EFBFBD>glage",
|
||||||
|
" 1.Pr<50>r<EFBFBD>glage n<>1",
|
||||||
|
" 2.Pr<50>r<EFBFBD>glage n<>2",
|
||||||
|
" 3.Pr<50>r<EFBFBD>glage n<>3",
|
||||||
|
" 4.Pr<50>r<EFBFBD>glage n<>4",
|
||||||
|
" 5.Pr<50>r<EFBFBD>glage n<>5",
|
||||||
|
" 6.Pr<50>r<EFBFBD>glage n<>6",
|
||||||
|
" 7.Pr<50>r<EFBFBD>glage n<>7",
|
||||||
|
" 8.Pr<50>r<EFBFBD>glage n<>8",
|
||||||
|
" 9.Pr<50>r<EFBFBD>glage n<>9",
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -475,7 +522,12 @@ static const char MenuText_ADMINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_
|
|||||||
" 5.Info & Version",
|
" 5.Info & Version",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Mode Administrateur",
|
||||||
|
" 1.Modifier PIN",
|
||||||
|
" 2.Contr<74>le des E/S",
|
||||||
|
" 3.Config. Pr<50>r<EFBFBD>gl.",
|
||||||
|
" 4.Valeurs du PID",
|
||||||
|
" 5.Info & Version"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -487,7 +539,7 @@ static const char MenuText_ADMINCHANGEPINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENU
|
|||||||
"Change PIN",
|
"Change PIN",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Modifier PIN"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -504,7 +556,12 @@ static const char MenuText_ADMINIOMAINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCOR
|
|||||||
" 5.Teslagun relais",
|
" 5.Teslagun relais",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Contr<EFBFBD>le des E/S",
|
||||||
|
" 1.Interlock",
|
||||||
|
" 2.Sol<6F>no<6E>des",
|
||||||
|
" 3.Lecture tension",
|
||||||
|
" 4.R<>glage tension",
|
||||||
|
" 5.Relai TeslaGun"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -517,7 +574,7 @@ static const char MenuText_ADMINIOINTERLOCKMENU[MENUTEXT_NUMBER_OF_LANGUAGES][ME
|
|||||||
"Read interlock",
|
"Read interlock",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Lecture interlock"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -533,24 +590,8 @@ static const char MenuText_ADMINSOLENOIDMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUC
|
|||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Sol<EFBFBD>no<EFBFBD>des",
|
||||||
}
|
"Basculer : touche 0"
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Administration Get Voltage output screen
|
|
||||||
static const char MenuText_ADMINVOLTAGOUTMAINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
|
|
||||||
{
|
|
||||||
// MAX 20 CHARACTERS - MIND THE TWO BLANKS AT STRING START - THIS IS WHERE THE CURSOR IS PUT
|
|
||||||
{
|
|
||||||
"Set voltage out",
|
|
||||||
" 1.Channel 1",
|
|
||||||
" 2.Channel 2",
|
|
||||||
" 3.Channel 3",
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
//FRENCH TBW
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -566,7 +607,8 @@ static const char MenuText_ADMINTESLAGUNMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUC
|
|||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Relai du TeslaGun",
|
||||||
|
"Basculer : touche 0"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -588,7 +630,16 @@ static const char MenuText_ADMINPRESETCONFIGSELECTMENU[MENUTEXT_NUMBER_OF_LANGUA
|
|||||||
" 9.Preset 9 config",
|
" 9.Preset 9 config",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Config. Pr<50>r<EFBFBD>gl.",
|
||||||
|
" 1 Pr<50>r<EFBFBD>gl 1 config",
|
||||||
|
" 2 Pr<50>r<EFBFBD>gl 2 config",
|
||||||
|
" 3 Pr<50>r<EFBFBD>gl 3 config",
|
||||||
|
" 4 Pr<50>r<EFBFBD>gl 4 config",
|
||||||
|
" 5 Pr<50>r<EFBFBD>gl 5 config",
|
||||||
|
" 6 Pr<50>r<EFBFBD>gl 6 config",
|
||||||
|
" 7 Pr<50>r<EFBFBD>gl 7 config",
|
||||||
|
" 8 Pr<50>r<EFBFBD>gl 8 config",
|
||||||
|
" 9 Pr<50>r<EFBFBD>gl 9 config",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -601,7 +652,7 @@ static const char MenuText_ADMININFOMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_
|
|||||||
"Info & Version",
|
"Info & Version",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Info & Version",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -614,11 +665,12 @@ static const char MenuText_CALIBRATIONMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCOR
|
|||||||
// MAX 20 CHARACTERS - MIND THE TWO BLANKS AT STRING START - THIS IS WHERE THE CURSOR IS PUT
|
// MAX 20 CHARACTERS - MIND THE TWO BLANKS AT STRING START - THIS IS WHERE THE CURSOR IS PUT
|
||||||
{
|
{
|
||||||
"Calibration",
|
"Calibration",
|
||||||
" 1.NOTHING YET",
|
" 1.To be written",
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//FRENCH TBW
|
"Calibration",
|
||||||
|
" 1.En construction"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
/// @file PowerLossDetector.h
|
||||||
|
/// @brief File 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) 2015 Micro-Key bv
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// @defgroup {group_name} {group_description}
|
||||||
|
/// Description
|
||||||
|
|
||||||
|
/// @file PowerLossDetector.h
|
||||||
|
/// @ingroup {group_name}
|
||||||
|
|
||||||
|
#ifndef POWERLOSSDETECTOR_H_
|
||||||
|
#define POWERLOSSDETECTOR_H_
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Include files
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "stm32f10x.h"
|
||||||
|
|
||||||
|
#include "CachedStorage.h"
|
||||||
|
#include "MemoryDevice.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Constant and macro definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Type definitions.
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Function declarations
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* PowerLossDetector_construct
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
* @param memoryDevice
|
||||||
|
*
|
||||||
|
* @return ErrorStatus
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern ErrorStatus PowerLossDetector_construct(struct MemoryDevice* memoryDevice, unsigned int pageNumber, unsigned int startAddress, unsigned int length);
|
||||||
|
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* PowerLossDetector_destruct
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern void PowerLossDetector_destruct(void);
|
||||||
|
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* PowerLossDetector_setBusyFlag
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern void PowerLossDetector_setBusyFlag(void);
|
||||||
|
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* PowerLossDetector_clearBusyFlag
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern void PowerLossDetector_clearBusyFlag(void);
|
||||||
|
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* PowerLossDetection_isFlagSet
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern bool PowerLossDetection_isFlagSet(void);
|
||||||
|
|
||||||
|
#endif /* POWERLOSSDETECTOR_H_ */
|
||||||
@@ -54,8 +54,6 @@
|
|||||||
#define HSB_MAINREPR_OOL_DURATION (20)
|
#define HSB_MAINREPR_OOL_DURATION (20)
|
||||||
#define HSB_MAINREPR_OOL_VALUE (300)
|
#define HSB_MAINREPR_OOL_VALUE (300)
|
||||||
|
|
||||||
#define HSB_SECURITY_VOLTAGE_THRESHOLD (100)
|
|
||||||
|
|
||||||
#define HSB_ADC_ANODE_MIN_VOLTAGE (0)
|
#define HSB_ADC_ANODE_MIN_VOLTAGE (0)
|
||||||
#define HSB_ADC_ANODE_MAX_VOLTAGE (10042)
|
#define HSB_ADC_ANODE_MAX_VOLTAGE (10042)
|
||||||
#define HSB_ADC_CMCP_MIN_VOLTAGE (0)
|
#define HSB_ADC_CMCP_MIN_VOLTAGE (0)
|
||||||
@@ -72,7 +70,6 @@
|
|||||||
|
|
||||||
|
|
||||||
// FLASH ADDRESSES FOR DATA STORAGE
|
// FLASH ADDRESSES FOR DATA STORAGE
|
||||||
|
|
||||||
// Define storage for presets, which is the biggest storage part
|
// Define storage for presets, which is the biggest storage part
|
||||||
// Each set of presets is written/saved on a dedicated page. This reduces
|
// Each set of presets is written/saved on a dedicated page. This reduces
|
||||||
// cache size when erasing page prior to write
|
// cache size when erasing page prior to write
|
||||||
@@ -91,8 +88,9 @@
|
|||||||
#define APP_FLASH_STORAGE_PARAMETERS (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PARAMETERS_PAGE)
|
#define APP_FLASH_STORAGE_PARAMETERS (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PARAMETERS_PAGE)
|
||||||
|
|
||||||
// Define storage for power-down detection flag
|
// Define storage for power-down detection flag
|
||||||
#define APP_FLASH_POWERDOWN_PAGE (127)
|
#define APP_FLASH_POWERLOSS_PAGE (127)
|
||||||
#define APP_FLASH_STORAGE_POWERDOWN (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_POWERDOWN_PAGE)
|
#define APP_FLASH_STORAGE_POWERLOSS (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_POWERLOSS_PAGE)
|
||||||
|
#define APP_FLASH_POWERLOSS_PAGESIZE (INTERNAL_FLASH_PAGE_SIZE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -163,6 +163,9 @@ extern void repairMenu_interlockWarning(struct RepairMenu* self, T_INTERLOCK_ID
|
|||||||
extern void repairMenu_interlockFailed(struct RepairMenu* self, T_INTERLOCK_ID interlockID);
|
extern void repairMenu_interlockFailed(struct RepairMenu* self, T_INTERLOCK_ID interlockID);
|
||||||
|
|
||||||
|
|
||||||
|
extern void repairMenu_powerLossDetected(struct RepairMenu* self);
|
||||||
|
|
||||||
|
|
||||||
extern void repairMenu_processFailed(struct RepairMenu* self);
|
extern void repairMenu_processFailed(struct RepairMenu* self);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
// Type definitions.
|
// Type definitions.
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern struct RepairProcess* const rp;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Function declarations
|
// Function declarations
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ static void MenuCore_scrollDownIndexHandler(struct MenuCore* self);
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus MenuCore_construct(struct MenuCore* self, struct Display* display, struct KeyboardDevice* keyboardDevice, int taskPriority, uint16_t stackSize, MenuCoreFunctionCall createMenu, MenuCoreFunctionCall stateHandle)
|
ErrorStatus MenuCore_construct(struct MenuCore* self, struct Display* display, struct KeyboardDevice* keyboardDevice, struct Buzzer* buzzer, int taskPriority, uint16_t stackSize, MenuCoreFunctionCall createMenu, MenuCoreFunctionCall stateHandle)
|
||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
@@ -98,6 +98,18 @@ ErrorStatus MenuCore_construct(struct MenuCore* self, struct Display* display, s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (returnValue == SUCCESS)
|
||||||
|
{
|
||||||
|
if (buzzer->initialized)
|
||||||
|
{
|
||||||
|
self->buzzer = buzzer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnValue = ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
// Let Task run as soon as it has been created
|
// Let Task run as soon as it has been created
|
||||||
@@ -225,6 +237,12 @@ static ErrorStatus MenuCore_performAction(struct MenuCore* self, char key, Keypa
|
|||||||
|
|
||||||
struct KeyActionBinding keyAction = MenuCore_findKeyAction(self, key, keyState);
|
struct KeyActionBinding keyAction = MenuCore_findKeyAction(self, key, keyState);
|
||||||
|
|
||||||
|
if (keyAction.action != NO_ACTION)
|
||||||
|
{
|
||||||
|
// Give audible feedback of valid key
|
||||||
|
BUZZER_KEYPAD_ACKNOWLEDGE(self->buzzer);
|
||||||
|
}
|
||||||
|
|
||||||
switch (keyAction.action)
|
switch (keyAction.action)
|
||||||
{
|
{
|
||||||
case NO_ACTION:
|
case NO_ACTION:
|
||||||
|
|||||||
@@ -0,0 +1,199 @@
|
|||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
/// @file PowerLossDetector.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 PowerLossDetector.c
|
||||||
|
/// @ingroup {group_name}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Include files
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
#include "PowerLossDetector.h"
|
||||||
|
|
||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Constant and macro definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define PLD_MASK_FREE (0xFFFFFFFF)
|
||||||
|
#define PLD_MASK_BUSY (0xDEADC01A)
|
||||||
|
#define PLD_MASK_USED (0x00000000)
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Type definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
struct PowerLossDetector
|
||||||
|
{
|
||||||
|
bool initialized;
|
||||||
|
bool loaded;
|
||||||
|
unsigned int pageNumber;
|
||||||
|
unsigned int startAddress;
|
||||||
|
unsigned int length;
|
||||||
|
struct MemoryDevice* memoryDevice;
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// File-scope variables
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static struct PowerLossDetector _plDetector = {.initialized = false, .loaded = false};
|
||||||
|
struct PowerLossDetector* const plDetector = &_plDetector;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Function declarations
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Function definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ErrorStatus PowerLossDetector_construct(struct MemoryDevice* memoryDevice, unsigned int pageNumber, unsigned int startAddress, unsigned int length)
|
||||||
|
{
|
||||||
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
|
if (!plDetector->initialized)
|
||||||
|
{
|
||||||
|
if (returnValue == SUCCESS)
|
||||||
|
{
|
||||||
|
plDetector->pageNumber = pageNumber;
|
||||||
|
plDetector->startAddress = startAddress;
|
||||||
|
plDetector->length = length;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (returnValue == SUCCESS)
|
||||||
|
{
|
||||||
|
if (memoryDevice != NULL)
|
||||||
|
{
|
||||||
|
if (memoryDevice->initialized)
|
||||||
|
{
|
||||||
|
plDetector->memoryDevice = memoryDevice;
|
||||||
|
plDetector->initialized = true;
|
||||||
|
LOGGER_DEBUG(mainLog, "PowerLossDetector constructed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnValue = ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnValue = ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnValue = ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern void PowerLossDetector_destruct(void)
|
||||||
|
{
|
||||||
|
plDetector->initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PowerLossDetector_setBusyFlag(void)
|
||||||
|
{
|
||||||
|
bool freeAddressFound = false;
|
||||||
|
uint32_t buffer;
|
||||||
|
unsigned int flagAddress;
|
||||||
|
unsigned int loopcounter;
|
||||||
|
// Find the first available free address
|
||||||
|
for (loopcounter = plDetector->startAddress; loopcounter < (plDetector->startAddress + plDetector->length); loopcounter += 4)
|
||||||
|
{
|
||||||
|
MemoryDevice_read(plDetector->memoryDevice, &buffer, loopcounter, 1);
|
||||||
|
if (buffer == PLD_MASK_FREE)
|
||||||
|
{
|
||||||
|
// Found free space
|
||||||
|
flagAddress = loopcounter;
|
||||||
|
freeAddressFound = true;
|
||||||
|
LOGGER_DEBUG(mainLog, "Found free address at: %X", loopcounter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// In case no free address has been found, the complete page must be cleared
|
||||||
|
// After clearing, the address to write the busy flag to is equal to the start address
|
||||||
|
if (!freeAddressFound)
|
||||||
|
{
|
||||||
|
MemoryDevice_erasePage(plDetector->memoryDevice, plDetector->pageNumber);
|
||||||
|
flagAddress = plDetector->startAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer = PLD_MASK_BUSY;
|
||||||
|
MemoryDevice_write(plDetector->memoryDevice, &buffer, flagAddress, 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern void PowerLossDetector_clearBusyFlag(void)
|
||||||
|
{
|
||||||
|
uint32_t buffer;
|
||||||
|
unsigned int loopcounter;
|
||||||
|
// Find the first available free address
|
||||||
|
for (loopcounter = plDetector->startAddress; loopcounter < (plDetector->startAddress + plDetector->length); loopcounter += 4)
|
||||||
|
{
|
||||||
|
MemoryDevice_read(plDetector->memoryDevice, &buffer, loopcounter, 1);
|
||||||
|
if (buffer == PLD_MASK_BUSY)
|
||||||
|
{
|
||||||
|
// Found the busy flag
|
||||||
|
buffer = PLD_MASK_USED;
|
||||||
|
LOGGER_DEBUG(mainLog, "Found busyFlag at address %X", loopcounter);
|
||||||
|
MemoryDevice_write(plDetector->memoryDevice, &buffer, loopcounter, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PowerLossDetection_isFlagSet(void)
|
||||||
|
{
|
||||||
|
bool returnValue = false;
|
||||||
|
|
||||||
|
uint32_t buffer;
|
||||||
|
unsigned int loopcounter;
|
||||||
|
// Find the first available free address
|
||||||
|
|
||||||
|
for (loopcounter = plDetector->startAddress; loopcounter < (plDetector->startAddress + plDetector->length); loopcounter += 4)
|
||||||
|
{
|
||||||
|
MemoryDevice_read(plDetector->memoryDevice, &buffer, loopcounter, 1);
|
||||||
|
if (buffer == PLD_MASK_BUSY)
|
||||||
|
{
|
||||||
|
// Found the busy flag
|
||||||
|
returnValue = true;
|
||||||
|
LOGGER_DEBUG(mainLog, "Found busyFlag at address %X", loopcounter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
@@ -81,6 +81,8 @@ ErrorStatus hsb_generateStartScreen(struct Display* Display)
|
|||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
|
Display_setCursorToPosition(mainDisplay, 1, 1);
|
||||||
|
vTaskDelay(10);
|
||||||
returnValue = Display_write(mainDisplay, PCBA_getInstance()->name, 1, 1);
|
returnValue = Display_write(mainDisplay, PCBA_getInstance()->name, 1, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -116,29 +118,29 @@ ErrorStatus hsb_enableSafetyWithError(void)
|
|||||||
CoverSolenoid_lock();
|
CoverSolenoid_lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
// if (returnValue == SUCCESS)
|
||||||
{
|
// {
|
||||||
// Check for INTERLOCK CLOSE
|
// // Check for INTERLOCK CLOSE
|
||||||
if (Interlock_isClosed(interlock))
|
// if (Interlock_isClosed(interlock))
|
||||||
{
|
// {
|
||||||
// Enable Interrupt for interlock switch
|
// // Enable Interrupt for interlock switch
|
||||||
Interlock_setEXTI(interlock, ENABLE);
|
// Interlock_setEXTI(interlock, ENABLE);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Error_postError(INTERLOCK_COMMON_FAIL);
|
// Error_postError(INTERLOCK_COMMON_FAIL);
|
||||||
returnValue = ERROR;
|
// returnValue = ERROR;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (returnValue == SUCCESS)
|
// if (returnValue == SUCCESS)
|
||||||
{
|
// {
|
||||||
// In case of a TESLA repair, release the teslaGunSafety
|
// // In case of a TESLA repair, release the teslaGunSafety
|
||||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
// if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||||
{
|
// {
|
||||||
TeslaGunSafety_release();
|
// TeslaGunSafety_release();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -162,29 +164,29 @@ ErrorStatus hsb_enableSafetyWithWarning(void)
|
|||||||
CoverSolenoid_lock();
|
CoverSolenoid_lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
// if (returnValue == SUCCESS)
|
||||||
{
|
// {
|
||||||
// Check for INTERLOCK CLOSE
|
// // Check for INTERLOCK CLOSE
|
||||||
if (Interlock_isClosed(interlock))
|
// if (Interlock_isClosed(interlock))
|
||||||
{
|
// {
|
||||||
// Enable Interrupt for interlock switch
|
// // Enable Interrupt for interlock switch
|
||||||
Interlock_setEXTI(interlock, ENABLE);
|
// Interlock_setEXTI(interlock, ENABLE);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Warning_postWarning(WARNING_INTERLOCK_COMMON_FAIL);
|
// Warning_postWarning(WARNING_INTERLOCK_COMMON_FAIL);
|
||||||
returnValue = ERROR;
|
// returnValue = ERROR;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (returnValue == SUCCESS)
|
// if (returnValue == SUCCESS)
|
||||||
{
|
// {
|
||||||
// In case of a TESLA repair, release the teslaGunSafety
|
// // In case of a TESLA repair, release the teslaGunSafety
|
||||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
// if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||||
{
|
// {
|
||||||
TeslaGunSafety_release();
|
// TeslaGunSafety_release();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -202,29 +204,22 @@ ErrorStatus hsb_disableSafety(void)
|
|||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
int adcR1Value = HSB_SECURITY_VOLTAGE_THRESHOLD;
|
|
||||||
int adcR2Value = HSB_SECURITY_VOLTAGE_THRESHOLD;
|
|
||||||
int adcR3Value = HSB_SECURITY_VOLTAGE_THRESHOLD;
|
|
||||||
|
|
||||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||||
{
|
{
|
||||||
TeslaGunSafety_block();
|
TeslaGunSafety_block();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display_clearScreen(mainDisplay);
|
|
||||||
char buffer[mainDisplay->displayDevice->parameters.numberOfColumns];
|
|
||||||
snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "WAITING FOR");
|
|
||||||
Display_write(mainDisplay, buffer, 3, 5);
|
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "POWER DOWN");
|
|
||||||
Display_write(mainDisplay, buffer, 4, 6);
|
|
||||||
|
|
||||||
|
|
||||||
// Power-down the DAC outputs
|
// Power-down the DAC outputs
|
||||||
DAConverter_setOutputVoltage(dacRow1, 0);
|
DAConverter_setOutputVoltage(dacRow1, 0);
|
||||||
DAConverter_setOutputVoltage(dacRow2, 0);
|
DAConverter_setOutputVoltage(dacRow2, 0);
|
||||||
DAConverter_setOutputVoltage(dacRow3, 0);
|
DAConverter_setOutputVoltage(dacRow3, 0);
|
||||||
|
|
||||||
|
char buffer[mainDisplay->displayDevice->parameters.numberOfColumns];
|
||||||
|
snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "WAITING FOR");
|
||||||
|
Display_write(mainDisplay, buffer, 3, 5);
|
||||||
|
|
||||||
|
snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "POWER DOWN");
|
||||||
|
Display_write(mainDisplay, buffer, 4, 6);
|
||||||
|
|
||||||
while (HighVoltageDetection_isVoltagePresent())
|
while (HighVoltageDetection_isVoltagePresent())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,8 +44,10 @@
|
|||||||
#include "Error.h"
|
#include "Error.h"
|
||||||
#include "hsb-mrts.h"
|
#include "hsb-mrts.h"
|
||||||
#include "hwValidationMenu.h"
|
#include "hwValidationMenu.h"
|
||||||
|
#include "PowerLossDetector.h"
|
||||||
#include "repairMenu.h"
|
#include "repairMenu.h"
|
||||||
#include "repairMenus.h"
|
#include "repairMenus.h"
|
||||||
|
#include "repairProcesses.h"
|
||||||
#include "Warning.h"
|
#include "Warning.h"
|
||||||
|
|
||||||
#include "CathodeMCP.h"
|
#include "CathodeMCP.h"
|
||||||
@@ -150,7 +152,7 @@ static void printSystemInfoTask(void* parameters)
|
|||||||
{
|
{
|
||||||
LOGGER_INFO(mainLog, "---------------------------------------");
|
LOGGER_INFO(mainLog, "---------------------------------------");
|
||||||
systeminfoCommandHandler();
|
systeminfoCommandHandler();
|
||||||
vTaskDelay(20000);
|
vTaskDelay(10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,9 +175,14 @@ static ErrorStatus systeminfoCommandHandler(void)
|
|||||||
vTaskDelay(10);
|
vTaskDelay(10);
|
||||||
OS_logTaskInfo(mainMenu->menuCore->taskHandle);
|
OS_logTaskInfo(mainMenu->menuCore->taskHandle);
|
||||||
vTaskDelay(10);
|
vTaskDelay(10);
|
||||||
|
OS_logTaskInfo(rp->taskHandle);
|
||||||
|
vTaskDelay(10);
|
||||||
OS_logTaskInfo(mainDisplay->taskHandle);
|
OS_logTaskInfo(mainDisplay->taskHandle);
|
||||||
vTaskDelay(10);
|
vTaskDelay(10);
|
||||||
OS_logTaskInfo(errorTaskHandle);
|
OS_logTaskInfo(errorTaskHandle);
|
||||||
|
vTaskDelay(10);
|
||||||
|
OS_logTaskInfo(mainBuzzer->taskHandle);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -189,13 +196,13 @@ static void initTask(void* parameters)
|
|||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
// Create the error handler
|
// Create the error handler
|
||||||
Error_construct();
|
returnValue = Error_construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
// Create the warning handler
|
// Create the warning handler
|
||||||
Warning_construct();
|
returnValue = Warning_construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
@@ -204,30 +211,36 @@ static void initTask(void* parameters)
|
|||||||
// All IO is initialized here
|
// All IO is initialized here
|
||||||
// Also, all periphery and platform-specifics are initialized here
|
// Also, all periphery and platform-specifics are initialized here
|
||||||
// IRQs are defined here
|
// IRQs are defined here
|
||||||
initPlatform();
|
returnValue = initPlatform();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
// Construct the displays
|
// Construct the displays
|
||||||
Displays_construct();
|
returnValue = Displays_construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (returnValue == SUCCESS)
|
||||||
|
{
|
||||||
|
// Construct the powerloss detector
|
||||||
|
returnValue = PowerLossDetector_construct(&iFlash->memoryDevice, APP_FLASH_POWERLOSS_PAGE, APP_FLASH_STORAGE_POWERLOSS, APP_FLASH_POWERLOSS_PAGESIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
// Construct the AD Converters
|
// Construct the AD Converters
|
||||||
ADConverters_construct();
|
returnValue = ADConverters_construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
// Construct the DA Converters
|
// Construct the DA Converters
|
||||||
DAConverters_construct();
|
returnValue = DAConverters_construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
hsb_generateStartScreen(mainDisplay);
|
returnValue = hsb_generateStartScreen(mainDisplay);
|
||||||
// Let start screen stay for 5 seconds
|
// Let start screen stay for 5 seconds
|
||||||
vTaskDelay(INIT_START_SCREEN_DELAY);
|
vTaskDelay(INIT_START_SCREEN_DELAY);
|
||||||
}
|
}
|
||||||
@@ -235,13 +248,13 @@ static void initTask(void* parameters)
|
|||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
// Construct/Load the device parameters
|
// Construct/Load the device parameters
|
||||||
DeviceParameters_construct(&deviceParameters, &iFlash->memoryDevice);
|
returnValue = DeviceParameters_construct(&deviceParameters, &iFlash->memoryDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
// Construct the repair presets
|
// Construct the repair presets
|
||||||
RepairPresets_construct(&cs, &iFlash->memoryDevice);
|
returnValue = RepairPresets_construct(&cs, &iFlash->memoryDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_HW_VALIDATION
|
#ifdef ENABLE_HW_VALIDATION
|
||||||
@@ -278,7 +291,16 @@ static void initTask(void* parameters)
|
|||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
// Construct the repair menu
|
// Construct the repair menu
|
||||||
repairMenus_construct();
|
returnValue = repairMenus_construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PowerLossDetection_isFlagSet())
|
||||||
|
{
|
||||||
|
LOGGER_ERROR(mainLog, "Powerloss detection triggered");
|
||||||
|
Error_postError(ERROR_POWER_LOSS);
|
||||||
|
returnValue = ERROR;
|
||||||
|
// Flag may be restored now
|
||||||
|
PowerLossDetector_clearBusyFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete this init task
|
// Delete this init task
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "DeviceParameters.h"
|
#include "DeviceParameters.h"
|
||||||
#include "PIDParameters.h"
|
#include "PIDParameters.h"
|
||||||
|
#include "PowerLossDetector.h"
|
||||||
#include "repairMenu.h"
|
#include "repairMenu.h"
|
||||||
#include "repairMenus.h"
|
#include "repairMenus.h"
|
||||||
#include "RepairPreset.h"
|
#include "RepairPreset.h"
|
||||||
@@ -254,6 +255,13 @@ void repairMenu_interlockFailed(struct RepairMenu* self, T_INTERLOCK_ID interloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void repairMenu_powerLossDetected(struct RepairMenu* self)
|
||||||
|
{
|
||||||
|
MenuCore_changeState(self->menuCore, RM_ERROR_STATE);
|
||||||
|
snprintf(self->menuCore->errorMessage, sizeof(self->menuCore->errorMessage) / sizeof(self->menuCore->errorMessage[0]), MenuText_ERROR_POWER_LOSS[languageIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void repairMenu_processFailed(struct RepairMenu* self)
|
void repairMenu_processFailed(struct RepairMenu* self)
|
||||||
{
|
{
|
||||||
MenuCore_changeState(self->menuCore, RM_ERROR_STATE);
|
MenuCore_changeState(self->menuCore, RM_ERROR_STATE);
|
||||||
@@ -1012,6 +1020,8 @@ static void repairMenu_startRepairProcess(struct MenuCore* self)
|
|||||||
{
|
{
|
||||||
// repair process is running
|
// repair process is running
|
||||||
MenuCore_changeState(self, RM_REPAIR_RUNNING);
|
MenuCore_changeState(self, RM_REPAIR_RUNNING);
|
||||||
|
// Set Flag in FLASH
|
||||||
|
PowerLossDetector_setBusyFlag();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1060,9 +1070,17 @@ static void repairMenu_gotoLastState(struct MenuCore* self)
|
|||||||
void repairMenu_menuStateHandle(struct MenuCore* self)
|
void repairMenu_menuStateHandle(struct MenuCore* self)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Stop the buzzer from recovered error or warning
|
||||||
|
if ((self->lastMenuState == RM_ERROR_STATE) || (self->lastMenuState == RM_WARNING_STATE))
|
||||||
|
{
|
||||||
|
if ((self->menuState != RM_ERROR_STATE) && (self->menuState != RM_WARNING_STATE))
|
||||||
|
Buzzer_stop(self->buzzer);
|
||||||
|
}
|
||||||
|
|
||||||
// Catch ERROR state
|
// Catch ERROR state
|
||||||
if (self->menuState == RM_ERROR_STATE)
|
if (self->menuState == RM_ERROR_STATE)
|
||||||
{
|
{
|
||||||
|
self->lastMenuState = self->menuState;
|
||||||
// Show ERROR message
|
// Show ERROR message
|
||||||
repairMenu_printError(self);
|
repairMenu_printError(self);
|
||||||
// Handle error
|
// Handle error
|
||||||
@@ -1073,6 +1091,7 @@ void repairMenu_menuStateHandle(struct MenuCore* self)
|
|||||||
}
|
}
|
||||||
else if (self->menuState == RM_WARNING_STATE)
|
else if (self->menuState == RM_WARNING_STATE)
|
||||||
{
|
{
|
||||||
|
self->lastMenuState = self->menuState;
|
||||||
repairMenu_printWarning(self);
|
repairMenu_printWarning(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1119,6 +1138,7 @@ void repairMenu_menuStateHandle(struct MenuCore* self)
|
|||||||
else if (self->menuState == RM_FINISH_CONTROL)
|
else if (self->menuState == RM_FINISH_CONTROL)
|
||||||
{
|
{
|
||||||
repairMenu_stopRepairProcess(self);
|
repairMenu_stopRepairProcess(self);
|
||||||
|
PowerLossDetector_clearBusyFlag();
|
||||||
MenuCore_changeState(self, RM_FINISH);
|
MenuCore_changeState(self, RM_FINISH);
|
||||||
}
|
}
|
||||||
else if (self->menuState == RM_FINISH)
|
else if (self->menuState == RM_FINISH)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "Warning.h"
|
#include "Warning.h"
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
#include "Buzzer.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "Observable.h"
|
#include "Observable.h"
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
@@ -82,7 +83,7 @@ ErrorStatus repairMenus_construct(void)
|
|||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
// Create the Menu core
|
// Create the Menu core
|
||||||
returnValue = MenuCore_construct(menuCore, mainDisplay, &storm700->keyboardDevice, HSB_MAINMENU_TASK_PRIORITY, HSB_MAINMENU_TASK_STACKSIZE, repairMenu_createMenuEntries, repairMenu_menuStateHandle);
|
returnValue = MenuCore_construct(menuCore, mainDisplay, &storm700->keyboardDevice, mainBuzzer, HSB_MAINMENU_TASK_PRIORITY, HSB_MAINMENU_TASK_STACKSIZE, repairMenu_createMenuEntries, repairMenu_menuStateHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
@@ -124,9 +125,16 @@ static ErrorStatus repairMenus_errorReceive(const void* const data)
|
|||||||
|
|
||||||
switch (errorCode)
|
switch (errorCode)
|
||||||
{
|
{
|
||||||
|
case ERROR_POWER_LOSS:
|
||||||
|
{
|
||||||
|
repairMenu_powerLossDetected(mainMenu);
|
||||||
|
BUZZER_ERROR(mainBuzzer);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case INTERLOCK_COMMON_FAIL:
|
case INTERLOCK_COMMON_FAIL:
|
||||||
{
|
{
|
||||||
repairMenu_interlockFailed(mainMenu, COMMON_INTERLOCK);
|
repairMenu_interlockFailed(mainMenu, COMMON_INTERLOCK);
|
||||||
|
BUZZER_ERROR(mainBuzzer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case POWERENABLE_FAIL:
|
case POWERENABLE_FAIL:
|
||||||
@@ -136,6 +144,7 @@ static ErrorStatus repairMenus_errorReceive(const void* const data)
|
|||||||
case REPAIR_FAIL:
|
case REPAIR_FAIL:
|
||||||
{
|
{
|
||||||
repairMenu_processFailed(mainMenu);
|
repairMenu_processFailed(mainMenu);
|
||||||
|
BUZZER_ERROR(mainBuzzer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ERROR_CRC_PIN:
|
case ERROR_CRC_PIN:
|
||||||
@@ -143,6 +152,7 @@ static ErrorStatus repairMenus_errorReceive(const void* const data)
|
|||||||
case ERROR_CRC_PRESETS:
|
case ERROR_CRC_PRESETS:
|
||||||
{
|
{
|
||||||
repairMenu_printCRCFailure(mainMenu, errorCode);
|
repairMenu_printCRCFailure(mainMenu, errorCode);
|
||||||
|
BUZZER_ERROR(mainBuzzer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -163,6 +173,7 @@ static ErrorStatus repairMenus_warningReceive(const void* const data)
|
|||||||
case WARNING_INTERLOCK_COMMON_FAIL:
|
case WARNING_INTERLOCK_COMMON_FAIL:
|
||||||
{
|
{
|
||||||
repairMenu_interlockWarning(mainMenu, COMMON_INTERLOCK);
|
repairMenu_interlockWarning(mainMenu, COMMON_INTERLOCK);
|
||||||
|
BUZZER_WARNING(mainBuzzer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ static void repairProcess_task(void* parameters)
|
|||||||
{
|
{
|
||||||
// The current ADC value is outside the error boundaries
|
// The current ADC value is outside the error boundaries
|
||||||
self->row[loopCounter].errorData.outOfLimitsCounter += 1;
|
self->row[loopCounter].errorData.outOfLimitsCounter += 1;
|
||||||
LOGGER_WARNING(mainLog, "Row %d outside boundaries", loopCounter);
|
// LOGGER_WARNING(mainLog, "Row %d outside boundaries", loopCounter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -282,7 +282,7 @@ static void repairProcess_task(void* parameters)
|
|||||||
// ROW is in error state
|
// ROW is in error state
|
||||||
self->row[loopCounter].lastDACValue = 0;
|
self->row[loopCounter].lastDACValue = 0;
|
||||||
DAConverter_setOutputVoltage(self->row[loopCounter].dacChannel, self->row[loopCounter].lastDACValue);
|
DAConverter_setOutputVoltage(self->row[loopCounter].dacChannel, self->row[loopCounter].lastDACValue);
|
||||||
LOGGER_ERROR(mainLog, "Row %d --- Row in ERROR state", loopCounter);
|
// LOGGER_ERROR(mainLog, "Row %d --- Row in ERROR state", loopCounter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
static struct RepairProcess mainRepairProcess;
|
static struct RepairProcess mainRepairProcess;
|
||||||
|
struct RepairProcess* const rp = &mainRepairProcess;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Function declarations
|
// Function declarations
|
||||||
|
|||||||
Reference in New Issue
Block a user