kopia lustrzana https://github.com/SP8EBC/ParaTNC
tatry speicifc
rodzic
f6e4314978
commit
2f16340637
|
@ -0,0 +1,318 @@
|
|||
/*
|
||||
* 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_VISCOUS
|
||||
//#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 _GSM_KEEP_MODEM_ALWAYS_ON
|
||||
|
||||
#define _WX_DOUBLE_TRANSMIT
|
||||
|
||||
/* MODES OF OPERATION */
|
||||
/* ------------------ */
|
||||
|
||||
/* ---------------------------- */
|
||||
/* 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
|
||||
|
||||
//#define _DUST_SDS011_SERIAL
|
||||
|
||||
/******** INTERNAL SENSORS CONFIGURATION *****************/
|
||||
|
||||
/*************** DATA SOURCES CONFIG ***********************/
|
||||
#define _TEMPERATURE_INTERNAL_PT100
|
||||
//#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 "SR0L"
|
||||
#define _SSID 0
|
||||
#define _LAT 4914.14
|
||||
#define _LATNS 'N'
|
||||
#define _LON 01954.77
|
||||
#define _LONWE 'E'
|
||||
#define _COMMENT "Stacja badawcza Litworowy Kocioł - https://mrozowiska.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 10 // WX packet interval in minutes
|
||||
#define _BCN_INTERVAL 240 // 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
|
||||
// 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 */
|
||||
/* ---------------------------- */
|
||||
|
||||
/* ---------------------------- */
|
||||
/* GSM and APRS-IS and API */
|
||||
|
||||
#define _GSM_APN_NAME "internet\0"
|
||||
#define _GSM_APN_USER "internet\0"
|
||||
#define _GSM_APN_PASS "internet\0"
|
||||
|
||||
#define _GSM_API_ENABLE
|
||||
#define _GSM_API_BASE_URL "http://157.25.103.93:22910/"
|
||||
#define _GSM_API_STATION_NAME "abakus"
|
||||
|
||||
//#define _GSM_APRSIS_ENABLE
|
||||
#define _GSM_APRSIS_PASSCODE 16823
|
||||
#define _GSM_APRSIS_PORT 14580
|
||||
#define _GSM_APRSIS_ADDRES "euro.aprs2.net\0"
|
||||
|
||||
/* GSM and APRS-IS and API */
|
||||
/* ---------------------------- */
|
||||
|
||||
// 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
|
||||
|
||||
#define ENG1 ENGINEERING1_INH_WX_PWR_HNDL | ENGINEERING1_EARLY_TX_ASSERT
|
||||
|
||||
#endif /* STATION_CONFIG_H_ */
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* variant.h
|
||||
*
|
||||
* Created on: Nov 5, 2022
|
||||
* Author: mateusz
|
||||
*/
|
||||
|
||||
#ifndef VARIANT_H_
|
||||
#define VARIANT_H_
|
||||
|
||||
|
||||
/**
|
||||
* !!!!!!!!!!!!!!!!
|
||||
*/
|
||||
#define TATRY
|
||||
/**
|
||||
* !!!!!!!!!!!!!!!!
|
||||
*/
|
||||
|
||||
|
||||
#endif /* VARIANT_H_ */
|
|
@ -7,7 +7,7 @@
|
|||
#include "drivers/serial.h"
|
||||
#include "config_data.h"
|
||||
|
||||
#define SW_VER "EA17"
|
||||
#define SW_VER "ZT17"
|
||||
#define SW_DATE "06112022"
|
||||
#define SW_KISS_PROTO "A"
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* variant.h
|
||||
*
|
||||
* Created on: Nov 5, 2022
|
||||
* Author: mateusz
|
||||
*/
|
||||
|
||||
#ifndef VARIANT_H_
|
||||
#define VARIANT_H_
|
||||
|
||||
|
||||
/**
|
||||
* !!!!!!!!!!!!!!!!
|
||||
*/
|
||||
#define TATRY
|
||||
/**
|
||||
* !!!!!!!!!!!!!!!!
|
||||
*/
|
||||
|
||||
|
||||
#endif /* VARIANT_H_ */
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#define _TELEM_DESCR_INTERVAL 150
|
||||
|
||||
#include "variant.h"
|
||||
|
||||
uint8_t packet_tx_beacon_interval = 0;
|
||||
uint8_t packet_tx_beacon_counter = 0;
|
||||
|
||||
|
@ -289,8 +291,11 @@ void packet_tx_handler(const config_data_basic_t * const config_basic, const con
|
|||
|
||||
|
||||
packet_tx_multi_per_call_handler();
|
||||
|
||||
#ifndef TATRY
|
||||
telemetry_send_status_raw_values_modbus();
|
||||
#else
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,6 +428,7 @@ void packet_tx_handler(const config_data_basic_t * const config_basic, const con
|
|||
rte_wx_wind_qf = AN_WIND_QF_UNKNOWN;
|
||||
}
|
||||
|
||||
#ifndef TATRY
|
||||
if (config_mode->victron == 1) {
|
||||
telemetry_send_values_pv(rx10m, digi10m, rte_pv_battery_current, rte_pv_battery_voltage, rte_pv_cell_voltage, dallas_qf, pressure_qf, humidity_qf, wind_qf);
|
||||
}
|
||||
|
@ -454,8 +460,12 @@ void packet_tx_handler(const config_data_basic_t * const config_basic, const con
|
|||
// if user will disable both _METEO and _DALLAS_AS_TELEM value will be zeroed internally anyway
|
||||
telemetry_send_values(rx10m, tx10m, digi10m, kiss10m, digidrop10m, 0.0f, dallas_qf, pressure_qf, humidity_qf, wind_qf, config_mode);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
telemetry_send_values_tatry();
|
||||
#endif
|
||||
|
||||
packet_tx_telemetry_counter = 0;
|
||||
|
||||
rx10m = 0, tx10m = 0, digi10m = 0, kiss10m = 0, digidrop10m = 0;
|
||||
|
@ -470,6 +480,8 @@ void packet_tx_handler(const config_data_basic_t * const config_basic, const con
|
|||
|
||||
packet_tx_multi_per_call_handler();
|
||||
|
||||
#ifndef TATRY
|
||||
|
||||
if (config_mode->victron == 1) {
|
||||
telemetry_send_chns_description_pv(config_basic);
|
||||
|
||||
|
@ -487,6 +499,9 @@ void packet_tx_handler(const config_data_basic_t * const config_basic, const con
|
|||
|
||||
//telemetry_send_status();
|
||||
}
|
||||
#else
|
||||
telemetry_send_chns_description_tatry(config_basic);
|
||||
#endif
|
||||
|
||||
telemetry_send_status();
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "ve_direct_protocol/parser.h"
|
||||
|
||||
#include "stdint.h"
|
||||
#include "variant.h"
|
||||
|
||||
typedef enum pressure_qf {
|
||||
PRESSURE_QF_UNKNOWN = 0,
|
||||
|
@ -97,6 +98,14 @@ void telemetry_send_status_raw_values_modbus(void);
|
|||
void telemetry_send_status_powersave_cutoff(uint16_t battery_voltage, int8_t vbatt_low, int8_t cutoff);
|
||||
void telemetry_send_status_powersave_registers(uint32_t register_last_sleep, uint32_t register_last_wakeup, uint32_t register_counters, uint32_t monitor, uint32_t last_sleep_time);
|
||||
|
||||
/**
|
||||
* These are very special telemetry format for scientific weather stations in TATRY
|
||||
*/
|
||||
#ifdef TATRY
|
||||
void telemetry_send_chns_description_tatry(const config_data_basic_t * const config_basic);
|
||||
void telemetry_send_values_tatry();
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "config_data.h"
|
||||
#include "drivers/spi.h"
|
||||
#include "int_average.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -23,6 +24,8 @@ typedef enum max31865_qf_t {
|
|||
}max31865_qf_t;
|
||||
|
||||
extern uint8_t max31865_current_fault_status;
|
||||
extern uint8_t max31865_measurements_counter;
|
||||
extern int_average_t max31865_average;
|
||||
|
||||
void max31865_init(uint8_t rdt_type, uint8_t reference_resistor);
|
||||
void max31865_init_average(void);
|
||||
|
|
|
@ -537,7 +537,7 @@ void telemetry_send_values( uint8_t rx_pkts,
|
|||
void telemetry_send_status(void) {
|
||||
memset(main_own_aprs_msg, 0x00, sizeof(main_own_aprs_msg));
|
||||
#ifdef STM32L471xx
|
||||
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ">ParaMETEO firmware %s-%s by SP8EBC - PV powered, fully outdoor, 3in1 APRS device", SW_VER, SW_DATE);
|
||||
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ">ParaMETEO firmware %s-%s by SP8EBC", SW_VER, SW_DATE);
|
||||
#else
|
||||
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ">ParaTNC firmware %s-%s by SP8EBC", SW_VER, SW_DATE);
|
||||
#endif
|
||||
|
@ -616,3 +616,143 @@ void telemetry_send_status_powersave_registers(uint32_t register_last_sleep, uin
|
|||
main_wait_for_tx_complete();
|
||||
}
|
||||
|
||||
#ifdef TATRY
|
||||
|
||||
#include "rte_main.h"
|
||||
#include "drivers/max31865.h"
|
||||
#include "int_average.h"
|
||||
#include "math.h"
|
||||
|
||||
void telemetry_send_chns_description_tatry(const config_data_basic_t * const config_basic) {
|
||||
// a buffer to assembly the 'call-ssid' string at the begining of the frame
|
||||
char message_prefix_buffer[9];
|
||||
|
||||
memset(message_prefix_buffer, 0x00, 0x09);
|
||||
|
||||
sprintf(message_prefix_buffer, "%s-%d", config_basic->callsign, config_basic->ssid);
|
||||
|
||||
// wait for any RF transmission to finish
|
||||
main_wait_for_tx_complete();
|
||||
|
||||
// clear the output frame buffer
|
||||
memset(main_own_aprs_msg, 0x00, sizeof(main_own_aprs_msg));
|
||||
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s :PARM.Spi,LastTempr,MaxTempr,Vbatt,PtSts,LSERDY,RTCEN,N,N,N,N,N,N", config_basic->callsign);
|
||||
|
||||
main_own_aprs_msg[main_own_aprs_msg_len] = 0;
|
||||
ax25_sendVia(&main_ax25, main_own_path, main_own_path_ln, main_own_aprs_msg, main_own_aprs_msg_len);
|
||||
after_tx_lock = 1;
|
||||
afsk_txStart(&main_afsk);
|
||||
main_wait_for_tx_complete();
|
||||
delay_fixed(1500);
|
||||
|
||||
memset(main_own_aprs_msg, 0x00, sizeof(main_own_aprs_msg));// / / / /
|
||||
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s :EQNS.0,1,0,0,0.25,-40,0,0.25,-40,0,0.02,10,0,1,0", config_basic->callsign);
|
||||
|
||||
main_own_aprs_msg[main_own_aprs_msg_len] = 0;
|
||||
ax25_sendVia(&main_ax25, main_own_path, main_own_path_ln, main_own_aprs_msg, main_own_aprs_msg_len);
|
||||
after_tx_lock = 1;
|
||||
afsk_txStart(&main_afsk);
|
||||
main_wait_for_tx_complete();
|
||||
delay_fixed(1500);
|
||||
|
||||
memset(main_own_aprs_msg, 0x00, sizeof(main_own_aprs_msg));
|
||||
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s :UNIT.Cnt,DegC,DegC,V,Raw,Hi,Hi,Hi,Hi,Hi,Hi,Hi,Hi", config_basic->callsign);
|
||||
|
||||
main_own_aprs_msg[main_own_aprs_msg_len] = 0;
|
||||
ax25_sendVia(&main_ax25, main_own_path, main_own_path_ln, main_own_aprs_msg, main_own_aprs_msg_len);
|
||||
after_tx_lock = 1;
|
||||
afsk_txStart(&main_afsk);
|
||||
main_wait_for_tx_complete();
|
||||
delay_fixed(1500);
|
||||
}
|
||||
|
||||
void telemetry_send_values_tatry() {
|
||||
|
||||
uint8_t spi_transmission_counter = max31865_measurements_counter;
|
||||
uint8_t scaled_last_temperature = 0;
|
||||
uint8_t scaled_max_temperature = 0;
|
||||
uint8_t scaled_vbatt_voltage = 0;
|
||||
uint8_t pt_status = max31865_current_fault_status;
|
||||
|
||||
float value = 0.0f;
|
||||
|
||||
uint16_t vbatt_voltage = rte_main_average_battery_voltage;
|
||||
|
||||
// this is B+ voltage, which is scaled * 100 what means that 1152 equals to 11.52V
|
||||
if (vbatt_voltage < 1511 && vbatt_voltage > 1000) {
|
||||
// mininum value will be 10.01V (0x0) and maximum 15.11V (0xFF), with the step of .02V
|
||||
scaled_vbatt_voltage = (uint8_t)((vbatt_voltage - 1000u) / 2u);
|
||||
}
|
||||
else if (vbatt_voltage > 1510) {
|
||||
scaled_vbatt_voltage = 0xFF;
|
||||
}
|
||||
else {
|
||||
;
|
||||
}
|
||||
|
||||
value = int_get_last(&max31865_average);
|
||||
if (value < -400.0f) {
|
||||
scaled_last_temperature = (uint8_t)0;
|
||||
}
|
||||
else if (value > 240.0f) {
|
||||
scaled_last_temperature = (uint8_t)255;
|
||||
}
|
||||
else {
|
||||
scaled_last_temperature = (uint8_t)roundf(((value + 400.0f) * 0.4f));
|
||||
}
|
||||
|
||||
value = int_get_max(&max31865_average);
|
||||
if (value < -400.0f) {
|
||||
scaled_max_temperature = (uint8_t)0;
|
||||
}
|
||||
else if (value > 240.0f) {
|
||||
scaled_max_temperature = (uint8_t)255;
|
||||
}
|
||||
else {
|
||||
scaled_max_temperature = (uint8_t)roundf(((value + 400.0f) * 0.4f));
|
||||
}
|
||||
|
||||
memset(main_own_aprs_msg, 0x00, sizeof(main_own_aprs_msg));
|
||||
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, "T#%03d,%03d,%03d,%03d,%03d,%03d,%c%c%c%c%c%c%c%c",
|
||||
telemetry_counter++,
|
||||
spi_transmission_counter,
|
||||
scaled_last_temperature,
|
||||
scaled_max_temperature,
|
||||
scaled_vbatt_voltage,
|
||||
pt_status,
|
||||
((RCC->BDCR & RCC_BDCR_LSERDY) > 0) ? '1' : '0',
|
||||
((RCC->BDCR & RCC_BDCR_RTCEN) > 0) ? '1' : '0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0');
|
||||
|
||||
|
||||
// reset the frame counter if it overflowed
|
||||
if (telemetry_counter > 999)
|
||||
telemetry_counter = 0;
|
||||
|
||||
// put a null terminator at the end of frame (but it should be placed there anyway)
|
||||
main_own_aprs_msg[main_own_aprs_msg_len] = 0;
|
||||
|
||||
// wait for completing any previous transmission (afsk_txStart will exit with failure if the modem is transmitting)
|
||||
main_wait_for_tx_complete();
|
||||
|
||||
// prepare transmission of the frame
|
||||
ax25_sendVia(&main_ax25, main_own_path, main_own_path_ln, main_own_aprs_msg, main_own_aprs_msg_len);
|
||||
|
||||
// ??
|
||||
after_tx_lock = 1;
|
||||
|
||||
// check if RF channel is free from other transmissions and wait for the clearance if it is needed
|
||||
while (main_ax25.dcd == 1);
|
||||
|
||||
// key up a transmitter and start transmission
|
||||
afsk_txStart(&main_afsk);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue