kopia lustrzana https://github.com/SP8EBC/ParaTNC
support for external watchdog IC, some code refactoring around the quality factor for analog anemometer
rodzic
dc347c2cb7
commit
b644c8d171
|
@ -5,7 +5,7 @@
|
|||
#include "drivers/serial.h"
|
||||
|
||||
#define SW_VER "DF05"
|
||||
#define SW_DATE "24072020"
|
||||
#define SW_DATE "27072020"
|
||||
|
||||
#define SYSTICK_TICKS_PER_SECONDS 100
|
||||
#define SYSTICK_TICKS_PERIOD 10
|
||||
|
|
|
@ -53,7 +53,7 @@ extern dallas_qf_t rte_wx_current_dallas_qf, rte_wx_error_dallas_qf;
|
|||
extern dallas_average_t rte_wx_dallas_average;
|
||||
extern ms5611_qf_t rte_wx_ms5611_qf;
|
||||
extern bme280_qf_t rte_wx_bme280_qf;
|
||||
extern analog_wind_qf_t rte_wx_analog_wind_qf;
|
||||
extern analog_wind_qf_t rte_wx_wind_qf;
|
||||
|
||||
#ifdef _UMB_MASTER
|
||||
|
||||
|
|
|
@ -477,6 +477,13 @@ int main(int argc, char* argv[]){
|
|||
IWDG_ReloadCounter();
|
||||
#endif
|
||||
|
||||
#ifdef EXTERNAL_WATCHDOG
|
||||
Configure_GPIO(GPIOA,12,GPPP_OUTPUT_2MHZ); // external watchdog
|
||||
|
||||
GPIOA->ODR ^= GPIO_Pin_12; // Flip the watchdog pin
|
||||
|
||||
#endif
|
||||
|
||||
// Infinite loop
|
||||
while (1)
|
||||
{
|
||||
|
@ -649,8 +656,6 @@ int main(int argc, char* argv[]){
|
|||
wx_pool_anemometer();
|
||||
|
||||
main_ten_second_pool_timer = 10000;
|
||||
|
||||
GPIOA->ODR = (GPIOA->ODR ^ GPIO_Pin_12);
|
||||
}
|
||||
|
||||
#ifdef _METEO
|
||||
|
|
|
@ -93,6 +93,10 @@ void packet_tx_handler(void) {
|
|||
|
||||
main_wait_for_tx_complete();
|
||||
|
||||
#ifdef EXTERNAL_WATCHDOG
|
||||
GPIOA->ODR ^= GPIO_Pin_12;
|
||||
#endif
|
||||
|
||||
packet_tx_meteo_counter = 0;
|
||||
}
|
||||
|
||||
|
@ -184,11 +188,11 @@ void packet_tx_handler(void) {
|
|||
}
|
||||
|
||||
// wind quality factor
|
||||
if (rte_wx_analog_wind_qf == AN_WIND_QF_UNKNOWN) {
|
||||
|
||||
if (rte_wx_wind_qf == AN_WIND_QF_UNKNOWN) {
|
||||
;
|
||||
}
|
||||
else {
|
||||
switch (rte_wx_analog_wind_qf) {
|
||||
switch (rte_wx_wind_qf) {
|
||||
case AN_WIND_QF_FULL: wind_qf = WIND_QF_FULL; break;
|
||||
case AN_WIND_QF_DEGRADED_DEBOUNCE:
|
||||
case AN_WIND_QF_DEGRADED_SLEW:
|
||||
|
|
|
@ -38,7 +38,7 @@ dallas_qf_t rte_wx_current_dallas_qf, rte_wx_error_dallas_qf = DALLAS_QF_UNKNOWN
|
|||
dallas_average_t rte_wx_dallas_average;
|
||||
ms5611_qf_t rte_wx_ms5611_qf = MS5611_QF_UNKNOWN;
|
||||
bme280_qf_t rte_wx_bme280_qf = BME280_QF_UKNOWN;
|
||||
analog_wind_qf_t rte_wx_analog_wind_qf = AN_WIND_QF_UNKNOWN;
|
||||
analog_wind_qf_t rte_wx_wind_qf = AN_WIND_QF_UNKNOWN;
|
||||
|
||||
#ifdef _UMB_MASTER
|
||||
umb_frame_t rte_wx_umb;
|
||||
|
|
|
@ -359,7 +359,12 @@ void wx_pool_anemometer(void) {
|
|||
if (rte_wx_average_winddirection < 0)
|
||||
rte_wx_average_winddirection += 360;
|
||||
|
||||
rte_wx_analog_wind_qf = analog_anemometer_get_qf();
|
||||
#ifdef _ANEMOMETER_ANALOGUE
|
||||
rte_wx_wind_qf = analog_anemometer_get_qf();
|
||||
#else
|
||||
rte_wx_wind_qf = AN_WIND_QF_UNKNOWN;
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef _ANEMOMETER_ANALOGUE
|
||||
|
||||
typedef enum analog_wind_qf {
|
||||
AN_WIND_QF_FULL,
|
||||
AN_WIND_QF_DEGRADED_DEBOUNCE,
|
||||
|
@ -23,6 +21,8 @@ typedef enum analog_wind_qf {
|
|||
AN_WIND_QF_UNKNOWN
|
||||
} analog_wind_qf_t;
|
||||
|
||||
#ifdef _ANEMOMETER_ANALOGUE
|
||||
|
||||
extern uint16_t analog_anemometer_windspeed_pulses_time[ANALOG_ANEMOMETER_SPEED_PULSES_N];
|
||||
extern uint16_t analog_anemometer_time_between_pulses[ANALOG_ANEMOMETER_SPEED_PULSES_N];
|
||||
extern uint16_t analog_anemometer_pulses_per_m_s_constant;
|
||||
|
|
|
@ -38,11 +38,10 @@ uint16_t tx20_current_direction;
|
|||
|
||||
#define PI 3.14159265
|
||||
|
||||
#ifdef _METEO
|
||||
void inline TX20BlinkLed(void) {
|
||||
led_flip_led2_botoom();
|
||||
}
|
||||
#endif
|
||||
//#ifdef _METEO
|
||||
//void inline TX20BlinkLed(void) {
|
||||
//}
|
||||
//#endif
|
||||
|
||||
void tx20_init(void) {
|
||||
int i;
|
||||
|
@ -96,7 +95,7 @@ void tx20_batch(void) {
|
|||
if (DCD == 1)
|
||||
if (FC == 0x29) {
|
||||
#ifdef _METEO
|
||||
TX20BlinkLed();
|
||||
led_flip_led2_bottom();
|
||||
#endif
|
||||
if (OE >= 3) {
|
||||
tx20_data_parse();
|
||||
|
|
Ładowanie…
Reference in New Issue