configuration
This commit is contained in:
parent
9223cbda73
commit
cb5dd5f79a
@ -8,6 +8,7 @@
|
|||||||
typedef struct __attribute__((__packed__)) s_configBlock {
|
typedef struct __attribute__((__packed__)) s_configBlock {
|
||||||
char deviceName[16];
|
char deviceName[16];
|
||||||
uint8_t macAddress[6];
|
uint8_t macAddress[6];
|
||||||
|
int32_t frontendThreshold;
|
||||||
char brokerName[64];
|
char brokerName[64];
|
||||||
char watchdogTopic[64];
|
char watchdogTopic[64];
|
||||||
char startupTopic[64];
|
char startupTopic[64];
|
||||||
|
@ -9,6 +9,5 @@ void frontendInit();
|
|||||||
void frontendAdcCallback(ADC_HandleTypeDef* hadc);
|
void frontendAdcCallback(ADC_HandleTypeDef* hadc);
|
||||||
void frontendEnable();
|
void frontendEnable();
|
||||||
void frontendDisable();
|
void frontendDisable();
|
||||||
void frontendSetThreshold(int32_t threshold);
|
|
||||||
|
|
||||||
#endif // _FRONTEND_H_
|
#endif // _FRONTEND_H_
|
@ -1,22 +1,11 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
typedef struct __attribute__((__packed__)) s_configBlock {
|
|
||||||
char deviceName[16];
|
|
||||||
uint8_t macAddress[6];
|
|
||||||
char brokerName[64];
|
|
||||||
char watchdogTopic[64];
|
|
||||||
char startupTopic[64];
|
|
||||||
char statusTopic[64];
|
|
||||||
char mbusDataTopic[64];
|
|
||||||
char syslogServerName[64];
|
|
||||||
} t_configBlock;
|
|
||||||
*/
|
|
||||||
|
|
||||||
t_configBlock defaultConfigBlock = {
|
t_configBlock defaultConfigBlock = {
|
||||||
.deviceName = "MBGW3",
|
.deviceName = "MBGW3",
|
||||||
.macAddress = { 0x00, 0xA0, 0x57, 0x05, 0x3E, 0x0D },
|
.macAddress = { 0x00, 0xA0, 0x57, 0x05, 0x3E, 0x0D },
|
||||||
|
.frontendThreshold = 240,
|
||||||
.brokerName = "mqttbroker",
|
.brokerName = "mqttbroker",
|
||||||
.watchdogTopic = "IoT/Watchdog",
|
.watchdogTopic = "IoT/Watchdog",
|
||||||
.startupTopic = "IoT/MBGW3/Startup",
|
.startupTopic = "IoT/MBGW3/Startup",
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
#include <frontend.h>
|
#include <frontend.h>
|
||||||
#include <logger.h>
|
#include <logger.h>
|
||||||
#include <show.h>
|
#include <show.h>
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
|
||||||
|
static t_configBlock *config;
|
||||||
|
|
||||||
|
|
||||||
static volatile int32_t frontendAdcThreshold = 0;
|
static volatile int32_t frontendAdcThreshold = 0;
|
||||||
@ -16,16 +17,15 @@ static volatile bool frontendEnabled = false;
|
|||||||
|
|
||||||
|
|
||||||
void frontendInit() {
|
void frontendInit() {
|
||||||
|
config = getConfig();
|
||||||
|
frontendAdcThreshold = config->frontendThreshold;
|
||||||
|
|
||||||
HAL_ADCEx_Calibration_Start(&frontendAdc);
|
HAL_ADCEx_Calibration_Start(&frontendAdc);
|
||||||
logMsg("frontendInit, calibration done");
|
logMsg("frontendInit, calibration done");
|
||||||
HAL_ADC_Start_IT(&frontendAdc);
|
HAL_ADC_Start_IT(&frontendAdc);
|
||||||
logMsg("frontendInit, adc started");
|
logMsg("frontendInit, adc started");
|
||||||
}
|
}
|
||||||
|
|
||||||
void frontendSetThreshold(int32_t threshold) {
|
|
||||||
frontendAdcThreshold = threshold;
|
|
||||||
}
|
|
||||||
|
|
||||||
void frontendEnable() {
|
void frontendEnable() {
|
||||||
frontendEnabled = true;
|
frontendEnabled = true;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,6 @@ void my_setup_2() {
|
|||||||
oledPrint(OLED_SCREEN0, "cmdhandler init");
|
oledPrint(OLED_SCREEN0, "cmdhandler init");
|
||||||
|
|
||||||
frontendInit();
|
frontendInit();
|
||||||
frontendSetThreshold(240);
|
|
||||||
oledPrint(OLED_SCREEN0, "frontend init");
|
oledPrint(OLED_SCREEN0, "frontend init");
|
||||||
|
|
||||||
mbusCommInit();
|
mbusCommInit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user