Skip to content

Commit

Permalink
illustrations for Ham wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Aug 25, 2023
1 parent ce426a0 commit f38075a
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 65 deletions.
Binary file added documents/images/ham-7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/images/ham-8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions software/firmware/source/SoftRF/src/driver/RF.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ typedef struct Slot_descr_struct {
} Slot_descr_t;

typedef struct Slots_descr_struct {
uint16_t interval_min;
uint16_t interval_max;
uint16_t interval_mid;
uint16_t adj;
uint32_t interval_min;
uint32_t interval_max;
uint32_t interval_mid;
uint32_t adj;
uint16_t air_time;
Slot_descr_t s0;
Slot_descr_t s1;
Expand Down
88 changes: 37 additions & 51 deletions software/firmware/source/SoftRF/src/protocol/radio/APRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
#include "../../../SoftRF.h"
#include "../../driver/RF.h"

/*
* Classic APRS
*/
const rf_proto_desc_t aprs_proto_desc = {
"APRS",
.type = RF_PROTOCOL_APRS,
Expand Down Expand Up @@ -57,6 +60,38 @@ const rf_proto_desc_t aprs_proto_desc = {
.slot1 = {0, 0}
};

/*
* APRS over LoRa
*/
const rf_proto_desc_t prol_proto_desc = {
"PRoL",
.type = RF_PROTOCOL_APRS,
.modulation_type = RF_MODULATION_TYPE_LORA,
.preamble_type = 0 /* INVALID FOR LORA */,
.preamble_size = 0 /* INVALID FOR LORA */,
.syncword = { 0x12 }, // sx127x default value, valid for PRoL
.syncword_size = 1,
.net_id = 0x0000, /* not in use */
.payload_type = RF_PAYLOAD_DIRECT,
.payload_size = APRS_PAYLOAD_SIZE,
.payload_offset = PROL_PAYLOAD_OFFSET,
.crc_type = RF_CHECKSUM_TYPE_NONE, /* LoRa packet has built-in CRC */
.crc_size = 0 /* INVALID FOR LORA */,
.bitrate = DR_SF12 /* CR_5 BW_125 SF_12 */,

.deviation = 0 /* INVALID FOR LORA */,
.whitening = RF_WHITENING_NONE,
.bandwidth = RF_RX_BANDWIDTH_SS_125KHZ, /* TBD */

.air_time = PROL_AIR_TIME,

.tm_type = RF_TIMING_INTERVAL,
.tx_interval_min = PROL_TX_INTERVAL_MIN,
.tx_interval_max = PROL_TX_INTERVAL_MAX,
.slot0 = {0, 0},
.slot1 = {0, 0}
};

static const char *AprsIcon[16] = // Icons for various FLARM acftType's
{ "/z", // 0 = ?
"/'", // 1 = (moto-)glider (most frequent)
Expand Down Expand Up @@ -194,22 +229,6 @@ bool ax25_decode(void *pkt, ufo_t *this_aircraft, ufo_t *fop) {
return aprs_decode((void *) tnc2.c_str(), this_aircraft, fop);
}

static void nmea_lat(float lat, char *buf)
{
int lat_int = (int) lat;
float lat_dec = lat - lat_int;

sprintf(buf, "%02d%05.2f%c", abs(lat_int), fabsf(lat_dec * 60), lat < 0 ? 'S' : 'N');
}

static void nmea_lon(float lon, char *buf)
{
int lon_int = (int) lon;
float lon_dec = lon - lon_int;

sprintf(buf, "%03d%05.2f%c", abs(lon_int), fabsf(lon_dec * 60), lon < 0 ? 'W' : 'E');
}

size_t aprs_encode(void *pkt, ufo_t *this_aircraft) {

char buf[APRS_PAYLOAD_SIZE];
Expand Down Expand Up @@ -240,7 +259,6 @@ size_t aprs_encode(void *pkt, ufo_t *this_aircraft) {
float lon_dec = lon - lon_int;

snprintf(buf, sizeof(buf),
// "<\xff\x01"
"%06X>%s:"
"/"
"%02d%02d%02dh"
Expand All @@ -258,38 +276,6 @@ size_t aprs_encode(void *pkt, ufo_t *this_aircraft) {
(altitude_i < 0) ? 0 : altitude_i, /* feet */
id | (XX << 24));

memcpy((void *) pkt, buf, strlen(buf));
return strlen(buf);
strcpy((char *) pkt, buf);
return strlen(buf) + 1;
}

/*
* APRS-over-LoRa
*/
const rf_proto_desc_t prol_proto_desc = {
"PRoL",
.type = RF_PROTOCOL_APRS,
.modulation_type = RF_MODULATION_TYPE_LORA,
.preamble_type = 0 /* INVALID FOR LORA */,
.preamble_size = 0 /* INVALID FOR LORA */,
.syncword = { 0x12 }, // sx127x default value, valid for PRoL
.syncword_size = 1,
.net_id = 0x0000, /* not in use */
.payload_type = RF_PAYLOAD_DIRECT,
.payload_size = APRS_PAYLOAD_SIZE,
.payload_offset = PROL_PAYLOAD_OFFSET,
.crc_type = RF_CHECKSUM_TYPE_NONE, /* LoRa packet has built-in CRC */
.crc_size = 0 /* INVALID FOR LORA */,
.bitrate = DR_SF12 /* CR_5 BW_125 SF_12 */,

.deviation = 0 /* INVALID FOR LORA */,
.whitening = RF_WHITENING_NONE,
.bandwidth = RF_RX_BANDWIDTH_SS_125KHZ, /* TBD */

.air_time = PROL_AIR_TIME,

.tm_type = RF_TIMING_INTERVAL,
.tx_interval_min = PROL_TX_INTERVAL_MIN,
.tx_interval_max = PROL_TX_INTERVAL_MAX,
.slot0 = {0, 0},
.slot1 = {0, 0}
};
4 changes: 2 additions & 2 deletions software/firmware/source/SoftRF/src/protocol/radio/APRS.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define APRS_AIR_TIME 3000 /* 3 s */

#define APRS_TX_INTERVAL_MIN 60000 /* in ms, no SB nor LBT support at this time */
#define APRS_TX_INTERVAL_MAX 65500 /* TBD: 80000 */
#define APRS_TX_INTERVAL_MAX 80000

typedef struct {

Expand All @@ -57,7 +57,7 @@ size_t aprs_encode(void *, ufo_t *);
#define PROL_AIR_TIME 4600 /* 4.6 s */

#define PROL_TX_INTERVAL_MIN 60000 /* in ms, no SB nor LBT support at this time */
#define PROL_TX_INTERVAL_MAX 65500 /* TBD: 80000 */
#define PROL_TX_INTERVAL_MAX 80000

extern const rf_proto_desc_t prol_proto_desc;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Protocol_ES1090.cpp
*
* Decoder for Extended Squitter 1090 MHz ADS-B radio protocol
* Copyright (C) 2021-2023 Linar Yusupov
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Protocol_OGNTP.cpp
*
* Encoder and decoder for Open Glider Network tracker radio protocol
* Copyright (C) 2017-2023 Linar Yusupov
*
Expand Down
2 changes: 1 addition & 1 deletion software/firmware/source/SoftRF/src/protocol/radio/P3I.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Protocol_P3I.cpp
*
* Encoder and decoder for PilotAware P3I radio protocol
* Copyright (C) 2017-2023 Linar Yusupov
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Protocol_UAT978.cpp
*
* Decoder for UAT 978 MHz ADS-B radio protocol
* Copyright (C) 2019-2023 Linar Yusupov
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ typedef struct RF_PROTOCOL {
uint16_t air_time;

uint8_t tm_type;
uint16_t tx_interval_min;
uint16_t tx_interval_max;
uint32_t tx_interval_min;
uint32_t tx_interval_max;
tslot_t slot0;
tslot_t slot1;
} rf_proto_desc_t;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ typedef struct RF_PROTOCOL {
uint16_t air_time;

uint8_t tm_type;
uint16_t tx_interval_min;
uint16_t tx_interval_max;
uint32_t tx_interval_min;
uint32_t tx_interval_max;
tslot_t slot0;
tslot_t slot1;
} rf_proto_desc_t;
Expand Down

0 comments on commit f38075a

Please sign in to comment.