diff --git a/src/config.h b/src/config.h index 12dfd5e..4feb566 100644 --- a/src/config.h +++ b/src/config.h @@ -1,9 +1,26 @@ #ifndef __CONFIG_H #define __CONFIG_H +// Experimental support for Graw DFM-17 radiosondes added! Please test and report any issues! +// WARNING: Using a DFM-17 as a primary flight tracker is NOT recommended yet! +// NOTE: DFM-17 radiosondes require a GPS lock (and clear visibility to the sky) to calibrate its internal oscillator. +// DFM-17 transmissions, especially APRS, may not decode correctly because of incorrect timing before the internal oscillator has been calibrated. + +// Define radiosonde type. Remove the "//" comment to select either RS41 or DFM17. +//#define RS41 +//#define DFM17 + +#if !defined(RS41) && !defined(DFM17) +#error "No hardware type specified. Please define RS41 or DFM17." +#endif +#if defined(RS41) && defined(DFM17) +#error "Please define either RS41 or DFM17." +#endif + + // Enable semihosting to receive debug logs during development // See the README for details on how to set up debugging and debug logs with GDB -// NOTE: Semihosting has to be disabled when the RS41 radiosonde is not connected to an STM32 programmer dongle, otherwise the firmware will not run. +// NOTE: Semihosting has to be disabled when the radiosonde is not connected to an STM32 programmer dongle, otherwise the firmware will not run. //#define SEMIHOSTING_ENABLE //#define LOGGING_ENABLE @@ -25,6 +42,49 @@ // Allow powering off the sonde by pressing the button for over a second (when the sonde is not transmitting) #define ALLOW_POWER_OFF false +// Number of character pairs to include in locator +#define LOCATOR_PAIR_COUNT_FULL 6 // max. 6 (12 characters WWL) + +// Delay after transmission for modes that do not use time synchronization. Zero delay allows continuous transmit mode for Horus V1 and V2. +#define RADIO_POST_TRANSMIT_DELAY_MS 1000 + +// Threshold for time-synchronized modes regarding how far from scheduled transmission time the transmission is still allowed +#define RADIO_TIME_SYNC_THRESHOLD_MS 2000 + +// Number of leap seconds to add to the raw GPS time reported by the GPS chip (see https://timetoolsltd.com/gps/what-is-gps-time/ for more info) +// This value is used by default, but if the received GPS data contains indication about leap seconds, that one is used instead. +#define GPS_TIME_LEAP_SECONDS 18 + +// Enable this setting to require 3D fix (altitude required, enable for airborne use), otherwise 2D fix is enough +#define GPS_REQUIRE_3D_FIX true + +// Enable this setting to make a cold start on the CPU if GPS-Fix missing longer then GPS_REBOOT_MISSING_GPS_FIX_SECONDS +#define GPS_REBOOT_MISSING_GPS_FIX_ENABLE false + +// If enabled above, define threschold how long a missing GPS-Fix before cold start (dont hold it to short) +#define GPS_REBOOT_MISSING_GPS_FIX_SECONDS 200 + +// Enable power-saving features of the GPS chip to save power. +// This option should be safe to enable, as it enters a selective power saving mode. +// If the GPS chip loses fix, it will enter a higher power state automatically. +// Note that power saving mode is only enabled after the GPS chip has acquired good GPS fix for the first time. +// It is not necessary to use power saving on short flights (e.g. less than 6 hours). +// Based on measurements Mark VK5QI, enabling this reduces power consumption by about 30-40 mA (~50%) to around 30-50 mA, +// where the consumption is 70-90 mA when power saving is not enabled and any radio transmitters are idle. +// See the README for details about power consumption. +#define GPS_POWER_SAVING_ENABLE false + +// Enable NMEA output from GPS via external serial port. This disables use of I²C bus (Si5351 and sensors) because the pins are shared. +#define GPS_NMEA_OUTPUT_VIA_SERIAL_PORT_ENABLE false + +#if (GPS_NMEA_OUTPUT_VIA_SERIAL_PORT_ENABLE) && ((RADIO_SI5351_ENABLE) || (SENSOR_BMP280_ENABLE)) +#error GPS NMEA output via serial port cannot be enabled simultaneously with the I2C bus. +#endif + +/** + * RS41 only: Global configuration (there is no I²C bus exposed in DFM-17) + */ + // Define the I²C bus clock speed in Hz. // The default of 100000 (= 100 kHz) should be used with the Si5351 clock generator to allow fast frequency changes. // Note that some BMP280 sensors may require decreasing the clock speed to 10000 (= 10 kHz) @@ -49,46 +109,6 @@ // Enable use of an externally connected I²C Si5351 clock generator chip for HF radio transmissions #define RADIO_SI5351_ENABLE false -// Number of character pairs to include in locator -#define LOCATOR_PAIR_COUNT_FULL 12 // max. 6 (12 characters WWL) - -// Delay after transmission for modes that do not use time synchronization. Zero delay allows continuous transmit mode for Horus V1 and V2. -#define RADIO_POST_TRANSMIT_DELAY_MS 1000 - -// Threshold for time-synchronized modes regarding how far from scheduled transmission time the transmission is still allowed -#define RADIO_TIME_SYNC_THRESHOLD_MS 4001 - -// Number of leap seconds to add to the raw GPS time reported by the GPS chip (see https://timetoolsltd.com/gps/what-is-gps-time/ for more info) -// This value is used by default, but if the received GPS data contains indication about leap seconds, that one is used instead. -#define GPS_TIME_LEAP_SECONDS 18 - -// Enable this setting to require 3D fix (altitude required, enable for airborne use), otherwise 2D fix is enough -#define GPS_REQUIRE_3D_FIX true - -// Enable this setting to make a cold start on the CPU if GPS-Fix missing longer then GPS_REBOOT_MISSING_GPS_FIX_SECONDS -#define GPS_REBOOT_MISSING_GPS_FIX_ENABLE true - -// If enabled above, define threschold how long a missing GPS-Fix before cold start (dont hold it to short) -#define GPS_REBOOT_MISSING_GPS_FIX_SECONDS 201 - - -// Enable power-saving features of the GPS chip to save power. -// This option should be safe to enable, as it enters a selective power saving mode. -// If the GPS chip loses fix, it will enter a higher power state automatically. -// Note that power saving mode is only enabled after the GPS chip has acquired good GPS fix for the first time. -// It is not necessary to use power saving on short flights (e.g. less than 6 hours). -// Based on measurements Mark VK5QI, enabling this reduces power consumption by about 30-40 mA (~50%) to around 30-50 mA, -// where the consumption is 70-90 mA when power saving is not enabled and any radio transmitters are idle. -// See the README for details about power consumption. -#define GPS_POWER_SAVING_ENABLE true - -// Enable NMEA output from GPS via external serial port. This disables use of I²C bus (Si5351 and sensors) because the pins are shared. -#define GPS_NMEA_OUTPUT_VIA_SERIAL_PORT_ENABLE false - -#if (GPS_NMEA_OUTPUT_VIA_SERIAL_PORT_ENABLE) && ((RADIO_SI5351_ENABLE) || (SENSOR_BMP280_ENABLE)) -#error GPS NMEA output via serial port cannot be enabled simultaneously with the I2C bus. -#endif - // Enable pulse counter via expansion header pin for use with devices like Geiger counters. // This disables the external I²C bus and the serial port as the expansion header pin 2 (I2C2_SDA (PB11) / UART3 RX) is used for pulse input. // Also changes the Horus 4FSK V2 data format and adds a custom data field for pulse count. @@ -117,7 +137,7 @@ #endif /** - * Built-in Si4032 radio chip transmission configuration + * RS41 only: Built-in Si4032 radio chip transmission configuration */ // Si4032 transmit power: 0..7 @@ -131,14 +151,14 @@ // The COUNT settings define the number of times that each type of transmission is repeated #define RADIO_SI4032_TX_CW false #define RADIO_SI4032_TX_CW_COUNT 1 -#define RADIO_SI4032_TX_PIP true -#define RADIO_SI4032_TX_PIP_COUNT 1 -#define RADIO_SI4032_TX_APRS false +#define RADIO_SI4032_TX_PIP false +#define RADIO_SI4032_TX_PIP_COUNT 6 +#define RADIO_SI4032_TX_APRS true #define RADIO_SI4032_TX_APRS_COUNT 2 #define RADIO_SI4032_TX_HORUS_V1 false #define RADIO_SI4032_TX_HORUS_V1_COUNT 1 #define RADIO_SI4032_TX_HORUS_V2 true -#define RADIO_SI4032_TX_HORUS_V2_COUNT 1 +#define RADIO_SI4032_TX_HORUS_V2_COUNT 6 // Continuous transmit mode can be enabled for *either* Horus V1 or V2, but not both. This disables all other transmission modes. // The continuous mode transmits Horus 4FSK preamble between transmissions @@ -148,17 +168,53 @@ // Transmit frequencies for the Si4032 transmitter modes #define RADIO_SI4032_TX_FREQUENCY_CW 432500000 -#define RADIO_SI4032_TX_FREQUENCY_PIP 434713000 +#define RADIO_SI4032_TX_FREQUENCY_PIP 432500000 #define RADIO_SI4032_TX_FREQUENCY_APRS_1200 432500000 // Use a frequency offset to place FSK tones slightly above the defined frequency for SSB reception #define RADIO_SI4032_TX_FREQUENCY_HORUS_V1 432501000 -#define RADIO_SI4032_TX_FREQUENCY_HORUS_V2 434713000 +#define RADIO_SI4032_TX_FREQUENCY_HORUS_V2 432501000 // Use a rotating alternate 2nd frequency for HORUS_V2 (not continously) #define RADIO_SI4032_TX_FREQUENCY2_HORUS_V2_ACTIV false #define RADIO_SI4032_TX_FREQUENCY2_HORUS_V2 437600000 + /** - * External Si5351 radio chip transmission configuration + * DFM-17 only: Built-in Si4063 radio chip transmission configuration + */ + +// Si4063 transmit power: 0..127 +// TODO: Document Si4063 transmit power levels +#define RADIO_SI4063_TX_POWER 127 + +// Which modes to transmit using the built-in Si4063 transmitter chip +// The COUNT settings define the number of times that each type of transmission is repeated +#define RADIO_SI4063_TX_CW false +#define RADIO_SI4063_TX_CW_COUNT 1 +#define RADIO_SI4063_TX_PIP false +#define RADIO_SI4063_TX_PIP_COUNT 6 +#define RADIO_SI4063_TX_APRS true +#define RADIO_SI4063_TX_APRS_COUNT 2 +#define RADIO_SI4063_TX_HORUS_V1 false +#define RADIO_SI4063_TX_HORUS_V1_COUNT 1 +#define RADIO_SI4063_TX_HORUS_V2 true +#define RADIO_SI4063_TX_HORUS_V2_COUNT 6 + +// Continuous transmit mode can be enabled for *either* Horus V1 or V2, but not both. This disables all other transmission modes. +// The continuous mode transmits Horus 4FSK preamble between transmissions +// to allow Horus receivers to keep frequency synchronization at all times, which improves reception. +#define RADIO_SI4063_TX_HORUS_V1_CONTINUOUS false +#define RADIO_SI4063_TX_HORUS_V2_CONTINUOUS false + +// Transmit frequencies for the Si4063 transmitter modes +#define RADIO_SI4063_TX_FREQUENCY_CW 432500000 +#define RADIO_SI4063_TX_FREQUENCY_PIP 432500000 +#define RADIO_SI4063_TX_FREQUENCY_APRS_1200 432500000 +// Use a frequency offset to place FSK tones slightly above the defined frequency for SSB reception +#define RADIO_SI4063_TX_FREQUENCY_HORUS_V1 432501000 +#define RADIO_SI4063_TX_FREQUENCY_HORUS_V2 432501000 + +/** + * RS41 only: External Si5351 radio chip transmission configuration */ // Si5351 transmit power: 0..3 @@ -246,6 +302,7 @@ */ #define HORUS_FREQUENCY_OFFSET_SI4032 0 +#define HORUS_FREQUENCY_OFFSET_SI4063 0 /** * Horus V1 4FSK mode settings (deprecated, please use Horus V2 mode) @@ -256,6 +313,7 @@ // Please request a new payload ID in GitHub according to the instructions at: https://github.com/projecthorus/horusdemodlib/wiki#how-do-i-transmit-it #define HORUS_V1_PAYLOAD_ID 0 #define HORUS_V1_BAUD_RATE_SI4032 100 +#define HORUS_V1_BAUD_RATE_SI4063 100 #define HORUS_V1_BAUD_RATE_SI5351 50 #define HORUS_V1_PREAMBLE_LENGTH 16 #define HORUS_V1_IDLE_PREAMBLE_LENGTH 32 @@ -273,8 +331,9 @@ // NOTE: Payload ID 256 (4FSKTEST-V2) is for testing purposes only, and should not be used on an actual flight. // Please request a new payload ID in GitHub according to the instructions at: https://github.com/projecthorus/horusdemodlib/wiki#how-do-i-transmit-it -#define HORUS_V2_PAYLOAD_ID 373 +#define HORUS_V2_PAYLOAD_ID 256 #define HORUS_V2_BAUD_RATE_SI4032 100 +#define HORUS_V2_BAUD_RATE_SI4063 100 #define HORUS_V2_BAUD_RATE_SI5351 50 #define HORUS_V2_PREAMBLE_LENGTH 16 #define HORUS_V2_IDLE_PREAMBLE_LENGTH 32 @@ -282,9 +341,9 @@ // Schedule transmission every N seconds, counting from beginning of an hour (based on GPS time). Set to zero to disable time sync. // See the README file for more detailed documentation about time sync and its offset setting -#define HORUS_V2_TIME_SYNC_SECONDS 60 +#define HORUS_V2_TIME_SYNC_SECONDS 0 // Delay transmission for an N second offset, counting from the scheduled time set with TIME_SYNC_SECONDS. -#define HORUS_V2_TIME_SYNC_OFFSET_SECONDS 1 +#define HORUS_V2_TIME_SYNC_OFFSET_SECONDS 0 /** * CW settings @@ -304,13 +363,13 @@ */ // Pip speed is defined as CW WPM, range 5 - 40 -#define PIP_SPEED_WPM 10 +#define PIP_SPEED_WPM 18 // Schedule transmission every N seconds, counting from beginning of an hour (based on GPS time). Set to zero to disable time sync. // See the README file for more detailed documentation about time sync and its offset setting -#define PIP_TIME_SYNC_SECONDS 60 +#define PIP_TIME_SYNC_SECONDS 0 // Delay transmission for an N second offset, counting from the scheduled time set with TIME_SYNC_SECONDS. -#define PIP_TIME_SYNC_OFFSET_SECONDS 31 +#define PIP_TIME_SYNC_OFFSET_SECONDS 0 /** * WSPR settings