From 1ff0ed604e4b09994ed6cb929deb5f400c0744c8 Mon Sep 17 00:00:00 2001 From: Sven Steudte Date: Mon, 13 Aug 2018 00:12:07 +0200 Subject: [PATCH] Adusted frequency naming --- tracker/software/source/config/config.c | 68 +++++++++---------- tracker/software/source/config/types.h | 28 ++++---- tracker/software/source/drivers/si446x.c | 4 +- tracker/software/source/math/geofence.c | 27 +++----- tracker/software/source/math/geofence.h | 20 +++--- .../software/source/pkt/managers/pktradio.c | 25 ++++--- tracker/software/source/threads/rxtx/radio.c | 6 +- 7 files changed, 86 insertions(+), 92 deletions(-) diff --git a/tracker/software/source/config/config.c b/tracker/software/source/config/config.c index ec80e18e..0c99f256 100644 --- a/tracker/software/source/config/config.c +++ b/tracker/software/source/config/config.c @@ -13,21 +13,21 @@ const conf_t conf_flash_default = { // Primary position app .pos_pri = { .beacon = { - .active = false, - .cycle = TIME_S2I(60 * 5), - .init_delay = TIME_S2I(60), + .active = true, + .cycle = TIME_S2I(120), + .init_delay = TIME_S2I(0), .fixed = false // Add lat, lon, alt fields when enabling fixed }, .radio_conf = { - .pwr = 0x1F, - .freq = 144800000, - .mod = MOD_2FSK, - .cca = 0x4F, + .pwr = 0x7F, + .freq = FREQ_GEOFENCE, + .mod = MOD_AFSK, + .cca = 0x5F, }, // App identity - .call = "VK2GJ-12", + .call = "DL7AD-15", .path = "WIDE1-1", - .symbol = SYM_ANTENNA, + .symbol = SYM_BALLOON, .aprs_msg = true, // Enable APRS message reception on this app }, @@ -44,12 +44,12 @@ const conf_t conf_flash_default = { }, .radio_conf = { .pwr = 0x7F, - .freq = FREQ_APRS_RECEIVE, + .freq = FREQ_GEOFENCE, .mod = MOD_AFSK, .cca = 0x4F }, // App identity - .call = "VK2GJ-5", + .call = "DL7AD-5", .path = "WIDE2-1", .symbol = SYM_DIGIPEATER, .aprs_msg = false, // Enable APRS message reception on this app @@ -58,26 +58,26 @@ const conf_t conf_flash_default = { // Primary image app .img_pri = { .svc_conf = { - .active = false, - .cycle = TIME_S2I(60 * 5), - .init_delay = TIME_S2I(60 * 1), - .send_spacing = TIME_S2I(5) + .active = true, + .cycle = CYCLE_CONTINUOUSLY, + .init_delay = TIME_S2I(30), + .send_spacing = TIME_S2I(10) }, .radio_conf = { .pwr = 0x7F, - .freq = 144800000, - .mod = MOD_2FSK, - .cca = 0x4F + .freq = FREQ_GEOFENCE, + .mod = MOD_AFSK, + .cca = 0x5F }, // App identity - .call = "VK2GJ-15", + .call = "DL7AD-15", .path = "", // Image settings - .res = RES_VGA, + .res = RES_QVGA, .quality = 4, - .buf_size = 40 * 1024, + .buf_size = 50 * 1024, .redundantTx = false }, @@ -91,12 +91,12 @@ const conf_t conf_flash_default = { }, .radio_conf = { .pwr = 0x1F, - .freq = APRS_FREQ_AUSTRALIA, + .freq = FREQ_APRS_AUSTRALIA, .mod = MOD_AFSK, .cca = 0x4F }, // App identity - .call = "VK2GJ-12", + .call = "DL7AD-12", .path = "", // Image settings @@ -115,12 +115,12 @@ const conf_t conf_flash_default = { }, .radio_conf = { .pwr = 0x7F, - .freq = FREQ_APRS_DYNAMIC, + .freq = FREQ_GEOFENCE, .mod = MOD_AFSK, .cca = 0x4F }, // Node identity - .call = "VK2GJ-13", + .call = "DL7AD-13", .path = "WIDE1-1", .density = 10 }, @@ -132,31 +132,31 @@ const conf_t conf_flash_default = { .svc_conf = { // The packet receive service is enabled if true // Receive is paused and resumed by transmission - .active = true, + .active = false, .init_delay = TIME_S2I(20) }, // Receive radio configuration .radio_conf = { - .freq = FREQ_APRS_DYNAMIC, + .freq = FREQ_GEOFENCE, .mod = MOD_AFSK, .rssi = 0x3F }, // APRS identity used in message responses if digipeat is not enabled - .call = "VK2GJ-4", + .call = "DL7AD-4", .symbol = SYM_ANTENNA }, .aprs_msg = false, // Set true to enable messages to be accepted on RX call sign - .digi = true, + .digi = false, .tx = { // Transmit radio configuration .radio_conf = { - .freq = FREQ_APRS_RECEIVE, + .freq = FREQ_RX_APRS, .pwr = 0x7F, .mod = MOD_AFSK, .cca = 0x4F }, // Digipeat transmission identity - .call = "VK2GJ-5", + .call = "DL7AD-5", .path = "WIDE2-1", .symbol = SYM_DIGIPEATER, // A digipeater beacon can be added using one of the POS apps @@ -183,13 +183,13 @@ const conf_t conf_flash_default = { .tel_enc_cycle = TIME_S2I(60 * 60 * 2), // The default APRS frequency when geofence is not resolved - .freq = APRS_FREQ_AUSTRALIA, + .freq = FREQ_APRS_EUROPE, // The base station identity. .base = { // If enabled tracker initiated APRS messages are addressed to this call sign - .enabled = true, - .call = "VK2GJ-7", + .enabled = false, + .call = "DL7AD-7", .path = "WIDE2-1", }, diff --git a/tracker/software/source/config/types.h b/tracker/software/source/config/types.h index 4067f7b7..5c5cbdab 100644 --- a/tracker/software/source/config/types.h +++ b/tracker/software/source/config/types.h @@ -6,22 +6,22 @@ #include "ublox.h" typedef enum { -FREQ_RADIO_INVALID = 0, -FREQ_APRS_DYNAMIC, /* Geofencing frequency (144.8 default). */ -FREQ_APRS_SCAN, /* Frequency last found in RX scan. - TBI */ -FREQ_APRS_RECEIVE, /* Active RX frequency - fall back to DYNAMIC. */ -FREQ_CMDC_RECEIVE, /* Frequency used for command and control. TBI */ -FREQ_APRS_DEFAULT, /* Default frequency specified in configuration */ -FREQ_CODES_END + FREQ_INVALID = 0, + FREQ_APRS_GEOFENCE, /* Geofencing frequency (144.8 default). */ + FREQ_SCAN, /* Frequency last found in RX scan. - TBI */ + FREQ_RX_APRS, /* Active RX frequency - fall back to DYNAMIC. */ + FREQ_RX_CMDC, /* Frequency used for command and control. TBI */ + FREQ_DEFAULT, /* Default frequency specified in configuration */ + FREQ_CODES_END } freq_codes_t; -#define FREQ_RADIO_INVALID 0 -#define FREQ_APRS_DYNAMIC 1 /* Geofencing frequency (144.8 default). */ -#define FREQ_APRS_SCAN 2 /* Frequency based on band base + channel scan. */ -#define FREQ_APRS_RECEIVE 3 /* Active RX frequency - fall back to DYNAMIC. */ -#define FREQ_CMDC_RECEIVE 4 /* Frequency used for command and control. TBI */ -#define FREQ_APRS_DEFAULT 5 /* Default frequency specified in configuration */ -#define FREQ_CODES_END 6 +#define FREQ_INVALID 0 +#define FREQ_GEOFENCE 1 /* Geofencing frequency (144.8 default). */ +#define FREQ_SCAN 2 /* Frequency based on band base + channel scan. */ +#define FREQ_RX_APRS 3 /* Active RX frequency - fall back to DYNAMIC. */ +#define FREQ_RX_CMDC 4 /* Frequency used for command and control. TBI */ +#define FREQ_DEFAULT 5 /* Default frequency specified in configuration */ +#define FREQ_CODES_END 6 #define CYCLE_CONTINUOUSLY 0 diff --git a/tracker/software/source/drivers/si446x.c b/tracker/software/source/drivers/si446x.c index 2c37c36f..ac8e8198 100644 --- a/tracker/software/source/drivers/si446x.c +++ b/tracker/software/source/drivers/si446x.c @@ -986,7 +986,7 @@ static bool Si446x_transmit(const radio_unit_t radio, radio_freq_t op_freq = pktComputeOperatingFrequency(radio, freq, step, chan, RADIO_TX); - if(op_freq == FREQ_RADIO_INVALID) { + if(op_freq == FREQ_INVALID) { TRACE_ERROR("SI > Frequency out of range"); TRACE_ERROR("SI > abort transmission"); return false; @@ -1068,7 +1068,7 @@ bool Si446x_receiveNoLock(const radio_unit_t radio, radio_freq_t op_freq = pktComputeOperatingFrequency(radio, freq, step, channel, RADIO_RX); - if(op_freq == FREQ_RADIO_INVALID) { + if(op_freq == FREQ_INVALID) { TRACE_ERROR("SI > Frequency out of range"); TRACE_ERROR("SI > abort transmission"); return false; diff --git a/tracker/software/source/math/geofence.c b/tracker/software/source/math/geofence.c index d881b7bf..0f93679c 100644 --- a/tracker/software/source/math/geofence.c +++ b/tracker/software/source/math/geofence.c @@ -648,55 +648,50 @@ static bool isPointInBrazil(int32_t lat, int32_t lon) { return isPointInPolygon(brazil, sizeof(brazil)/sizeof(brazil[0]), lat, lon); } -/** - * Returns APRS region specific frequency determined by GPS location. It will - * use the APRS default frequency set in the config file if no GPS fix has - * been received. - */ uint32_t getAPRSRegionFrequency() { dataPoint_t *point = getLastDataPoint(); // Position unknown if(point == NULL || (point->gps_lat == 0 && point->gps_lon == 0)) // Return code and let pktradio figure out what to do. - return FREQ_APRS_DEFAULT; + return FREQ_INVALID; // America 144.390 MHz if(isPointInAmerica(point->gps_lat, point->gps_lon)) - return APRS_FREQ_AMERICA; + return FREQ_APRS_AMERICA; // China 144.640 MHz if(isPointInChina(point->gps_lat, point->gps_lon)) - return APRS_FREQ_CHINA; + return FREQ_APRS_CHINA; // Japan 144.660 MHz if(isPointInJapan(point->gps_lat, point->gps_lon)) - return APRS_FREQ_JAPAN; + return FREQ_APRS_JAPAN; // Southkorea 144.620 MHz if(isPointInSouthkorea(point->gps_lat, point->gps_lon)) - return APRS_FREQ_SOUTHKOREA; + return FREQ_APRS_SOUTHKOREA; // Southkorea 144.620 MHz if(isPointInSoutheastAsia(point->gps_lat, point->gps_lon)) - return APRS_FREQ_SOUTHEASTASIA; + return FREQ_APRS_SOUTHEASTASIA; // Australia 145.175 MHz if(isPointInAustralia(point->gps_lat, point->gps_lon)) - return APRS_FREQ_AUSTRALIA; + return FREQ_APRS_AUSTRALIA; // Australia 144.575 MHz if(isPointInNewZealand(point->gps_lat, point->gps_lon)) - return APRS_FREQ_NEWZEALAND; + return FREQ_APRS_NEWZEALAND; // Argentina/Paraguay/Uruguay 144.930 MHz if(isPointInArgentina(point->gps_lat, point->gps_lon)) - return APRS_FREQ_ARGENTINA; + return FREQ_APRS_ARGENTINA; // Brazil 145.575 MHz if(isPointInBrazil(point->gps_lat, point->gps_lon)) - return APRS_FREQ_BRAZIL; + return FREQ_APRS_BRAZIL; - return FREQ_APRS_DEFAULT; + return FREQ_INVALID; } diff --git a/tracker/software/source/math/geofence.h b/tracker/software/source/math/geofence.h index d846c748..eaf8b272 100644 --- a/tracker/software/source/math/geofence.h +++ b/tracker/software/source/math/geofence.h @@ -6,16 +6,16 @@ #include "types.h" // APRS region frequencies -#define APRS_FREQ_OTHER 144800000 -#define APRS_FREQ_AMERICA 144390000 -#define APRS_FREQ_CHINA 144640000 -#define APRS_FREQ_JAPAN 144660000 -#define APRS_FREQ_SOUTHKOREA 144620000 -#define APRS_FREQ_SOUTHEASTASIA 144390000 -#define APRS_FREQ_AUSTRALIA 145175000 -#define APRS_FREQ_NEWZEALAND 144575000 -#define APRS_FREQ_ARGENTINA 144930000 -#define APRS_FREQ_BRAZIL 145575000 +#define FREQ_APRS_EUROPE 144800000 +#define FREQ_APRS_AMERICA 144390000 +#define FREQ_APRS_CHINA 144640000 +#define FREQ_APRS_JAPAN 144660000 +#define FREQ_APRS_SOUTHKOREA 144620000 +#define FREQ_APRS_SOUTHEASTASIA 144390000 +#define FREQ_APRS_AUSTRALIA 145175000 +#define FREQ_APRS_NEWZEALAND 144575000 +#define FREQ_APRS_ARGENTINA 144930000 +#define FREQ_APRS_BRAZIL 145575000 typedef struct { int32_t lat; diff --git a/tracker/software/source/pkt/managers/pktradio.c b/tracker/software/source/pkt/managers/pktradio.c index 56aebfe1..0c05e976 100644 --- a/tracker/software/source/pkt/managers/pktradio.c +++ b/tracker/software/source/pkt/managers/pktradio.c @@ -672,27 +672,27 @@ uint8_t pktGetNumRadios(void) { int pktDisplayFrequencyCode(const radio_freq_t code, char *buf, size_t size) { char* str = NULL; switch(code) { - case FREQ_RADIO_INVALID: + case FREQ_INVALID: str = "No Code"; break; - case FREQ_APRS_DYNAMIC: + case FREQ_GEOFENCE: str = "APRS Dynamic frequency"; break; - case FREQ_APRS_SCAN: + case FREQ_SCAN: str = "APRS Scan channel"; break; - case FREQ_APRS_RECEIVE: + case FREQ_RX_APRS: str = "APRS Receive frequency"; break; - case FREQ_CMDC_RECEIVE: + case FREQ_RX_CMDC: str = "CNC Receive frequency"; break; - case FREQ_APRS_DEFAULT: + case FREQ_DEFAULT: str = "APRS Default frequency"; break; @@ -719,7 +719,7 @@ int pktDisplayFrequencyCode(const radio_freq_t code, char *buf, size_t size) { * @param[in] radio Radio unit ID. * * @return operating frequency - * @retval FREQ_RADIO_INVALID if radio ID is invalid + * @retval FREQ_INVALID if radio ID is invalid * @retval Default frequency otherwise * * @api @@ -855,7 +855,7 @@ const radio_config_t *pktGetRadioData(radio_unit_t radio) { * * @return operating frequency in Hz. * @retval an absolute operating frequency in Hz. - * @retval FREQ_RADIO_INVALID if frequency or radio ID is invalid. + * @retval FREQ_INVALID if frequency or radio ID is invalid. * * @api */ @@ -865,7 +865,7 @@ radio_freq_t pktComputeOperatingFrequency(const radio_unit_t radio, radio_ch_t chan, const radio_mode_t mode) { - if((base_freq == FREQ_APRS_RECEIVE || base_freq == FREQ_APRS_SCAN) + if((base_freq == FREQ_RX_APRS || base_freq == FREQ_SCAN) && (mode == RADIO_TX || mode == RADIO_ALL)) { /* Get current RX frequency (or default) and use that. */ step = 0; @@ -878,7 +878,7 @@ radio_freq_t pktComputeOperatingFrequency(const radio_unit_t radio, * Check for dynamic frequency determination. * Dynamic can return an absolute frequency or a further special code. */ - if(base_freq == FREQ_APRS_DYNAMIC) { + if(base_freq == FREQ_GEOFENCE) { /* * Get frequency by geofencing. * Geofencing can return special code FREQ_APRS_DEFAULT. @@ -888,8 +888,7 @@ radio_freq_t pktComputeOperatingFrequency(const radio_unit_t radio, chan = 0; } - /* Check for default. */ - if(base_freq == FREQ_APRS_DEFAULT) { + if(base_freq == FREQ_INVALID) { // Geofence not resolved base_freq = pktGetDefaultOperatingFrequency(radio); step = 0; chan = 0; @@ -901,7 +900,7 @@ radio_freq_t pktComputeOperatingFrequency(const radio_unit_t radio, if(pktCheckAllowedFrequency(radio, op_freq) != NULL) { return op_freq; } - return FREQ_RADIO_INVALID; + return FREQ_INVALID; } /** diff --git a/tracker/software/source/threads/rxtx/radio.c b/tracker/software/source/threads/rxtx/radio.c index b8f0b23f..071e406b 100644 --- a/tracker/software/source/threads/rxtx/radio.c +++ b/tracker/software/source/threads/rxtx/radio.c @@ -70,8 +70,8 @@ void start_aprs_threads(radio_unit_t radio, radio_freq_t base_freq, channel_hz_t step, radio_ch_t chan, radio_squelch_t rssi) { - if(base_freq == FREQ_APRS_RECEIVE) { - TRACE_ERROR("RX > Cannot specify FREQ_APRS_RECEIVE for receiver"); + if(base_freq == FREQ_RX_APRS) { + TRACE_ERROR("RX > Cannot specify FREQ_RX_APRS for receiver"); return; } @@ -133,7 +133,7 @@ bool transmitOnRadio(packet_t pp, const radio_freq_t base_freq, step, chan, RADIO_TX); - if(op_freq == FREQ_RADIO_INVALID) { + if(op_freq == FREQ_INVALID) { TRACE_ERROR("RAD > Transmit operating frequency of %d.%03d MHz is invalid", op_freq/1000000, (op_freq%1000000)/1000); pktReleaseBufferChain(pp);