some configuration moved to the separate structure instead of direct defines. bugfix for callsigns shorter than 6 characters

pull/2/head
Mateusz Lubecki 2021-01-12 15:19:31 +01:00
rodzic 240a96902c
commit 32bd6f4e83
8 zmienionych plików z 194 dodań i 26 usunięć

Wyświetl plik

@ -9,6 +9,7 @@ C_SRCS += \
../src/PathConfig.c \
../src/TimerConfig.c \
../src/_write.c \
../src/config_data.c \
../src/delay.c \
../src/io.c \
../src/it_handlers.c \
@ -26,6 +27,7 @@ OBJS += \
./src/PathConfig.o \
./src/TimerConfig.o \
./src/_write.o \
./src/config_data.o \
./src/delay.o \
./src/io.o \
./src/it_handlers.o \
@ -43,6 +45,7 @@ C_DEPS += \
./src/PathConfig.d \
./src/TimerConfig.d \
./src/_write.d \
./src/config_data.d \
./src/delay.d \
./src/io.d \
./src/it_handlers.d \

Wyświetl plik

@ -9,13 +9,14 @@
#define PATH_H_
#include "aprs/ax25.h"
#include "config_data.h"
/* C++ detection */
#ifdef __cplusplus
extern "C" {
#endif
uint8_t ConfigPath(AX25Call* p);
uint8_t ConfigPath(AX25Call* p, const config_data_basic_t* conf);
#ifdef __cplusplus
}

Wyświetl plik

@ -0,0 +1,70 @@
/*
* config_data.h
*
* Created on: Jan 12, 2021
* Author: mateusz
*/
#ifndef CONFIG_DATA_H_
#define CONFIG_DATA_H_
#include <stdint.h>
/**
* This is NOT an editable configuration file where ParaTNC settings are made! Do not touch this!
* Please look at 'station_config.h' instead to set all parameters.
*/
typedef struct config_data_mode_t {
uint8_t digi;
uint8_t wx;
uint8_t victron;
} config_data_mode_t;
typedef struct config_data_basic_t {
char * callsign;
uint8_t ssid;
float latitude;
// N or S
uint8_t zero_to_n_one_to_s;
float longitude;
// E or W
uint8_t zero_to_e_one_to_w;
char * comment;
// 0 - _SYMBOL_DIGI // uncomment if you want digi symbol(green star with D inside)
// 1 - _SYMBOL_WIDE1_DIGI // uncomment if you want 'little' digi symbol (green star with digit 1 overlaid)
// 2 - _SYMBOL_HOUSE // uncomment if you want house symbol
// 3 - _SYMBOL_RXIGATE // uncomment if you want rxigate symbol (black diamond with R)
// 4 - _SYMBOL_IGATE // uncomment if you want igate symol (black diamond with I)
uint8_t symbol;
// 0 - no path
// 1 - WIDE1-1 path
// 2 - WIDE2-1 path
uint8_t path_type;
uint8_t beacon_at_bootup;
uint8_t wx_transmit_period;
uint8_t beacon_transmit_period;
} config_data_basic_t;
extern const config_data_basic_t config_data_basic;
#endif /* CONFIG_DATA_H_ */

Wyświetl plik

@ -5,7 +5,7 @@
#include "drivers/serial.h"
#define SW_VER "DF11"
#define SW_DATE "09012021"
#define SW_DATE "12012021"
#define SYSTICK_TICKS_PER_SECONDS 100
#define SYSTICK_TICKS_PERIOD 10

Wyświetl plik

@ -9,23 +9,40 @@
#include "station_config.h"
#include <string.h>
uint8_t ConfigPath(AX25Call* p) {
uint8_t ConfigPath(AX25Call* p, const config_data_basic_t* conf) {
memcpy(p[0].call, "AKLPRZ", 6), p[0].ssid = 0;
#if (defined(_WIDE1_PATH) && !defined(_WIDE21_PATH))
memcpy(p[1].call, _CALL, 6), p[1].ssid = _SSID;
memcpy(p[2].call, "WIDE1", 6), p[2].ssid = 1;
return 3;
#elif (!defined(_WIDE1_PATH) && defined(_WIDE21_PATH))
memcpy(p[1].call, _CALL, 6), p[1].ssid = _SSID;
memcpy(p[2].call, "WIDE2", 6), p[2].ssid = 1;
return 3;
#else
memcpy(p[1].call, _CALL, 6), p[1].ssid = _SSID;
return 2;
#endif
return 0;
switch (conf->path_type) {
case 1:
strncpy(p[1].call, conf->callsign, 6), p[1].ssid = conf->ssid;
memcpy(p[2].call, "WIDE1", 6), p[2].ssid = 1;
return 3;
case 2:
strncpy(p[1].call, conf->callsign, 6), p[1].ssid = conf->ssid;
memcpy(p[2].call, "WIDE2", 6), p[2].ssid = 1;
return 3;
case 0:
default:
strncpy(p[1].call, conf->callsign, 6), p[1].ssid = conf->ssid;
return 2;
}
//#if (defined(_WIDE1_PATH) && !defined(_WIDE21_PATH))
// memcpy(p[1].call, _CALL, 6), p[1].ssid = _SSID;
// memcpy(p[2].call, "WIDE1", 6), p[2].ssid = 1;
// return 3;
//#elif (!defined(_WIDE1_PATH) && defined(_WIDE21_PATH))
// memcpy(p[1].call, _CALL, 6), p[1].ssid = _SSID;
// memcpy(p[2].call, "WIDE2", 6), p[2].ssid = 1;
// return 3;
//#else
// memcpy(p[1].call, _CALL, 6), p[1].ssid = _SSID;
// return 2;
// #endif
//
// return 0;
}

71
src/config_data.c 100644
Wyświetl plik

@ -0,0 +1,71 @@
/*
* config_data.c
*
* Created on: Jan 12, 2021
* Author: mateusz
*/
/**
* This is NOT an editable configuration file where ParaTNC settings are made! Do not touch this!
* Please look at 'station_config.h' instead to set all parameters.
*/
#include "config_data.h"
#include "station_config.h"
const config_data_basic_t config_data_basic = {
.callsign = _CALL,
.ssid = _SSID,
.latitude = _LAT,
.longitude = _LON,
#if (_LATNS == 'N')
.zero_to_n_one_to_s = 0,
#else
.zero_to_n_one_to_s = 1,
#endif
#if (_LONWE == 'E')
.zero_to_e_one_to_w = 0,
#else
.zero_to_e_one_to_w = 1,
#endif
.comment = _COMMENT,
#ifdef _SYMBOL_DIGI
.symbol = 0,
#endif
#ifdef _SYMBOL_WIDE1_DIGI
.symbol = 1,
#endif
#ifdef _SYMBOL_HOUSE
.symbol = 2,
#endif
#ifdef _SYMBOL_RXIGATE
.symbol = 3,
#endif
#ifdef _SYMBOL_IGATE
.symbol = 4,
#endif
#if defined(_WIDE1_PATH)
.path_type = 1,
#elif defined(_WIDE21_PATH)
.path_type = 2,
#else
.path_type = 0,
#endif
.wx_transmit_period = _WX_INTERVAL,
.beacon_transmit_period = _BCN_INTERVAL,
#ifdef _BCN_ON_STARTUP
.beacon_at_bootup = 1
#else
.beacon_at_bootup = 0
#endif
};

Wyświetl plik

@ -10,7 +10,9 @@
#include "main.h"
#include "packet_tx_handler.h"
#include "station_config.h"
#include "config_data.h"
#include "diag/Trace.h"
#include "antilib_adc.h"
@ -390,8 +392,11 @@ int main(int argc, char* argv[]){
#endif
// initialize APRS path with zeros
memset (main_own_path, 0x00, sizeof(main_own_path));
// configuring an APRS path used to transmit own packets (telemetry, wx, beacons)
main_own_path_ln = ConfigPath(main_own_path);
main_own_path_ln = ConfigPath(main_own_path, &config_data_basic);
#ifdef INTERNAL_WATCHDOG
// enable write access to watchdog registers

Wyświetl plik

@ -16,6 +16,7 @@
#include <main.h>
#include <stdio.h>
#include <string.h>
uint16_t telemetry_counter = 0;
@ -187,13 +188,13 @@ void telemetry_send_chns_description(void) {
// prepare a frame with channel names depending on SSID
#if (_SSID == 0)
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s :PARM.Rx10min,Tx10min,Digi10min,HostTx10m,Tempre,DS_QF_FULL,DS_QF_DEGRAD,DS_QF_NAVBLE,QNH_QF_NAVBLE,HUM_QF_NAVBLE,WIND_QF_DEGR,WIND_QF_NAVB", _CALL);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s :PARM.Rx10min,Tx10min,Digi10min,HostTx10m,Tempre,DS_QF_FULL,DS_QF_DEGRAD,DS_QF_NAVBLE,QNH_QF_NAVBLE,HUM_QF_NAVBLE,WIND_QF_DEGR,WIND_QF_NAVB", _CALL);
#endif
#if (_SSID > 0 && _SSID <= 9)
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s-%d :PARM.Rx10min,Tx10min,Digi10min,HostTx10m,Tempre,DS_QF_FULL,DS_QF_DEGRAD,DS_QF_NAVBLE,QNH_QF_NAVBLE,HUM_QF_NAVBLE,WIND_QF_DEGR,WIND_QF_NAVB", _CALL, _SSID);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s-%d :PARM.Rx10min,Tx10min,Digi10min,HostTx10m,Tempre,DS_QF_FULL,DS_QF_DEGRAD,DS_QF_NAVBLE,QNH_QF_NAVBLE,HUM_QF_NAVBLE,WIND_QF_DEGR,WIND_QF_NAVB", _CALL, _SSID);
#endif
#if (_SSID > 9 && _SSID <= 15)
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s-%d:PARM.Rx10min,Tx10min,Digi10min,HostTx10m,Tempre,DS_QF_FULL,DS_QF_DEGRAD,DS_QF_NAVBLE,QNH_QF_NAVBLE,HUM_QF_NAVBLE,WIND_QF_DEGR,WIND_QF_NAVB", _CALL, _SSID);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s-%d:PARM.Rx10min,Tx10min,Digi10min,HostTx10m,Tempre,DS_QF_FULL,DS_QF_DEGRAD,DS_QF_NAVBLE,QNH_QF_NAVBLE,HUM_QF_NAVBLE,WIND_QF_DEGR,WIND_QF_NAVB", _CALL, _SSID);
#endif
// place a null terminator at the end
@ -213,13 +214,13 @@ main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s-%d:PARM.Rx10min,Tx10min,
while (main_ax25.dcd == 1);
#if (_SSID == 0)
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s :EQNS.0,1,0,0,1,0,0,1,0,0,1,0,0,0.5,-50", _CALL);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s :EQNS.0,1,0,0,1,0,0,1,0,0,1,0,0,0.5,-50", _CALL);
#endif
#if (_SSID > 0 && _SSID <= 9)
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s-%d :EQNS.0,1,0,0,1,0,0,1,0,0,1,0,0,0.5,-50", _CALL, _SSID);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s-%d :EQNS.0,1,0,0,1,0,0,1,0,0,1,0,0,0.5,-50", _CALL, _SSID);
#endif
#if (_SSID > 9 && _SSID <= 15)
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s-%d:EQNS.0,1,0,0,1,0,0,1,0,0,1,0,0,0.5,-50", _CALL, _SSID);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s-%d:EQNS.0,1,0,0,1,0,0,1,0,0,1,0,0,0.5,-50", _CALL, _SSID);
#endif
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);
@ -233,13 +234,13 @@ main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s-%d:PARM.Rx10min,Tx10min,
while (main_ax25.dcd == 1);
#if (_SSID == 0)
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s :UNIT.Pkt,Pkt,Pkt,Pkt,DegC,Hi,Hi,Hi,Hi,Hi,Hi,Hi", _CALL);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s :UNIT.Pkt,Pkt,Pkt,Pkt,DegC,Hi,Hi,Hi,Hi,Hi,Hi,Hi", _CALL);
#endif
#if (_SSID > 0 && _SSID <= 9)
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s-%d :UNIT.Pkt,Pkt,Pkt,Pkt,DegC,Hi,Hi,Hi,Hi,Hi,Hi,Hi", _CALL, _SSID);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s-%d :UNIT.Pkt,Pkt,Pkt,Pkt,DegC,Hi,Hi,Hi,Hi,Hi,Hi,Hi", _CALL, _SSID);
#endif
#if (_SSID > 9 && _SSID <= 15)
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%s-%d:UNIT.Pkt,Pkt,Pkt,Pkt,DegC,Hi,Hi,Hi,Hi,Hi,Hi,Hi", _CALL, _SSID);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s-%d:UNIT.Pkt,Pkt,Pkt,Pkt,DegC,Hi,Hi,Hi,Hi,Hi,Hi,Hi", _CALL, _SSID);
#endif
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);