Further handling of out of packet buffers condition in image thread.

pull/4/head
CInsights 2018-03-30 17:01:33 +11:00
rodzic b33c2ebe46
commit f617715aba
5 zmienionych plików z 18 dodań i 28 usunięć

Wyświetl plik

@ -58,8 +58,8 @@ const conf_t conf_flash_default = {
.thread_conf = {
.active = true,
.cycle = CYCLE_CONTINUOUSLY,
.init_delay = TIME_S2I(5),
.packet_spacing = TIME_S2I(30)
.init_delay = TIME_S2I(20),
.packet_spacing = TIME_S2I(0)
},
.radio_conf = {
.pwr = 0x7F,
@ -68,7 +68,7 @@ const conf_t conf_flash_default = {
.chan = 64,
.mod = MOD_2FSK,
.preamble = 200,
.redundantTx = true
.redundantTx = false
},
.call = "VK2GJ-15",

Wyświetl plik

@ -13,22 +13,9 @@
#include "radio.h"
#endif
/*
* Transmitter global variables.
* Saved when setting band. */
//static uint32_t tx_frequency;
//static uint16_t tx_step;
// Si446x variables
static int16_t lastTemp = 0x7FFF;
//static bool radioInitialized;
// Receiver thread variables
/*static uint32_t rx_frequency;
static uint16_t rx_step;
static uint8_t rx_chan;
static uint8_t rx_rssi;
static mod_t rx_mod;*/
/* =================================================================== SPI communication ==================================================================== */
@ -70,7 +57,7 @@ static void Si446x_write(const uint8_t* txData, uint32_t len) {
*/
static void Si446x_read(const uint8_t* txData, uint32_t txlen, uint8_t* rxData, uint32_t rxlen) {
// Transmit data by SPI
/* TODO: Add radio unit ID and get SPI accordingly. */
/* TODO: Add radio unit ID and get SPI configuration accordingly. */
uint8_t null_spi[txlen];
/* Acquire bus and then start SPI. */
@ -1220,14 +1207,17 @@ void Si446x_send2FSK(packet_t pp) {
/* ========================================================================== Misc ========================================================================== */
static int16_t Si446x_getTemperature(void) {
static int16_t Si446x_getTemperature(radio_unit_t radio) {
/* TODO: Add hardware selection. */
(void)radio;
const uint8_t txData[2] = {0x14, 0x10};
uint8_t rxData[8];
Si446x_read(txData, 2, rxData, 8);
uint16_t adc = rxData[7] | ((rxData[6] & 0x7) << 8);
return (89900*adc)/4096 - 29300;
return (89900 * adc) / 4096 - 29300;
}
/* TODO: Abstract this by radio ID. */
int16_t Si446x_getLastTemperature(radio_unit_t radio) {
if(lastTemp == 0x7FFF) { // Temperature was never measured => measure it now
packet_svc_t *handler = pktGetServiceObject(radio);
@ -1237,7 +1227,7 @@ int16_t Si446x_getLastTemperature(radio_unit_t radio) {
if(handler->radio_init) {
pktAcquireRadio(radio);
// Temperature readout
lastTemp = Si446x_getTemperature();
lastTemp = Si446x_getTemperature(radio);
TRACE_INFO("SI > Transmitter temperature %d degC\r\n", lastTemp/100);
pktReleaseRadio(radio);
} else {

Wyświetl plik

@ -181,8 +181,6 @@
#define Si446x_FREQ_CONTROL_W_SIZE 0x4006
#define Si446x_FREQ_CONTROL_VCOCNT_RX_ADJ 0x4007
#define RADIO_TASK_QUEUE_MAX 10
#define PKT_SI446X_APRS_CHANNEL 94
#define PKT_SI446X_SQUELCH_LEVEL 0x4F

Wyświetl plik

@ -26,10 +26,8 @@
#define PKT_RADIO_TASK_QUEUE_PREFIX "radx_"
#define BAND_START_2M 144000000
#define AU_APRS_2M_FREQUENCY 145175000
#define PKT_RADIO_CHANNEL_STEPPING_NONE 0
/* The number of radio task object the FIFO has. */
#define RADIO_TASK_QUEUE_MAX 10
/*===========================================================================*/
/* Module data structures and types. */

Wyświetl plik

@ -624,13 +624,17 @@ 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 > Failure in image packet transmit");
TRACE_WARN("IMG > Unable to TX queue snapshot image %i - discarded", gimage_id-1);
/* Allow time for 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 > Failure in image packet transmit");
TRACE_WARN("IMG > Unable to TX queue fixed image %i - discarded", gimage_id-1);
/* Allow time for queue to be processed. */
chThdSleep(TIME_S2I(10));
}
}
}