diff --git a/.github/workflows/flash_analysis.yml b/.github/workflows/flash_analysis.yml index 143d54790c..7f126352ab 100644 --- a/.github/workflows/flash_analysis.yml +++ b/.github/workflows/flash_analysis.yml @@ -54,6 +54,7 @@ jobs: run: | make clean make distclean + make submodulesclean - name: If it's a PR checkout the base branch if: ${{ github.event.pull_request }} diff --git a/.github/workflows/sitl_tests.yml b/.github/workflows/sitl_tests.yml index 68e16bed71..813e78073b 100644 --- a/.github/workflows/sitl_tests.yml +++ b/.github/workflows/sitl_tests.yml @@ -118,7 +118,7 @@ jobs: PX4_HOME_LON: ${{matrix.config.longitude}} PX4_HOME_ALT: ${{matrix.config.altitude}} PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}} - run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 10 --abort-early --model ${{matrix.config.model}} --upload test/mavsdk_tests/configs/sitl.json --verbose --force-color + run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 10 --abort-early --model ${{matrix.config.model}} test/mavsdk_tests/configs/sitl.json --verbose --force-color timeout-minutes: 45 - name: Upload failed logs diff --git a/Tools/process_sensor_caldata.py b/Tools/process_sensor_caldata.py index e70ffc8878..c0c656e015 100755 --- a/Tools/process_sensor_caldata.py +++ b/Tools/process_sensor_caldata.py @@ -1656,9 +1656,9 @@ sensor_baro_0['pressure'] = median_filter(sensor_baro_0['pressure']) # fit data median_pressure = np.median(sensor_baro_0['pressure']) if noResample: - coef_baro_0_x = np.polyfit(temp_rel,100*(sensor_baro_0['pressure']-median_pressure),5) # convert from hPa to Pa + coef_baro_0_x = np.polyfit(temp_rel,(sensor_baro_0['pressure']-median_pressure),5) # pressure in Pascal else: - temperature, baro = resampleWithDeltaX(temp_rel,100*(sensor_baro_0['pressure']-median_pressure)) # convert from hPa to Pa + temperature, baro = resampleWithDeltaX(temp_rel,(sensor_baro_0['pressure']-median_pressure)) # pressure in Pascal coef_baro_0_x = np.polyfit(temperature,baro,5) baro_0_params['TC_B0_X5'] = coef_baro_0_x[0] @@ -1717,9 +1717,9 @@ if num_baros >= 2: # fit data median_pressure = np.median(sensor_baro_1['pressure']) if noResample: - coef_baro_1_x = np.polyfit(temp_rel,100*(sensor_baro_1['pressure']-median_pressure),5) # convert from hPa to Pa + coef_baro_1_x = np.polyfit(temp_rel,(sensor_baro_1['pressure']-median_pressure),5) # pressure in Pascal else: - temperature, baro = resampleWithDeltaX(temp_rel,100*(sensor_baro_1['pressure']-median_pressure)) # convert from hPa to Pa + temperature, baro = resampleWithDeltaX(temp_rel,(sensor_baro_1['pressure']-median_pressure)) # pressure in Pascal coef_baro_1_x = np.polyfit(temperature,baro,5) baro_1_params['TC_B1_X5'] = coef_baro_1_x[0] @@ -1778,9 +1778,9 @@ if num_baros >= 3: # fit data median_pressure = np.median(sensor_baro_2['pressure']) if noResample: - coef_baro_2_x = np.polyfit(temp_rel,100*(sensor_baro_2['pressure']-median_pressure),5) # convert from hPa to Pa + coef_baro_2_x = np.polyfit(temp_rel,(sensor_baro_2['pressure']-median_pressure),5) # pressure in Pascal else: - temperature, baro = resampleWithDeltaX(temp_rel,100*(sensor_baro_2['pressure']-median_pressure)) # convert from hPa to Pa + temperature, baro = resampleWithDeltaX(temp_rel,(sensor_baro_2['pressure']-median_pressure)) # pressure in Pascal coef_baro_2_x = np.polyfit(temperature,baro,5) baro_2_params['TC_B2_X5'] = coef_baro_2_x[0] @@ -1838,7 +1838,7 @@ if num_baros >= 4: # fit data median_pressure = np.median(sensor_baro_3['pressure']) - coef_baro_3_x = np.polyfit(temp_rel,100*(sensor_baro_3['pressure']-median_pressure),5) # convert from hPa to Pa + coef_baro_3_x = np.polyfit(temp_rel,(sensor_baro_3['pressure']-median_pressure),5) # pressure in Pascal baro_3_params['TC_B3_X5'] = coef_baro_3_x[0] baro_3_params['TC_B3_X4'] = coef_baro_3_x[1] baro_3_params['TC_B3_X3'] = coef_baro_3_x[2] diff --git a/boards/ark/can-gps/src/board_config.h b/boards/ark/can-gps/src/board_config.h index 723310472f..81f0394944 100644 --- a/boards/ark/can-gps/src/board_config.h +++ b/boards/ark/can-gps/src/board_config.h @@ -47,7 +47,7 @@ #define GPIO_BTN_SAFETY /* PB15 */ (GPIO_INPUT|GPIO_PULLDOWN|GPIO_PORTB|GPIO_PIN15) /* Safety LED */ -#define GPIO_LED_SAFETY /* PA1 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN1) +#define GPIO_LED_SAFETY /* PA1 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN1) /* Tone alarm output. */ #define TONE_ALARM_TIMER 2 /* timer 2 */ diff --git a/boards/auterion/fmu-v6s/default.px4board b/boards/auterion/fmu-v6s/default.px4board index 296f2db880..bcee3cb8cb 100644 --- a/boards/auterion/fmu-v6s/default.px4board +++ b/boards/auterion/fmu-v6s/default.px4board @@ -14,6 +14,7 @@ CONFIG_COMMON_DISTANCE_SENSOR=y CONFIG_DRIVERS_DSHOT=y CONFIG_DRIVERS_GNSS_SEPTENTRIO=y CONFIG_DRIVERS_GPS=y +CONFIG_DRIVERS_PPS_CAPTURE=y CONFIG_DRIVERS_IMU_BOSCH_BMI088=y CONFIG_BMI088_ACCELEROMETER_INT2=y CONFIG_COMMON_LIGHT=y diff --git a/boards/auterion/fmu-v6s/init/rc.board_defaults b/boards/auterion/fmu-v6s/init/rc.board_defaults index 012605bee3..a5e81c9825 100644 --- a/boards/auterion/fmu-v6s/init/rc.board_defaults +++ b/boards/auterion/fmu-v6s/init/rc.board_defaults @@ -19,6 +19,13 @@ param set-default SDLOG_BACKEND 2 # 200kOhm/10kOhm voltage divider on V_BAT param set-default BAT1_V_DIV 21 +# Uncomment to use PWM9 as Analog input +# param set-default PWM_MAIN_TIM2 -2 + +# Uncomment to use PWM10 as PPS input +# param set-default PWM_MAIN_TIM3 -2 +# param set-default PWM_MAIN_FUNC10 2064 + # Skynode: use the "custom participant", IP=10.41.10.1 config for uxrce_dds_client param set-default UXRCE_DDS_PTCFG 2 param set-default UXRCE_DDS_AG_IP 170461697 diff --git a/boards/auterion/fmu-v6s/nuttx-config/nsh/defconfig b/boards/auterion/fmu-v6s/nuttx-config/nsh/defconfig index eed622209e..2fa27f6758 100644 --- a/boards/auterion/fmu-v6s/nuttx-config/nsh/defconfig +++ b/boards/auterion/fmu-v6s/nuttx-config/nsh/defconfig @@ -238,9 +238,12 @@ CONFIG_STM32H7_SPI3_DMA_BUFFER=1024 CONFIG_STM32H7_SPI4=y CONFIG_STM32H7_SPI4_DMA=y CONFIG_STM32H7_SPI4_DMA_BUFFER=4096 -CONFIG_STM32H7_TIM12=y CONFIG_STM32H7_TIM1=y +CONFIG_STM32H7_TIM2=y CONFIG_STM32H7_TIM3=y +CONFIG_STM32H7_TIM4=y +CONFIG_STM32H7_TIM5=y +CONFIG_STM32H7_TIM8=y CONFIG_STM32H7_UART4=y CONFIG_STM32H7_UART5=y CONFIG_STM32H7_UART7=y diff --git a/boards/auterion/fmu-v6s/src/board_config.h b/boards/auterion/fmu-v6s/src/board_config.h index 0b2f3c9225..4e40de72eb 100644 --- a/boards/auterion/fmu-v6s/src/board_config.h +++ b/boards/auterion/fmu-v6s/src/board_config.h @@ -135,15 +135,14 @@ /* PWM Timers */ -#define BOARD_NUM_IO_TIMERS 2 -#define DIRECT_PWM_OUTPUT_CHANNELS 8 +/* 3 for PWM outputs, 1 for input capture */ +#define BOARD_NUM_IO_TIMERS 4 +/* 9 for PWM outputs, 1 for input capture */ +#define DIRECT_PWM_OUTPUT_CHANNELS 10 /* High-resolution timer */ -#define HRT_TIMER 8 /* use timer8 for the HRT */ -#define HRT_TIMER_CHANNEL 3 /* use capture/compare channel 3 */ - -#define HRT_PPM_CHANNEL /* T8C2 */ 2 /* use capture/compare channel 1 */ -#define GPIO_PPM_IN /* PC7 */ GPIO_TIM8_CH2IN_1 +#define HRT_TIMER 4 /* use timer4 for the HRT */ +#define HRT_TIMER_CHANNEL 1 /* use capture/compare channel 1 */ /* This board provides a DMA pool and APIs */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/auterion/fmu-v6s/src/timer_config.cpp b/boards/auterion/fmu-v6s/src/timer_config.cpp index 66311d38e2..a409137ef8 100644 --- a/boards/auterion/fmu-v6s/src/timer_config.cpp +++ b/boards/auterion/fmu-v6s/src/timer_config.cpp @@ -44,11 +44,17 @@ * TIM3_CH2 T FMU_CH6 * TIM3_CH3 T FMU_CH7 * TIM3_CH4 T FMU_CH8 + * + * TIM5_CH1 T FMU_CH9 + * + * TIM8_CH2 T FMU_CAP1 < Input Capture */ constexpr io_timers_t io_timers[MAX_IO_TIMERS] = { initIOTimer(Timer::Timer1, DMA{DMA::Index1}), initIOTimer(Timer::Timer3, DMA{DMA::Index1}), + initIOTimer(Timer::Timer5), + initIOTimer(Timer::Timer8), }; constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { @@ -60,6 +66,8 @@ constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { initIOTimerChannel(io_timers, {Timer::Timer3, Timer::Channel2}, {GPIO::PortB, GPIO::Pin5}), initIOTimerChannel(io_timers, {Timer::Timer3, Timer::Channel3}, {GPIO::PortB, GPIO::Pin0}), initIOTimerChannel(io_timers, {Timer::Timer3, Timer::Channel4}, {GPIO::PortC, GPIO::Pin9}), + initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel1}, {GPIO::PortA, GPIO::Pin0}), + initIOTimerChannelCapture(io_timers, {Timer::Timer8, Timer::Channel2}, {GPIO::PortC, GPIO::Pin7}), }; constexpr io_timers_channel_mapping_t io_timers_channel_mapping = diff --git a/boards/auterion/fmu-v6x/default.px4board b/boards/auterion/fmu-v6x/default.px4board index dece24a26f..84b4cbc57e 100644 --- a/boards/auterion/fmu-v6x/default.px4board +++ b/boards/auterion/fmu-v6x/default.px4board @@ -20,6 +20,7 @@ CONFIG_DRIVERS_DSHOT=y CONFIG_DRIVERS_GNSS_SEPTENTRIO=y CONFIG_DRIVERS_GPIO_MCP23009=y CONFIG_DRIVERS_GPS=y +CONFIG_DRIVERS_PPS_CAPTURE=y CONFIG_DRIVERS_IMU_BOSCH_BMI088=y CONFIG_DRIVERS_IMU_INVENSENSE_ICM20602=y CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y diff --git a/boards/auterion/fmu-v6x/src/board_config.h b/boards/auterion/fmu-v6x/src/board_config.h index c304153abf..671a1c3e5f 100644 --- a/boards/auterion/fmu-v6x/src/board_config.h +++ b/boards/auterion/fmu-v6x/src/board_config.h @@ -471,7 +471,7 @@ #define PX4_I2C_BUS_MTD 4,5 -#define BOARD_NUM_IO_TIMERS 5 +#define BOARD_NUM_IO_TIMERS 4 /* No CDCACM driver for this board, so this is manually defined for version.c * so that the px4_board_version reports the correct board id to the companion */ diff --git a/boards/auterion/fmu-v6x/src/timer_config.cpp b/boards/auterion/fmu-v6x/src/timer_config.cpp index 928f4916f0..a1c458d9eb 100644 --- a/boards/auterion/fmu-v6x/src/timer_config.cpp +++ b/boards/auterion/fmu-v6x/src/timer_config.cpp @@ -50,8 +50,6 @@ * TIM1_CH3 T SPI2_DRDY2_ISM330_INT2 < Capture or GPIO INT * TIM1_CH1 T SPIX_SYNC > Pulse or GPIO strobe * - * TIM2_CH3 T HEATER > PWM OUT or GPIO - * * TIM14_CH1 T BUZZER_1 - Driven by other driver * TIM8_CH1_IN T FMU_PPM_INPUT - Sampled byt HRT by other driver */ @@ -61,7 +59,6 @@ constexpr io_timers_t io_timers[MAX_IO_TIMERS] = { initIOTimer(Timer::Timer4, DMA{DMA::Index1}), initIOTimer(Timer::Timer12), initIOTimer(Timer::Timer1), - initIOTimer(Timer::Timer2), }; constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { diff --git a/boards/px4/fmu-v6c/neural.px4board b/boards/px4/fmu-v6c/neural.px4board index f54d152869..4fd951d324 100644 --- a/boards/px4/fmu-v6c/neural.px4board +++ b/boards/px4/fmu-v6c/neural.px4board @@ -20,7 +20,6 @@ CONFIG_DRIVERS_HEATER=y CONFIG_DRIVERS_IMU_BOSCH_BMI055=y CONFIG_DRIVERS_IMU_BOSCH_BMI088=y CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y -CONFIG_COMMON_INS=y CONFIG_COMMON_LIGHT=y CONFIG_COMMON_MAGNETOMETER=y CONFIG_COMMON_OPTICAL_FLOW=y diff --git a/docs/en/advanced_config/bootloader_update_from_betaflight.md b/docs/en/advanced_config/bootloader_update_from_betaflight.md index 8c6cd1c2ad..e2b17103db 100644 --- a/docs/en/advanced_config/bootloader_update_from_betaflight.md +++ b/docs/en/advanced_config/bootloader_update_from_betaflight.md @@ -85,7 +85,7 @@ Flight controllers that have bootloader PX4-Autopilot `make` targets, can build The list of controllers for which this applies can be obtained by running the following `make` command, and noting the `make` targets that end in `_bootloader` ``` -$make list_config_targets +$ make list_config_targets ... cuav_nora_bootloader diff --git a/src/drivers/barometer/ms5837/MS5837.cpp b/src/drivers/barometer/ms5837/MS5837.cpp index 933d3a1a32..4bd4d11c9a 100644 --- a/src/drivers/barometer/ms5837/MS5837.cpp +++ b/src/drivers/barometer/ms5837/MS5837.cpp @@ -332,14 +332,13 @@ int MS5837::_collect() } else { /* pressure calculation, result in Pa */ - int32_t P = (((raw * _SENS) >> 21) - _OFF) >> 13; - + int32_t pressure_pascal = ((((raw * _SENS) >> 21) - _OFF) >> 13) * 10; // publish sensor_baro_s sensor_baro{}; sensor_baro.timestamp_sample = timestamp_sample; sensor_baro.device_id = get_device_id(); - sensor_baro.pressure = P; + sensor_baro.pressure = pressure_pascal; sensor_baro.temperature = _last_temperature; sensor_baro.error_count = perf_event_count(_comms_errors); sensor_baro.timestamp = hrt_absolute_time(); diff --git a/src/drivers/gps/devices b/src/drivers/gps/devices index 0b9695881b..caf5158061 160000 --- a/src/drivers/gps/devices +++ b/src/drivers/gps/devices @@ -1 +1 @@ -Subproject commit 0b9695881bd1e8f830ab4538ab3acc0050019eba +Subproject commit caf5158061bd10e79c9f042abb62c86bc6f3e7a7 diff --git a/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp b/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp index 33ab49eb32..f6d575943e 100644 --- a/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp +++ b/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp @@ -108,26 +108,29 @@ void InternalCombustionEngineControl::Run() const hrt_abstime now = hrt_absolute_time(); - UserOnOffRequest user_request = UserOnOffRequest::Off; - switch (static_cast(_param_ice_on_source.get())) { case ICESource::ArmingState: { - if (vehicle_status.arming_state == vehicle_status_s::ARMING_STATE_ARMED) { - user_request = UserOnOffRequest::On; - } + _user_request = vehicle_status.arming_state == vehicle_status_s::ARMING_STATE_ARMED ? UserOnOffRequest::On : + UserOnOffRequest::Off; } break; case ICESource::Aux1: { if (manual_control_setpoint.aux1 > 0.5f) { - user_request = UserOnOffRequest::On; + _user_request = UserOnOffRequest::On; + + } else if (manual_control_setpoint.aux1 < -0.5f) { + _user_request = UserOnOffRequest::Off; } } break; case ICESource::Aux2: { if (manual_control_setpoint.aux2 > 0.5f) { - user_request = UserOnOffRequest::On; + _user_request = UserOnOffRequest::On; + + } else if (manual_control_setpoint.aux2 < -0.5f) { + _user_request = UserOnOffRequest::Off; } } break; @@ -137,7 +140,7 @@ void InternalCombustionEngineControl::Run() case State::Stopped: { controlEngineStop(); - if (user_request == UserOnOffRequest::On && !maximumAttemptsReached()) { + if (_user_request == UserOnOffRequest::On && !maximumAttemptsReached()) { _state = State::Starting; _state_start_time = now; @@ -148,7 +151,7 @@ void InternalCombustionEngineControl::Run() case State::Starting: { - if (user_request == UserOnOffRequest::Off) { + if (_user_request == UserOnOffRequest::Off) { _state = State::Stopped; _starting_retry_cycle = 0; PX4_INFO("ICE: Stopped"); @@ -196,7 +199,7 @@ void InternalCombustionEngineControl::Run() case State::Running: { controlEngineRunning(throttle_in); - if (user_request == UserOnOffRequest::Off) { + if (_user_request == UserOnOffRequest::Off) { _state = State::Stopped; _starting_retry_cycle = 0; PX4_INFO("ICE: Stopped"); @@ -217,7 +220,7 @@ void InternalCombustionEngineControl::Run() case State::Fault: { - if (user_request == UserOnOffRequest::Off) { + if (_user_request == UserOnOffRequest::Off) { _state = State::Stopped; _starting_retry_cycle = 0; PX4_INFO("ICE: Stopped"); @@ -243,10 +246,10 @@ void InternalCombustionEngineControl::Run() _throttle_control_slew_rate.setForcedValue(0.f); } - publishControl(now, user_request); + publishControl(now); } -void InternalCombustionEngineControl::publishControl(const hrt_abstime now, const UserOnOffRequest user_request) +void InternalCombustionEngineControl::publishControl(const hrt_abstime now) { internal_combustion_engine_control_s ice_control{}; ice_control.timestamp = now; @@ -254,7 +257,7 @@ void InternalCombustionEngineControl::publishControl(const hrt_abstime now, cons ice_control.ignition_on = _ignition_on; ice_control.starter_engine_control = _starter_engine_control; ice_control.throttle_control = _throttle_control; - ice_control.user_request = static_cast(user_request); + ice_control.user_request = static_cast(_user_request); _internal_combustion_engine_control_pub.publish(ice_control); internal_combustion_engine_status_s ice_status; diff --git a/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.hpp b/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.hpp index 01884e4967..ad9feafec6 100644 --- a/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.hpp +++ b/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.hpp @@ -102,7 +102,7 @@ private: enum class UserOnOffRequest { Off, On - }; + } _user_request{UserOnOffRequest::Off}; enum class ICESource { ArmingState, @@ -126,7 +126,7 @@ private: void controlEngineStartup(const hrt_abstime now); void controlEngineFault(); bool maximumAttemptsReached(); - void publishControl(const hrt_abstime now, const UserOnOffRequest user_request); + void publishControl(const hrt_abstime now); // Starting state specifics static constexpr float DELAY_BEFORE_RESTARTING{1.f}; diff --git a/src/modules/simulation/sensor_baro_sim/SensorBaroSim.cpp b/src/modules/simulation/sensor_baro_sim/SensorBaroSim.cpp index fc70998e9a..e7dd2bd991 100644 --- a/src/modules/simulation/sensor_baro_sim/SensorBaroSim.cpp +++ b/src/modules/simulation/sensor_baro_sim/SensorBaroSim.cpp @@ -155,7 +155,7 @@ void SensorBaroSim::Run() _baro_drift_pa += _baro_drift_pa_per_sec * dt; const float absolute_pressure_noisy = absolute_pressure + abs_pressure_noise + _baro_drift_pa; - // convert to hPa + // Apply pressure offset float pressure = absolute_pressure_noisy + _sim_baro_off_p.get(); // calculate temperature in Celsius diff --git a/src/modules/temperature_compensation/temperature_calibration/baro.cpp b/src/modules/temperature_compensation/temperature_calibration/baro.cpp index 7cee4739df..1bc0a2f98b 100644 --- a/src/modules/temperature_compensation/temperature_calibration/baro.cpp +++ b/src/modules/temperature_compensation/temperature_calibration/baro.cpp @@ -96,7 +96,7 @@ int TemperatureCalibrationBaro::update_sensor_instance(PerSensorData &data, int data.device_id = baro_data.device_id; - data.sensor_sample_filt[0] = 100.0f * baro_data.pressure; // convert from hPA to Pa + data.sensor_sample_filt[0] = baro_data.pressure; data.sensor_sample_filt[1] = baro_data.temperature;