Fixed logging error

Made camera sampling faster (reduced SYSCLK)
Develop
Sven Steudte 2017-06-22 17:21:13 +02:00
rodzic c41374ff64
commit 60a8d820b7
6 zmienionych plików z 40 dodań i 41 usunięć

Wyświetl plik

@ -178,7 +178,7 @@ void start_user_modules(void)
config[0].frequency.hz = 144800000; // Default frequency 144.800 MHz
config[0].init_delay = 0; // Module startup delay in msec
config[0].trigger.type = TRIG_NEW_POINT; // Trigger when new track point released
chsnprintf(config[0].aprs_conf.callsign, 6, "DO7EN"); // APRS Callsign
chsnprintf(config[0].aprs_conf.callsign, 6, "DL7AD"); // APRS Callsign
config[0].aprs_conf.ssid = 12; // APRS SSID
config[0].aprs_conf.symbol = SYM_BALLOON; // APRS Symbol
chsnprintf(config[0].aprs_conf.path, 16, "WIDE1-1"); // APRS Path
@ -238,14 +238,13 @@ void start_user_modules(void)
config[3].frequency.type = FREQ_APRS_REGION; // Dynamic frequency allocation
config[3].frequency.hz = 144800000; // Transmission frequency 144.800 MHz
config[3].init_delay = 2000; // Module startup delay in msec
config[3].packet_spacing = 60000; // Packet spacing in ms
config[3].packet_spacing = 20000; // Packet spacing in ms
config[3].trigger.type = TRIG_TIMEOUT; // Trigger transmission on timeout (Periodic cycling)
config[3].trigger.timeout = 10; // Timeout 10 sec
chsnprintf(config[3].aprs_conf.callsign, 6, "DO7EN"); // APRS Callsign
chsnprintf(config[3].aprs_conf.callsign, 6, "DL7AD"); // APRS Callsign
config[3].aprs_conf.ssid = 12; // APRS SSID
chsnprintf(config[3].aprs_conf.path, 16, "WIDE1-1"); // APRS Path
config[3].aprs_conf.preamble = 300; // APRS Preamble
chsnprintf(config[3].ssdv_conf.callsign, 6, "DO7EN"); // SSDV Callsign
chsnprintf(config[3].ssdv_conf.callsign, 6, "DL7AD"); // SSDV Callsign
config[3].ssdv_conf.ram_buffer = ssdv_buffer; // Camera buffer
config[3].ssdv_conf.ram_size = sizeof(ssdv_buffer); // Buffer size
config[3].ssdv_conf.res = RES_QVGA; // Resolution VGA
@ -274,10 +273,10 @@ void start_user_modules(void)
config[5].init_delay = 4000; // Module startup delay in msec
config[5].trigger.type = TRIG_TIMEOUT; // Trigger transmission on timeout (Periodic cycling)
config[5].trigger.timeout = 2; // Timeout 10 sec
chsnprintf(config[5].aprs_conf.callsign, 6, "DO7EN"); // APRS Callsign
chsnprintf(config[5].aprs_conf.callsign, 6, "DL7AD"); // APRS Callsign
config[5].aprs_conf.ssid = 12; // APRS SSID
config[5].aprs_conf.preamble = 50; // APRS Preamble
chsnprintf(config[5].ssdv_conf.callsign, 6, "DO7EN"); // SSDV Callsign
chsnprintf(config[5].ssdv_conf.callsign, 6, "DL7AD"); // SSDV Callsign
config[5].ssdv_conf.ram_buffer = ssdv_buffer2; // Camera buffer
config[5].ssdv_conf.ram_size = sizeof(ssdv_buffer2); // Buffer size
config[5].ssdv_conf.res = RES_QVGA; // Resolution XGA
@ -311,7 +310,7 @@ void start_user_modules(void)
config[8].init_delay = 10000; // Module startup delay in msec
config[8].trigger.type = TRIG_TIMEOUT; // Trigger transmission on timeout (Periodic cycling)
config[8].trigger.timeout = 600; // Timeout 600 sec
chsnprintf(config[8].aprs_conf.callsign, 6, "DO7EN"); // APRS Callsign
chsnprintf(config[8].aprs_conf.callsign, 6, "DL7AD"); // APRS Callsign
config[8].aprs_conf.ssid = 12; // APRS SSID
chsnprintf(config[8].aprs_conf.path, 16, "WIDE1-1"); // APRS Path
config[8].aprs_conf.preamble = 500; // APRS Preamble

Wyświetl plik

@ -10,7 +10,7 @@
//extern module_conf_t config[9];
#define TRACK_CYCLE_TIME 60 /* Tracking cycle (all peripheral data [airpressure, GPS, temperature, ...] is collected each x seconds */
#define TRACK_CYCLE_TIME 180 /* Tracking cycle (all peripheral data [airpressure, GPS, temperature, ...] is collected each x seconds */
#define LOG_CYCLE_TIME 1800 /* Log cycle time in seconds */

Wyświetl plik

@ -312,7 +312,7 @@ static const struct regval_list ov2640_init_regs[] = {
{ 0x2e, 0xdf },
{ BANK_SEL, BANK_SEL_SENS },
{ 0x3c, 0x32 },
{ CLKRC, CLKRC_DIV_SET(2) },
{ CLKRC, CLKRC_DIV_SET(3) },
{ COM2, COM2_OCAP_Nx_SET(3) },
{ REG04, REG04_DEF | REG04_HREF_EN },
{ COM8, COM8_DEF | COM8_AGC_EN | COM8_AEC_EN | COM8_BNDF_EN },
@ -631,9 +631,8 @@ static const struct regval_list ov2640_jpeg_regs[] = {
ENDMARKER,
};
bool ov2640_samplingFinished;
ssdv_conf_t *ov2640_conf;
uint32_t size;
/**
* Captures an image from the camera.
@ -649,18 +648,12 @@ bool OV2640_Snapshot2RAM(void)
bool OV2640_BufferOverflow(void)
{
return OV2640_getBuffer(NULL) > ov2640_conf->ram_size-3;
return ov2640_conf->ram_buffer[0] != 0xFF || ov2640_conf->ram_buffer[1] != 0xD8; // Check for JPEG SOI header
}
uint32_t OV2640_getBuffer(uint8_t** buffer) {
*buffer = ov2640_conf->ram_buffer;
// Detect size
uint32_t size = ov2640_conf->ram_size;
while(!ov2640_conf->ram_buffer[size-1])
size--;
return size;
return ov2640_conf->size_sampled;
}
void OV2640_Capture(void)
@ -671,23 +664,29 @@ void OV2640_Capture(void)
while(palReadLine(LINE_CAM_VSYNC));
while(!palReadLine(LINE_CAM_VSYNC));
uint32_t i=0;
while(palReadLine(LINE_CAM_VSYNC))
uint8_t gpioc;
uint8_t gpioa;
ov2640_conf->size_sampled = 0;
while(true)
{
if(!palReadLine(LINE_CAM_HREF))
continue;
do {
gpioc = GPIOC->IDR & 0x7;
} while((gpioc & 0x1) != 0x1); // Wait for PCLK to rise
while(!palReadLine(LINE_CAM_PCLK));
// We've got a rising edge
gpioa = GPIOA->IDR;
ov2640_conf->ram_buffer[i++] = (uint8_t)GPIOA->IDR;
switch(gpioc) {
case 0x3:
break;
case 0x7:
ov2640_conf->ram_buffer[ov2640_conf->size_sampled++] = gpioa;
break;
default:
return;
}
// Wait for falling edge
while(palReadLine(LINE_CAM_PCLK));
}
if(i > 1000)
{
return;
while(GPIOC->IDR & 0x1);
}
}
}

Wyświetl plik

@ -46,15 +46,15 @@
#define STM32_PLLSRC STM32_PLLSRC_HSE
#define STM32_PLLM_VALUE 26
#define STM32_PLLN_VALUE 192
#define STM32_PLLP_VALUE 2
#define STM32_PLLP_VALUE 4
#define STM32_PLLQ_VALUE 4
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE1 STM32_PPRE1_DIV2
#define STM32_PPRE2 STM32_PPRE2_DIV1
#define STM32_PPRE1 STM32_PPRE1_DIV4
#define STM32_PPRE2 STM32_PPRE2_DIV4
#define STM32_RTCSEL STM32_RTCSEL_LSI
#define STM32_RTCPRE_VALUE 8
#define STM32_MCO1SEL STM32_MCO1SEL_HSE
#define STM32_MCO1PRE STM32_MCO1PRE_DIV3
#define STM32_MCO1PRE STM32_MCO1PRE_DIV4
#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
#define STM32_I2SSRC STM32_I2SSRC_CKIN

Wyświetl plik

@ -276,7 +276,7 @@ static bool getLastLog(trackPoint_t* last)
}
if(last_address) {
flashRead(last_address, (char*)&last, sizeof(trackPoint_t));
flashRead(last_address, (char*)last, sizeof(trackPoint_t));
return true;
} else {
return false;
@ -321,11 +321,11 @@ static void writeLogTrackPoint(trackPoint_t* tp)
// Write data into flash
TRACE_INFO("TRAC > Flash write (ADDR=%08x)", address);
flashSectorBegin(flashSectorAt(address));
flashWrite(address, (char*)&tp, sizeof(trackPoint_t));
flashWrite(address, (char*)tp, sizeof(trackPoint_t));
flashSectorEnd(flashSectorAt(address));
// Verify
if(flashCompare(address, (char*)&tp, sizeof(trackPoint_t)))
if(flashCompare(address, (char*)tp, sizeof(trackPoint_t)))
TRACE_INFO("TRAC > Flash write OK")
else
TRACE_ERROR("TRAC > Flash write failed");

Wyświetl plik

@ -114,8 +114,9 @@ typedef struct {
char callsign[8]; // Callsign
resolution_t res; // Camera resolution
uint8_t quality; // JPEG quality
uint8_t *ram_buffer; // Camera Buffer (do not set in config)
size_t ram_size; // Size of buffer (do not set in config)
uint8_t *ram_buffer; // Camera Buffer
uint16_t ram_size; // Size of buffer
uint16_t size_sampled; // Actual image data size (do not set in config)
bool no_camera; // Camera disabled
bool redundantTx; // Redundand packet transmission (APRS only)
} ssdv_conf_t;