kopia lustrzana https://github.com/SP8EBC/ParaTNC
counting restarts caused by verification failure
rodzic
d5614dbf53
commit
9b52612eec
|
@ -58,6 +58,6 @@
|
||||||
<listEntry value="4"/>
|
<listEntry value="4"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="Context string"/> "/>
|
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="Context string"/> "/>
|
||||||
<stringAttribute key="org.eclipse.embedcdt.debug.gdbjtag.core.PERIPHERALS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <peripherals> <peripheral name="IWDG"/> <peripheral name="DBGMCU"/> <peripheral name="USART3"/> </peripherals> "/>
|
<stringAttribute key="org.eclipse.embedcdt.debug.gdbjtag.core.PERIPHERALS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <peripherals> <peripheral name="IWDG"/> <peripheral name="DBGMCU"/> <peripheral name="RTC"/> </peripherals> "/>
|
||||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||||
</launchConfiguration>
|
</launchConfiguration>
|
||||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -81,6 +81,11 @@ void backup_reg_set_telemetry(uint16_t);
|
||||||
void backup_reg_get_packet_counters(uint8_t * beacon_counter, uint8_t * meteo_counter, uint8_t * meteo_gsm_counter);
|
void backup_reg_get_packet_counters(uint8_t * beacon_counter, uint8_t * meteo_counter, uint8_t * meteo_gsm_counter);
|
||||||
void backup_reg_set_packet_counters(uint8_t beacon_counter, uint8_t meteo_counter, uint8_t meteo_gsm_counter);
|
void backup_reg_set_packet_counters(uint8_t beacon_counter, uint8_t meteo_counter, uint8_t meteo_gsm_counter);
|
||||||
|
|
||||||
|
void backup_reg_increment_aprsis_check_reset(void);
|
||||||
|
void backup_reg_increment_weather_measurements_check_reset(void);
|
||||||
|
void backup_reg_increment_dallas_degraded_reset(void);
|
||||||
|
void backup_reg_increment_is_rtc_ok_check_reset(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BACKUP_REGISTERS_H_ */
|
#endif /* BACKUP_REGISTERS_H_ */
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* misc_config.h
|
||||||
|
* Misc configuration which doesn't match to any other place
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Created on: Apr 15, 2024
|
||||||
|
* Author: mateusz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ETC_MISC_CONFIG_H_
|
||||||
|
#define ETC_MISC_CONFIG_H_
|
||||||
|
|
||||||
|
#define RTE_WX_PROBLEMS_MAX_THRESHOLD 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ETC_MISC_CONFIG_H_ */
|
|
@ -15,8 +15,8 @@
|
||||||
#define SYSTICK_TICKS_PER_SECONDS 100
|
#define SYSTICK_TICKS_PER_SECONDS 100
|
||||||
#define SYSTICK_TICKS_PERIOD 10
|
#define SYSTICK_TICKS_PERIOD 10
|
||||||
|
|
||||||
#define INTERNAL_WATCHDOG
|
//#define INTERNAL_WATCHDOG
|
||||||
#define EXTERNAL_WATCHDOG
|
//#define EXTERNAL_WATCHDOG
|
||||||
|
|
||||||
#define PWR_SWITCH_BOTH
|
#define PWR_SWITCH_BOTH
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ extern "C"
|
||||||
void rte_wx_init(void);
|
void rte_wx_init(void);
|
||||||
void rte_wx_update_last_measuremenet_timers(uint16_t measurement_type);
|
void rte_wx_update_last_measuremenet_timers(uint16_t measurement_type);
|
||||||
void rte_wx_reset_last_measuremenet_timers(uint16_t measurement_type);
|
void rte_wx_reset_last_measuremenet_timers(uint16_t measurement_type);
|
||||||
|
int8_t rte_wx_check_weather_measurements(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
#ifndef SOFTWARE_VERSION_H_
|
#ifndef SOFTWARE_VERSION_H_
|
||||||
#define SOFTWARE_VERSION_H_
|
#define SOFTWARE_VERSION_H_
|
||||||
|
|
||||||
#define SW_VER "EB04"
|
#define SW_VER "EB05"
|
||||||
#define SW_DATE "10042024"
|
#define SW_DATE "18042024"
|
||||||
#define SW_KISS_PROTO "B"
|
#define SW_KISS_PROTO "B"
|
||||||
|
|
||||||
extern const char software_version_str[5];
|
extern const char software_version_str[5];
|
||||||
|
|
|
@ -56,7 +56,7 @@ ENTRY(Reset_Handler)
|
||||||
_estack = 0x20018000; /* end of RAM */
|
_estack = 0x20018000; /* end of RAM */
|
||||||
/* Generate a link error if heap and stack don't fit into RAM */
|
/* Generate a link error if heap and stack don't fit into RAM */
|
||||||
_Min_Heap_Size = 0x200; /* required amount of heap */
|
_Min_Heap_Size = 0x200; /* required amount of heap */
|
||||||
_Min_Stack_Size = 0x400; /* required amount of stack */
|
_Min_Stack_Size = 0x800; /* required amount of stack */
|
||||||
|
|
||||||
/* Specify the memory areas */
|
/* Specify the memory areas */
|
||||||
MEMORY
|
MEMORY
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#define REGISTER_COUNTERS RTC->BKP4R
|
#define REGISTER_COUNTERS RTC->BKP4R
|
||||||
#define REGISTER_LAST_SLTIM RTC->BKP6R
|
#define REGISTER_LAST_SLTIM RTC->BKP6R
|
||||||
#define REGISTER_PACKET_COUNTERS RTC->BKP7R
|
#define REGISTER_PACKET_COUNTERS RTC->BKP7R
|
||||||
|
#define REGISTER_RESET_CHECK_FAIL RTC->BKP8R
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BACKUP_REG_INHIBIT_PWR_SWITCH_PERIODIC_H 1u
|
#define BACKUP_REG_INHIBIT_PWR_SWITCH_PERIODIC_H 1u
|
||||||
|
@ -39,6 +40,7 @@
|
||||||
// 5 -> monitor
|
// 5 -> monitor
|
||||||
// 6 -> last sleep time
|
// 6 -> last sleep time
|
||||||
// 7 -> weather and telemetry timers & counters
|
// 7 -> weather and telemetry timers & counters
|
||||||
|
// 8 -> counters of resets caused by validation checks failures
|
||||||
|
|
||||||
// 7th register map
|
// 7th register map
|
||||||
// xxxxyyAA - telemetry frames counter
|
// xxxxyyAA - telemetry frames counter
|
||||||
|
@ -47,6 +49,12 @@
|
||||||
// xxAAyyyy - value of packet_tx_beacon_counter
|
// xxAAyyyy - value of packet_tx_beacon_counter
|
||||||
// Axxxyyyy - checksum
|
// Axxxyyyy - checksum
|
||||||
|
|
||||||
|
// 8th register map
|
||||||
|
// xxxxyyAA - resets caused by 'aprsis_check_connection_attempt_alive()'
|
||||||
|
// xxxxAAyy - resets caused by 'rte_wx_check_weather_measurements()'
|
||||||
|
// xxAAyyyy - resets caused by value of 'rte_wx_dallas_degraded_counter'
|
||||||
|
// AAxxyyyy - resets caused by 'system_is_rtc_ok()'
|
||||||
|
|
||||||
static void backup_reg_unclock(void) {
|
static void backup_reg_unclock(void) {
|
||||||
// enable access to backup domain
|
// enable access to backup domain
|
||||||
PWR->CR1 |= PWR_CR1_DBP;
|
PWR->CR1 |= PWR_CR1_DBP;
|
||||||
|
@ -421,7 +429,10 @@ uint32_t backup_reg_get_last_sleep_duration(void) {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param in
|
||||||
|
*/
|
||||||
void backup_reg_set_last_sleep_duration(uint32_t in) {
|
void backup_reg_set_last_sleep_duration(uint32_t in) {
|
||||||
#ifdef PARAMETEO
|
#ifdef PARAMETEO
|
||||||
backup_reg_unclock();
|
backup_reg_unclock();
|
||||||
|
@ -512,6 +523,12 @@ void backup_reg_set_telemetry(uint16_t in) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param beacon_counter
|
||||||
|
* @param meteo_counter
|
||||||
|
* @param meteo_gsm_counter
|
||||||
|
*/
|
||||||
void backup_reg_get_packet_counters(uint8_t * beacon_counter, uint8_t * meteo_counter, uint8_t * meteo_gsm_counter) {
|
void backup_reg_get_packet_counters(uint8_t * beacon_counter, uint8_t * meteo_counter, uint8_t * meteo_gsm_counter) {
|
||||||
#ifdef PARAMETEO
|
#ifdef PARAMETEO
|
||||||
uint32_t reg_value = REGISTER_PACKET_COUNTERS;
|
uint32_t reg_value = REGISTER_PACKET_COUNTERS;
|
||||||
|
@ -539,6 +556,12 @@ void backup_reg_get_packet_counters(uint8_t * beacon_counter, uint8_t * meteo_co
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param beacon_counter
|
||||||
|
* @param meteo_counter
|
||||||
|
* @param meteo_gsm_counter
|
||||||
|
*/
|
||||||
void backup_reg_set_packet_counters(uint8_t beacon_counter, uint8_t meteo_counter, uint8_t meteo_gsm_counter) {
|
void backup_reg_set_packet_counters(uint8_t beacon_counter, uint8_t meteo_counter, uint8_t meteo_gsm_counter) {
|
||||||
#ifdef PARAMETEO
|
#ifdef PARAMETEO
|
||||||
volatile uint32_t reg_value = REGISTER_PACKET_COUNTERS;
|
volatile uint32_t reg_value = REGISTER_PACKET_COUNTERS;
|
||||||
|
@ -572,3 +595,95 @@ void backup_reg_set_packet_counters(uint8_t beacon_counter, uint8_t meteo_counte
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void backup_reg_increment_aprsis_check_reset(void) {
|
||||||
|
// REGISTER_RESET_CHECK_FAIL
|
||||||
|
volatile uint32_t reg_value = REGISTER_RESET_CHECK_FAIL;
|
||||||
|
|
||||||
|
// get existing value
|
||||||
|
uint8_t counter = (uint8_t)(reg_value & 0xFFU);
|
||||||
|
|
||||||
|
// increment it
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
// clear existing value from register
|
||||||
|
reg_value &= 0xFFFFFF00U;
|
||||||
|
|
||||||
|
// add incremented counter value
|
||||||
|
reg_value |= counter;
|
||||||
|
|
||||||
|
backup_reg_unclock();
|
||||||
|
|
||||||
|
REGISTER_RESET_CHECK_FAIL = reg_value;
|
||||||
|
|
||||||
|
backup_reg_lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void backup_reg_increment_weather_measurements_check_reset(void) {
|
||||||
|
// REGISTER_RESET_CHECK_FAIL
|
||||||
|
volatile uint32_t reg_value = REGISTER_RESET_CHECK_FAIL;
|
||||||
|
|
||||||
|
// get existing value
|
||||||
|
uint8_t counter = (uint8_t)((reg_value & 0xFF00U) >> 8U);
|
||||||
|
|
||||||
|
// increment it
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
// clear existing value from register
|
||||||
|
reg_value &= 0xFFFF00FFU;
|
||||||
|
|
||||||
|
// add incremented counter value
|
||||||
|
reg_value |= ((uint32_t)counter << 8U);
|
||||||
|
|
||||||
|
backup_reg_unclock();
|
||||||
|
|
||||||
|
REGISTER_RESET_CHECK_FAIL = reg_value;
|
||||||
|
|
||||||
|
backup_reg_lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void backup_reg_increment_dallas_degraded_reset(void) {
|
||||||
|
// REGISTER_RESET_CHECK_FAIL
|
||||||
|
volatile uint32_t reg_value = REGISTER_RESET_CHECK_FAIL;
|
||||||
|
|
||||||
|
// get existing value
|
||||||
|
uint8_t counter = (uint8_t)((reg_value & 0xFF0000U) >> 16U);
|
||||||
|
|
||||||
|
// increment it
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
// clear existing value from register
|
||||||
|
reg_value &= 0xFF00FFFFU;
|
||||||
|
|
||||||
|
// add incremented counter value
|
||||||
|
reg_value |= ((uint32_t)counter << 16U);
|
||||||
|
|
||||||
|
backup_reg_unclock();
|
||||||
|
|
||||||
|
REGISTER_RESET_CHECK_FAIL = reg_value;
|
||||||
|
|
||||||
|
backup_reg_lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void backup_reg_increment_is_rtc_ok_check_reset(void) {
|
||||||
|
// REGISTER_RESET_CHECK_FAIL
|
||||||
|
volatile uint32_t reg_value = REGISTER_RESET_CHECK_FAIL;
|
||||||
|
|
||||||
|
// get existing value
|
||||||
|
uint8_t counter = (uint8_t)((reg_value & 0xFF000000U) >> 24U);
|
||||||
|
|
||||||
|
// increment it
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
// clear existing value from register
|
||||||
|
reg_value &= 0x00FFFFFFU;
|
||||||
|
|
||||||
|
// add incremented counter value
|
||||||
|
reg_value |= ((uint32_t)counter << 24U);
|
||||||
|
|
||||||
|
backup_reg_unclock();
|
||||||
|
|
||||||
|
REGISTER_RESET_CHECK_FAIL = reg_value;
|
||||||
|
|
||||||
|
backup_reg_lock();
|
||||||
|
}
|
||||||
|
|
23
src/main.c
23
src/main.c
|
@ -122,8 +122,8 @@
|
||||||
// 3 -> controller configuration status
|
// 3 -> controller configuration status
|
||||||
// 4 -> wakeup events MSB, sleep events LSB
|
// 4 -> wakeup events MSB, sleep events LSB
|
||||||
// 5 -> monitor
|
// 5 -> monitor
|
||||||
// 6 -> weather and telemetry timers & counters
|
// 6 -> last sleep time
|
||||||
|
// 7 -> weather and telemetry timers & counters
|
||||||
|
|
||||||
#define CONFIG_FIRST_RESTORED (1)
|
#define CONFIG_FIRST_RESTORED (1)
|
||||||
#define CONFIG_FIRST_FAIL_RESTORING (1 << 1)
|
#define CONFIG_FIRST_FAIL_RESTORING (1 << 1)
|
||||||
|
@ -1485,16 +1485,31 @@ int main(int argc, char* argv[]){
|
||||||
if ((main_config_data_gsm->aprsis_enable != 0) && (main_config_data_mode->gsm == 1)) {
|
if ((main_config_data_gsm->aprsis_enable != 0) && (main_config_data_mode->gsm == 1)) {
|
||||||
|
|
||||||
if (pwr_save_is_currently_cutoff() == 0) {
|
if (pwr_save_is_currently_cutoff() == 0) {
|
||||||
|
// this checks when APRS-IS was alive last time and when any packet
|
||||||
|
// has been sent to the server.
|
||||||
const int i_am_ok_with_aprsis = aprsis_check_connection_attempt_alive();
|
const int i_am_ok_with_aprsis = aprsis_check_connection_attempt_alive();
|
||||||
|
|
||||||
if (i_am_ok_with_aprsis != 0) {
|
if (i_am_ok_with_aprsis != 0) {
|
||||||
|
|
||||||
|
// increase counter stored in RTC backup register
|
||||||
|
backup_reg_increment_aprsis_check_reset();
|
||||||
|
|
||||||
|
// trigger a restart
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (rte_wx_check_weather_measurements() == 0) {
|
||||||
|
backup_reg_increment_weather_measurements_check_reset();
|
||||||
|
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
|
|
||||||
if (rte_wx_dallas_degraded_counter > DALLAS_MAX_LIMIT_OF_DEGRADED) {
|
if (rte_wx_dallas_degraded_counter > DALLAS_MAX_LIMIT_OF_DEGRADED) {
|
||||||
|
backup_reg_increment_dallas_degraded_reset();
|
||||||
|
|
||||||
rte_main_reboot_req = 1;
|
rte_main_reboot_req = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1504,7 +1519,11 @@ int main(int argc, char* argv[]){
|
||||||
if (--main_one_hour_pool_timer < 0) {
|
if (--main_one_hour_pool_timer < 0) {
|
||||||
main_one_hour_pool_timer = 60;
|
main_one_hour_pool_timer = 60;
|
||||||
|
|
||||||
|
// check if RTC is working correctly
|
||||||
if (system_is_rtc_ok() == 0) {
|
if (system_is_rtc_ok() == 0) {
|
||||||
|
|
||||||
|
backup_reg_increment_is_rtc_ok_check_reset();
|
||||||
|
|
||||||
rte_main_reboot_req = 1;
|
rte_main_reboot_req = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
79
src/rte_wx.c
79
src/rte_wx.c
|
@ -9,6 +9,11 @@
|
||||||
#include <rte_wx.h>
|
#include <rte_wx.h>
|
||||||
#include <wx_handler.h>
|
#include <wx_handler.h>
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "misc_config.h"
|
||||||
|
|
||||||
|
#ifndef RTE_WX_PROBLEMS_MAX_THRESHOLD
|
||||||
|
#define RTE_WX_PROBLEMS_MAX_THRESHOLD 20
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A little word of explanataion:
|
* A little word of explanataion:
|
||||||
|
@ -21,7 +26,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//float rte_wx_temperature_average_external = 0.0f; //<! This name should be refactored
|
|
||||||
float rte_wx_temperature_average_external_valid = 0.0f; //<! This name should be refactored
|
float rte_wx_temperature_average_external_valid = 0.0f; //<! This name should be refactored
|
||||||
float rte_wx_temperature_internal = 0.0f, rte_wx_temperature_internal_valid = 0.0f;
|
float rte_wx_temperature_internal = 0.0f, rte_wx_temperature_internal_valid = 0.0f;
|
||||||
float rte_wx_pressure = 0.0f, rte_wx_pressure_valid = 0.0f;
|
float rte_wx_pressure = 0.0f, rte_wx_pressure_valid = 0.0f;
|
||||||
|
@ -81,9 +85,15 @@ uint8_t rte_wx_davis_station_avaliable = 0;
|
||||||
uint8_t rte_wx_davis_loop_packet_avaliable = 0;
|
uint8_t rte_wx_davis_loop_packet_avaliable = 0;
|
||||||
davis_loop_t rte_wx_davis_loop_content;
|
davis_loop_t rte_wx_davis_loop_content;
|
||||||
|
|
||||||
|
uint8_t rte_wx_problems_wind_buffers = 0; //!< Problems detected with buffers content
|
||||||
|
uint8_t rte_wx_problems_wind_values = 0; //!< Problems with values calculated from buffers content
|
||||||
|
|
||||||
void rte_wx_init(void) {
|
void rte_wx_init(void) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
rte_wx_problems_wind_buffers = 0;
|
||||||
|
rte_wx_problems_wind_values = 0;
|
||||||
|
|
||||||
for (; i < WIND_AVERAGE_LEN; i++) {
|
for (; i < WIND_AVERAGE_LEN; i++) {
|
||||||
rte_wx_windspeed[i] = 0;
|
rte_wx_windspeed[i] = 0;
|
||||||
rte_wx_winddirection[i] = 0;
|
rte_wx_winddirection[i] = 0;
|
||||||
|
@ -116,3 +126,70 @@ void rte_wx_reset_last_measuremenet_timers(uint16_t parameter_type) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function checks if weather measurements looks to be valid and if they
|
||||||
|
* are changing over time. The function shall be called in one minute interval.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int8_t rte_wx_check_weather_measurements(void) {
|
||||||
|
int8_t looks_good = 1;
|
||||||
|
|
||||||
|
uint8_t i = 0; // loop iterator
|
||||||
|
|
||||||
|
// go through wind direction buffer and checks if it contains the same value
|
||||||
|
for (i = 0; i < WIND_AVERAGE_LEN - 1; i++) {
|
||||||
|
if (rte_wx_winddirection[i] != rte_wx_winddirection[i + 1]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if an end of the buffer has been reached
|
||||||
|
if (i >= WIND_AVERAGE_LEN - 1) {
|
||||||
|
rte_wx_problems_wind_buffers++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// go through wind speed buffer and checks if it contains the same value
|
||||||
|
for (i = 0; i < WIND_AVERAGE_LEN - 1; i++) {
|
||||||
|
if (rte_wx_windspeed[i] != rte_wx_windspeed[i + 1]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if an end of the buffer has been reached
|
||||||
|
if (i >= WIND_AVERAGE_LEN - 1) {
|
||||||
|
rte_wx_problems_wind_buffers++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if average wind speed is different from zero and the same than gusts
|
||||||
|
if (rte_wx_average_windspeed != 0 &&
|
||||||
|
(rte_wx_average_windspeed == rte_wx_max_windspeed))
|
||||||
|
{
|
||||||
|
// if so a wind sensor had been blocked by icing very rapidly
|
||||||
|
// before next DMA interrupt so rte_wx_windspeed is also
|
||||||
|
// not updated at all
|
||||||
|
rte_wx_problems_wind_values++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if wind direction equals exactly north (zero degrees)
|
||||||
|
if (rte_wx_average_winddirection == 0) {
|
||||||
|
// open wind direction input (anemometer disconnected) gives
|
||||||
|
// a reading of about 6 do 8 degrees. If it is stuck on zero
|
||||||
|
// the U->f converted or its reference clock generator
|
||||||
|
// might not work at all
|
||||||
|
rte_wx_problems_wind_values++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rte_wx_problems_wind_values = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rte_wx_problems_wind_values > RTE_WX_PROBLEMS_MAX_THRESHOLD) {
|
||||||
|
looks_good = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rte_wx_problems_wind_buffers > RTE_WX_PROBLEMS_MAX_THRESHOLD * 3) {
|
||||||
|
looks_good = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return looks_good;
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,9 @@ const uint32_t * const config_section_first_start = (const uint32_t *)CONFIG_S
|
||||||
const uint32_t * const config_section_second_start = (const uint32_t *)CONFIG_SECTION_SECOND_START;
|
const uint32_t * const config_section_second_start = (const uint32_t *)CONFIG_SECTION_SECOND_START;
|
||||||
const uint32_t * const config_section_default_start = (const uint32_t *)CONFIG_SECTION_DEFAULT_START;
|
const uint32_t * const config_section_default_start = (const uint32_t *)CONFIG_SECTION_DEFAULT_START;
|
||||||
|
|
||||||
|
uint8_t config_engineering_1 = 0xFFU;
|
||||||
|
uint8_t config_engineering_2 = 0xFFU;
|
||||||
|
|
||||||
#ifdef PARAMETEO
|
#ifdef PARAMETEO
|
||||||
#define STRUCT_COUNT 6
|
#define STRUCT_COUNT 6
|
||||||
#endif
|
#endif
|
||||||
|
@ -638,6 +641,9 @@ void configuration_handler_load_configuration(configuration_handler_region_t reg
|
||||||
|
|
||||||
configuration_handler_loaded = region;
|
configuration_handler_loaded = region;
|
||||||
|
|
||||||
|
config_engineering_1 = main_config_data_basic->engineering1;
|
||||||
|
config_engineering_2 = main_config_data_basic->engineering2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kiss_communication_nrc_t configuration_handler_erase_startup(void) {
|
kiss_communication_nrc_t configuration_handler_erase_startup(void) {
|
||||||
|
|
|
@ -180,7 +180,7 @@ void wx_pool_anemometer(const config_data_wx_sources_t * const config_sources, c
|
||||||
short i = 0;
|
short i = 0;
|
||||||
uint8_t average_ln;
|
uint8_t average_ln;
|
||||||
|
|
||||||
int32_t modbus_retval;
|
int32_t modbus_retval = MODBUS_RET_UNINITIALIZED;
|
||||||
uint16_t scaled_windspeed = 0;
|
uint16_t scaled_windspeed = 0;
|
||||||
|
|
||||||
//#ifdef STM32L471xx
|
//#ifdef STM32L471xx
|
||||||
|
|
Ładowanie…
Reference in New Issue