X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fkernel%2Fao_telemetry.c;h=99fc45348347410fd5c8835114122a0a8d0d147a;hb=HEAD;hp=9f98ea002187e03308f5346ab707a6ef9a579b1d;hpb=4ff9f3271f9d20603626c18ee16b20e50c579ddf;p=fw%2Faltos diff --git a/src/kernel/ao_telemetry.c b/src/kernel/ao_telemetry.c index 9f98ea00..8586efd5 100644 --- a/src/kernel/ao_telemetry.c +++ b/src/kernel/ao_telemetry.c @@ -58,7 +58,7 @@ static AO_TICK_TYPE ao_aprs_time; #define AO_SEND_MEGA 1 #endif -#if defined (TELEMETRUM_V_2_0) || defined (TELEMETRUM_V_3_0) +#if defined (TELEMETRUM_V_2_0) || defined (TELEMETRUM_V_3_0) || defined (TELEMETRUM_V_4_0) #define AO_SEND_METRUM 1 #endif @@ -142,6 +142,8 @@ ao_send_mega_sensor(void) #if AO_LOG_NORMALIZED #if AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_5 telemetry.generic.type = AO_TELEMETRY_MEGA_NORM_MPU6000_MMC5983; +#elif AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_6 + telemetry.generic.type = AO_TELEMETRY_MEGA_NORM_BMI088_MMC5983; #else #error unknown normalized log type #endif @@ -153,7 +155,7 @@ ao_send_mega_sensor(void) telemetry.mega_norm.pres = ao_data_pres(packet); telemetry.mega_norm.temp = ao_data_temp(packet); -#if HAS_MPU6000 +#ifdef ao_data_along telemetry.mega_norm.accel_along = ao_data_along(packet); telemetry.mega_norm.accel_across = ao_data_across(packet); telemetry.mega_norm.accel_through = ao_data_through(packet); @@ -163,7 +165,7 @@ ao_send_mega_sensor(void) telemetry.mega_norm.gyro_yaw = ao_data_yaw(packet); #endif -#if HAS_MMC5983 +#ifdef ao_data_mag_along telemetry.mega_norm.mag_along = ao_data_mag_along(packet); telemetry.mega_norm.mag_across = ao_data_mag_across(packet); telemetry.mega_norm.mag_through = ao_data_mag_through(packet); @@ -639,45 +641,47 @@ ao_telemetry_set_interval(uint16_t interval) interval = min_interval[ao_config.radio_rate]; #endif ao_telemetry_interval = interval; + if (interval) { #if AO_SEND_MEGA - if (interval > 1) - ao_telemetry_mega_data_max = 1; - else - ao_telemetry_mega_data_max = 2; - if (ao_telemetry_mega_data_max > cur) - cur++; - ao_telemetry_mega_data_cur = cur; + if (interval > 1) + ao_telemetry_mega_data_max = 1; + else + ao_telemetry_mega_data_max = 2; + if (ao_telemetry_mega_data_max > cur) + cur++; + ao_telemetry_mega_data_cur = cur; #endif #if AO_SEND_METRUM - ao_telemetry_metrum_data_max = (int16_t) (AO_SEC_TO_TICKS(1) / interval); - if (ao_telemetry_metrum_data_max > cur) - cur++; - ao_telemetry_metrum_data_cur = cur; + ao_telemetry_metrum_data_max = (int16_t) (AO_SEC_TO_TICKS(1) / interval); + if (ao_telemetry_metrum_data_max > cur) + cur++; + ao_telemetry_metrum_data_cur = cur; #endif #if HAS_COMPANION - if (!ao_companion_setup.update_period) - ao_companion_setup.update_period = AO_SEC_TO_TICKS(1); - ao_telemetry_companion_max = (int16_t) (ao_companion_setup.update_period / interval); - if (ao_telemetry_companion_max > cur) - cur++; - ao_telemetry_companion_cur = cur; + if (!ao_companion_setup.update_period) + ao_companion_setup.update_period = AO_SEC_TO_TICKS(1); + ao_telemetry_companion_max = (int16_t) (ao_companion_setup.update_period / interval); + if (ao_telemetry_companion_max > cur) + cur++; + ao_telemetry_companion_cur = cur; #endif #if HAS_GPS - ao_telemetry_gps_max = (int16_t) (AO_SEC_TO_TICKS(1) / interval); - if (ao_telemetry_gps_max > cur) - cur++; - ao_telemetry_loc_cur = cur; - if (ao_telemetry_gps_max > cur) - cur++; - ao_telemetry_sat_cur = cur; -#endif - - ao_telemetry_config_max = (int16_t) (AO_SEC_TO_TICKS(5) / interval); - if (ao_telemetry_config_max > cur) - cur++; - ao_telemetry_config_cur = cur; + ao_telemetry_gps_max = (int16_t) (AO_SEC_TO_TICKS(1) / interval); + if (ao_telemetry_gps_max > cur) + cur++; + ao_telemetry_loc_cur = cur; + if (ao_telemetry_gps_max > cur) + cur++; + ao_telemetry_sat_cur = cur; +#endif + + ao_telemetry_config_max = (int16_t) (AO_SEC_TO_TICKS(5) / interval); + if (ao_telemetry_config_max > cur) + cur++; + ao_telemetry_config_cur = cur; + } #ifndef SIMPLIFY ao_telemetry_time =