diff --git a/tracker/software/config.c b/tracker/software/config.c index 906350f..fdc9b48 100644 --- a/tracker/software/config.c +++ b/tracker/software/config.c @@ -237,7 +237,7 @@ 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 = 0; // Module startup delay in msec - config[3].packet_spacing = 10000; // Packet spacing in ms + config[3].packet_spacing = 20000; // Packet spacing in ms //config[3].sleep_conf.type = SLEEP_WHEN_ISOL_BELOW_THRES; //config[3].sleep_conf.isol_thres = 3; config[3].trigger.type = TRIG_CONTINUOUSLY; // Continuous Trigger diff --git a/tracker/software/config.h b/tracker/software/config.h index 8ffbbb1..2c34167 100644 --- a/tracker/software/config.h +++ b/tracker/software/config.h @@ -8,18 +8,18 @@ #include "radio.h" #include "sleep.h" -#define TRACK_CYCLE_TIME 60 /* Tracking cycle (all peripheral data [airpressure, GPS, temperature, ...] is collected each x seconds */ +#define TRACK_CYCLE_TIME 120 /* Tracking cycle (all peripheral data [airpressure, GPS, temperature, ...] is collected each x seconds */ #define LOG_CYCLE_TIME 30 /* Log cycle time in seconds */ #define LOG_FLASH_ADDR1 0x080C0000 /* Log flash memory address 1 */ #define LOG_FLASH_ADDR2 0x080E0000 /* Log flash memory address 2 */ #define LOG_SECTOR_SIZE 0x20000 /* Log flash memory size */ -#define GPS_ON_VBAT 4000 /* Battery voltage threshold at which GPS is switched on */ -#define GPS_OFF_VBAT 3500 /* Battery voltage threshold at which GPS is switched off */ +#define GPS_ON_VBAT 3500 /* Battery voltage threshold at which GPS is switched on */ +#define GPS_OFF_VBAT 3000 /* Battery voltage threshold at which GPS is switched off */ #define TRACE_TIME TRUE /* Enables time tracing on debugging port */ -#define TRACE_FILE TRUE /* Enables file and line tracing on debugging port */ +#define TRACE_FILE FALSE /* Enables file and line tracing on debugging port */ #define RUN_3V TRUE /* Lets the tracker run a 3V otherwise 1.8V. 3V is needed to do 20dBm radio output power. * With 1.8V only 15dBm can be done. Some serial-USB adapters also need a 3V IO level in diff --git a/tracker/software/debug.h b/tracker/software/debug.h index 456e5e9..daf7693 100644 --- a/tracker/software/debug.h +++ b/tracker/software/debug.h @@ -73,21 +73,6 @@ extern bool debug_on_usb; #define TRACE_TAB " " #endif -#define TRACE_GPSFIX(fix) { \ - TRACE_INFO("GPS > New GPS Fix\r\n"\ - "%s GPS Time: %04d-%02d-%02d %02d:%02d:%02d\r\n" \ - "%s Sats: %d (used for solution)\r\n" \ - "%s Latitude: %d.%07ddeg\r\n" \ - "%s Longitude: %d.%07ddeg\r\n" \ - "%s Altitude: %d Meter", \ - TRACE_TAB, (fix)->time.year, (fix)->time.month, (fix)->time.day, (fix)->time.hour, (fix)->time.minute, (fix)->time.second, \ - TRACE_TAB, (fix)->num_svs, \ - TRACE_TAB, (fix)->lat/10000000, ((fix)->lat > 0 ? 1:-1)*(fix)->lat%10000000, \ - TRACE_TAB, (fix)->lon/10000000, ((fix)->lon > 0 ? 1:-1)*(fix)->lon%10000000, \ - TRACE_TAB, (fix)->alt \ - ); \ -} - #define TRACE_BIN(data, len) { \ chMtxLock(&trace_mtx); \ chprintf((BaseSequentialStream*)&SD3, "[%8d.%03d][DEBUG] ", chVTGetSystemTimeX()/CH_CFG_ST_FREQUENCY, (chVTGetSystemTimeX()*1000/CH_CFG_ST_FREQUENCY)%1000); \ diff --git a/tracker/software/drivers/ublox.c b/tracker/software/drivers/ublox.c index f70129e..774c91e 100644 --- a/tracker/software/drivers/ublox.c +++ b/tracker/software/drivers/ublox.c @@ -188,8 +188,6 @@ bool gps_get_fix(gpsFix_t *fix) { return false; } - TRACE_INFO("GPS > PVT Polling OK"); - fix->num_svs = response[23]; fix->type = response[20]; @@ -217,6 +215,12 @@ bool gps_get_fix(gpsFix_t *fix) { fix->alt = (uint16_t)alt_tmp; } + TRACE_INFO("GPS > PVT Polling OK time=%04d-%02d-%02d %02d:%02d:%02d lat=%d.%05d lon=%d.%05d alt=%dm sats=%d", + fix->time.year, fix->time.month, fix->time.day, fix->time.hour, fix->time.minute, fix->time.day, + fix->lat/10000000, (fix->lat > 0 ? 1:-1)*(fix->lat/100)%100000, fix->lon/10000000, (fix->lon > 0 ? 1:-1)*(fix->lon/100)%100000, + fix->alt, fix->num_svs + ); + return true; } diff --git a/tracker/software/modules/image.c b/tracker/software/modules/image.c index d184baa..dbdc777 100644 --- a/tracker/software/modules/image.c +++ b/tracker/software/modules/image.c @@ -16,7 +16,7 @@ #include "watchdog.h" #include "flash.h" -static uint8_t gimage_id; // Global image ID (for all image threads) +static uint8_t gimage_id = 2; // Global image ID (for all image threads) mutex_t camera_mtx; void encode_ssdv(uint8_t *image, uint32_t image_len, module_conf_t* conf, uint8_t image_id, bool redudantTx) diff --git a/tracker/software/modules/tracking.c b/tracker/software/modules/tracking.c index 6aa82d4..96b76ee 100644 --- a/tracker/software/modules/tracking.c +++ b/tracker/software/modules/tracking.c @@ -252,13 +252,15 @@ THD_FUNCTION(trackingThread, arg) { if(isGPSLocked(&gpsFix)) { // GPS locked // Switch off GPS (if cycle time is more than 60 seconds) - #if TRACK_CYCLE_TIME > 60 + #if TRACK_CYCLE_TIME >= 60 + TRACE_INFO("TRAC > Switch off GPS"); GPS_Deinit(); + #else + TRACE_INFO("TRAC > Keep GPS switched of because cycle < 60sec"); #endif // Debug TRACE_INFO("TRAC > GPS sampling finished GPS LOCK"); - TRACE_GPSFIX(&gpsFix); // Calibrate RTC setTime(gpsFix.time); @@ -332,13 +334,13 @@ THD_FUNCTION(trackingThread, arg) { // Trace data TRACE_INFO( "TRAC > New tracking point available (ID=%d)\r\n" "%s Time %04d-%02d-%02d %02d:%02d:%02d\r\n" - "%s Pos %d.%07d %d.%07d Alt %dm\r\n" + "%s Pos %d.%05d %d.%05d Alt %dm\r\n" "%s Sats %d TTFF %dsec\r\n" "%s ADC Vbat=%d.%03dV Vsol=%d.%03dV VUSB=%d.%03dV Pbat=%dmW Isol=%dmA\r\n" "%s AIR p=%6d.%01dPa T=%2d.%02ddegC phi=%2d.%01d%%", tp->id, TRACE_TAB, tp->time.year, tp->time.month, tp->time.day, tp->time.hour, tp->time.minute, tp->time.day, - TRACE_TAB, tp->gps_lat/10000000, (tp->gps_lat > 0 ? 1:-1)*tp->gps_lat%10000000, tp->gps_lon/10000000, (tp->gps_lon > 0 ? 1:-1)*tp->gps_lon%10000000, tp->gps_alt, + TRACE_TAB, tp->gps_lat/10000000, (tp->gps_lat > 0 ? 1:-1)*(tp->gps_lat/100)%100000, tp->gps_lon/10000000, (tp->gps_lon > 0 ? 1:-1)*(tp->gps_lon/100)%100000, tp->gps_alt, TRACE_TAB, tp->gps_sats, tp->gps_ttff, TRACE_TAB, tp->adc_vbat/1000, (tp->adc_vbat%1000), tp->adc_vsol/1000, (tp->adc_vsol%1000), tp->adc_vusb/1000, (tp->adc_vusb%1000), tp->adc_pbat, tp->adc_isol, TRACE_TAB, tp->air_press/10, tp->air_press%10, tp->air_temp/100, tp->air_temp%100, tp->air_hum/10, tp->air_hum%10