Fixed GPS startup error (GPS didnt start on first cycle)

Attempt to fix SD card error (not working yet)
Tidied up code
pull/1/head
Sven Steudte 2018-01-16 11:20:32 +01:00
rodzic a898181d3b
commit c746b1297b
6 zmienionych plików z 13 dodań i 31 usunięć

Wyświetl plik

@ -360,7 +360,7 @@
#include "chprintf.h"
// Global variables
systime_t track_cycle_time = S2ST(10); // Tracking cycle (all peripheral data [airpressure, GPS, temperature, ...] is collected each 60 seconds
systime_t track_cycle_time = S2ST(60); // Tracking cycle (all peripheral data [airpressure, GPS, temperature, ...] is collected each 60 seconds
bool keep_cam_switched_on = false; // Keep camera switched on and initialized, this makes image capturing faster but takes a lot of power over long time
uint16_t gps_on_vbat = 1000; // Battery voltage threshold at which GPS is switched on
uint16_t gps_off_vbat = 1000; // Battery voltage threshold at which GPS is switched off
@ -380,7 +380,7 @@ void start_user_modules(void)
/* -------------------------------------------------- POSITION TRANSMISSION -------------------------------------------------- */
// Module POSITION, APRS 2m AFSK
config[0].power = 20; // Transmission Power
config[0].power = 127; // Transmission Power
config[0].protocol = PROT_APRS_AFSK; // Protocol APRS (AFSK)
config[0].frequency.type = FREQ_APRS_REGION; // Dynamic frequency allocation
config[0].frequency.hz = 144800000; // Default frequency 144.800 MHz
@ -398,11 +398,11 @@ void start_user_modules(void)
/* ---------------------------------------------------- IMAGE TRANSMISSION --------------------------------------------------- */
// Module IMAGE, APRS 2m AFSK low-duty cycle
config[3].power = 1; // Transmission Power
config[3].power = 127; // Transmission Power
config[3].protocol = PROT_APRS_AFSK; // Protocol APRS/SSDV (AFSK)
config[3].frequency.type = FREQ_APRS_REGION; // Dynamic frequency allocation
config[3].frequency.hz = 144800000; // Transmission frequency 144.800 MHz
config[3].packet_spacing = 20000; // Packet spacing in ms
config[3].packet_spacing = 10000; // Packet spacing in ms
config[3].trigger.type = TRIG_CONTINUOUSLY; // Transmit continuously
chsnprintf(config[3].aprs_conf.callsign, 16, "DL7AD"); // APRS Callsign
config[3].aprs_conf.ssid = 14; // APRS SSID
@ -410,12 +410,12 @@ void start_user_modules(void)
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 QVGA
config[3].redundantTx = true; // Redundant transmission (transmit packets twice)
//config[3].redundantTx = true; // Redundant transmission (transmit packets twice)
config[3].ssdv_conf.quality = 4; // Image quality
//start_image_thread(&config[3]);
start_image_thread(&config[3]);
// Module IMAGE, APRS 2m 2FSK
config[4].power = 80; // Transmission Power
config[4].power = 127; // Transmission Power
config[4].protocol = PROT_APRS_2FSK; // Protocol APRS/SSDV (2FSK)
config[4].fsk_conf.speed = 9600; // 2FSK Speed
config[4].frequency.type = FREQ_STATIC; // Static frequency allocation

Wyświetl plik

@ -19,7 +19,7 @@ const SerialConfig uart_config =
mutex_t trace_mtx; // Used internal to synchronize multiple chprintf in debug.h
bool debug_on_usb = false;
bool debug_on_usb = true;
void debugOnUSB(BaseSequentialStream *chp, int argc, char *argv[])
{

Wyświetl plik

@ -25,14 +25,15 @@ bool initSD(void)
// Maximum speed SPI configuration
static SPIConfig hs_spicfg = {
.ssport = PAL_PORT(LINE_SD_CS),
.sspad = PAL_PAD(LINE_SD_CS)
.sspad = PAL_PAD(LINE_SD_CS),
.cr1 = SPI_CR1_MSTR
};
// Low speed SPI configuration
static SPIConfig ls_spicfg = {
.ssport = PAL_PORT(LINE_SD_CS),
.sspad = PAL_PAD(LINE_SD_CS),
.cr1 = SPI_CR1_BR_2 | SPI_CR1_BR_1
.cr1 = SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_MSTR
};
// MMC/SD over SPI driver configuration

Wyświetl plik

@ -28,25 +28,6 @@ int main(void) {
halInit(); // Startup HAL
chSysInit(); // Startup RTOS
/*// Clear Wakeup flag
PWR->CR |= PWR_CR_CWUF;
// Select STANDBY mode
PWR->CR |= PWR_CR_PDDS;
// Set SLEEPDEEP bit of Cortex System Control Register
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
// This option is used to ensure that store operations are completed
#if defined ( __CC_ARM )
__force_stores();
#endif
// Request Wait For Interrupt
__WFI();
while(1);*/
// Init debugging (Serial debug port, LEDs)
DEBUG_INIT();
TRACE_INFO("MAIN > Startup");

Wyświetl plik

@ -14,6 +14,6 @@ void start_essential_threads(void) {
pac1720_init(); // Initialize current measurement
init_tracking_manager(false); // Initialize tracking manager (without GPS, GPS is initialized if needed by position thread)
startReceiver(); // Start APRS receiver
chThdSleepMilliseconds(500); // Wait for tracking manager to initialize
chThdSleepMilliseconds(300); // Wait for tracking manager to initialize
}

Wyświetl plik

@ -361,7 +361,7 @@ THD_FUNCTION(trackingThread, arg) {
writeLogTrackPoint(lastTrackPoint);
// Wait for position threads to start
chThdSleepMilliseconds(100);
chThdSleepMilliseconds(500);
systime_t cycle_time = chVTGetSystemTimeX();
while(true)