Implement burst mode packet send for 9600. Improved error messages.

pull/4/head
CInsights 2018-04-06 19:54:08 +10:00
rodzic 7fddb09931
commit c481db3af0
21 zmienionych plików z 304 dodań i 228 usunięć

Wyświetl plik

@ -34,7 +34,8 @@ const conf_t conf_flash_default = {
.pos_sec = {
.thread_conf = {
.active = false,
.cycle = TIME_S2I(120)
.cycle = TIME_S2I(120),
.init_delay = TIME_S2I(60)
},
.radio_conf = {
.pwr = 0x7F,
@ -57,7 +58,7 @@ const conf_t conf_flash_default = {
.active = false,
.cycle = TIME_S2I(600),
.init_delay = TIME_S2I(20),
.packet_spacing = TIME_S2I(1)
.send_spacing = TIME_S2I(5)
},
.radio_conf = {
.pwr = 0x7F,
@ -79,17 +80,19 @@ const conf_t conf_flash_default = {
.img_sec = {
.thread_conf = {
.active = false,
.cycle = CYCLE_CONTINUOUSLY
.cycle = TIME_S2I(600),
.init_delay = TIME_S2I(20),
.send_spacing = TIME_MS2I(100)
},
.radio_conf = {
.pwr = 0x7F,
.freq = FREQ_APRS_DYNAMIC,
.freq = 145175000,
.mod = MOD_AFSK,
.rssi = 0x4F,
},
.call = "DL7AD-14",
.path = "",
.call = "VK2GJ-15",
.path = "DB0BLO",
.res = RES_VGA,
.quality = 4,

Wyświetl plik

@ -723,7 +723,7 @@ uint32_t OV5640_Snapshot2RAM(uint8_t* buffer, uint32_t size, resolution_t res)
}
}
// Capture image until we get a good image (max cntr tries)
// Capture image until we get a good image or reach max retries.
TRACE_INFO("CAM > Capture image");
do {
@ -1168,7 +1168,7 @@ void OV5640_InitGPIO(void)
palSetLineMode(LINE_CAM_D7, PAL_MODE_INPUT | PAL_STM32_OSPEED_HIGHEST);
palSetLineMode(LINE_CAM_D8, PAL_MODE_INPUT | PAL_STM32_OSPEED_HIGHEST);
palSetLineMode(LINE_CAM_D9, PAL_MODE_INPUT | PAL_STM32_OSPEED_HIGHEST);
palSetPadMode(GPIOA, 8, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
//palSetPadMode(GPIOA, 8, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
palSetLineMode(LINE_CAM_EN, PAL_MODE_OUTPUT_PUSHPULL);
palSetLineMode(LINE_CAM_RESET, PAL_MODE_OUTPUT_PUSHPULL);

Wyświetl plik

@ -177,7 +177,7 @@ uint16_t gps_receive_payload(uint8_t class_id, uint8_t msg_id, unsigned char *pa
*
* This method divides MAX7/8 and MAX6 modules since the protocol changed at MAX7 series. MAX6 requires
* NAV-POSLLH NAV-TIMEUTC and NAV-SOL to get all information about the GPS. With implementation of the
* NAV-PVT message at the MAX7 series, all information can be aquired by only one message. Although
* NAV-PVT message at the MAX7 series, all information can be acquired by only one message. Although
* MAX7 is backward compatible, MAX7/8 will use NAV-PVT rather than the old protocol.
*
* argument is call by reference to avoid large stack allocations
@ -204,7 +204,7 @@ bool gps_get_fix(gpsFix_t *fix) {
return false;
}
/* Temporary hack to enable fixed GPS location to be specified. */
/* FIXME: Temporary hack to enable fixed GPS location to be specified. */
extern bool test_gps_enabled;
/* Fake GPS test. */
if(test_gps_enabled) {

Wyświetl plik

@ -48,7 +48,7 @@ void manageShell(void) {
}
chEvtWaitAnyTimeout(EVENT_MASK(USB_SHELL_EVT), TIME_S2I(1));
if(chThdTerminatedX(shelltp)) {
chThdRelease(shelltp);
chThdWait(shelltp);
shelltp = NULL;
chEvtUnregister(&shell_terminated, &shell_el);
}

Wyświetl plik

@ -6,7 +6,7 @@
#include "threads.h"
#include "padc.h"
//#define intoCCM __attribute__((section(".ram3"))) __attribute__((aligned(4)))
//#define intoCCM __attribute__((section(".ram4"))) __attribute__((aligned(4)))
/**
* Main routine is starting up system, runs the software watchdog (module monitoring), controls LEDs

Wyświetl plik

@ -885,8 +885,8 @@ THD_FUNCTION(pktAFSKDecoder, arg) {
/* This case is set when an error status. */
case DECODER_ERROR: {
pktAddEventFlags(myHandler, EVT_DECODER_ERROR);
myDriver->active_demod_object->status |= EVT_DECODER_ERROR;
//pktAddEventFlags(myHandler, EVT_DECODER_ERROR);
//myDriver->active_demod_object->status |= EVT_DECODER_ERROR;
myDriver->decoder_state = DECODER_SUSPEND;
break;
} /* End case DECODER_ERROR. */

Wyświetl plik

@ -818,8 +818,6 @@ static void Si446x_transmitTimeoutI(thread_t *tp) {
THD_FUNCTION(bloc_si_fifo_feeder_afsk, arg) {
radio_task_object_t *rto = arg;
packet_t pp = rto->packet_out;
radio_unit_t radio = rto->handler->radio;
pktAcquireRadio(radio, TIME_INFINITE);
@ -841,7 +839,7 @@ THD_FUNCTION(bloc_si_fifo_feeder_afsk, arg) {
chVTObjectInit(&send_timer);
msg_t exit_msg = MSG_OK;
tx_iterator_t iterator;
packet_t np = NULL;
packet_t pp = rto->packet_out;
do {
/*
@ -973,22 +971,22 @@ THD_FUNCTION(bloc_si_fifo_feeder_afsk, arg) {
/* Warn when level drops below 50% of FIFO size. */
TRACE_WARN("SI > AFSK TX FIFO dropped below safe threshold %i", lower);
}
packet_t np = pp->nextp;
if(exit_msg == MSG_OK) {
/* Next packet in queue. */
np = pp->nextp;
/* Send was OK. Release the just completed packet. */
pktReleaseSendObject(pp);
} else {
/* Send failed so release any queue and terminate. */
pktReleaseSendQueue(pp);
np = NULL;
}
if(exit_msg == MSG_OK) {
/* Send was OK. Release the just completed packet. */
pktReleaseSendObject(pp);
} else {
/* Send failed so release queue and terminate. */
pktReleaseSendQueue(pp);
np = NULL;
}
} while(np != NULL);
/* Get the next packet in the send queue. */
pp = np;
} while(pp != NULL);
chThdSleep(TIME_MS2I(100));
/* Schedule thread memory release. */
pktSignalSendComplete(rto, chThdGetSelfX());
@ -1004,12 +1002,12 @@ bool Si446x_blocSendAFSK(radio_task_object_t *rt) {
thread_t *afsk_feeder_thd = NULL;
/* Create a send thread name which includes the sequence number. */
chsnprintf(rt->packet_out->tx_thd_name, sizeof(rt->packet_out->tx_thd_name),
"446x_afsk_tx_%03i", rt->packet_out->tx_seq);
chsnprintf(rt->tx_thd_name, sizeof(rt->tx_thd_name),
"446x_afsk_tx_%03i", rt->tx_seq_num);
afsk_feeder_thd = chThdCreateFromHeap(NULL,
THD_WORKING_AREA_SIZE(SI_AFSK_FIFO_MIN_FEEDER_WA_SIZE),
rt->packet_out->tx_thd_name,
rt->tx_thd_name,
NORMALPRIO - 10,
bloc_si_fifo_feeder_afsk,
rt);
@ -1037,8 +1035,6 @@ void Si446x_stopDecoder(void) {
THD_FUNCTION(bloc_si_fifo_feeder_fsk, arg) {
radio_task_object_t *rto = arg;
packet_t pp = rto->packet_out;
radio_unit_t radio = rto->handler->radio;
/* TODO: Check result for MSG_RESET. */
@ -1064,7 +1060,8 @@ THD_FUNCTION(bloc_si_fifo_feeder_fsk, arg) {
chVTObjectInit(&send_timer);
tx_iterator_t iterator;
packet_t np = NULL;
packet_t pp = rto->packet_out;
/* The exit message. */
msg_t exit_msg;
do {
@ -1181,9 +1178,7 @@ THD_FUNCTION(bloc_si_fifo_feeder_fsk, arg) {
/* Warn when level drops below 50% of FIFO size. */
TRACE_WARN("SI > AFSK TX FIFO dropped below safe threshold %i", lower);
}
/* Get the next packet in the send queue. */
np = pp->nextp;
packet_t np = pp->nextp;
if(exit_msg == MSG_OK) {
/* Send was OK. Release the just completed packet. */
@ -1193,8 +1188,12 @@ THD_FUNCTION(bloc_si_fifo_feeder_fsk, arg) {
pktReleaseSendQueue(pp);
np = NULL;
}
} while(np != NULL);
/* Get the next packet in the send queue. */
pp = np;
} while(pp != NULL);
chThdSleep(TIME_MS2I(100));
/* Finished send so schedule thread memory and task object release. */
pktSignalSendComplete(rto, chThdGetSelfX());
@ -1213,12 +1212,12 @@ bool Si446x_blocSend2FSK(radio_task_object_t *rt) {
/* TODO: Don't need to put the thread name in the packet. Just use local var. */
/* Create a send thread name which includes the sequence number. */
chsnprintf(rt->packet_out->tx_thd_name, sizeof(rt->packet_out->tx_thd_name),
"446x_2fsk_tx_%03i", rt->packet_out->tx_seq);
chsnprintf(rt->tx_thd_name, sizeof(rt->tx_thd_name),
"446x_2fsk_tx_%03i", rt->tx_seq_num);
fsk_feeder_thd = chThdCreateFromHeap(NULL,
THD_WORKING_AREA_SIZE(SI_FSK_FIFO_FEEDER_WA_SIZE),
rt->packet_out->tx_thd_name,
rt->tx_thd_name,
NORMALPRIO - 10,
bloc_si_fifo_feeder_fsk,
rt);

Wyświetl plik

@ -46,9 +46,9 @@ eventmask_t evt = chEvtGetAndClearEvents(EVENT_MASK(1));
if(flags & EVT_AX25_BUFFER_FULL) {
TRACE_WARN("PKT > AX25 receive buffer full");
}
if(flags & EVT_DECODER_ERROR) {
/* if(flags & EVT_DECODER_ERROR) {
TRACE_ERROR("PKT > Decoder error");
}
}*/
if(flags & EVT_PWM_UNKNOWN_INBAND) {
TRACE_ERROR("PKT > Unknown PWM in-band flag");
}

Wyświetl plik

@ -42,6 +42,7 @@ THD_FUNCTION(pktRadioManager, arg) {
#define PKT_RADIO_TASK_MANAGER_TX_RATE_MS 100
/* Continue at TX rate for this number of cycles. */
/* TODO: Deprecate this gear shift stuff. */
#define PKT_RADIO_TASK_MANAGER_TX_HYSTERESIS 10
packet_svc_t *handler = arg;
@ -51,6 +52,7 @@ THD_FUNCTION(pktRadioManager, arg) {
chDbgCheck(arg != NULL);
sysinterval_t poll_rate = PKT_RADIO_TASK_MANAGER_IDLE_RATE_MS;
/* TODO: Deprecate this gear shift stuff. */
uint8_t poll_hysteresis = 0;
objects_fifo_t *radio_queue = chFactoryGetObjectsFIFO(the_radio_fifo);
@ -65,6 +67,7 @@ THD_FUNCTION(pktRadioManager, arg) {
(void *)&task_object,
TIME_MS2I(poll_rate));
if(fifo_msg == MSG_TIMEOUT) {
/* TODO: Deprecate this gear shift stuff. */
if(poll_hysteresis == 0)
poll_rate = PKT_RADIO_TASK_MANAGER_IDLE_RATE_MS;
else
@ -174,17 +177,8 @@ THD_FUNCTION(pktRadioManager, arg) {
* Is it necessary since the RX is not outputting data during TX?
*/
/* TODO: Move all setting of pp params to radio.c */
packet_t pp = task_object->packet_out;
/* pp->base_frequency = task_object->base_frequency;
pp->radio_step = task_object->step_hz;
pp->radio_chan = task_object->channel;
pp->radio_pwr = task_object->tx_power;
pp->cca_rssi = task_object->squelch;*/
/* Give each send a sequence number. */
/* TODO: Put in task object instead? */
pp->tx_seq = ++handler->radio_tx_config.seq_num;
++handler->radio_tx_config.tx_seq_num;
if(pktLLDsendPacket(task_object)) {
/* TODO: Deprecate this gear shift stuff. */
@ -193,10 +187,13 @@ THD_FUNCTION(pktRadioManager, arg) {
poll_rate = PKT_RADIO_TASK_MANAGER_TX_RATE_MS;
/* Send Successfully enqueued.
* Unlike receive the task object is held by the TX until complete.
* It is then released in the TX thread release task. */
* This is non blocking as radio transmit runs in a thread.
* The radio task object is released in the TX thread release task.
*/
continue;
}
/* Send failed so release send packet object(s). */
packet_t pp = task_object->packet_out;
pktReleaseSendQueue(pp);
break;
} /* End case PKT_RADIO_TX. */

Wyświetl plik

@ -69,7 +69,6 @@ typedef void (*radio_task_cb_t)(radio_task_object_t *task_object);
struct radioTask {
/* For safety keep clear - where pool stores its free link. */
struct pool_header link;
//radio_unit_t radio_id;
radio_command_t command;
mod_t type;
radio_freq_t base_frequency;
@ -77,12 +76,14 @@ struct radioTask {
radio_ch_t channel;
radio_squelch_t squelch;
radio_task_cb_t callback;
msg_t result;
thread_t *thread;
char tx_thd_name[16];
packet_svc_t *handler;
packet_t packet_out;
uint8_t tx_power;
uint32_t tx_speed;
uint8_t seq_num;
uint8_t tx_seq_num;
};
/*===========================================================================*/

Wyświetl plik

@ -90,7 +90,7 @@ bool pktServiceCreate(radio_unit_t radio) {
* If it does exist the ref count is increased.
* If we can't create it get false else true.
*/
if(pktOutgoingBufferSemaphoreCreate(radio) == NULL)
if(pktCommonBufferSemaphoreCreate(radio) == NULL)
return false;
#endif
/* Send request to create radio manager. */
@ -264,7 +264,7 @@ msg_t pktOpenRadioReceive(radio_unit_t radio,
/*
* Open (init) the radio (via submit radio task).
*/
msg_t msg = pktSendRadioCommand(radio, &rt);
msg_t msg = pktSendRadioCommand(radio, &rt, NULL);
if(msg != MSG_OK)
return msg;
@ -314,7 +314,7 @@ msg_t pktStartDataReception(radio_unit_t radio,
rt.command = PKT_RADIO_RX_START;
msg_t msg = pktSendRadioCommand(radio, &rt);
msg_t msg = pktSendRadioCommand(radio, &rt, NULL);
if(msg != MSG_OK)
return MSG_TIMEOUT;
@ -408,7 +408,7 @@ msg_t pktStopDataReception(radio_unit_t radio) {
rt.command = PKT_RADIO_RX_STOP;
msg_t msg = pktSendRadioCommand(radio, &rt);
msg_t msg = pktSendRadioCommand(radio, &rt, NULL);
if(msg != MSG_OK)
return msg;
@ -501,7 +501,7 @@ msg_t pktCloseRadioReceive(radio_unit_t radio) {
rt.command = PKT_RADIO_RX_CLOSE;
/* Submit command. A timeout can occur waiting for a command queue object. */
msg_t msg = pktSendRadioCommand(radio, &rt);
msg_t msg = pktSendRadioCommand(radio, &rt, NULL);
if(msg != MSG_OK)
return msg;
@ -825,7 +825,7 @@ dyn_objects_fifo_t *pktIncomingBufferPoolCreate(radio_unit_t radio) {
/*
* Send shares a common pool of buffers.
*/
dyn_objects_fifo_t *pktOutgoingBufferPoolCreate(radio_unit_t radio) {
dyn_objects_fifo_t *pktCommonBufferPoolCreate(radio_unit_t radio) {
packet_svc_t *handler = pktGetServiceObject(radio);
@ -842,7 +842,7 @@ dyn_objects_fifo_t *pktOutgoingBufferPoolCreate(radio_unit_t radio) {
/* Create the dynamic objects FIFO for the packet data queue. */
dyn_fifo = chFactoryCreateObjectsFIFO(PKT_SEND_BUFFER_NAME,
sizeof(packet_tx_t),
NUMBER_TX_PKT_BUFFERS, sizeof(msg_t));
NUMBER_COMMON_PKT_BUFFERS, sizeof(msg_t));
chDbgAssert(dyn_fifo != NULL, "failed to create send PKT objects FIFO");
}
@ -854,7 +854,7 @@ dyn_objects_fifo_t *pktOutgoingBufferPoolCreate(radio_unit_t radio) {
/*
* Send shares a common pool of buffers.
*/
void pktOutgoingBufferPoolRelease(radio_unit_t radio) {
void pktCommonBufferPoolRelease(radio_unit_t radio) {
packet_svc_t *handler = pktGetServiceObject(radio);
@ -868,7 +868,7 @@ void pktOutgoingBufferPoolRelease(radio_unit_t radio) {
/*
* Send shares a common pool of buffers.
*/
dyn_semaphore_t *pktOutgoingBufferSemaphoreCreate(radio_unit_t radio) {
dyn_semaphore_t *pktCommonBufferSemaphoreCreate(radio_unit_t radio) {
packet_svc_t *handler = pktGetServiceObject(radio);
@ -884,7 +884,7 @@ dyn_semaphore_t *pktOutgoingBufferSemaphoreCreate(radio_unit_t radio) {
if(dyn_sem == NULL) {
/* Create the dynamic objects FIFO for the packet data queue. */
dyn_sem = chFactoryCreateSemaphore(PKT_SEND_BUFFER_SEM_NAME,
NUMBER_TX_PKT_BUFFERS);
NUMBER_COMMON_PKT_BUFFERS);
chDbgAssert(dyn_sem != NULL, "failed to create send PKT semaphore");
} else {

Wyświetl plik

@ -16,7 +16,7 @@
/* Main thread events. */
#define PKT_RX_BUFFER_SIZE PKT_MAX_RX_PACKET_LEN
#define PKT_RX_BUFFER_SIZE PKT_MAX_RX_PACKET_LEN
#define PKT_FRAME_QUEUE_PREFIX "pktr_"
#define PKT_CALLBACK_TERMINATOR_PREFIX "cbtr_"
@ -25,8 +25,8 @@
#define PKT_SEND_BUFFER_SEM_NAME "pstx"
#define PKT_CALLBACK_WA_SIZE 8192
#define PKT_TERMINATOR_WA_SIZE 1024
#define PKT_CALLBACK_WA_SIZE 8192
#define PKT_TERMINATOR_WA_SIZE 1024
/*===========================================================================*/
/* Module data structures and types. */
@ -233,9 +233,9 @@ extern "C" {
thread_t *pktCallbackManagerCreate(radio_unit_t radio);
void pktCallbackManagerRelease(packet_svc_t *handler);
void pktIncomingBufferPoolRelease(packet_svc_t *handler);
dyn_objects_fifo_t *pktOutgoingBufferPoolCreate(radio_unit_t radio);
void pktOutgoingBufferPoolRelease(radio_unit_t radio);
dyn_semaphore_t *pktOutgoingBufferSemaphoreCreate(radio_unit_t radio);
dyn_objects_fifo_t *pktCommonBufferPoolCreate(radio_unit_t radio);
void pktCommonBufferPoolRelease(radio_unit_t radio);
dyn_semaphore_t *pktCommonBufferSemaphoreCreate(radio_unit_t radio);
void pktBufferSemaphoreRelease(radio_unit_t radio);
msg_t pktGetPacketBuffer(packet_t *pp, sysinterval_t timeout);
void pktReleasePacketBuffer(packet_t pp);

Wyświetl plik

@ -60,7 +60,7 @@
#define EVT_AX25_FRAME_RDY EVENT_MASK(EVT_PRIORITY_BASE + 0)
#define EVT_RADIO_CCA_GLITCH EVENT_MASK(EVT_PRIORITY_BASE + 1)
#define EVT_RADIO_CCA_CLOSE EVENT_MASK(EVT_PRIORITY_BASE + 2)
#define EVT_DECODER_ERROR EVENT_MASK(EVT_PRIORITY_BASE + 3)
//#define EVT_DECODER_ERROR EVENT_MASK(EVT_PRIORITY_BASE + 3)
#define EVT_AFSK_TERMINATED EVENT_MASK(EVT_PRIORITY_BASE + 4)
#define EVT_PWM_UNKNOWN_INBAND EVENT_MASK(EVT_PRIORITY_BASE + 5)
@ -347,20 +347,22 @@ static inline void pktWritePWMMirror(uint8_t state) {
* @brief Sends a command request to a radio.
* @post The command object posted to the radio manager queue.
*
* @param[in] radio radio unit ID.
* @param[in] task pointer to a task object.
* @param[in] radio radio unit ID.
* @param[in] task pointer to a task object.
* @param[in] cb function to call with result (can be NULL).
*
* @api
*/
static inline msg_t pktSendRadioCommand(radio_unit_t radio,
radio_task_object_t *task) {
radio_task_object_t *task,
radio_task_cb_t cb) {
#if USE_SPI_ATTACHED_RADIO == TRUE
radio_task_object_t *rt = NULL;
msg_t msg = pktGetRadioTaskObject(radio, TIME_MS2I(3000), &rt);
if(msg != MSG_OK)
return MSG_TIMEOUT;
*rt = *task;
pktSubmitRadioTask(radio, rt, NULL);
pktSubmitRadioTask(radio, rt, cb);
return msg;
#else
(void)task;

Wyświetl plik

@ -238,7 +238,7 @@ packet_t ax25_new (void) {
#if DEBUG
TRACE_DEBUG("ax25_new(): before alloc, new=%d, delete=%d", new_count, delete_count);
TRACE_DEBUG("PKT > ax25_new(): before alloc, new=%d, delete=%d", new_count, delete_count);
#endif
last_seq_num++;
@ -278,7 +278,7 @@ packet_t ax25_new (void) {
#endif
if (this_p == NULL) {
TRACE_ERROR ("ERROR - can't allocate memory in ax25_new.");
TRACE_ERROR ("PKT > ERROR - can't allocate memory in ax25_new.");
return NULL;
}
@ -308,11 +308,11 @@ void ax25_delete (packet_t this_p)
#endif
{
#if DEBUG
TRACE_DEBUG ("ax25_delete(): before free, new=%d, delete=%d", new_count, delete_count);
TRACE_DEBUG ("PKT > ax25_delete(): before free, new=%d, delete=%d", new_count, delete_count);
#endif
if (this_p == NULL) {
TRACE_ERROR ("ERROR - NULL pointer passed to ax25_delete.");
TRACE_ERROR ("PKT > ERROR - NULL pointer passed to ax25_delete.");
return;
}
@ -321,12 +321,12 @@ void ax25_delete (packet_t this_p)
#if AX25MEMDEBUG
if (ax25memdebug) {
TRACE_DEBUG ("ax25_delete, seq=%d, called from %s %d, new_count=%d, delete_count=%d", this_p->seq, src_file, src_line, new_count, delete_count);
TRACE_DEBUG ("PKT > ax25_delete, seq=%d, called from %s %d, new_count=%d, delete_count=%d", this_p->seq, src_file, src_line, new_count, delete_count);
}
#endif
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
@ -408,7 +408,7 @@ packet_t ax25_from_text (char *monitor, int strict)
#if AX25MEMDEBUG
if (ax25memdebug) {
TRACE_DEBUG ("ax25_from_text, seq=%d, called from %s %d", this_p->seq, src_file, src_line);
TRACE_DEBUG ("PKT > ax25_from_text, seq=%d, called from %s %d", this_p->seq, src_file, src_line);
}
#endif
@ -438,7 +438,7 @@ packet_t ax25_from_text (char *monitor, int strict)
this_p->num_addr = (-1);
if(ax25_get_num_addr(this_p) != 2) {
TRACE_ERROR("Error of unknown reason");
TRACE_ERROR("PKT > Error of unknown reason");
return NULL;
}
@ -450,6 +450,7 @@ packet_t ax25_from_text (char *monitor, int strict)
if (pinfo == NULL) {
#if USE_NEW_PKT_TX_ALLOC == TRUE
/* Only needs a single packet released here (although linked release would be safe too. */
pktReleasePacketBuffer(this_p);
#else
ax25_delete (this_p);
@ -471,7 +472,8 @@ packet_t ax25_from_text (char *monitor, int strict)
*/
pa = strtok_r (stuff, ">", &saveptr);
if (pa == NULL) {
TRACE_ERROR ("Failed to create packet from text. No source address");
TRACE_ERROR("PKT > No source address in packet");
//TRACE_ERROR ("Failed to create packet from text. No source address");
#if USE_NEW_PKT_TX_ALLOC == TRUE
pktReleasePacketBuffer(this_p);
#else
@ -481,8 +483,10 @@ packet_t ax25_from_text (char *monitor, int strict)
}
if ( ! ax25_parse_addr (AX25_SOURCE, pa, strict, atemp, &ssid_temp, &heard_temp)) {
TRACE_ERROR ("Failed to create packet from text. Bad source address");
TRACE_ERROR("PKT > Bad source address in packet");
//TRACE_ERROR ("Failed to create packet from text. Bad source address");
#if USE_NEW_PKT_TX_ALLOC == TRUE
/* Only need single packet release here. */
pktReleasePacketBuffer(this_p);
#else
ax25_delete (this_p);
@ -500,8 +504,10 @@ packet_t ax25_from_text (char *monitor, int strict)
pa = strtok_r (NULL, ",", &saveptr);
if (pa == NULL) {
TRACE_ERROR ("Failed to create packet from text. No destination address");
TRACE_ERROR("PKT > No destination address in packet");
//TRACE_ERROR ("Failed to create packet from text. No destination address");
#if USE_NEW_PKT_TX_ALLOC == TRUE
/* Only need single packet release here. */
pktReleasePacketBuffer(this_p);
#else
ax25_delete (this_p);
@ -510,8 +516,10 @@ packet_t ax25_from_text (char *monitor, int strict)
}
if ( ! ax25_parse_addr (AX25_DESTINATION, pa, strict, atemp, &ssid_temp, &heard_temp)) {
TRACE_ERROR ("Failed to create packet from text. Bad destination address");
TRACE_ERROR("PKT > Bad destination address in packet");
//TRACE_ERROR ("Failed to create packet from text. Bad destination address");
#if USE_NEW_PKT_TX_ALLOC == TRUE
/* Only need single packet release here. */
pktReleasePacketBuffer(this_p);
#else
ax25_delete (this_p);
@ -533,8 +541,10 @@ packet_t ax25_from_text (char *monitor, int strict)
k = this_p->num_addr;
if ( ! ax25_parse_addr (k, pa, strict, atemp, &ssid_temp, &heard_temp)) {
TRACE_ERROR ("Failed to create packet from text. Bad digipeater address");
TRACE_ERROR("PKT > Bad digipeater address in packet");
//TRACE_ERROR ("Failed to create packet from text. Bad digipeater address");
#if USE_NEW_PKT_TX_ALLOC == TRUE
/* Only need single packet release here. */
pktReleasePacketBuffer(this_p);
#else
ax25_delete (this_p);
@ -568,7 +578,7 @@ packet_t ax25_from_text (char *monitor, int strict)
//#define DEBUG14H 1
#if DEBUG14H
TRACE_DEBUG ("BEFORE: %s\nSAFE: ", pinfo);
TRACE_DEBUG ("PKT > BEFORE: %s\nSAFE: ", pinfo);
ax25_safe_print (pinfo, -1, 0);
#endif
@ -598,13 +608,14 @@ packet_t ax25_from_text (char *monitor, int strict)
info_part[info_len] = '\0';
#if DEBUG14H
TRACE_DEBUG ("AFTER: %s\nSAFE: ", info_part);
TRACE_DEBUG ("PKT > AFTER: %s\nSAFE: ", info_part);
ax25_safe_print (info_part, info_len, 0);
#endif
/*
* Append the info part.
*/
/* FIXME: Check for buffer overflow here. */
memcpy ((char*)(this_p->frame_data+this_p->frame_len), info_part, info_len);
this_p->frame_len += info_len;
@ -661,7 +672,7 @@ packet_t ax25_from_frame (unsigned char *fbuf, int flen)
if (flen < AX25_MIN_PACKET_LEN || flen > AX25_MAX_PACKET_LEN)
{
TRACE_ERROR ("Frame length %d not in allowable range of %d to %d.", flen, AX25_MIN_PACKET_LEN, AX25_MAX_PACKET_LEN);
TRACE_ERROR ("PKT > Frame length %d not in allowable range of %d to %d.", flen, AX25_MIN_PACKET_LEN, AX25_MAX_PACKET_LEN);
return (NULL);
}
@ -678,7 +689,7 @@ packet_t ax25_from_frame (unsigned char *fbuf, int flen)
#if AX25MEMDEBUG
if (ax25memdebug) {
TRACE_DEBUG ("ax25_from_frame, seq=%d, called from %s %d", this_p->seq, src_file, src_line);
TRACE_DEBUG ("PKT > ax25_from_frame, seq=%d, called from %s %d", this_p->seq, src_file, src_line);
}
#endif
@ -739,7 +750,7 @@ packet_t ax25_dup (packet_t copy_from)
#if AX25MEMDEBUG
if (ax25memdebug) {
TRACE_DEBUG ("ax25_dup, seq=%d, called from %s %d, clone of seq %d", this_p->seq, src_file, src_line, copy_from->seq);
TRACE_DEBUG ("PKT > ax25_dup, seq=%d, called from %s %d, clone of seq %d", this_p->seq, src_file, src_line, copy_from->seq);
}
#endif
@ -798,8 +809,8 @@ int ax25_parse_addr (int position, char *in_addr, int strict, char *out_addr, in
if (strict && strlen(in_addr) >= 2 && strncmp(in_addr, "qA", 2) == 0) {
TRACE_ERROR ("%sAddress \"%s\" is a \"q-construct\" used for communicating", position_name[position], in_addr);
TRACE_ERROR ("with APRS Internet Servers. It was not expected here.");
TRACE_ERROR ("PKT > %sAddress \"%s\" is a \"q-construct\" used for communicating", position_name[position], in_addr);
TRACE_ERROR ("PKT > with APRS Internet Servers. It was not expected here.");
}
//printf ("ax25_parse_addr in: %s\n", in_addr);
@ -813,13 +824,13 @@ int ax25_parse_addr (int position, char *in_addr, int strict, char *out_addr, in
i = 0;
for (p = in_addr; isalnum(*p); p++) {
if (i >= maxlen) {
TRACE_ERROR ("%sAddress is too long. \"%s\" has more than %d characters.", position_name[position], in_addr, maxlen);
TRACE_ERROR ("PKT > %sAddress is too long. \"%s\" has more than %d characters.", position_name[position], in_addr, maxlen);
return 0;
}
out_addr[i++] = *p;
out_addr[i] = '\0';
if (strict && islower(*p)) {
TRACE_ERROR ("%sAddress has lower case letters. \"%s\" must be all upper case.", position_name[position], in_addr);
TRACE_ERROR ("PKT > %sAddress has lower case letters. \"%s\" must be all upper case.", position_name[position], in_addr);
return 0;
}
}
@ -829,19 +840,19 @@ int ax25_parse_addr (int position, char *in_addr, int strict, char *out_addr, in
if (*p == '-') {
for (p++; isalnum(*p); p++) {
if (j >= 2) {
TRACE_ERROR ("%sSSID is too long. SSID part of \"%s\" has more than 2 characters.", position_name[position], in_addr);
TRACE_ERROR ("PKT > %sSSID is too long. SSID part of \"%s\" has more than 2 characters.", position_name[position], in_addr);
return 0;
}
sstr[j++] = *p;
sstr[j] = '\0';
if (strict && ! isdigit(*p)) {
TRACE_ERROR ("%sSSID must be digits. \"%s\" has letters in SSID.", position_name[position], in_addr);
TRACE_ERROR ("PKT > %sSSID must be digits. \"%s\" has letters in SSID.", position_name[position], in_addr);
return 0;
}
}
k = atoi(sstr);
if (k < 0 || k > 15) {
TRACE_ERROR ("%sSSID out of range. SSID of \"%s\" not in range of 0 to 15.", position_name[position], in_addr);
TRACE_ERROR ("PKT > %sSSID out of range. SSID of \"%s\" not in range of 0 to 15.", position_name[position], in_addr);
return 0;
}
*out_ssid = k;
@ -853,7 +864,7 @@ int ax25_parse_addr (int position, char *in_addr, int strict, char *out_addr, in
}
if (*p != '\0') {
TRACE_ERROR ("Invalid character \"%c\" found in %saddress \"%s\".", *p, position_name[position], in_addr);
TRACE_ERROR ("PKT > Invalid character \"%c\" found in %saddress \"%s\".", *p, position_name[position], in_addr);
return 0;
}
@ -919,7 +930,7 @@ int ax25_check_addresses (packet_t pp)
}
if (! all_ok) {
TRACE_ERROR ("*** The origin and journey of this packet should receive some scrutiny. ***");
TRACE_ERROR ("PKT > *** The origin and journey of this packet should receive some scrutiny. ***");
}
return (all_ok);
@ -947,7 +958,8 @@ packet_t ax25_unwrap_third_party (packet_t from_pp)
packet_t result_pp;
if (ax25_get_dti(from_pp) != '}') {
TRACE_ERROR ("Internal error: ax25_unwrap_third_party: wrong data type.");
TRACE_ERROR("PKT > Internal error: ax25_unwrap_third_party: wrong data type.");
//TRACE_ERROR ("Internal error: ax25_unwrap_third_party: wrong data type.");
return (NULL);
}
@ -957,7 +969,7 @@ packet_t ax25_unwrap_third_party (packet_t from_pp)
// Want strict because addresses should conform to AX.25 here.
// That's not the case for something from an Internet Server.
result_pp = ax25_from_text((char *)info_p + 1, 1);
result_pp = ax25_from_text((char *)info_p + 1, true);
return (result_pp);
}
@ -993,11 +1005,13 @@ void ax25_set_addr (packet_t this_p, int n, char *ad)
int i;
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow.");
//TRACE_ERROR("Buffer overflow");
return;
}
if(n < 0 || n >= AX25_MAX_ADDRS) {
TRACE_ERROR("Address overflow/underflow");
TRACE_ERROR("PKT > Address overflow/underflow.");
//TRACE_ERROR("Address overflow/underflow");
return;
}
@ -1030,7 +1044,8 @@ void ax25_set_addr (packet_t this_p, int n, char *ad)
ax25_insert_addr (this_p, n, ad);
}
else {
TRACE_ERROR ("Internal error, ax25_set_addr, bad position %d for '%s'", n, ad);
TRACE_ERROR("PKT > Internal error, ax25_set_addr, bad position %d for '%s'", n, ad);
//TRACE_ERROR ("Internal error, ax25_set_addr, bad position %d for '%s'", n, ad);
}
}
@ -1071,11 +1086,11 @@ void ax25_insert_addr (packet_t this_p, int n, char *ad)
int expect;
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
if(n < AX25_REPEATER_1 || n >= AX25_MAX_ADDRS) {
TRACE_ERROR("Address overflow");
TRACE_ERROR("PKT > Address overflow");
return;
}
@ -1114,7 +1129,7 @@ void ax25_insert_addr (packet_t this_p, int n, char *ad)
expect = this_p->num_addr;
this_p->num_addr = (-1);
if (expect != ax25_get_num_addr (this_p)) {
TRACE_ERROR ("Internal error ax25_remove_addr expect %d, actual %d", expect, this_p->num_addr);
TRACE_ERROR ("PKT > Internal error ax25_remove_addr expect %d, actual %d", expect, this_p->num_addr);
}
}
@ -1143,11 +1158,11 @@ void ax25_remove_addr (packet_t this_p, int n)
int expect;
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
if(n < AX25_REPEATER_1 || n >= AX25_MAX_ADDRS) {
TRACE_ERROR("Address overflow");
TRACE_ERROR("PKT > Address overflow");
return;
}
@ -1166,7 +1181,7 @@ void ax25_remove_addr (packet_t this_p, int n)
expect = this_p->num_addr;
this_p->num_addr = (-1);
if (expect != ax25_get_num_addr (this_p)) {
TRACE_ERROR ("Internal error ax25_remove_addr expect %d, actual %d", expect, this_p->num_addr);
TRACE_ERROR ("PKT > Internal error ax25_remove_addr expect %d, actual %d", expect, this_p->num_addr);
}
}
@ -1195,7 +1210,7 @@ int ax25_get_num_addr (packet_t this_p)
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -1205,7 +1220,7 @@ int ax25_get_num_addr (packet_t this_p)
return (this_p->num_addr);
}
/* Otherwise, determine the number ofaddresses. */
/* Otherwise, determine the number of addresses. */
this_p->num_addr = 0; /* Number of addresses extracted. */
@ -1243,7 +1258,7 @@ int ax25_get_num_addr (packet_t this_p)
int ax25_get_num_repeaters (packet_t this_p)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -1285,21 +1300,21 @@ void ax25_get_addr_with_ssid (packet_t this_p, int n, char *station)
int i;
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
if (n < 0) {
TRACE_ERROR ("Internal error detected in ax25_get_addr_with_ssid, %s, line %d.", __FILE__, __LINE__);
TRACE_ERROR ("Address index, %d, is less than zero.", n);
TRACE_ERROR ("PKT > Internal error detected in ax25_get_addr_with_ssid, %s, line %d.", __FILE__, __LINE__);
TRACE_ERROR ("PKT > Address index, %d, is less than zero.", n);
strlcpy (station, "??????", 10);
return;
}
if (n >= this_p->num_addr) {
TRACE_ERROR ("Internal error detected in ax25_get_addr_with_ssid, %s, line %d.", __FILE__, __LINE__);
TRACE_ERROR ("Address index, %d, is too large for number of addresses, %d.", n, this_p->num_addr);
TRACE_ERROR ("PKT > Internal error detected in ax25_get_addr_with_ssid, %s, line %d.", __FILE__, __LINE__);
TRACE_ERROR ("PKT > Address index, %d, is too large for number of addresses, %d.", n, this_p->num_addr);
strlcpy (station, "??????", 10);
return;
}
@ -1350,21 +1365,21 @@ void ax25_get_addr_no_ssid (packet_t this_p, int n, char *station)
int i;
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
if (n < 0) {
TRACE_ERROR ("Internal error detected in ax25_get_addr_no_ssid, %s, line %d.", __FILE__, __LINE__);
TRACE_ERROR ("Address index, %d, is less than zero.", n);
TRACE_ERROR ("PKT > Internal error detected in ax25_get_addr_no_ssid, %s, line %d.", __FILE__, __LINE__);
TRACE_ERROR ("PKT > Address index, %d, is less than zero.", n);
strlcpy (station, "??????", 7);
return;
}
if (n >= this_p->num_addr) {
TRACE_ERROR ("Internal error detected in ax25_get_no_with_ssid, %s, line %d.", __FILE__, __LINE__);
TRACE_ERROR ("Address index, %d, is too large for number of addresses, %d.", n, this_p->num_addr);
TRACE_ERROR ("PKT > Internal error detected in ax25_get_no_with_ssid, %s, line %d.", __FILE__, __LINE__);
TRACE_ERROR ("PKT > Address index, %d, is too large for number of addresses, %d.", n, this_p->num_addr);
strlcpy (station, "??????", 7);
return;
}
@ -1400,7 +1415,7 @@ int ax25_get_ssid (packet_t this_p, int n)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -1435,7 +1450,7 @@ void ax25_set_ssid (packet_t this_p, int n, int ssid)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
@ -1445,7 +1460,7 @@ void ax25_set_ssid (packet_t this_p, int n, int ssid)
((ssid << SSID_SSID_SHIFT) & SSID_SSID_MASK) ;
}
else {
TRACE_ERROR ("Internal error: ax25_set_ssid(%d,%d), num_addr=%d", n, ssid, this_p->num_addr);
TRACE_ERROR ("PKT > Internal error: ax25_set_ssid(%d,%d), num_addr=%d", n, ssid, this_p->num_addr);
}
}
@ -1471,11 +1486,11 @@ int ax25_get_h (packet_t this_p, int n)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
if(n < 0 || n >= this_p->num_addr) {
TRACE_ERROR("Address overflow");
TRACE_ERROR("PKT > Address overflow");
return 0;
}
@ -1483,7 +1498,7 @@ int ax25_get_h (packet_t this_p, int n)
return ((this_p->frame_data[n*7+6] & SSID_H_MASK) >> SSID_H_SHIFT);
}
else {
TRACE_ERROR ("Internal error: ax25_get_h(%d), num_addr=%d", n, this_p->num_addr);
TRACE_ERROR ("PKT > Internal error: ax25_get_h(%d), num_addr=%d", n, this_p->num_addr);
return (0);
}
}
@ -1510,7 +1525,7 @@ void ax25_set_h (packet_t this_p, int n)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
@ -1518,7 +1533,7 @@ void ax25_set_h (packet_t this_p, int n)
this_p->frame_data[n*7+6] |= SSID_H_MASK;
}
else {
TRACE_ERROR ("Internal error: ax25_set_hd(%d), num_addr=%d", n, this_p->num_addr);
TRACE_ERROR ("PKT > Internal error: ax25_set_hd(%d), num_addr=%d", n, this_p->num_addr);
}
}
@ -1545,7 +1560,7 @@ int ax25_get_heard(packet_t this_p)
int result;
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -1583,7 +1598,7 @@ int ax25_get_first_not_repeated(packet_t this_p)
int i;
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -1616,11 +1631,11 @@ int ax25_get_rr (packet_t this_p, int n)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
if(n < 0 && n >= this_p->num_addr) {
TRACE_ERROR("Address overflow");
TRACE_ERROR("PKT > Address overflow");
return 0;
}
@ -1628,7 +1643,7 @@ int ax25_get_rr (packet_t this_p, int n)
return ((this_p->frame_data[n*7+6] & SSID_RR_MASK) >> SSID_RR_SHIFT);
}
else {
TRACE_ERROR ("Internal error: ax25_get_rr(%d), num_addr=%d", n, this_p->num_addr);
TRACE_ERROR ("PKT > Internal error: ax25_get_rr(%d), num_addr=%d", n, this_p->num_addr);
return (0);
}
}
@ -1718,7 +1733,7 @@ int ax25_cut_at_crlf (packet_t this_p)
int j;
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -1759,7 +1774,7 @@ int ax25_cut_at_crlf (packet_t this_p)
int ax25_get_dti (packet_t this_p)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -1786,7 +1801,7 @@ int ax25_get_dti (packet_t this_p)
void ax25_set_nextp (packet_t this_p, packet_t next_p)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
@ -1810,7 +1825,7 @@ void ax25_set_nextp (packet_t this_p, packet_t next_p)
packet_t ax25_get_nextp (packet_t this_p)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -1833,7 +1848,7 @@ packet_t ax25_get_nextp (packet_t this_p)
void ax25_set_release_time (packet_t this_p, double release_time)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
@ -1853,7 +1868,7 @@ void ax25_set_release_time (packet_t this_p, double release_time)
double ax25_get_release_time (packet_t this_p)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -1872,7 +1887,7 @@ double ax25_get_release_time (packet_t this_p)
void ax25_set_modulo (packet_t this_p, int modulo)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
@ -1920,7 +1935,7 @@ void ax25_format_addrs (packet_t this_p, char *result)
char stemp[AX25_MAX_ADDR_LEN];
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
*result = '\0';
@ -1987,7 +2002,7 @@ void ax25_format_via_path (packet_t this_p, char *result, size_t result_size)
char stemp[AX25_MAX_ADDR_LEN];
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return;
}
*result = '\0';
@ -2037,12 +2052,12 @@ void ax25_format_via_path (packet_t this_p, char *result, size_t result_size)
int ax25_pack (packet_t this_p, unsigned char result[AX25_MAX_PACKET_LEN])
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return -1;
}
if(this_p->frame_len == 0 || this_p->frame_len > AX25_MAX_PACKET_LEN) {
TRACE_ERROR("Packet length over-/underflow");
TRACE_ERROR("PKT > Packet length over-/underflow");
return -1;
}
@ -2090,7 +2105,7 @@ ax25_frame_type_t ax25_frame_type (packet_t this_p, cmdres_t *cr, char *desc, in
int c2 = 0; // I & S frames can have second Control byte.
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -2254,7 +2269,7 @@ int ax25_is_aprs (packet_t this_p)
int ctrl, pid, is_aprs;
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -2291,7 +2306,7 @@ int ax25_is_null_frame (packet_t this_p)
int is_null;
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -2319,7 +2334,7 @@ int ax25_is_null_frame (packet_t this_p)
int ax25_get_control (packet_t this_p)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -2334,7 +2349,7 @@ int ax25_get_control (packet_t this_p)
int ax25_get_c2 (packet_t this_p)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -2375,7 +2390,7 @@ int ax25_get_c2 (packet_t this_p)
int ax25_get_pid (packet_t this_p)
{
if(this_p->magic1 != MAGIC || this_p->magic2 != MAGIC) {
TRACE_ERROR("Buffer overflow");
TRACE_ERROR("PKT > Buffer overflow");
return 0;
}
@ -2600,7 +2615,7 @@ void ax25_safe_print (char *pstr, int len, int ascii_only)
// TODO1.2: should return string rather printing to remove a race condition.
TRACE_DEBUG ("%s", safe_str);
TRACE_DEBUG ("PKT > %s", safe_str);
} /* end ax25_safe_print */

Wyświetl plik

@ -131,10 +131,10 @@ typedef struct packet_s {
#define SSID_LAST_MASK 0x01
/* The transmit sequence number for this packet. */
uint8_t tx_seq;
//uint8_t tx_seq;
/* TODO: Move this out of here... */
char tx_thd_name[16];
//char tx_thd_name[16];
/* Frame length without CRC. */
int frame_len;

Wyświetl plik

@ -90,9 +90,9 @@
#define PWM_DATA_SLOTS 6000
/* Number of frame receive buffers. */
#define NUMBER_RX_PKT_BUFFERS 2U
#define NUMBER_RX_PKT_BUFFERS 3U
/* Number of frame send buffers. */
#define NUMBER_TX_PKT_BUFFERS 3U
#define NUMBER_COMMON_PKT_BUFFERS 20U
/*===========================================================================*/
/* Module pre-compile time settings. */

Wyświetl plik

@ -45,7 +45,7 @@ static bool dedupe_initialized;
const conf_command_t command_list[] = {
{TYPE_INT, "pos_pri.active", sizeof(conf_sram.pos_pri.thread_conf.active), &conf_sram.pos_pri.thread_conf.active },
{TYPE_TIME, "pos_pri.init_delay", sizeof(conf_sram.pos_pri.thread_conf.init_delay), &conf_sram.pos_pri.thread_conf.init_delay },
{TYPE_TIME, "pos_pri.packet_spacing", sizeof(conf_sram.pos_pri.thread_conf.packet_spacing), &conf_sram.pos_pri.thread_conf.packet_spacing },
{TYPE_TIME, "pos_pri.packet_spacing", sizeof(conf_sram.pos_pri.thread_conf.send_spacing), &conf_sram.pos_pri.thread_conf.send_spacing },
{TYPE_INT, "pos_pri.sleep_conf.type", sizeof(conf_sram.pos_pri.thread_conf.sleep_conf.type), &conf_sram.pos_pri.thread_conf.sleep_conf.type },
{TYPE_INT, "pos_pri.sleep_conf.vbat_thres", sizeof(conf_sram.pos_pri.thread_conf.sleep_conf.vbat_thres), &conf_sram.pos_pri.thread_conf.sleep_conf.vbat_thres},
{TYPE_INT, "pos_pri.sleep_conf.vsol_thres", sizeof(conf_sram.pos_pri.thread_conf.sleep_conf.vsol_thres), &conf_sram.pos_pri.thread_conf.sleep_conf.vsol_thres},
@ -64,7 +64,7 @@ const conf_command_t command_list[] = {
{TYPE_INT, "pos_sec.active", sizeof(conf_sram.pos_sec.thread_conf.active), &conf_sram.pos_sec.thread_conf.active },
{TYPE_TIME, "pos_sec.init_delay", sizeof(conf_sram.pos_sec.thread_conf.init_delay), &conf_sram.pos_sec.thread_conf.init_delay },
{TYPE_TIME, "pos_sec.packet_spacing", sizeof(conf_sram.pos_sec.thread_conf.packet_spacing), &conf_sram.pos_sec.thread_conf.packet_spacing },
{TYPE_TIME, "pos_sec.packet_spacing", sizeof(conf_sram.pos_sec.thread_conf.send_spacing), &conf_sram.pos_sec.thread_conf.send_spacing },
{TYPE_INT, "pos_sec.sleep_conf.type", sizeof(conf_sram.pos_sec.thread_conf.sleep_conf.type), &conf_sram.pos_sec.thread_conf.sleep_conf.type },
{TYPE_INT, "pos_sec.sleep_conf.vbat_thres", sizeof(conf_sram.pos_sec.thread_conf.sleep_conf.vbat_thres), &conf_sram.pos_sec.thread_conf.sleep_conf.vbat_thres},
{TYPE_INT, "pos_sec.sleep_conf.vsol_thres", sizeof(conf_sram.pos_sec.thread_conf.sleep_conf.vsol_thres), &conf_sram.pos_sec.thread_conf.sleep_conf.vsol_thres},
@ -83,7 +83,7 @@ const conf_command_t command_list[] = {
{TYPE_INT, "img_pri.active", sizeof(conf_sram.img_pri.thread_conf.active), &conf_sram.img_pri.thread_conf.active },
{TYPE_TIME, "img_pri.init_delay", sizeof(conf_sram.img_pri.thread_conf.init_delay), &conf_sram.img_pri.thread_conf.init_delay },
{TYPE_TIME, "img_pri.packet_spacing", sizeof(conf_sram.img_pri.thread_conf.packet_spacing), &conf_sram.img_pri.thread_conf.packet_spacing },
{TYPE_TIME, "img_pri.packet_spacing", sizeof(conf_sram.img_pri.thread_conf.send_spacing), &conf_sram.img_pri.thread_conf.send_spacing },
{TYPE_INT, "img_pri.sleep_conf.type", sizeof(conf_sram.img_pri.thread_conf.sleep_conf.type), &conf_sram.img_pri.thread_conf.sleep_conf.type },
{TYPE_INT, "img_pri.sleep_conf.vbat_thres", sizeof(conf_sram.img_pri.thread_conf.sleep_conf.vbat_thres), &conf_sram.img_pri.thread_conf.sleep_conf.vbat_thres},
{TYPE_INT, "img_pri.sleep_conf.vsol_thres", sizeof(conf_sram.img_pri.thread_conf.sleep_conf.vsol_thres), &conf_sram.img_pri.thread_conf.sleep_conf.vsol_thres},
@ -102,7 +102,7 @@ const conf_command_t command_list[] = {
{TYPE_INT, "img_sec.active", sizeof(conf_sram.img_sec.thread_conf.active), &conf_sram.img_sec.thread_conf.active },
{TYPE_TIME, "img_sec.init_delay", sizeof(conf_sram.img_sec.thread_conf.init_delay), &conf_sram.img_sec.thread_conf.init_delay },
{TYPE_TIME, "img_sec.packet_spacing", sizeof(conf_sram.img_sec.thread_conf.packet_spacing), &conf_sram.img_sec.thread_conf.packet_spacing },
{TYPE_TIME, "img_sec.packet_spacing", sizeof(conf_sram.img_sec.thread_conf.send_spacing), &conf_sram.img_sec.thread_conf.send_spacing },
{TYPE_INT, "img_sec.sleep_conf.type", sizeof(conf_sram.img_sec.thread_conf.sleep_conf.type), &conf_sram.img_sec.thread_conf.sleep_conf.type },
{TYPE_INT, "img_sec.sleep_conf.vbat_thres", sizeof(conf_sram.img_sec.thread_conf.sleep_conf.vbat_thres), &conf_sram.img_sec.thread_conf.sleep_conf.vbat_thres},
{TYPE_INT, "img_sec.sleep_conf.vsol_thres", sizeof(conf_sram.img_sec.thread_conf.sleep_conf.vsol_thres), &conf_sram.img_sec.thread_conf.sleep_conf.vsol_thres},
@ -121,7 +121,7 @@ const conf_command_t command_list[] = {
{TYPE_INT, "log.active", sizeof(conf_sram.log.thread_conf.active), &conf_sram.log.thread_conf.active },
{TYPE_TIME, "log.init_delay", sizeof(conf_sram.log.thread_conf.init_delay), &conf_sram.log.thread_conf.init_delay },
{TYPE_TIME, "log.packet_spacing", sizeof(conf_sram.log.thread_conf.packet_spacing), &conf_sram.log.thread_conf.packet_spacing },
{TYPE_TIME, "log.packet_spacing", sizeof(conf_sram.log.thread_conf.send_spacing), &conf_sram.log.thread_conf.send_spacing },
{TYPE_INT, "log.sleep_conf.type", sizeof(conf_sram.log.thread_conf.sleep_conf.type), &conf_sram.log.thread_conf.sleep_conf.type },
{TYPE_INT, "log.sleep_conf.vbat_thres", sizeof(conf_sram.log.thread_conf.sleep_conf.vbat_thres), &conf_sram.log.thread_conf.sleep_conf.vbat_thres },
{TYPE_INT, "log.sleep_conf.vsol_thres", sizeof(conf_sram.log.thread_conf.sleep_conf.vsol_thres), &conf_sram.log.thread_conf.sleep_conf.vsol_thres },
@ -269,7 +269,7 @@ packet_t aprs_encode_position(const char *callsign, const char *path, uint16_t s
xmit[len+len2+26] = '|';
xmit[len+len2+27] = 0;
return ax25_from_text(xmit, 1);
return ax25_from_text(xmit, true);
}
packet_t aprs_encode_data_packet(const char *callsign, const char *path, char packetType, uint8_t *data)
@ -277,7 +277,7 @@ packet_t aprs_encode_data_packet(const char *callsign, const char *path, char pa
char xmit[256];
chsnprintf(xmit, sizeof(xmit), "%s>%s,%s:{{%c%s", callsign, APRS_DEST_CALLSIGN, path, packetType, data);
return ax25_from_text(xmit, 1);
return ax25_from_text(xmit, true);
}
/**
@ -291,7 +291,7 @@ packet_t aprs_encode_message(const char *callsign, const char *path, const char
else
chsnprintf(xmit, sizeof(xmit), "%s>%s,%s::%-9s:%s{%d", callsign, APRS_DEST_CALLSIGN, path, receiver, text, ++msg_id);
return ax25_from_text(xmit, 1);
return ax25_from_text(xmit, true);
}
packet_t aprs_encode_query_answer_aprsd(const char *callsign, const char *path, const char *receiver)
@ -339,9 +339,11 @@ static bool aprs_decode_message(packet_t pp)
// Try to find out if this message is meant for us
bool pos_pri = !strcmp(conf_sram.pos_pri.call, dest)
&& (conf_sram.pos_pri.aprs_msg);
&& (conf_sram.pos_pri.aprs_msg)
&& (conf_sram.pos_pri.thread_conf.active);
bool pos_sec = !strcmp(conf_sram.pos_sec.call, dest)
&& (conf_sram.pos_sec.aprs_msg);
&& (conf_sram.pos_sec.aprs_msg)
&& (conf_sram.pos_sec.thread_conf.active);
bool aprs = !strcmp(conf_sram.aprs.rx.call, dest);
if((pinfo[10] == ':') && (pos_pri || pos_sec || aprs)) {
@ -533,7 +535,6 @@ static bool aprs_decode_message(packet_t pp)
conf_sram.aprs.tx.radio_conf.mod,
conf_sram.aprs.tx.radio_conf.rssi);
}
return false; // Mark that message should not be digipeated
}
@ -555,6 +556,7 @@ static void aprs_digipeat(packet_t pp) {
wide_re, 0, preempt, NULL);
if(result != NULL) { // Should be digipeated
dedupe_remember(result, 0);
/* If transmit fails the packet is freed. */
transmitOnRadio(result,
conf_sram.aprs.tx.radio_conf.freq,
0,

Wyświetl plik

@ -57,7 +57,9 @@ static void aquirePosition(dataPoint_t* tp, dataPoint_t* ltp, sysinterval_t time
do {
batt = stm32_get_vbat();
gps_get_fix(&gpsFix);
} while(!isGPSLocked(&gpsFix) && batt >= conf_sram.gps_off_vbat && chVTGetSystemTime() <= start + timeout); // Do as long no GPS lock and within timeout, timeout=cycle-1sec (-3sec in order to keep synchronization)
} while(!isGPSLocked(&gpsFix)
&& batt >= conf_sram.gps_off_vbat
&& chVTIsSystemTimeWithin(start, start + timeout)); // Do as long no GPS lock and within timeout, timeout=cycle-1sec (-3sec in order to keep synchronization)
if(batt < conf_sram.gps_off_vbat) { // GPS was switched on but prematurely switched off because the battery is low on power, switch off GPS
@ -278,7 +280,7 @@ THD_FUNCTION(collectorThread, arg) {
} else if(conf_sram.pos_pri.thread_conf.active) { // Only primary position thread is active
data_cycle_time = conf_sram.pos_pri.thread_conf.cycle;
} else if(conf_sram.pos_sec.thread_conf.active) { // Only secondary position thread is active
data_cycle_time = conf_sram.pos_pri.thread_conf.cycle;
data_cycle_time = conf_sram.pos_sec.thread_conf.cycle;
} else { // There must be an error
TRACE_ERROR("COLL > Data collector started but no position thread is active");
}

Wyświetl plik

@ -372,12 +372,15 @@ static bool transmit_image_packets(const uint8_t *image,
ssdv_enc_set_buffer(&ssdv, pkt);
ssdv_enc_feed(&ssdv, image, 0);
/* TODO: Review/revise how this works with block send. */
do {
// Process redundant transmission from last cycle
if(strlen((char*)pkt_base91) && conf->radio_conf.redundantTx) {
packet_t packet = aprs_encode_data_packet(conf->call, conf->path, 'I', pkt_base91);
packet_t packet = aprs_encode_data_packet(conf->call, conf->path,
'I', pkt_base91);
if(packet == NULL) {
TRACE_ERROR("IMG > No available packet for redundant image transmission");
TRACE_ERROR("IMG > No available packet for redundant"
" image transmission");
} else {
if(!transmitOnRadio(packet,
conf->radio_conf.freq,
@ -386,41 +389,72 @@ static bool transmit_image_packets(const uint8_t *image,
conf->radio_conf.pwr,
conf->radio_conf.mod,
conf->radio_conf.rssi)) {
/* Packet has been released by transmit. */
TRACE_ERROR("IMG > Unable to send redundant image on radio");
}
}
chThdSleep(TIME_MS2I(10)); // Leave other threads some time
}
// Encode packet
TRACE_INFO("IMG > Encode APRS/SSDV packet");
/* TODO: re-implement chunk sized SSDV conversions. */
while((c = ssdv_enc_get_packet(&ssdv)) == SSDV_FEED_ME) {
b = &image[bi++];
if(bi > image_len) {
TRACE_ERROR("SSDV > Premature end of file");
packet_t head = NULL;
packet_t previous = NULL;
uint8_t chain = (conf->radio_conf.mod == MOD_2FSK) ? (NUMBER_COMMON_PKT_BUFFERS / 2) : 1;
// Encode packet(s)
TRACE_INFO("IMG > Encode APRS/SSDV packet(s) %i", chain);
while((chain-- > 0) && (c != SSDV_EOI)) {
/* TODO: re-implement chunk sized SSDV conversions. */
while((c = ssdv_enc_get_packet(&ssdv)) == SSDV_FEED_ME) {
b = &image[bi++];
if(bi > image_len) {
TRACE_ERROR("SSDV > Premature end of file");
if(head != NULL) {
pktReleaseSendQueue(head);
}
return false;
}
ssdv_enc_feed(&ssdv, b, 1);
}
if(c == SSDV_EOI) {
TRACE_INFO("SSDV > ssdv_enc_get_packet said EOI");
break;
} else if(c != SSDV_OK) {
TRACE_ERROR("SSDV > ssdv_enc_get_packet failed: %i", c);
if(head != NULL) {
pktReleaseSendQueue(head);
}
return false;
}
ssdv_enc_feed(&ssdv, b, 1);
}
if(c == SSDV_EOI) {
TRACE_INFO("SSDV > ssdv_enc_get_packet said EOI");
return true;
} else if(c != SSDV_OK) {
TRACE_ERROR("SSDV > ssdv_enc_get_packet failed: %i", c);
return false;
}
/*
* Sync byte, CRC and FEC of SSDV not transmitted.
* Not necessary inside an APRS packet.
*/
base91_encode(&pkt[6], pkt_base91, 174);
// Sync byte, CRC and FEC of SSDV not transmitted (because its not necessary inside an APRS packet)
base91_encode(&pkt[6], pkt_base91, 174);
packet_t packet = aprs_encode_data_packet(conf->call, conf->path,
'I', pkt_base91);
if(packet == NULL) {
TRACE_ERROR("IMG > No available packet for image transmission");
/* Error so release any linked packets. */
if(head != NULL) {
pktReleaseSendQueue(head);
}
return false;
}
if(head == NULL)
head = packet;
if(previous != NULL)
/* Link the next packet into the chain. */
previous->nextp = packet;
/* Now set previous as current. */
previous = packet;
} /* End while. */
/* TODO: Implement en bloc send using chained buffers. */
packet_t packet = aprs_encode_data_packet(conf->call, conf->path, 'I', pkt_base91);
if(packet == NULL) {
TRACE_ERROR("IMG > No available packet for image transmission");
} else {
if(!transmitOnRadio(packet,
/* If we have some image packet(s) to transmit then do it. */
if(head != NULL) {
if(!transmitOnRadio(head,
conf->radio_conf.freq,
0,
0,
@ -428,14 +462,18 @@ static bool transmit_image_packets(const uint8_t *image,
conf->radio_conf.mod,
conf->radio_conf.rssi)) {
TRACE_ERROR("IMG > Unable to send image on radio");
/* Transmit on radio will release the packet chain. */
}
}
chThdSleep(TIME_MS2I(10)); // Leave other threads some time
/* TODO: Review/revise how this works with block send. */
// Repeat packets
for(uint8_t i=0; i<16; i++) {
if(packetRepeats[i].n_done && image_id == packetRepeats[i].image_id) {
if(!transmit_image_packet(image, image_len, conf, image_id, packetRepeats[i].packet_id)) {
if(!transmit_image_packet(image, image_len, conf,
image_id, packetRepeats[i].packet_id)) {
TRACE_ERROR("IMG > Failed re-send of image %i", image_id);
} else {
packetRepeats[i].n_done = false; // Set done
@ -445,8 +483,8 @@ static bool transmit_image_packets(const uint8_t *image,
}
// Packet spacing (delay)
if(conf->thread_conf.packet_spacing)
chThdSleep(conf->thread_conf.packet_spacing);
if(conf->thread_conf.send_spacing)
chThdSleep(conf->thread_conf.send_spacing);
// Handle image rejection flag
if((conf == &conf_sram.img_pri) && reject_pri) { // Image rejected
@ -455,7 +493,8 @@ static bool transmit_image_packets(const uint8_t *image,
if((conf == &conf_sram.img_sec) && reject_sec) { // Image rejected
reject_sec = false;
}
} while(true);
} while(c != SSDV_EOI);
return true;
}
/**
@ -514,8 +553,8 @@ static bool analyze_image(uint8_t *image, uint32_t image_len)
static bool camInitialized = false;
uint32_t takePicture(uint8_t* buffer, uint32_t size, resolution_t res, bool enableJpegValidation)
{
uint32_t takePicture(uint8_t* buffer, uint32_t size,
resolution_t res, bool enableJpegValidation) {
uint32_t size_sampled = 0;
// Initialize mutex
@ -591,9 +630,11 @@ THD_FUNCTION(imgThread, arg) {
// Take picture
/* Create image capture buffer. */
uint8_t *buffer = chHeapAllocAligned(NULL, conf->buf_size, DMA_FIFO_BURST_ALIGN);
uint8_t *buffer = chHeapAllocAligned(NULL, conf->buf_size,
DMA_FIFO_BURST_ALIGN);
if(buffer != NULL) {
uint32_t size_sampled = takePicture(buffer, conf->buf_size, conf->res, true);
uint32_t size_sampled = takePicture(buffer, conf->buf_size,
conf->res, true);
gimage_id++; // Increase SSDV image counter
// Radio transmission
@ -603,7 +644,9 @@ THD_FUNCTION(imgThread, arg) {
if(initSD())
{
char filename[32];
chsnprintf(filename, sizeof(filename), "r%02xi%04x.jpg", getLastDataPoint()->reset % 0xFF, (gimage_id-1) % 0xFFFF);
chsnprintf(filename, sizeof(filename), "r%02xi%04x.jpg",
getLastDataPoint()->reset % 0xFF,
(gimage_id-1) % 0xFFFF);
// Find SOI
uint32_t soi;
@ -617,15 +660,20 @@ THD_FUNCTION(imgThread, arg) {
// Encode and transmit picture
TRACE_INFO("IMG > Encode/Transmit SSDV ID=%d", gimage_id-1);
if(!transmit_image_packets(buffer, size_sampled, conf, (uint8_t)(gimage_id-1))) {
TRACE_ERROR("IMG > Error in encoding snapshot image %i - discarded", gimage_id-1);
if(!transmit_image_packets(buffer, size_sampled, conf,
(uint8_t)(gimage_id-1))) {
TRACE_ERROR("IMG > Error in encoding snapshot image"
" %i - discarded", gimage_id-1);
/* Allow time for output queue to be processed. */
chThdSleep(TIME_S2I(10));
}
} else { // No camera found
TRACE_INFO("IMG > Encode/Transmit SSDV (camera error) ID=%d", gimage_id-1);
if(!transmit_image_packets(noCameraFound, sizeof(noCameraFound), conf, (uint8_t)(gimage_id-1))) {
TRACE_ERROR("IMG > Error in encoding dummy image %i - discarded", gimage_id-1);
TRACE_INFO("IMG > Encode/Transmit SSDV (camera error) ID=%d",
gimage_id-1);
if(!transmit_image_packets(noCameraFound, sizeof(noCameraFound),
conf, (uint8_t)(gimage_id-1))) {
TRACE_ERROR("IMG > Error in encoding dummy image %i"
" - discarded", gimage_id-1);
/* Allow time for output queue to be processed. */
chThdSleep(TIME_S2I(10));
}
@ -634,7 +682,8 @@ THD_FUNCTION(imgThread, arg) {
chHeapFree(buffer);
} else {
/* Could not get a capture buffer. */
TRACE_WARN("IMG > Unable to get capture buffer for image %i", gimage_id-1);
TRACE_WARN("IMG > Unable to get capture buffer for image %i",
gimage_id-1);
}
}
chThdSleep(TIME_MS2I(10));
@ -647,10 +696,13 @@ THD_FUNCTION(imgThread, arg) {
*/
void start_image_thread(thd_img_conf_t *conf)
{
thread_t *th = chThdCreateFromHeap(NULL, THD_WORKING_AREA_SIZE(40 * 1024), "IMG", LOWPRIO, imgThread, conf);
thread_t *th = chThdCreateFromHeap(NULL,
THD_WORKING_AREA_SIZE(40 * 1024),
"IMG", LOWPRIO, imgThread, conf);
if(!th) {
// Print startup error, do not start watchdog for this thread
TRACE_ERROR("IMG > Could not startup thread (not enough memory available)");
TRACE_ERROR("IMG > Could not startup thread"
" (not enough memory available)");
}
}

Wyświetl plik

@ -125,7 +125,8 @@ bool transmitOnRadio(packet_t pp, radio_freq_t base_freq,
if(!pktIsTransmitOpen(radio)) {
TRACE_WARN( "RAD > Transmit is not open on radio");
#if USE_NEW_PKT_TX_ALLOC == TRUE
pktReleasePacketBuffer(pp);
pktReleaseSendQueue(pp);
//pktReleasePacketBuffer(pp);
#else
ax25_delete (pp);
#endif
@ -159,7 +160,8 @@ bool transmitOnRadio(packet_t pp, radio_freq_t base_freq,
TRACE_ERROR("RAD > Transmit base frequency of %d.%03d MHz is invalid",
base_freq/1000000, (base_freq%1000000)/1000);
#if USE_NEW_PKT_TX_ALLOC == TRUE
pktReleasePacketBuffer(pp);
pktReleaseSendQueue(pp);
//pktReleasePacketBuffer(pp);
#else
ax25_delete (pp);
#endif
@ -194,16 +196,16 @@ bool transmitOnRadio(packet_t pp, radio_freq_t base_freq,
rt.tx_speed = (mod == MOD_2FSK ? 9600 : 1200);
rt.squelch = rssi;
rt.packet_out = pp;
rt.callback = NULL;
/* Update the task mirror. */
handler->radio_tx_config = rt;
msg_t msg = pktSendRadioCommand(radio, &rt);
msg_t msg = pktSendRadioCommand(radio, &rt, NULL);
if(msg != MSG_OK) {
TRACE_ERROR("RAD > Failed to post radio task");
#if USE_NEW_PKT_TX_ALLOC == TRUE
pktReleasePacketBuffer(pp);
pktReleaseSendQueue(pp);
//pktReleasePacketBuffer(pp);
#else
ax25_delete (pp);
#endif
@ -216,7 +218,8 @@ bool transmitOnRadio(packet_t pp, radio_freq_t base_freq,
base_freq/1000000, (base_freq%1000000)/1000, pwr,
getModulation(mod), len);
#if USE_NEW_PKT_TX_ALLOC == TRUE
pktReleasePacketBuffer(pp);
pktReleaseSendQueue(pp);
//pktReleasePacketBuffer(pp);
#else
ax25_delete (pp);
#endif

Wyświetl plik

@ -68,7 +68,7 @@ typedef struct {
typedef struct {
bool active;
sysinterval_t init_delay;
sysinterval_t packet_spacing;
sysinterval_t send_spacing;
sleep_conf_t sleep_conf;
sysinterval_t cycle; // Cycle time (0: continously)
sysinterval_t duration;