kopia lustrzana https://github.com/DL7AD/pecanpico10
Merge remote-tracking branch 'origin/master' into Development
Conflicts: tracker/software/make/pp10b.make tracker/software/source/config/config.cwebcam_dev
commit
5f0e5a4833
|
|
@ -294,7 +294,18 @@ function time_format(time) {
|
|||
}
|
||||
|
||||
function get_alt(p) {
|
||||
return '---'; // TODO: Implement pressure to altitude calculation
|
||||
var p_height;
|
||||
p = p / 100; // convert pascal to millibar
|
||||
if (p >= 226.32) {
|
||||
p_height = 44330.8 * (1.0 - Math.exp(Math.log(p / 1013.25) * 0.190263));
|
||||
}
|
||||
if (p < 226.32 && p > 54.749) {
|
||||
p_height = 11000 - 6341.624 * Math.log(p / 226.3202);
|
||||
}
|
||||
if (p <= 54.749) {
|
||||
p_height = 20000 + 216650 * (Math.exp(Math.log(p / 54.749) * -0.0292173) -1.0);
|
||||
}
|
||||
return p_height;
|
||||
}
|
||||
|
||||
function updateData() {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ int main(void) {
|
|||
pktConfigureCoreIO();
|
||||
|
||||
/* Setup the mutex for trace output. */
|
||||
//DEBUG_INIT();
|
||||
debug_init();
|
||||
|
||||
#if ACTIVATE_CONSOLE
|
||||
/* Start console. */
|
||||
|
|
@ -33,7 +33,7 @@ int main(void) {
|
|||
chDbgAssert(pkt == true, "failed to init packet system");
|
||||
|
||||
/* Start serial debug channel(s) if selected. */
|
||||
pktSerialStart();
|
||||
//pktSerialStart();
|
||||
|
||||
/*
|
||||
* Create a packet radio service.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,197 @@
|
|||
/**
|
||||
* Put your configuration settings here. See description of all fields in types.h
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include "aprs.h"
|
||||
#include "geofence.h"
|
||||
|
||||
conf_t conf_sram;
|
||||
|
||||
const conf_t conf_flash_default = {
|
||||
// Primary position app
|
||||
.pos_pri = {
|
||||
.beacon = {
|
||||
.active = false,
|
||||
.cycle = TIME_S2I(60 * 5),
|
||||
.init_delay = TIME_S2I(60),
|
||||
.fixed = false // Add lat, lon, alt fields when enabling fixed
|
||||
},
|
||||
.radio_conf = {
|
||||
.pwr = 0x1F,
|
||||
.freq = 144860000,
|
||||
.mod = MOD_2FSK,
|
||||
.cca = 0x4F,
|
||||
},
|
||||
// App identity
|
||||
.call = "DL0CPS-11",
|
||||
.path = "WIDE1-1",
|
||||
.symbol = SYM_BALLOON,
|
||||
.aprs_msg = true, // Enable APRS message reception on this app
|
||||
},
|
||||
|
||||
// Secondary position app
|
||||
.pos_sec = {
|
||||
.beacon = {
|
||||
.active = false,
|
||||
.cycle = TIME_S2I(60 * 30), // Beacon interval
|
||||
.init_delay = TIME_S2I(60),
|
||||
.fixed = true, // Add lat, lon alt fields when enabling fixed
|
||||
.lat = -337331175, // Degrees (expressed in 1e-7 form)
|
||||
.lon = 1511143478, // Degrees (expressed in 1e-7 form)
|
||||
.alt = 144 // Altitude in metres
|
||||
},
|
||||
.radio_conf = {
|
||||
.pwr = 0x7F,
|
||||
.freq = FREQ_APRS_RECEIVE,
|
||||
.mod = MOD_AFSK,
|
||||
.cca = 0x4F
|
||||
},
|
||||
// App identity
|
||||
.call = "DL0CPS-5",
|
||||
.path = "WIDE2-1",
|
||||
.symbol = SYM_DIGIPEATER,
|
||||
.aprs_msg = false, // Enable APRS message reception on this app
|
||||
},
|
||||
|
||||
// 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)
|
||||
},
|
||||
.radio_conf = {
|
||||
.pwr = 0x7F,
|
||||
.freq = 144860000,
|
||||
.mod = MOD_2FSK,
|
||||
.cca = 0x4F
|
||||
|
||||
},
|
||||
// App identity
|
||||
.call = "DL0CPS-15",
|
||||
.path = "",
|
||||
|
||||
// Image settings
|
||||
.res = RES_VGA,
|
||||
.quality = 4,
|
||||
.buf_size = 40 * 1024,
|
||||
.redundantTx = false
|
||||
},
|
||||
|
||||
// Secondary image app
|
||||
.img_sec = {
|
||||
.svc_conf = {
|
||||
.active = false,
|
||||
.cycle = TIME_S2I(60 * 15),
|
||||
.init_delay = TIME_S2I(15 * 1),
|
||||
.send_spacing = TIME_S2I(2)
|
||||
},
|
||||
.radio_conf = {
|
||||
.pwr = 0x1F,
|
||||
.freq = 144860000,
|
||||
.mod = MOD_2FSK,
|
||||
.cca = 0x4F
|
||||
},
|
||||
// App identity
|
||||
.call = "DL0CPS-12",
|
||||
.path = "",
|
||||
|
||||
// Image settings
|
||||
.res = RES_QVGA,
|
||||
.quality = 4,
|
||||
.buf_size = 15 * 1024,
|
||||
.redundantTx = false
|
||||
},
|
||||
|
||||
// Log app
|
||||
.log = {
|
||||
.svc_conf = {
|
||||
.active = false,
|
||||
.cycle = TIME_S2I(10),
|
||||
.init_delay = TIME_S2I(5)
|
||||
},
|
||||
.radio_conf = {
|
||||
.pwr = 0x7F,
|
||||
.freq = 144860000,
|
||||
.mod = MOD_2FSK,
|
||||
.cca = 0x4F
|
||||
},
|
||||
// Node identity
|
||||
.call = "DL0CPS-11",
|
||||
.path = "WIDE1-1",
|
||||
.density = 10
|
||||
},
|
||||
|
||||
// APRS app
|
||||
.aprs = {
|
||||
// The receive identity for APRS
|
||||
.rx = {
|
||||
.svc_conf = {
|
||||
// The packet receive service is enabled if true
|
||||
// Receive is paused and resumed by transmission
|
||||
.active = true,
|
||||
.init_delay = TIME_S2I(20)
|
||||
},
|
||||
// Receive radio configuration
|
||||
.radio_conf = {
|
||||
.freq = 144840000,
|
||||
.mod = MOD_AFSK,
|
||||
.rssi = 0x3F
|
||||
},
|
||||
// APRS identity used in message responses if digipeat is not enabled
|
||||
.call = "DL0CPS-4",
|
||||
.symbol = SYM_ANTENNA
|
||||
},
|
||||
.aprs_msg = false, // Set true to enable messages to be accepted on RX call sign
|
||||
.digi = true,
|
||||
.tx = {
|
||||
// Transmit radio configuration
|
||||
.radio_conf = {
|
||||
.freq = FREQ_APRS_RECEIVE,
|
||||
.pwr = 0x7F,
|
||||
.mod = MOD_AFSK,
|
||||
.cca = 0x4F
|
||||
},
|
||||
// Digipeat transmission identity
|
||||
.call = "VK2GJ-5",
|
||||
.path = "WIDE2-1",
|
||||
.symbol = SYM_DIGIPEATER,
|
||||
// A digipeater beacon can be added using one of the POS apps
|
||||
// Set the POS identity the same as the dipipeater TX identity
|
||||
// Alternatively the digipeater can have its own .beacon entry here
|
||||
},
|
||||
},
|
||||
|
||||
// Global controls
|
||||
|
||||
// Power control
|
||||
.keep_cam_switched_on = false,
|
||||
.gps_on_vbat = 3600, // mV
|
||||
.gps_off_vbat = 3400, // mV
|
||||
.gps_onper_vbat = 4000, // mV
|
||||
|
||||
// GPS altitude model control (air pressure controlled using on-board BME280)
|
||||
.gps_pressure = 90000, // Air pressure (Pa) threshold for alt model switch
|
||||
.gps_low_alt = GPS_STATIONARY,
|
||||
.gps_high_alt = GPS_AIRBORNE_1G,
|
||||
|
||||
// APRS
|
||||
// How often to send telemetry config (global for beacons)
|
||||
.tel_enc_cycle = TIME_S2I(60 * 60 * 2),
|
||||
|
||||
// The default APRS frequency when geofence is not resolved
|
||||
.freq = 144860000,
|
||||
|
||||
// The base station identity.
|
||||
.base = {
|
||||
// If enabled tracker initiated APRS messages are addressed to this call sign
|
||||
.enabled = true,
|
||||
.call = "DL0CPS-7",
|
||||
.path = "WIDE2-1",
|
||||
},
|
||||
|
||||
.magic = CONFIG_MAGIC_DEFAULT // Do not remove. This is the activation bit.
|
||||
};
|
||||
|
|
@ -65,8 +65,8 @@ const conf_t conf_flash_default = {
|
|||
},
|
||||
.radio_conf = {
|
||||
.pwr = 0x7F,
|
||||
.freq = FREQ_GEOFENCE,
|
||||
.mod = MOD_AFSK,
|
||||
.freq = 144860000,
|
||||
.mod = MOD_2FSK,
|
||||
.cca = 0x5F
|
||||
|
||||
},
|
||||
|
|
@ -75,7 +75,7 @@ const conf_t conf_flash_default = {
|
|||
.path = "",
|
||||
|
||||
// Image settings
|
||||
.res = RES_QVGA,
|
||||
.res = RES_VGA,
|
||||
.quality = 4,
|
||||
.buf_size = 50 * 1024,
|
||||
.redundantTx = false
|
||||
|
|
@ -85,15 +85,15 @@ const conf_t conf_flash_default = {
|
|||
.img_sec = {
|
||||
.svc_conf = {
|
||||
.active = false,
|
||||
.cycle = TIME_S2I(60 * 5),
|
||||
.init_delay = TIME_S2I(15 * 1),
|
||||
.send_spacing = TIME_S2I(2)
|
||||
.cycle = CYCLE_CONTINUOUSLY,
|
||||
.init_delay = TIME_S2I(60),
|
||||
.send_spacing = TIME_S2I(10)
|
||||
},
|
||||
.radio_conf = {
|
||||
.pwr = 0x1F,
|
||||
.freq = FREQ_APRS_AUSTRALIA,
|
||||
.mod = MOD_AFSK,
|
||||
.cca = 0x4F
|
||||
.pwr = 0x7F,
|
||||
.freq = 144860000,
|
||||
.mod = MOD_2FSK,
|
||||
.cca = 0x5F
|
||||
},
|
||||
// App identity
|
||||
.call = "VK2GJ-12",
|
||||
|
|
@ -139,7 +139,7 @@ const conf_t conf_flash_default = {
|
|||
.radio_conf = {
|
||||
.freq = FREQ_APRS_AUSTRALIA,
|
||||
.mod = MOD_AFSK,
|
||||
.rssi = 0x3F
|
||||
.rssi = 0x5F
|
||||
},
|
||||
// APRS identity used in message responses if digipeat is not enabled
|
||||
.call = "VK2GJ-4",
|
||||
|
|
@ -153,7 +153,7 @@ const conf_t conf_flash_default = {
|
|||
.freq = FREQ_RX_APRS,
|
||||
.pwr = 0x7F,
|
||||
.mod = MOD_AFSK,
|
||||
.cca = 0x4F
|
||||
.cca = 0x5F
|
||||
},
|
||||
// Digipeat transmission identity
|
||||
.call = "VK2GJ-5",
|
||||
|
|
@ -169,9 +169,9 @@ const conf_t conf_flash_default = {
|
|||
|
||||
// Power control
|
||||
.keep_cam_switched_on = false,
|
||||
.gps_on_vbat = 3600, // mV
|
||||
.gps_off_vbat = 3400, // mV
|
||||
.gps_onper_vbat = 4000, // mV
|
||||
.gps_on_vbat = 3300, // mV
|
||||
.gps_off_vbat = 3000, // mV
|
||||
.gps_onper_vbat = 3500, // mV
|
||||
|
||||
// GPS altitude model control (air pressure controlled using on-board BME280)
|
||||
.gps_pressure = 90000, // Air pressure (Pa) threshold for alt model switch
|
||||
|
|
@ -180,7 +180,7 @@ const conf_t conf_flash_default = {
|
|||
|
||||
// APRS
|
||||
// How often to send telemetry config (global for beacons)
|
||||
.tel_enc_cycle = TIME_S2I(60 * 60 * 2),
|
||||
.tel_enc_cycle = TIME_S2I(3600),
|
||||
|
||||
// The default APRS frequency when geofence is not resolved
|
||||
.freq = FREQ_APRS_EUROPE,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ typedef enum { // Modulation type
|
|||
MOD_NONE,
|
||||
MOD_AFSK,
|
||||
MOD_2FSK
|
||||
} mod_t;
|
||||
} radio_mod_t;
|
||||
|
||||
typedef enum {
|
||||
RES_NONE = 0,
|
||||
|
|
@ -66,7 +66,7 @@ typedef enum {
|
|||
typedef struct {
|
||||
radio_pwr_t pwr;
|
||||
radio_freq_t freq;
|
||||
mod_t mod;
|
||||
radio_mod_t mod;
|
||||
link_speed_t speed;
|
||||
union {
|
||||
radio_squelch_t cca;
|
||||
|
|
@ -77,14 +77,14 @@ typedef struct {
|
|||
typedef struct {
|
||||
radio_pwr_t pwr;
|
||||
radio_freq_t freq;
|
||||
mod_t mod;
|
||||
radio_mod_t mod;
|
||||
link_speed_t speed;
|
||||
radio_squelch_t cca;
|
||||
} radio_tx_conf_t; // Radio / Modulation
|
||||
|
||||
typedef struct {
|
||||
radio_freq_t freq;
|
||||
mod_t mod;
|
||||
radio_mod_t mod;
|
||||
link_speed_t speed;
|
||||
radio_squelch_t rssi;
|
||||
} radio_rx_conf_t; // Radio / Modulation
|
||||
|
|
|
|||
|
|
@ -1063,7 +1063,7 @@ bool Si446x_receiveNoLock(const radio_unit_t radio,
|
|||
channel_hz_t step,
|
||||
radio_ch_t channel,
|
||||
radio_squelch_t rssi,
|
||||
mod_t mod) {
|
||||
radio_mod_t mod) {
|
||||
|
||||
radio_freq_t op_freq = pktComputeOperatingFrequency(radio, freq,
|
||||
step, channel,
|
||||
|
|
@ -1123,7 +1123,7 @@ bool Si4464_enableReceive(const radio_unit_t radio,
|
|||
const channel_hz_t rx_step,
|
||||
const radio_ch_t rx_chan,
|
||||
const radio_squelch_t rx_rssi,
|
||||
const mod_t rx_mod) {
|
||||
const radio_mod_t rx_mod) {
|
||||
|
||||
/* Get an absolute operating frequency in Hz. */
|
||||
radio_freq_t op_freq = pktComputeOperatingFrequency(radio,
|
||||
|
|
|
|||
|
|
@ -316,13 +316,13 @@ extern "C" {
|
|||
channel_hz_t rx_step,
|
||||
radio_ch_t rx_chan,
|
||||
radio_squelch_t rx_rssi,
|
||||
mod_t rx_mod);
|
||||
radio_mod_t rx_mod);
|
||||
bool Si446x_receiveNoLock(const radio_unit_t radio,
|
||||
radio_freq_t rx_frequency,
|
||||
channel_hz_t rx_step,
|
||||
radio_ch_t chan,
|
||||
radio_squelch_t rssi,
|
||||
mod_t mod);
|
||||
radio_mod_t mod);
|
||||
void Si446x_lockRadio(const radio_mode_t mode);
|
||||
void Si446x_unlockRadio(const radio_mode_t mode);
|
||||
void Si446x_lockRadioByCamera(void);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,67 @@
|
|||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
#include "debug.h"
|
||||
#include "portab.h"
|
||||
|
||||
//mutex_t trace_mtx; // Used internal to synchronize multiple chprintf in debug.h
|
||||
mutex_t mtx; // Used internal to synchronize multiple chprintf in debug.h
|
||||
|
||||
char error_list[ERROR_LIST_SIZE][ERROR_LIST_LENGTH];
|
||||
uint8_t error_counter;
|
||||
|
||||
static const SerialConfig debug_config = {
|
||||
115200,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
#ifdef USB_TRACE_LEVEL
|
||||
uint8_t usb_trace_level = USB_TRACE_LEVEL; // Set in makefile UDEFS
|
||||
#else
|
||||
uint8_t usb_trace_level = 2; // Level: Errors + Warnings
|
||||
#endif
|
||||
|
||||
|
||||
void debug_init(void) {
|
||||
chMtxObjectInit(&mtx);
|
||||
|
||||
sdStart(&SD3, &debug_config);
|
||||
palSetLineMode(LINE_IO_TXD, PAL_MODE_ALTERNATE(7));
|
||||
palSetLineMode(LINE_IO_RXD, PAL_MODE_ALTERNATE(7));
|
||||
}
|
||||
|
||||
void debug_print(char *type, char* filename, uint32_t line, char* format, ...)
|
||||
{
|
||||
chMtxLock(&mtx);
|
||||
|
||||
uint8_t str[256];
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
chsnprintf((char*)str, sizeof(str), format, args);
|
||||
va_end(args);
|
||||
|
||||
|
||||
if(isConsoleOutputAvailable()) {
|
||||
if(TRACE_TIME) {
|
||||
chprintf((BaseSequentialStream*)&SDU1, "[%8d.%03d]", chVTGetSystemTime()/CH_CFG_ST_FREQUENCY, (chVTGetSystemTime()*1000/CH_CFG_ST_FREQUENCY)%1000);
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SDU1, "[%s]", type);
|
||||
if(TRACE_FILE) {
|
||||
chprintf((BaseSequentialStream*)&SDU1, "[%12s %04d]", filename, line);
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SDU1, " %s\r\n", str);
|
||||
}
|
||||
|
||||
if(TRACE_TIME) {
|
||||
chprintf((BaseSequentialStream*)&SD3, "[%8d.%03d]", chVTGetSystemTime()/CH_CFG_ST_FREQUENCY, (chVTGetSystemTime()*1000/CH_CFG_ST_FREQUENCY)%1000);
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SD3, "[%s]", type);
|
||||
if(TRACE_FILE) {
|
||||
chprintf((BaseSequentialStream*)&SD3, "[%12s %04d]", filename, line);
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SD3, " %s\r\n", str);
|
||||
|
||||
chMtxUnlock(&mtx);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,40 +17,15 @@
|
|||
|
||||
extern char error_list[ERROR_LIST_SIZE][ERROR_LIST_LENGTH];
|
||||
extern uint8_t error_counter;
|
||||
extern mutex_t trace_mtx;
|
||||
extern const SerialConfig uart_config;
|
||||
extern uint8_t usb_trace_level;
|
||||
|
||||
// Initializer for serial debug and LEDs
|
||||
/*
|
||||
#define DEBUG_INIT() { \
|
||||
chMtxObjectInit(&trace_mtx); \
|
||||
}
|
||||
*/
|
||||
|
||||
#define TRACE_BASE(format, type, args...) { \
|
||||
if(isConsoleOutputAvailable()) { \
|
||||
if(TRACE_TIME) { \
|
||||
chprintf((BaseSequentialStream*)&SDU1, "[%8d.%03d]", chVTGetSystemTime()/CH_CFG_ST_FREQUENCY, (chVTGetSystemTime()*1000/CH_CFG_ST_FREQUENCY)%1000); \
|
||||
} \
|
||||
chprintf((BaseSequentialStream*)&SDU1, "[%s]", type); \
|
||||
if(TRACE_FILE) { \
|
||||
chprintf((BaseSequentialStream*)&SDU1, "[%12s %04d]", __FILENAME__, __LINE__); \
|
||||
} \
|
||||
chprintf((BaseSequentialStream*)&SDU1, " "); \
|
||||
chprintf((BaseSequentialStream*)&SDU1, (format), ##args); \
|
||||
chprintf((BaseSequentialStream*)&SDU1, "\r\n"); \
|
||||
chThdSleep(TIME_MS2I(10)); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define TRACE_DEBUG(format, args...) if(usb_trace_level > 4) { TRACE_BASE(format, "DEBUG", ##args) }
|
||||
#define TRACE_INFO(format, args...) if(usb_trace_level > 3) { TRACE_BASE(format, " ", ##args) }
|
||||
#define TRACE_MON(format, args...) if(usb_trace_level > 2) { TRACE_BASE(format, " ", ##args) }
|
||||
#define TRACE_WARN(format, args...) if(usb_trace_level > 1) { TRACE_BASE(format, "WARN ", ##args) }
|
||||
#define TRACE_DEBUG(format, args...) if(usb_trace_level > 4) { debug_print("DEBUG", __FILENAME__, __LINE__, format, ##args); }
|
||||
#define TRACE_INFO(format, args...) if(usb_trace_level > 3) { debug_print(" ", __FILENAME__, __LINE__, format, ##args); }
|
||||
#define TRACE_MON(format, args...) if(usb_trace_level > 2) { debug_print(" ", __FILENAME__, __LINE__, format, ##args); }
|
||||
#define TRACE_WARN(format, args...) if(usb_trace_level > 1) { debug_print("WARN ", __FILENAME__, __LINE__, format, ##args); }
|
||||
#define TRACE_ERROR(format, args...) { \
|
||||
if(usb_trace_level > 0) { \
|
||||
TRACE_BASE(format, "ERROR", ##args); \
|
||||
debug_print("ERROR", __FILENAME__, __LINE__, format, ##args); \
|
||||
} \
|
||||
\
|
||||
uint8_t strcnt = chsnprintf(error_list[error_counter], ERROR_LIST_LENGTH, "[%8d.%03d] ", chVTGetSystemTime()/CH_CFG_ST_FREQUENCY, (chVTGetSystemTime()*1000/CH_CFG_ST_FREQUENCY)%1000); \
|
||||
|
|
@ -68,28 +43,6 @@ extern uint8_t usb_trace_level;
|
|||
#define TRACE_TAB " "
|
||||
#endif
|
||||
|
||||
/*
|
||||
#define TRACE_BIN(data, len) { \
|
||||
chMtxLock(&trace_mtx); \
|
||||
chprintf((BaseSequentialStream*)&SD3, "[%8d.%03d][DEBUG] ", chVTGetSystemTime()/CH_CFG_ST_FREQUENCY, (chVTGetSystemTime()*1000/CH_CFG_ST_FREQUENCY)%1000); \
|
||||
chprintf((BaseSequentialStream*)&SD3, " > Binary data (%d bits)\r\n", (len)); \
|
||||
for(uint32_t i=0; i<((len)+7)/8; i+=8) \
|
||||
chprintf((BaseSequentialStream*)&SD3, "%s 0x%03x ... 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\r\n", \
|
||||
TRACE_TAB, i, (data)[i], (data)[i+1], (data)[i+2], (data)[i+3], (data)[i+4], (data)[i+5], (data)[i+6], (data)[i+7]); \
|
||||
chMtxUnlock(&trace_mtx); \
|
||||
}
|
||||
|
||||
#define TRACE_BIN_CHAR(data, len) { \
|
||||
chMtxLock(&trace_mtx); \
|
||||
chprintf((BaseSequentialStream*)&SD3, "[%8d.%03d][DEBUG] ", chVTGetSystemTime()/CH_CFG_ST_FREQUENCY, (chVTGetSystemTime()*1000/CH_CFG_ST_FREQUENCY)%1000); \
|
||||
chprintf((BaseSequentialStream*)&SD3, " > Binary data (%d bits)\r\n", (len)); \
|
||||
for(uint32_t i=0; i<((len)+7)/8; i+=8) \
|
||||
chprintf((BaseSequentialStream*)&SD3, "%s %c%c%c%c%c%c%c%c\r\n", \
|
||||
TRACE_TAB, i, (data)[i], (data)[i+1], (data)[i+2], (data)[i+3], (data)[i+4], (data)[i+5], (data)[i+6], (data)[i+7]); \
|
||||
chMtxUnlock(&trace_mtx); \
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
#if USE_CCM_FOR_PKT_POOL == TRUE
|
||||
|
|
@ -110,5 +63,8 @@ static inline heap_header_t *pktSystemCheck(void) {
|
|||
}
|
||||
#endif
|
||||
|
||||
void debug_init(void);
|
||||
void debug_print(char *type, char* filename, uint32_t line, char* format, ...);
|
||||
|
||||
#endif /* __TRACE_H__ */
|
||||
|
||||
|
|
|
|||
|
|
@ -1053,7 +1053,7 @@ bool pktLLDradioResumeReceive(const radio_unit_t radio) {
|
|||
channel_hz_t step = handler->radio_rx_config.step_hz;
|
||||
radio_ch_t chan = handler->radio_rx_config.channel;
|
||||
radio_squelch_t rssi = handler->radio_rx_config.squelch;
|
||||
mod_t mod = handler->radio_rx_config.type;
|
||||
radio_mod_t mod = handler->radio_rx_config.type;
|
||||
bool result = Si4464_enableReceive(radio, freq, step, chan, rssi, mod);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1185,4 +1185,45 @@ uint8_t pktLLDradioReadCCA(const radio_unit_t radio) {
|
|||
return Si446x_readCCA(radio);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void pktLLDradioConfigIndicators(const radio_unit_t radio) {
|
||||
(void)radio;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void pktLLDradioDeconfigIndicators(const radio_unit_t radio) {
|
||||
(void)radio;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void pktLLDradioSetIndicator(const radio_unit_t radio,
|
||||
radio_indicator_t ind) {
|
||||
(void)radio;
|
||||
(void)ind;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void pktLLDradioClearIndicator(const radio_unit_t radio,
|
||||
radio_indicator_t ind) {
|
||||
(void)radio;
|
||||
(void)ind;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void pktLLDradioToggleIndicator(const radio_unit_t radio,
|
||||
radio_indicator_t ind) {
|
||||
(void)radio;
|
||||
(void)ind;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -38,6 +38,13 @@
|
|||
/* Module data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
typedef enum radioIndicators {
|
||||
PKT_INDICATOR_DECODE,
|
||||
PKT_INDICATOR_SQUELCH,
|
||||
PKT_INDICATOR_FIFO,
|
||||
PKT_INDICATOR_OVERFLOW
|
||||
} radio_indicator_t;
|
||||
|
||||
#include "pkttypes.h"
|
||||
|
||||
/**
|
||||
|
|
@ -61,27 +68,27 @@ typedef enum radioCommand {
|
|||
typedef struct radioTask radio_task_object_t;
|
||||
typedef struct packetHandlerData packet_svc_t;
|
||||
typedef struct radioConfig radio_config_t;
|
||||
typedef struct radioSettings radio_settings_t;
|
||||
typedef struct radioAction radio_action_t;
|
||||
//typedef struct radioSettings radio_settings_t;
|
||||
//typedef struct radioAction radio_action_t;
|
||||
|
||||
/**
|
||||
* @brief Radio task notification callback type.
|
||||
* @brief Radio task notification callback type.
|
||||
*
|
||||
* @param[in] rcob pointer to a @p radio task object
|
||||
* @param[in] task_object pointer to a @p radio task object
|
||||
*/
|
||||
typedef void (*radio_task_cb_t)(radio_task_object_t *task_object);
|
||||
|
||||
#include "ax25_pad.h"
|
||||
|
||||
struct radioSettings {
|
||||
mod_t type;
|
||||
typedef struct radioSettings {
|
||||
radio_mod_t type;
|
||||
radio_freq_t base_frequency;
|
||||
channel_hz_t step_hz;
|
||||
radio_ch_t channel;
|
||||
radio_squelch_t squelch;
|
||||
};
|
||||
} radio_settings_t;
|
||||
|
||||
struct radioAction {
|
||||
typedef struct radioAction {
|
||||
radio_command_t command;
|
||||
radio_task_cb_t callback;
|
||||
msg_t result;
|
||||
|
|
@ -89,12 +96,12 @@ struct radioAction {
|
|||
char tx_thd_name[16];
|
||||
packet_svc_t *handler;
|
||||
packet_t packet_out;
|
||||
};
|
||||
} radio_action_t;
|
||||
|
||||
struct radioTaskx {
|
||||
/*struct radioTaskx {
|
||||
radio_settings_t settings;
|
||||
radio_action_t action;
|
||||
};
|
||||
};*/
|
||||
|
||||
/**
|
||||
* @brief Radio task object.
|
||||
|
|
@ -104,7 +111,7 @@ struct radioTask {
|
|||
/* For safety keep clear - where pool stores its free link. */
|
||||
struct pool_header link;
|
||||
radio_command_t command;
|
||||
mod_t type;
|
||||
radio_mod_t type;
|
||||
radio_freq_t base_frequency;
|
||||
channel_hz_t step_hz;
|
||||
radio_ch_t channel;
|
||||
|
|
@ -120,10 +127,30 @@ struct radioTask {
|
|||
};
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/* Module macros. */
|
||||
/*===========================================================================*/
|
||||
|
||||
//extern const ICUConfig pwm_icucfg;
|
||||
/**
|
||||
* @brief Alias of pktStopDecoder for convenience.
|
||||
*
|
||||
* @param[in] radio radio unit ID
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define pktPauseDecoding(radio) pktStopDecoder(radio)
|
||||
|
||||
/**
|
||||
* @brief Alias for convenience of pktStartDecoder.
|
||||
*
|
||||
* @param[in] radio radio unit ID
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define pktResumeDecoding(radio) pktStartDecoder(radio)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -181,6 +208,14 @@ extern "C" {
|
|||
size_t size);
|
||||
const radio_config_t *pktGetRadioData(radio_unit_t radio);
|
||||
uint8_t pktLLDradioReadCCA(const radio_unit_t radio);
|
||||
void pktLLDradioConfigIndicators(const radio_unit_t radio);
|
||||
void pktLLDradioDeconfigIndicators(const radio_unit_t radio);
|
||||
void pktLLDradioSetIndicator(const radio_unit_t radio,
|
||||
radio_indicator_t ind);
|
||||
void pktLLDradioClearIndicator(const radio_unit_t radio,
|
||||
radio_indicator_t ind);
|
||||
void pktLLDradioToggleIndicator(const radio_unit_t radio,
|
||||
radio_indicator_t ind);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -189,24 +224,6 @@ extern "C" {
|
|||
/* Module inline functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Alias of pktStopDecoder for convenience.
|
||||
*
|
||||
* @param[in] radio radio unit ID
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define pktPauseDecoding(radio) pktStopDecoder(radio)
|
||||
|
||||
/**
|
||||
* @brief Alias for convenience of pktStartDecoder.
|
||||
*
|
||||
* @param[in] radio radio unit ID
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define pktResumeDecoding(radio) pktStartDecoder(radio)
|
||||
|
||||
#endif /* PKT_MANAGERS_PKTRADIO_H_ */
|
||||
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ typedef enum HDLCFrameStates {
|
|||
#include "types.h"
|
||||
|
||||
/* Link level encoding type. */
|
||||
typedef mod_t encoding_type_t;
|
||||
typedef radio_mod_t encoding_type_t;
|
||||
|
||||
#include "pktradio.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ typedef struct APRSIdentity {
|
|||
/* Radio parameters. */
|
||||
radio_freq_t freq;
|
||||
radio_pwr_t pwr;
|
||||
mod_t mod;
|
||||
radio_mod_t mod;
|
||||
radio_squelch_t cca;
|
||||
} aprs_identity_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ void start_aprs_threads(radio_unit_t radio, radio_freq_t base_freq,
|
|||
*/
|
||||
bool transmitOnRadio(packet_t pp, const radio_freq_t base_freq,
|
||||
const channel_hz_t step, radio_ch_t chan,
|
||||
const radio_pwr_t pwr, const mod_t mod,
|
||||
const radio_pwr_t pwr, const radio_mod_t mod,
|
||||
const radio_squelch_t cca) {
|
||||
/* Select a radio by frequency. */
|
||||
radio_unit_t radio = pktSelectRadioForFrequency(base_freq,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
void start_aprs_threads(radio_unit_t radio, radio_freq_t freq, channel_hz_t step,
|
||||
radio_ch_t chan, radio_squelch_t rssi);
|
||||
bool transmitOnRadio(packet_t pp, radio_freq_t freq, channel_hz_t step,
|
||||
radio_ch_t chan, radio_pwr_t pwr, mod_t mod,
|
||||
radio_ch_t chan, radio_pwr_t pwr, radio_mod_t mod,
|
||||
radio_squelch_t rssi);
|
||||
|
||||
inline const char *getModulation(uint8_t key) {
|
||||
|
|
|
|||
|
|
@ -24,21 +24,8 @@ void start_essential_threads(void)
|
|||
}
|
||||
|
||||
void start_user_threads(void) {
|
||||
conf_t *conf_flash = (conf_t*)0x08060000;
|
||||
/* Check if a user update has been made to configuration in flash. */
|
||||
if(conf_flash->magic != CONFIG_MAGIC_UPDATED) {
|
||||
if(conf_flash->magic != CONFIG_MAGIC_DEFAULT
|
||||
|| memcmp(&conf_flash, &conf_flash_default, sizeof(conf_t)) != 0) {
|
||||
/* No configuration found in flash memory or default config has changed. */
|
||||
flashSectorBegin(flashSectorAt((uint32_t)conf_flash));
|
||||
flashErase((uint32_t)conf_flash, 0x20000);
|
||||
flashWrite((uint32_t)conf_flash, (char*)&conf_flash_default, sizeof(conf_t));
|
||||
flashSectorEnd(flashSectorAt((uint32_t)conf_flash));
|
||||
}
|
||||
}
|
||||
|
||||
// Copy
|
||||
memcpy(&conf_sram, conf_flash, sizeof(conf_t));
|
||||
memcpy(&conf_sram, &conf_flash_default, sizeof(conf_t));
|
||||
|
||||
/* TODO: Implement scheduler that will run threads based on schedule. */
|
||||
if(conf_sram.pos_pri.beacon.active)
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue