Merge branch 'Development' of github.com:DL7AD/pecanpico10 into Development

webcam_dev
Sven Steudte 2018-08-18 05:58:20 +02:00
commit d7e72a35e5
4 zmienionych plików z 55 dodań i 50 usunięć

Wyświetl plik

@ -14,7 +14,7 @@ const conf_t conf_flash_default = {
.pos_pri = {
.beacon = {
.active = false,
.cycle = TIME_S2I(120),
.cycle = TIME_S2I(60 * 30),
.init_delay = TIME_S2I(0),
.fixed = false // Add lat, lon, alt fields when enabling fixed
},
@ -25,16 +25,16 @@ const conf_t conf_flash_default = {
.cca = 0x5F,
},
// App identity
.call = "VK2GJ-15",
.call = "VK2GJ-5",
.path = "WIDE1-1",
.symbol = SYM_BALLOON,
.aprs_msg = true, // Enable APRS message reception on this app
.symbol = SYM_DIGIPEATER,
.aprs_msg = false, // Enable APRS message reception on this app
},
// Secondary position app
.pos_sec = {
.beacon = {
.active = false,
.active = true,
.cycle = TIME_S2I(60 * 30), // Beacon interval
.init_delay = TIME_S2I(0),
.fixed = true, // Add lat, lon alt fields when enabling fixed
@ -59,7 +59,7 @@ const conf_t conf_flash_default = {
.img_pri = {
.svc_conf = {
.active = true,
.cycle = CYCLE_CONTINUOUSLY,
.cycle = TIME_S2I(60 * 15),
.init_delay = TIME_S2I(30),
.send_spacing = TIME_S2I(10)
},
@ -85,7 +85,7 @@ const conf_t conf_flash_default = {
.img_sec = {
.svc_conf = {
.active = true,
.cycle = CYCLE_CONTINUOUSLY,
.cycle = TIME_S2I(60 * 10),
.init_delay = TIME_S2I(60),
.send_spacing = TIME_S2I(0)
},
@ -132,7 +132,7 @@ const conf_t conf_flash_default = {
.svc_conf = {
// The packet receive service is enabled if true
// Receive is paused and resumed by transmission
.active = false,
.active = true,
.init_delay = TIME_S2I(20)
},
// Receive radio configuration
@ -188,7 +188,7 @@ const conf_t conf_flash_default = {
// The base station identity.
.base = {
// If enabled tracker initiated APRS messages are addressed to this call sign
.enabled = false,
.enabled = true,
.call = "VK2GJ-7",
.path = "WIDE2-1",
},

Wyświetl plik

@ -1034,6 +1034,39 @@ void OV5640_UnlockResourcesForCapture(void) {
*
*/
uint32_t OV5640_Capture(uint8_t* buffer, uint32_t size) {
/*
* Buffer address must be word aligned.
* Also note requirement for burst transfers from FIFO.
* A burst write from DMA FIFO to memory must not cross a 1K address boundary.
* See RM0430 9.3.12
*
* TODO: To use DMA_FIFO_BURST_ALIGN in setting of ssdv buffer alignment.
* Currently this is set to 32 manually in image.c.
*/
if (((uint32_t)buffer % DMA_FIFO_BURST_ALIGN) != 0) {
OV5640_UnlockResourcesForCapture();
TRACE_ERROR("CAM > Buffer not allocated on DMA burst boundary");
return 0;
}
#if OV5640_USE_DMA_DBM == TRUE
/*
* Calculate the number of whole buffers.
* TODO: Make this include remainder memory as partial buffer?
*/
if((size / DMA_SEGMENT_SIZE) < 2) {
OV5640_UnlockResourcesForCapture();
TRACE_ERROR("CAM > Capture buffer less than 2 DMA segment segments");
return 0;
}
#else
if((size > 0xFFFF) {
OV5640_UnlockResourcesForCapture();
TRACE_ERROR("CAM > Capture buffer in non-DBM mode can not exceed 0xFFFF");
return 0;
}
#endif
/*
* Note:
@ -1077,24 +1110,8 @@ uint32_t OV5640_Capture(uint8_t* buffer, uint32_t size) {
dmaStreamSetPeripheral(dma_control.dmastp, &GPIOA->IDR); // We want to read the data from here
#if OV5640_USE_DMA_DBM == TRUE
//dma_buffer = buffer;
dma_control.capture_buffer = buffer;
/*
* Buffer address must be word aligned.
* Also note requirement for burst transfers from FIFO.
* A burst write from DMA FIFO to memory must not cross a 1K address boundary.
* See RM0430 9.3.12
*
* TODO: To use DMA_FIFO_BURST_ALIGN in setting of ssdv buffer alignment.
* Currently this is set to 32 manually in image.c.
*/
if (((uint32_t)buffer % DMA_FIFO_BURST_ALIGN) != 0) {
OV5640_UnlockResourcesForCapture();
TRACE_ERROR("CAM > Buffer not allocated on DMA burst boundary");
return 0;
}
/*
* Set the initial buffer addresses.
* The updating of DMA:MxAR is done in the the DMA interrupt function.
@ -1102,17 +1119,6 @@ uint32_t OV5640_Capture(uint8_t* buffer, uint32_t size) {
dmaStreamSetMemory0(dma_control.dmastp, &buffer[0]);
dmaStreamSetMemory1(dma_control.dmastp, &buffer[DMA_SEGMENT_SIZE]);
dmaStreamSetTransactionSize(dma_control.dmastp, DMA_SEGMENT_SIZE);
/*
* Calculate the number of whole buffers.
* TODO: Make this include remainder memory as partial buffer?
*/
dma_control.dbm_index = (size / DMA_SEGMENT_SIZE);
if(dma_control.dbm_index < 2) {
OV5640_UnlockResourcesForCapture();
TRACE_ERROR("CAM > Capture buffer less than 2 DMA segment segments");
return 0;
}
#else
dmaStreamSetMemory0(dmastp, buffer);
dmaStreamSetTransactionSize(dma_control.dmastp, size);
@ -1156,15 +1162,14 @@ uint32_t OV5640_Capture(uint8_t* buffer, uint32_t size) {
#endif
// Wait for capture to be finished
uint8_t timout = 50; // 500ms max
uint8_t timeout = 50; // 500ms max
do {
chThdSleep(TIME_MS2I(10));
} while(!dma_control.capture && !dma_control.dma_error && --timout);
} while(!dma_control.capture && !dma_control.dma_error && --timeout);
palDisableLineEvent(LINE_CAM_VSYNC);
if(!timout) {
TRACE_ERROR("CAM > Image sampling timeout");
if(!timeout) {
dma_control.dma_count = dma_stop(dma_control.dmastp);
dma_control.timer->DIER &= ~TIM_DIER_CC1DE;
dma_control.dma_error = true;
@ -1193,7 +1198,7 @@ uint32_t OV5640_Capture(uint8_t* buffer, uint32_t size) {
error = 0x5;
return 0;
}
TRACE_ERROR("CAM > Unexpected DMA error %x", dma_control.dma_flags);
TRACE_ERROR("CAM > DMA image capture timeout");
return 0;
}
TRACE_INFO("CAM > Capture success");

Wyświetl plik

@ -33,7 +33,7 @@
#define AFSK_SPACE_FREQUENCY 2200U
/* Thread working area size. */
#define PKT_AFSK_DECODER_WA_SIZE 1024
#define PKT_AFSK_DECODER_WA_SIZE (1024 * 2)
/* AFSK decoder type selection. */
#define AFSK_NULL_DECODE 0

Wyświetl plik

@ -895,7 +895,7 @@ static bool transmit_image_packet(const uint8_t *image,
}
/**
* Callback to throttle image send.
* Callback used to throttle image send.
* Next packet (or burst) is readied.
*/
static void image_packet_send_complete(void) {
@ -904,9 +904,9 @@ static void image_packet_send_complete(void) {
return;
}
/*
/**
* Transmit image packets.
* Return true if no SSDV encoding error or false on encoding error.
* Return true if no encoding, TX or memory error.
*/
static bool transmit_image_packets(const uint8_t *image,
uint32_t image_len,
@ -916,8 +916,10 @@ static bool transmit_image_packets(const uint8_t *image,
uint8_t pkt[SSDV_PKT_SIZE];
uint8_t pkt_base91[256] = {0};
/* FIXME: This doesn't work with burst mode packet sends. */
// Process redundant transmission from last cycle
/**
* @brief Process redundant transmission from last cycle
* @note If redundant send is used packet burst mode is disabled.
*/
if(strlen((char*)pkt_base91)
&& conf->redundantTx) {
packet_t packet = aprs_encode_data_packet(conf->call, conf->path,
@ -951,14 +953,12 @@ static bool transmit_image_packets(const uint8_t *image,
ssdv_enc_set_buffer(&ssdv, pkt);
ssdv_enc_feed(&ssdv, image, 0);
//chBSemObjectInit(&tx_complete, false);
while(c != SSDV_EOI) {
TRACE_DEBUG("IMG > Get encode/transmit semaphore");
/* Get the semaphore for encode and TX. */
if(chBSemWait(&tx_complete) == MSG_RESET)
break;
return false;
/*
* Next encode packets.
* Packet burst send is available if redundant TX is not requested.