kopia lustrzana https://github.com/SP8EBC/ParaTNC
rodzic
16d70c7028
commit
6484c8ce8f
|
@ -8,6 +8,7 @@
|
||||||
#ifndef IT_HANDLERS_H_
|
#ifndef IT_HANDLERS_H_
|
||||||
#define IT_HANDLERS_H_
|
#define IT_HANDLERS_H_
|
||||||
|
|
||||||
|
extern uint8_t it_handlers_inhibit_radiomodem_dcd_led;
|
||||||
|
|
||||||
void it_handlers_set_priorities(void);
|
void it_handlers_set_priorities(void);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,304 @@
|
||||||
|
/*
|
||||||
|
* 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 _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 */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
#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
|
||||||
|
|
||||||
|
/* WEATHER/METEO CONFIGURATION */
|
||||||
|
/* ---------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
/******** 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
|
||||||
|
/******** INTERNAL SENSORS CONFIGURATION *****************/
|
||||||
|
|
||||||
|
|
||||||
|
/******** UMB MASTER CONFIGURATION *****************/
|
||||||
|
#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
|
||||||
|
/******** 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 ***********************/
|
||||||
|
|
||||||
|
|
||||||
|
/* 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 "SR9WXP"
|
||||||
|
#define _SSID 0
|
||||||
|
#define _LAT 4932.18
|
||||||
|
#define _LATNS 'N'
|
||||||
|
#define _LON 01919.18
|
||||||
|
#define _LONWE 'E'
|
||||||
|
#define _COMMENT "DigiW1 + WX = TXPower 1W = Pilsko, wyciag orczykowy VII, 1400m AMSL = 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 4 // WX packet interval in minutes
|
||||||
|
#define _BCN_INTERVAL 124 // 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 14 // * 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
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
#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 1
|
||||||
|
|
||||||
|
#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(_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_ */
|
|
@ -98,7 +98,7 @@ static void api_construct_url_status(api_endpoint_t endpoint) {
|
||||||
|
|
||||||
static void api_callback(uint16_t http_code, char * content, uint16_t content_lenght) {
|
static void api_callback(uint16_t http_code, char * content, uint16_t content_lenght) {
|
||||||
|
|
||||||
//http_client_close();
|
http_client_close();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -467,8 +467,8 @@ const config_data_rtu_t __attribute__((section(".config_section_default.rtu")))
|
||||||
const config_data_gsm_t __attribute__((section(".config_section_default.gsm"))) config_data_gsm_default = {
|
const config_data_gsm_t __attribute__((section(".config_section_default.gsm"))) config_data_gsm_default = {
|
||||||
.pin = "\0\0\0\0\0",
|
.pin = "\0\0\0\0\0",
|
||||||
|
|
||||||
//.apn = "internet\0", // PlusGSM
|
.apn = "internet\0", // PlusGSM
|
||||||
.apn = "virgin-internet\0", // Virgin Mobile
|
//.apn = "virgin-internet\0", // Virgin Mobile
|
||||||
|
|
||||||
.username = "\0",
|
.username = "\0",
|
||||||
|
|
||||||
|
@ -478,12 +478,12 @@ const config_data_gsm_t __attribute__((section(".config_section_default.gsm")))
|
||||||
|
|
||||||
// 78.88.56.14
|
// 78.88.56.14
|
||||||
//.api_base_url = "http://78.88.56.14:8080/",
|
//.api_base_url = "http://78.88.56.14:8080/",
|
||||||
.api_base_url = "http://157.25.103.93:22910/",
|
.api_base_url = "http://157.25.103.93:8080/", // 22910
|
||||||
//.api_base_url = "http://193.33.111.22:8080/meteo_backend",
|
//.api_base_url = "http://193.33.111.22:8080/meteo_backend",
|
||||||
|
|
||||||
.api_station_name = "abakus",
|
.api_station_name = "abakus",
|
||||||
|
|
||||||
.aprsis_enable = 1,
|
.aprsis_enable = 0,
|
||||||
|
|
||||||
.aprsis_passcode = 16823,
|
.aprsis_passcode = 16823,
|
||||||
|
|
||||||
|
|
|
@ -471,8 +471,8 @@ const config_data_rtu_t __attribute__((section(".config_section_first.rtu"))) co
|
||||||
const config_data_gsm_t __attribute__((section(".config_section_first.gsm"))) config_data_gsm_first = {
|
const config_data_gsm_t __attribute__((section(".config_section_first.gsm"))) config_data_gsm_first = {
|
||||||
.pin = "\0\0\0\0\0",
|
.pin = "\0\0\0\0\0",
|
||||||
|
|
||||||
//.apn = "internet\0",
|
.apn = "internet\0",
|
||||||
.apn = "virgin-internet\0",
|
//.apn = "virgin-internet\0",
|
||||||
|
|
||||||
.username = "\0",
|
.username = "\0",
|
||||||
|
|
||||||
|
@ -480,12 +480,12 @@ const config_data_gsm_t __attribute__((section(".config_section_first.gsm"))) co
|
||||||
|
|
||||||
.api_enable = 1,
|
.api_enable = 1,
|
||||||
|
|
||||||
.api_base_url = "http://157.25.103.93:22910/",
|
.api_base_url = "http://157.25.103.93:8080/",
|
||||||
//.api_base_url = "http://193.33.111.22:8080/meteo_backend",
|
//.api_base_url = "http://193.33.111.22:8080/meteo_backend",
|
||||||
|
|
||||||
.api_station_name = "abakus",
|
.api_station_name = "abakus",
|
||||||
|
|
||||||
.aprsis_enable = 1,
|
.aprsis_enable = 0,
|
||||||
|
|
||||||
.aprsis_passcode = 16823,
|
.aprsis_passcode = 16823,
|
||||||
|
|
||||||
|
|
|
@ -465,8 +465,8 @@ const config_data_rtu_t __attribute__((section(".config_section_second.rtu"))) c
|
||||||
const config_data_gsm_t __attribute__((section(".config_section_second.gsm"))) config_data_gsm_second = {
|
const config_data_gsm_t __attribute__((section(".config_section_second.gsm"))) config_data_gsm_second = {
|
||||||
.pin = "\0\0\0\0\0",
|
.pin = "\0\0\0\0\0",
|
||||||
|
|
||||||
//.apn = "internet\0",
|
.apn = "internet\0",
|
||||||
.apn = "virgin-internet\0",
|
//.apn = "virgin-internet\0",
|
||||||
|
|
||||||
.username = "\0",
|
.username = "\0",
|
||||||
|
|
||||||
|
@ -474,12 +474,12 @@ const config_data_gsm_t __attribute__((section(".config_section_second.gsm"))) c
|
||||||
|
|
||||||
.api_enable = 1,
|
.api_enable = 1,
|
||||||
|
|
||||||
.api_base_url = "http://157.25.103.93:22910/",
|
.api_base_url = "http://157.25.103.93:8080/",
|
||||||
//.api_base_url = "http://193.33.111.22:8080/meteo_backend",
|
//.api_base_url = "http://193.33.111.22:8080/meteo_backend",
|
||||||
|
|
||||||
.api_station_name = "abakus",
|
.api_station_name = "abakus",
|
||||||
|
|
||||||
.aprsis_enable = 1,
|
.aprsis_enable = 0,
|
||||||
|
|
||||||
.aprsis_passcode = 16823,
|
.aprsis_passcode = 16823,
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <stm32l471xx.h>
|
#include <stm32l471xx.h>
|
||||||
#include "cmsis/stm32l4xx/system_stm32l4xx.h"
|
#include "cmsis/stm32l4xx/system_stm32l4xx.h"
|
||||||
#include "pwr_save.h"
|
#include "pwr_save.h"
|
||||||
|
|
||||||
|
uint8_t it_handlers_inhibit_radiomodem_dcd_led = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "drivers/dallas.h"
|
#include "drivers/dallas.h"
|
||||||
|
@ -143,6 +145,10 @@ void SysTick_Handler(void) {
|
||||||
|
|
||||||
delay_decrement_counter();
|
delay_decrement_counter();
|
||||||
|
|
||||||
|
if (it_handlers_inhibit_radiomodem_dcd_led == 0) {
|
||||||
|
led_control_led1_upper(main_ax25.dcd);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void USART1_IRQHandler(void) {
|
void USART1_IRQHandler(void) {
|
||||||
|
@ -255,7 +261,6 @@ void TIM7_IRQHandler(void) {
|
||||||
// io_ext_watchdog_service();
|
// io_ext_watchdog_service();
|
||||||
AdcValue = (short int)(( AdcBuffer[0] + AdcBuffer[1] + AdcBuffer[2] + AdcBuffer[3]) >> 1);
|
AdcValue = (short int)(( AdcBuffer[0] + AdcBuffer[1] + AdcBuffer[2] + AdcBuffer[3]) >> 1);
|
||||||
AFSK_ADC_ISR(&main_afsk, (AdcValue - 4095) );
|
AFSK_ADC_ISR(&main_afsk, (AdcValue - 4095) );
|
||||||
led_control_led1_upper(main_ax25.dcd);
|
|
||||||
ASC = 0;
|
ASC = 0;
|
||||||
|
|
||||||
if (ASC2++ == 2) {
|
if (ASC2++ == 2) {
|
||||||
|
|
18
src/main.c
18
src/main.c
|
@ -897,6 +897,10 @@ int main(int argc, char* argv[]){
|
||||||
|
|
||||||
#ifdef STM32L471xx
|
#ifdef STM32L471xx
|
||||||
if (main_config_data_mode->gsm == 1) {
|
if (main_config_data_mode->gsm == 1) {
|
||||||
|
it_handlers_inhibit_radiomodem_dcd_led = 1;
|
||||||
|
|
||||||
|
led_control_led1_upper(false);
|
||||||
|
|
||||||
gsm_sim800_init(&main_gsm_state, 1);
|
gsm_sim800_init(&main_gsm_state, 1);
|
||||||
|
|
||||||
http_client_init(&main_gsm_state, main_gsm_srl_ctx_ptr, 0);
|
http_client_init(&main_gsm_state, main_gsm_srl_ctx_ptr, 0);
|
||||||
|
@ -1212,9 +1216,13 @@ int main(int argc, char* argv[]){
|
||||||
#ifdef STM32L471xx
|
#ifdef STM32L471xx
|
||||||
if (main_config_data_mode->gsm == 1) {
|
if (main_config_data_mode->gsm == 1) {
|
||||||
|
|
||||||
|
if (http_client_connection_errors > HTTP_CLIENT_MAX_CONNECTION_ERRORS) {
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
|
|
||||||
gsm_sim800_poolers_one_minute(main_gsm_srl_ctx_ptr, &main_gsm_state);
|
gsm_sim800_poolers_one_minute(main_gsm_srl_ctx_ptr, &main_gsm_state);
|
||||||
|
|
||||||
aprsis_connect_and_login_default(1);
|
//aprsis_connect_and_login_default(1);
|
||||||
|
|
||||||
// if (gsm_sim800_gprs_ready == 1) {
|
// if (gsm_sim800_gprs_ready == 1) {
|
||||||
//
|
//
|
||||||
|
@ -1241,6 +1249,13 @@ int main(int argc, char* argv[]){
|
||||||
#ifdef STM32L471xx
|
#ifdef STM32L471xx
|
||||||
if (main_config_data_mode->gsm == 1) {
|
if (main_config_data_mode->gsm == 1) {
|
||||||
|
|
||||||
|
if (gsm_sim800_gprs_ready == 1) {
|
||||||
|
led_control_led1_upper(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
led_control_led1_upper(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (gsm_sim800_gprs_ready == 1) {
|
if (gsm_sim800_gprs_ready == 1) {
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
|
@ -1328,7 +1343,6 @@ int main(int argc, char* argv[]){
|
||||||
|
|
||||||
#ifdef STM32L471xx
|
#ifdef STM32L471xx
|
||||||
if (main_config_data_mode->gsm == 1) {
|
if (main_config_data_mode->gsm == 1) {
|
||||||
|
|
||||||
packet_tx_tcp_handler();
|
packet_tx_tcp_handler();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -109,19 +109,19 @@ void packet_tx_tcp_handler(void) {
|
||||||
aprsis_return_t aprsis_result = APRSIS_UNKNOWN;
|
aprsis_return_t aprsis_result = APRSIS_UNKNOWN;
|
||||||
|
|
||||||
if ((packet_tx_trigger_tcp & APRSIS_TRIGGER_METEO) != 0) {
|
if ((packet_tx_trigger_tcp & APRSIS_TRIGGER_METEO) != 0) {
|
||||||
|
// TODO: fixme
|
||||||
if (aprsis_connected == 0) {
|
// if (aprsis_connected == 0) {
|
||||||
aprsis_result = aprsis_connect_and_login_default(0);
|
// aprsis_result = aprsis_connect_and_login_default(0);
|
||||||
|
//
|
||||||
if (aprsis_result == APRSIS_OK) {
|
// if (aprsis_result == APRSIS_OK) {
|
||||||
// send APRS-IS frame, if APRS-IS is not connected this function will return immediately
|
// // send APRS-IS frame, if APRS-IS is not connected this function will return immediately
|
||||||
aprsis_send_wx_frame(rte_wx_average_windspeed, rte_wx_max_windspeed, rte_wx_average_winddirection, rte_wx_temperature_average_external_valid, rte_wx_pressure_valid, rte_wx_humidity_valid);
|
// aprsis_send_wx_frame(rte_wx_average_windspeed, rte_wx_max_windspeed, rte_wx_average_winddirection, rte_wx_temperature_average_external_valid, rte_wx_pressure_valid, rte_wx_humidity_valid);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
// send APRS-IS frame, if APRS-IS is not connected this function will return immediately
|
// // send APRS-IS frame, if APRS-IS is not connected this function will return immediately
|
||||||
aprsis_send_wx_frame(rte_wx_average_windspeed, rte_wx_max_windspeed, rte_wx_average_winddirection, rte_wx_temperature_average_external_valid, rte_wx_pressure_valid, rte_wx_humidity_valid);
|
// aprsis_send_wx_frame(rte_wx_average_windspeed, rte_wx_max_windspeed, rte_wx_average_winddirection, rte_wx_temperature_average_external_valid, rte_wx_pressure_valid, rte_wx_humidity_valid);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// clear the bit
|
// clear the bit
|
||||||
|
@ -129,15 +129,16 @@ void packet_tx_tcp_handler(void) {
|
||||||
}
|
}
|
||||||
else if ((packet_tx_trigger_tcp & API_TRIGGER_STATUS) != 0) {
|
else if ((packet_tx_trigger_tcp & API_TRIGGER_STATUS) != 0) {
|
||||||
|
|
||||||
// check if APRS-IS is connected
|
// TODO: fixme
|
||||||
if (aprsis_connected != 0) {
|
// // check if APRS-IS is connected
|
||||||
// disconnect it before call to API - this disconnection has blocking IO
|
// if (aprsis_connected != 0) {
|
||||||
aprsis_disconnect();
|
// // disconnect it before call to API - this disconnection has blocking IO
|
||||||
|
// aprsis_disconnect();
|
||||||
// remember to reconnect APRSIS after all API comm will be done
|
//
|
||||||
packet_tx_trigger_tcp |= RECONNECT_APRSIS;
|
// // remember to reconnect APRSIS after all API comm will be done
|
||||||
|
// packet_tx_trigger_tcp |= RECONNECT_APRSIS;
|
||||||
}
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
// send status (async)
|
// send status (async)
|
||||||
api_send_json_status();
|
api_send_json_status();
|
||||||
|
@ -147,15 +148,16 @@ void packet_tx_tcp_handler(void) {
|
||||||
}
|
}
|
||||||
else if ((packet_tx_trigger_tcp & API_TRIGGER_METEO) != 0) {
|
else if ((packet_tx_trigger_tcp & API_TRIGGER_METEO) != 0) {
|
||||||
|
|
||||||
// check if APRS-IS is connected
|
// TODO: fixme
|
||||||
if (aprsis_connected != 0) {
|
// // check if APRS-IS is connected
|
||||||
// disconnect it before call to API - this disconnection has blocking IO
|
// if (aprsis_connected != 0) {
|
||||||
aprsis_disconnect();
|
// // disconnect it before call to API - this disconnection has blocking IO
|
||||||
|
// aprsis_disconnect();
|
||||||
// remember to reconnect APRSIS after all API comm will be done
|
//
|
||||||
packet_tx_trigger_tcp |= RECONNECT_APRSIS;
|
// // remember to reconnect APRSIS after all API comm will be done
|
||||||
|
// packet_tx_trigger_tcp |= RECONNECT_APRSIS;
|
||||||
}
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
api_send_json_measuremenets();
|
api_send_json_measuremenets();
|
||||||
|
|
||||||
|
@ -163,11 +165,12 @@ void packet_tx_tcp_handler(void) {
|
||||||
packet_tx_trigger_tcp ^= API_TRIGGER_METEO;
|
packet_tx_trigger_tcp ^= API_TRIGGER_METEO;
|
||||||
}
|
}
|
||||||
else if ((packet_tx_trigger_tcp & RECONNECT_APRSIS) != 0) {
|
else if ((packet_tx_trigger_tcp & RECONNECT_APRSIS) != 0) {
|
||||||
result = aprsis_connect_and_login_default(1);
|
// TODO: fixme
|
||||||
|
// result = aprsis_connect_and_login_default(1);
|
||||||
if (result == APRSIS_OK) {
|
//
|
||||||
|
// if (result == APRSIS_OK) {
|
||||||
packet_tx_trigger_tcp ^= RECONNECT_APRSIS;
|
packet_tx_trigger_tcp ^= RECONNECT_APRSIS;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -213,7 +216,8 @@ void packet_tx_handler(const config_data_basic_t * const config_basic, const con
|
||||||
#ifdef STM32L471xx
|
#ifdef STM32L471xx
|
||||||
// send wx packet to APRSIS one minute before radio transmission
|
// send wx packet to APRSIS one minute before radio transmission
|
||||||
if (packet_tx_meteo_counter == packet_tx_meteo_interval - 1 && packet_tx_meteo_interval != 0) {
|
if (packet_tx_meteo_counter == packet_tx_meteo_interval - 1 && packet_tx_meteo_interval != 0) {
|
||||||
packet_tx_trigger_tcp |= APRSIS_TRIGGER_METEO;
|
// TODO: fixme
|
||||||
|
//packet_tx_trigger_tcp |= APRSIS_TRIGGER_METEO;
|
||||||
|
|
||||||
//aprsis_send_wx_frame(rte_wx_average_windspeed, rte_wx_max_windspeed, rte_wx_average_winddirection, rte_wx_temperature_average_external_valid, rte_wx_pressure_valid, rte_wx_humidity_valid);
|
//aprsis_send_wx_frame(rte_wx_average_windspeed, rte_wx_max_windspeed, rte_wx_average_winddirection, rte_wx_temperature_average_external_valid, rte_wx_pressure_valid, rte_wx_humidity_valid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#define HTTP_CLIENT_RET_TCPIP_BSY 2
|
#define HTTP_CLIENT_RET_TCPIP_BSY 2
|
||||||
#define HTTP_CLIENT_RET_WRONG_URL 3
|
#define HTTP_CLIENT_RET_WRONG_URL 3
|
||||||
|
|
||||||
|
#define HTTP_CLIENT_MAX_CONNECTION_ERRORS 8
|
||||||
|
|
||||||
typedef void(*http_client_response_available_t)(uint16_t http_code, char * content, uint16_t content_lenght);
|
typedef void(*http_client_response_available_t)(uint16_t http_code, char * content, uint16_t content_lenght);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,6 +49,8 @@ extern uint16_t http_client_content_lenght;
|
||||||
*/
|
*/
|
||||||
extern uint16_t http_client_max_content_ln;
|
extern uint16_t http_client_max_content_ln;
|
||||||
|
|
||||||
|
extern uint8_t http_client_connection_errors;
|
||||||
|
|
||||||
void http_client_init(gsm_sim800_state_t * state, srl_context_t * serial_context, uint8_t ignore_content_on_http_error);
|
void http_client_init(gsm_sim800_state_t * state, srl_context_t * serial_context, uint8_t ignore_content_on_http_error);
|
||||||
uint8_t http_client_async_get(char * url, uint8_t url_ln, uint16_t response_ln_limit, uint8_t force_disconnect_on_busy, http_client_response_available_t callback_on_response);
|
uint8_t http_client_async_get(char * url, uint8_t url_ln, uint16_t response_ln_limit, uint8_t force_disconnect_on_busy, http_client_response_available_t callback_on_response);
|
||||||
uint8_t http_client_async_post(char * url, uint8_t url_ln, char * data_to_post, uint16_t data_ln, uint8_t force_disconnect_on_busy, http_client_response_available_t callback_on_response);
|
uint8_t http_client_async_post(char * url, uint8_t url_ln, char * data_to_post, uint16_t data_ln, uint8_t force_disconnect_on_busy, http_client_response_available_t callback_on_response);
|
||||||
|
|
|
@ -52,6 +52,8 @@ srl_context_t * http_client_deticated_serial_context;
|
||||||
*/
|
*/
|
||||||
uint8_t http_client_ignore_content_on_http_error;
|
uint8_t http_client_ignore_content_on_http_error;
|
||||||
|
|
||||||
|
uint8_t http_client_connection_errors = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default port for http
|
* Default port for http
|
||||||
*/
|
*/
|
||||||
|
@ -283,7 +285,9 @@ uint8_t http_client_async_get(char * url, uint8_t url_ln, uint16_t response_ln_l
|
||||||
gsm_sim800_tcpip_async_receive(http_client_deticated_serial_context, http_client_deticated_sim800_state, http_client_rx_done_callback, 5000u, http_client_response_done_callback /** FIXME */);
|
gsm_sim800_tcpip_async_receive(http_client_deticated_serial_context, http_client_deticated_sim800_state, http_client_rx_done_callback, 5000u, http_client_response_done_callback /** FIXME */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
http_client_connection_errors++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (split_point == 0xFFFF) {
|
else if (split_point == 0xFFFF) {
|
||||||
out = HTTP_CLIENT_RET_WRONG_URL;
|
out = HTTP_CLIENT_RET_WRONG_URL;
|
||||||
|
@ -386,6 +390,9 @@ uint8_t http_client_async_post(char * url, uint8_t url_ln, char * data_to_post,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
http_client_connection_errors++;
|
||||||
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue