timeout during RTC initialization amd low vbatt cutoff patch

tatry_variant EA08
Mateusz Lubecki 2022-06-24 19:01:32 +02:00
rodzic 1663fa768a
commit 8d0dd57116
12 zmienionych plików z 165 dodań i 337 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="ilg.gnumcueclipse.debug.gdbjtag.openocd.launchConfigurationType">
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.PERIPHERALS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;peripherals&gt;&#10; &lt;peripheral name=&quot;GPIOC&quot;/&gt;&#10; &lt;peripheral name=&quot;TIM8&quot;/&gt;&#10;&lt;/peripherals&gt;&#10;"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.PERIPHERALS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;peripherals&gt;&#10; &lt;peripheral name=&quot;GPIOA&quot;/&gt;&#10; &lt;peripheral name=&quot;RTC&quot;/&gt;&#10;&lt;/peripherals&gt;&#10;"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doContinue" value="true"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doDebugInRam" value="false"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doFirstReset" value="true"/>
@ -57,6 +57,6 @@
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList context=&quot;Context string&quot;&gt;&#10; &lt;memoryBlockExpression address=&quot;536876736&quot; label=&quot;api_buffer&quot;/&gt;&#10;&lt;/memoryBlockExpressionList&gt;&#10;"/>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList context=&quot;Context string&quot;/&gt;&#10;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

Wyświetl plik

@ -35,6 +35,6 @@
/**
* Do not uncomment this on production devices
*/
#define INHIBIT_CUTOFF
//#define INHIBIT_CUTOFF
#endif /* INCLUDE_PWR_SAVE_CONFIGURATION_H_ */

Wyświetl plik

@ -8,24 +8,38 @@
#ifndef STATION_CONFIG_H_
#define STATION_CONFIG_H_
#define _POWERSAVE_NORMAL
//#define _POWERSAVE_AGGRESIVE
/* ------------------ */
/* MODES OF OPERATION */
#define _METEO // Enable meteo station
#define _DIGI // Enable WIDE1-1 digipeater
//#define _DIGI_ONLY_789 // Limit digipeater to handle only -7, -8 and -9 SSIDs
//#define _VICTRON // Enable support for Victron VE.Direct protocol
//#define _DIGI // Enable WIDE1-1 digipeater
//#define _DIGI_VISCOUS
#define _DIGI_ONLY_789 // Limit digipeater to handle only -7, -8 and -9 SSIDs
#define _GSM // only for ParaMETEO
#define _GSM_KEEP_MODEM_ALWAYS_ON
#define _WX_DOUBLE_TRANSMIT
/* MODES OF OPERATION */
/* ------------------ */
/**
* Enable support for Victron VE.Direct protocol. This is independent from wx sensor configuration
*/
//#define _VICTRON
/* ---------------------------- */
/* WEATHER/METEO CONFIGURATION */
// If none of those three sources are chosen (uncommented) the software will use internal sensors
/**
* Three defines below enables or disabled listed communication drivers. Enabling any of then doesn't means
* that these are used as a data source automatically. That shall be set in 'DATA SOURCES CONFIG' section.
*/
//#define _UMB_MASTER
//#define _DAVIS_SERIAL
@ -40,6 +54,9 @@
// May be used even if _METEO is not enabled
#define _DALLAS_SPLIT_PIN // Must be enabled for all ParaTNC hardware revisions
/* WEATHER/METEO CONFIGURATION */
/* ---------------------------- */
/******** INTERNAL SENSORS CONFIGURATION *****************/
@ -47,9 +64,12 @@
#define _ANEMOMETER_ANALOGUE // Use analogue/mechanical (like Davis 6410) as an internal anemometr
#define _ANEMOMETER_PULSES_IN_10SEC_PER_ONE_MS_OF_WINDSPEED 10
//#define _SENSOR_MS5611
#define _SENSOR_BME280
#define _SENSOR_MS5611
//#define _SENSOR_BME280
/******** INTERNAL SENSORS CONFIGURATION *****************/
/******** UMB MASTER CONFIGURATION *****************/
#define _UMB_SLAVE_ID 1
#define _UMB_SLAVE_CLASS 8
#define _UMB_CHANNEL_WINDSPEED 460
@ -57,8 +77,33 @@
#define _UMB_CHANNEL_WINDDIRECTION 580
#define _UMB_CHANNEL_TEMPERATURE 100
#define _UMB_CHANNEL_QFE 300
/******** UMB MASTER CONFIGURATION *****************/
/*************** DATA SOURCES CONFIG ***********************/
//#define _TEMPERATURE_INTERNAL
//#define _TEMPERATURE_UMB
#define _TEMPERATURE_RTU
//#define _TEMPERATURE_DAVIS
//
#define _PRESSURE_INTERNAL
//#define _PRESSURE_UMB
//#define _PRESSURE_RTU
//#define _PRESSURE_DAVIS
//
//#define _HUMIDITY_INTERNAL
//#define _HUMIDITY_UMB
#define _HUMIDITY_RTU
//#define _HUMIDITY_DAVIS
//
//
#define _WIND_INTERNAL
//#define _WIND_UMB
//#define _WIND_RTU
//#define _WIND_FULL_RTU
//#define _WIND_DAVIS
/*************** DATA SOURCES CONFIG ***********************/
/******** INTERNAL SENSORS CONFIGURATION *****************/
/* WEATHER/METEO CONFIGURATION */
/* ---------------------------- */
@ -68,20 +113,21 @@
// and switch device to "pure" kiss TNC operation. Packets from PC will be transmitted normally.
// Coordines should be in APRS decimal format DDDMM.SS for Longitude and DDMM.SS for latitude
#define _CALL "N0CALL"
#define _SSID 0
#define _LAT 4935.00
#define _CALL "ABAKUS"
#define _SSID 1
#define _LAT 4948.11
#define _LATNS 'N'
#define _LON 01919.19
#define _LON 01903.22
#define _LONWE 'E'
#define _COMMENT "Set Your configuration in this file and rename to station_config.h"
// You can use only one of these below defines to choose symbol. Meteo data are are always transmitted with blue WX symbol
//#define _SYMBOL_DIGI // uncomment if you want digi symbol(green star with D inside)
#define _SYMBOL_WIDE1_DIGI // uncomment if you want 'little' digi symbol (green star with digit 1 overlaid)
//#define _SYMBOL_WIDE1_DIGI // uncomment if you want 'little' digi symbol (green star with digit 1 overlaid)
//#define _SYMBOL_HOUSE // uncomment if you want house symbol
//#define _SYMBOL_RXIGATE // uncomment if you want rxigate symbol (black diamond with R)
//#define _SYMBOL_IGATE // uncomment if you want igate symol (black diamond with I)
#define _SYMBOL_SAILBOAT
// Or you can keep commented all symbol defines and choose custom one based on data from APRS symbols table
//#define _SYMBOL_F '/'
@ -89,18 +135,20 @@
// Uncomment one of these two defines to choose what path You want. If you uncommend both of them or
// if you keep both commended path will be completely disabled. CALL-S>AKLPRZ:data
#define _WIDE1_PATH // CALL-S>AKLPRZ,WIDE1-1:data
//#define _WIDE1_PATH // CALL-S>AKLPRZ,WIDE1-1:data
//#define _WIDE21_PATH // CALL-S>AKLPRZ,WIDE2-1:data
// Comment this to disable beacon auto sending during startup (this can be risky if RF feedback occur)
//#define _BCN_ON_STARTUP
#define _BCN_ON_STARTUP
#define _WX_INTERVAL 7 // WX packet interval in minutes
#define _BCN_INTERVAL 45 // Own beacon interval in minutes
#define _WX_INTERVAL 4 // WX packet interval in minutes
#define _BCN_INTERVAL 125 // Own beacon interval in minutes
#define _PTT_PUSHPULL // Uncomment this if you want PTT line to work as Push-pull instead of Open Drain
#define _SERIAL_BAUDRATE 9600
#define _DIGI_VISCOUS_DEALY 2
// Transmitting delay
#define _DELAY_BASE 20 // * 50ms. For example setting 10 gives 500msec delay. Maximum value is 20
//#define _RANDOM_DELAY // adds random delay TO fixed time set by _DELAY_BASE. This additional time can be
@ -133,6 +181,9 @@
// D
//
// because of that D cannot be set to zero
//
// scaling for temperature shall be set to get *10 temperature
// as an output of getter / 123 -> 12.3 oC
#define _RTU_SLAVE_SPEED 9600u
#define _RTU_SLAVE_PARITY 0
#define _RTU_SLAVE_STOP_BITS 2
@ -140,7 +191,7 @@
#define _RTU_SLAVE_ID_1 0x01
#define _RTU_SLAVE_FUNC_1 0x03
#define _RTU_SLAVE_ADDR_1 0x00
#define _RTU_SLAVE_LENGHT_1 0x05
#define _RTU_SLAVE_LENGHT_1 0x01
#define _RTU_SLAVE_SCALING_A_1 0
#define _RTU_SLAVE_SCALING_B_1 1
#define _RTU_SLAVE_SCALING_C_1 0
@ -173,11 +224,30 @@
#define _RTU_SLAVE_SCALING_C_4 0
#define _RTU_SLAVE_SCALING_D_4 1
#define _RTU_SLAVE_ID_5 0x00
#define _RTU_SLAVE_FUNC_5 0x00
#define _RTU_SLAVE_ADDR_5 0x03
//#define _RTU_SLAVE_LENGHT_4 0x01
#define _RTU_SLAVE_SCALING_A_5 0
#define _RTU_SLAVE_SCALING_B_5 1
#define _RTU_SLAVE_SCALING_C_5 0
#define _RTU_SLAVE_SCALING_D_5 1
#define _RTU_SLAVE_ID_6 0x00
#define _RTU_SLAVE_FUNC_6 0x00
#define _RTU_SLAVE_ADDR_6 0x00
//#define _RTU_SLAVE_LENGHT_4 0x01
#define _RTU_SLAVE_SCALING_A_6 0
#define _RTU_SLAVE_SCALING_B_6 1
#define _RTU_SLAVE_SCALING_C_6 0
#define _RTU_SLAVE_SCALING_D_6 1
#define _RTU_SLAVE_TEMPERATURE_SOURCE 1
#define _RTU_SLAVE_HUMIDITY_SOURCE 2
#define _RTU_SLAVE_PRESSURE_SOURCE 3
#define _RTU_SLAVE_WIND_DIRECTION_SORUCE 4
#define _RTU_SLAVE_WIND_SPEED_SOURCE 4
//#define _RTU_SLAVE_PRESSURE_SOURCE 3
//#define _RTU_SLAVE_WIND_DIRECTION_SORUCE 4
//#define _RTU_SLAVE_WIND_SPEED_SOURCE 4
/* MODBUS RTU CONFIGURATION */
@ -204,23 +274,20 @@
defined (_SYMBOL_IGATE)
#define _SYMBOL_F 'R'
#define _SYMBOL_S '&'
#elif !defined (_SYMBOL_DIGI) && !defined (_SYMBOL_WIDE1_DIGI) && !defined (_SYMBOL_HOUSE) && !defined (_SYMOL_RXIGATE) &&\
!defined (_SYMBOL_IGATE) && defined(_SYMBOL_SAILBOAT)
#define _SYMBOL_F '/'
#define _SYMBOL_S 'Y'
#elif !defined (_SYMBOL_F) && !defined (_SYMBOL_S)
#error "Missing symbol configuration in station_config.h"
#elif defined (_SYMBOL_F) && defined (_SYMBOL_S)
#else
#error "Wrong symbol configuration in station_config.h"
#endif
#if defined (_METEO) && !defined (_DIGI)
#define _DIGI
#endif
//#if defined (_METEO) && !defined (_DIGI)
//#define _DIGI
//#endif
#if defined(PARATNC_HWREV_A) && (defined (_METEO) || defined (_DALLAS_AS_TELEM)) && !defined(_DALLAS_SPLIT_PIN)
#define _DALLAS_SPLIT_PIN
#endif
#if defined(PARATNC_HWREV_B) && (defined (_METEO) || defined (_DALLAS_AS_TELEM)) && !defined(_DALLAS_SPLIT_PIN)
#define _DALLAS_SPLIT_PIN
#endif
#if defined(_ANEMOMETER_TX20) && defined(_ANEMOMETER_ANALOGUE)
#error "You cannot use two anemometers at once!!!"

Wyświetl plik

@ -1,294 +0,0 @@
/*
* config.h
*
* Created on: 03.07.2017
* Author: mateusz
*/
#ifndef STATION_CONFIG_H_
#define STATION_CONFIG_H_
//#define _POWERSAVE_NORMAL
#define _POWERSAVE_AGGRESIVE
/* ------------------ */
/* MODES OF OPERATION */
#define _METEO // Enable meteo station
//#define _DIGI // Enable WIDE1-1 digipeater
//#define _DIGI_ONLY_789 // Limit digipeater to handle only -7, -8 and -9 SSIDs
//#define _VICTRON // Enable support for Victron VE.Direct protocol
#define _GSM // only for ParaMETEO
#define _WX_DOUBLE_TRANSMIT
/* MODES OF OPERATION */
/* ------------------ */
//#define PARATNC_HWREV_C
#define PARAMETEO
/* ---------------------------- */
/* WEATHER/METEO CONFIGURATION */
// If none of those three sources are chosen (uncommented) the software will use internal sensors
//#define _UMB_MASTER
//#define _DAVIS_SERIAL
//#define _MODBUS_RTU // use Modbus RTU slave devices as a external meteo data source. For more configuration
// (slave ids, registers...) please look into MODBUS RTU CONFIGURATION section of this file
#define _INTERNAL_AS_BACKUP // if defined ParaTNC will switch to internal sensors in case of
// the communication with UMB/Dallas Serial/Modbus external sensors will hang up
//#define _DALLAS_AS_TELEM // Use Dallas one-wire thermometer as a 5th telemetry channel
// May be used even if _METEO is not enabled
#define _DALLAS_SPLIT_PIN // Must be enabled for all ParaTNC hardware revisions
/******** INTERNAL SENSORS CONFIGURATION *****************/
//#define _ANEMOMETER_TX20 // Use TX20 as an internal anemometer
#define _ANEMOMETER_ANALOGUE // Use analogue/mechanical (like Davis 6410) as an internal anemometr
#define _ANEMOMETER_PULSES_IN_10SEC_PER_ONE_MS_OF_WINDSPEED 10
#define _SENSOR_MS5611
//#define _SENSOR_BME280
#define _UMB_SLAVE_ID 1
#define _UMB_SLAVE_CLASS 8
#define _UMB_CHANNEL_WINDSPEED 460
#define _UMB_CHANNEL_WINDGUSTS 440
#define _UMB_CHANNEL_WINDDIRECTION 580
#define _UMB_CHANNEL_TEMPERATURE 100
#define _UMB_CHANNEL_QFE 300
/******** INTERNAL SENSORS CONFIGURATION *****************/
/*************** DATA SOURCES CONFIG ***********************/
#define _TEMPERATURE_INTERNAL
//#define _TEMPERATURE_UMB
//#define _TEMPERATURE_RTU
//#define _TEMPERATURE_DAVIS
//
#define _PRESSURE_INTERNAL
//#define _PRESSURE_UMB
//#define _PRESSURE_RTU
//#define _PRESSURE_DAVIS
//
#define _HUMIDITY_INTERNAL
//#define _HUMIDITY_UMB
//#define _HUMIDITY_RTU
//#define _HUMIDITY_DAVIS
//
//
#define _WIND_INTERNAL
//#define _WIND_UMB
//#define _WIND_RTU
//#define _WIND_FULL_RTU
//#define _WIND_DAVIS
/*************** DATA SOURCES CONFIG ***********************/
/* WEATHER/METEO CONFIGURATION */
/* ---------------------------- */
//#define _MUTE_RF // TODO: Not yet implemented - This will make station RXonly and disable all data transmission
//#define _MUTE_OWN // TODO: Not yet implemented - This will disable all self-generated packets (wx, telemetry, beacon)
// and switch device to "pure" kiss TNC operation. Packets from PC will be transmitted normally.
// Coordines should be in APRS decimal format DDDMM.SS for Longitude and DDMM.SS for latitude
#define _CALL "SR9WXZ"
#define _SSID 0
#define _LAT 4943.44
#define _LATNS 'N'
#define _LON 01912.11
#define _LONWE 'E'
#define _COMMENT "WX only = TXPower 2W = Klub Zeglarski Halny, plywajaca keja manewrowa na J. Zywieckim = sp8ebc@interia.pl"
// You can use only one of these below defines to choose symbol. Meteo data are are always transmitted with blue WX symbol
//#define _SYMBOL_DIGI // uncomment if you want digi symbol(green star with D inside)
//#define _SYMBOL_WIDE1_DIGI // uncomment if you want 'little' digi symbol (green star with digit 1 overlaid)
//#define _SYMBOL_HOUSE // uncomment if you want house symbol
//#define _SYMBOL_RXIGATE // uncomment if you want rxigate symbol (black diamond with R)
//#define _SYMBOL_IGATE // uncomment if you want igate symol (black diamond with I)
#define _SYMBOL_SAILBOAT
// Or you can keep commented all symbol defines and choose custom one based on data from APRS symbols table
//#define _SYMBOL_F '/'
//#define _SYMBOL_S '#'
// Uncomment one of these two defines to choose what path You want. If you uncommend both of them or
// if you keep both commended path will be completely disabled. CALL-S>AKLPRZ:data
//#define _WIDE1_PATH // CALL-S>AKLPRZ,WIDE1-1:data
//#define _WIDE21_PATH // CALL-S>AKLPRZ,WIDE2-1:data
// Comment this to disable beacon auto sending during startup (this can be risky if RF feedback occur)
#define _BCN_ON_STARTUP
#define _WX_INTERVAL 5 // WX packet interval in minutes
#define _BCN_INTERVAL 45 // Own beacon interval in minutes
#define _PTT_PUSHPULL // Uncomment this if you want PTT line to work as Push-pull instead of Open Drain
#define _SERIAL_BAUDRATE 9600
// Transmitting delay
#define _DELAY_BASE 20 // * 50ms. For example setting 10 gives 500msec delay. Maximum value is 20
//#define _RANDOM_DELAY // adds random delay TO fixed time set by _DELAY_BASE. This additional time can be
// from 100ms up to 1 sec in 100ms steps. Values are drawn from samples going from ADC
// so it is better to use Unsquelched output in radio to provide much more randomness
//After waiting time declared above ParaTNC will check DCD (Data Carrier Detect) flag, which works as some
//kind of semaphore. If radio channel is not occupied by any other transmission TX will be keyed up immediately,
//otherwise software will wait for clear conditions.
// Few IMPORTANT hints about setting transmit delay properly.
//
// Transmit delay is key parameter to maintain RF network free from packet losses and collisions. If your station will be
// installed on tall object, without any other digi's close to it, you can set _DELAY_BASE to very low value and disable
// _RANDOM_DELAY. If you wanna rather auxiliary station, witch should only fill gap in RF coverage in small area, then
// _DELAY_BASE parameter should be not less than 12 (600msec), the smallest range the higher _DELAY_BASE should be.
// Additionally for gapfillers (auxiliary stations) _RANDOM_DELAY schould be enabled.
//
// This delay will ensure that while other station will be transmitting repeated packets from mobile, Yours will keep
// always quiet and won't jam RF network. This greatly improve DCD based access to channel. Various controllers uses
// various lenght of preamble, some of them produce signal which might be impossible to decode by ParaTNC, so DCD
// is only one part of effective multiaccess to medium.
/* ---------------------------- */
/* MODBUS RTU CONFIGURATION */
// scaling coefficients are used as follows
//
// A * x ^ 2 + B * x + C
// real value = ---------------------------
// D
//
// because of that D cannot be set to zero
#define _RTU_SLAVE_SPEED 9600u
#define _RTU_SLAVE_PARITY 0
#define _RTU_SLAVE_STOP_BITS 2
#define _RTU_SLAVE_ID_1 0x01
#define _RTU_SLAVE_FUNC_1 0x03
#define _RTU_SLAVE_ADDR_1 0x00
#define _RTU_SLAVE_LENGHT_1 0x01
#define _RTU_SLAVE_SCALING_A_1 0
#define _RTU_SLAVE_SCALING_B_1 1
#define _RTU_SLAVE_SCALING_C_1 0
#define _RTU_SLAVE_SCALING_D_1 10
#define _RTU_SLAVE_ID_2 0x01
#define _RTU_SLAVE_FUNC_2 0x03
#define _RTU_SLAVE_ADDR_2 0x01
//#define _RTU_SLAVE_LENGHT_2 0x01
#define _RTU_SLAVE_SCALING_A_2 0
#define _RTU_SLAVE_SCALING_B_2 1
#define _RTU_SLAVE_SCALING_C_2 0
#define _RTU_SLAVE_SCALING_D_2 1
#define _RTU_SLAVE_ID_3 0x01
#define _RTU_SLAVE_FUNC_3 0x03
#define _RTU_SLAVE_ADDR_3 0x02
//#define _RTU_SLAVE_LENGHT_3 0x01
#define _RTU_SLAVE_SCALING_A_3 0
#define _RTU_SLAVE_SCALING_B_3 1
#define _RTU_SLAVE_SCALING_C_3 0
#define _RTU_SLAVE_SCALING_D_3 1
#define _RTU_SLAVE_ID_4 0x01
#define _RTU_SLAVE_FUNC_4 0x03
#define _RTU_SLAVE_ADDR_4 0x03
//#define _RTU_SLAVE_LENGHT_4 0x01
#define _RTU_SLAVE_SCALING_A_4 0
#define _RTU_SLAVE_SCALING_B_4 1
#define _RTU_SLAVE_SCALING_C_4 0
#define _RTU_SLAVE_SCALING_D_4 1
#define _RTU_SLAVE_ID_5 0x00
#define _RTU_SLAVE_FUNC_5 0x00
#define _RTU_SLAVE_ADDR_5 0x03
//#define _RTU_SLAVE_LENGHT_4 0x01
#define _RTU_SLAVE_SCALING_A_5 0
#define _RTU_SLAVE_SCALING_B_5 1
#define _RTU_SLAVE_SCALING_C_5 0
#define _RTU_SLAVE_SCALING_D_5 1
#define _RTU_SLAVE_ID_6 0x00
#define _RTU_SLAVE_FUNC_6 0x00
#define _RTU_SLAVE_ADDR_6 0x00
//#define _RTU_SLAVE_LENGHT_4 0x01
#define _RTU_SLAVE_SCALING_A_6 0
#define _RTU_SLAVE_SCALING_B_6 1
#define _RTU_SLAVE_SCALING_C_6 0
#define _RTU_SLAVE_SCALING_D_6 1
//#define _RTU_SLAVE_TEMPERATURE_SOURCE 1
#define _RTU_SLAVE_HUMIDITY_SOURCE 2
//#define _RTU_SLAVE_PRESSURE_SOURCE 3
//#define _RTU_SLAVE_WIND_DIRECTION_SORUCE 4
//#define _RTU_SLAVE_WIND_SPEED_SOURCE 4
/* MODBUS RTU CONFIGURATION */
/* ---------------------------- */
// Do not touch this
#if defined (_SYMBOL_DIGI) && !defined (_SYMBOL_WIDE1_DIGI) && !defined (_SYMBOL_HOUSE) && !defined (_SYMOL_RXIGATE) &&\
!defined (_SYMBOL_IGATE)
#define _SYMBOL_F '/'
#define _SYMBOL_S '#'
#elif !defined (_SYMBOL_DIGI) && defined (_SYMBOL_WIDE1_DIGI) && !defined (_SYMBOL_HOUSE) && !defined (_SYMOL_RXIGATE) &&\
!defined (_SYMBOL_IGATE)
#define _SYMBOL_F '1'
#define _SYMBOL_S '#'
#elif !defined (_SYMBOL_DIGI) && !defined (_SYMBOL_WIDE1_DIGI) && defined (_SYMBOL_HOUSE) && !defined (_SYMOL_RXIGATE) &&\
!defined (_SYMBOL_IGATE)
#define _SYMBOL_F '/'
#define _SYMBOL_S '-'
#elif !defined (_SYMBOL_DIGI) && !defined (_SYMBOL_WIDE1_DIGI) && !defined (_SYMBOL_HOUSE) && defined (_SYMOL_RXIGATE) &&\
!defined (_SYMBOL_IGATE)
#define _SYMBOL_F 'I'
#define _SYMBOL_S '&'
#elif !defined (_SYMBOL_DIGI) && !defined (_SYMBOL_WIDE1_DIGI) && !defined (_SYMBOL_HOUSE) && !defined (_SYMOL_RXIGATE) &&\
defined (_SYMBOL_IGATE)
#define _SYMBOL_F 'R'
#define _SYMBOL_S '&'
#elif !defined (_SYMBOL_DIGI) && !defined (_SYMBOL_WIDE1_DIGI) && !defined (_SYMBOL_HOUSE) && !defined (_SYMOL_RXIGATE) &&\
!defined (_SYMBOL_IGATE) && defined(_SYMBOL_SAILBOAT)
#define _SYMBOL_F '/'
#define _SYMBOL_S 'Y'
#elif !defined (_SYMBOL_F) && !defined (_SYMBOL_S)
#error "Missing symbol configuration in station_config.h"
#elif defined (_SYMBOL_F) && defined (_SYMBOL_S)
#else
#error "Wrong symbol configuration in station_config.h"
#endif
//#if defined (_METEO) && !defined (_DIGI)
//#define _DIGI
//#endif
#if defined(PARATNC_HWREV_A) && (defined (_METEO) || defined (_DALLAS_AS_TELEM)) && !defined(_DALLAS_SPLIT_PIN)
#define _DALLAS_SPLIT_PIN
#endif
#if defined(PARATNC_HWREV_B) && (defined (_METEO) || defined (_DALLAS_AS_TELEM)) && !defined(_DALLAS_SPLIT_PIN)
#define _DALLAS_SPLIT_PIN
#endif
#if defined(_ANEMOMETER_TX20) && defined(_ANEMOMETER_ANALOGUE)
#error "You cannot use two anemometers at once!!!"
#endif
#if defined(_MOBUS_RTU) && defined(_DAVIS_SERIAL)
#error "You cannot use modbus RTU devices and Davis weather station at once!!!"
#endif
#if !defined(_ANEMOMETER_TX20) && !defined(_ANEMOMETER_ANALOGUE) && !defined(_UMB_MASTER) && defined(_METEO)
#define _ANEMOMETER_TX20
#endif
#endif /* STATION_CONFIG_H_ */

Wyświetl plik

@ -7,8 +7,8 @@
#include "drivers/serial.h"
#include "config_data.h"
#define SW_VER "EA07"
#define SW_DATE "09062022"
#define SW_VER "EA08"
#define SW_DATE "24062022"
#define SYSTICK_TICKS_PER_SECONDS 100
#define SYSTICK_TICKS_PERIOD 10

Wyświetl plik

@ -662,6 +662,7 @@ int main(int argc, char* argv[]){
#if defined(STM32L471xx)
main_wx_srl_ctx_ptr->te_pin = LL_GPIO_PIN_8;
main_wx_srl_ctx_ptr->te_port = GPIOA;
main_wx_srl_ctx_ptr->early_tx_assert = 1; // TODO: move to configuration!!
srl_init(main_gsm_srl_ctx_ptr, USART3, srl_usart3_rx_buffer, RX_BUFFER_3_LN, srl_usart3_tx_buffer, TX_BUFFER_3_LN, 115200, 1);
#endif

Wyświetl plik

@ -531,6 +531,10 @@ void pwr_save_switch_mode_to_l6(uint16_t sleep_time) {
return;
}
if (system_is_rtc_ok() == 0) {
return;
}
main_set_monitor(28);
// turn OFF +5V_S (and internal VHF radio module in HW-RevB)
@ -581,6 +585,10 @@ void pwr_save_switch_mode_to_l7(uint16_t sleep_time) {
return;
}
if (system_is_rtc_ok() == 0) {
return;
}
main_set_monitor(26);
// turn OFF +5V_S (and internal VHF radio module in HW-RevB)

Wyświetl plik

@ -12,5 +12,6 @@ void system_clock_update_l4(void); // SystemCoreClockUpdateL4
int system_clock_configure_l4(void); // SystemClock_Config_L4
int system_clock_configure_rtc_l4(void);
void system_clock_configure_auto_wakeup_l4(uint16_t seconds);
int system_is_rtc_ok(void);
#endif /* INCLUDE_CMSIS_STM32L4XX_SYSTEM_STM32L4XX_H_ */

Wyświetl plik

@ -74,6 +74,7 @@ typedef struct srl_context_t {
GPIO_TypeDef* te_port;
uint16_t te_pin;
uint16_t early_tx_assert;
// these pointers points to either internal buffer
// or external provided by caller, depends on 'uint8_t internal_external'

Wyświetl plik

@ -181,6 +181,8 @@
*/
uint32_t SystemCoreClock = 4000000U;
uint32_t SystemRtcHasFailed = 0;
const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U};
const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U};
const uint32_t MSIRangeTable[12] = {100000U, 200000U, 400000U, 800000U, 1000000U, 2000000U, \
@ -427,7 +429,9 @@ int system_clock_configure_l4(void)
void system_clock_start_rtc_l4(void) {
if ((RCC->BDCR & RCC_BDCR_LSERDY) == 0) {
volatile uint32_t timeout_counter = 0;
if ((RCC->BDCR & RCC_BDCR_LSERDY) == 0 || SystemRtcHasFailed == 1) {
return;
}
@ -442,7 +446,13 @@ void system_clock_start_rtc_l4(void) {
RTC->ISR |= RTC_ISR_INIT;
// wait for going into clock set mode
while((RTC->ISR & RTC_ISR_INITF) == 0);
while((RTC->ISR & RTC_ISR_INITF) == 0) {
if (timeout_counter++ > SYSTEM_CLOCK_RTC_CLOCK_TIMEOUT) {
SystemRtcHasFailed = 1;
return;
}
}
// set date
RTC->DR = 0x0021A820;
@ -507,13 +517,17 @@ int system_clock_configure_rtc_l4(void) {
if (timeout_counter++ > SYSTEM_CLOCK_RTC_CLOCK_TIMEOUT) {
retval = -1;
SystemRtcHasFailed = 1;
break;
}
}
}
// starting and configuring the RTC itself
system_clock_start_rtc_l4();
if (SystemRtcHasFailed == 0) {
// starting and configuring the RTC itself
system_clock_start_rtc_l4();
}
// disable access do backup domain
PWR->CR1 &= (0xFFFFFFFF ^ PWR_CR1_DBP);
@ -523,6 +537,10 @@ int system_clock_configure_rtc_l4(void) {
void system_clock_configure_auto_wakeup_l4(uint16_t seconds) {
if (SystemRtcHasFailed == 1) {
return;
}
// enable access to backup domain
PWR->CR1 |= PWR_CR1_DBP;
@ -569,6 +587,27 @@ void system_clock_configure_auto_wakeup_l4(uint16_t seconds) {
PWR->CR1 &= (0xFFFFFFFF ^ PWR_CR1_DBP);
}
int system_is_rtc_ok(void) {
int result = 1;
// check if LSE is working now
uint8_t lse_is_working = ((RCC->BDCR & RCC_BDCR_LSERDY) > 0) ? 1 : 0;
if (SystemRtcHasFailed == 1) {
result = 0;
}
if ((RCC->BDCR & RCC_BDCR_RTCEN) == 0) {
result = 0;
}
if (lse_is_working == 0) {
result = 0;
}
return result;
}
/**
* @}

Wyświetl plik

@ -240,6 +240,10 @@ uint8_t srl_send_data(srl_context_t *ctx, const uint8_t* data, uint8_t mode, uin
}
else return SRL_WRONG_BUFFER_PARAM;
if (ctx->te_port != 0 && ctx->early_tx_assert != 0) {
LL_GPIO_SetOutputPin(ctx->te_port, ctx->te_pin);
}
// enabling transmitter
ctx->port->CR1 |= USART_CR1_TE;
ctx->port->ISR &= (0xFFFFFFFF ^ USART_ISR_TC);
@ -268,8 +272,9 @@ uint8_t srl_start_tx(srl_context_t *ctx, short leng) {
// setting a pointer to transmit buffer to the internal buffer inside the driver
//ctx->srl_tx_buf_pointer = srl_usart1_tx_buffer;
// if (ctx->te_port != 0)
// GPIO_SetBits(ctx->te_port, ctx->te_pin);
if (ctx->te_port != 0 && ctx->early_tx_assert != 0) {
LL_GPIO_SetOutputPin(ctx->te_port, ctx->te_pin);
}
// check if delay should be applied to transmission
if (ctx->srl_tx_start_time == 0xFFFFFFFFu) {

Wyświetl plik

@ -225,7 +225,7 @@ int32_t rtu_serial_pool(void) {
// stupid workaround. If there is a lot of I/O errors reset the controller
if (rte_rtu_number_of_serial_io_errors >= (0xFF - RTU_NUMBER_OF_ERRORS_TO_TRIG_STATUS))
if (rte_rtu_number_of_serial_io_errors >= 0xF0)
{
rte_main_reboot_req = 1;
}