Skip to content

Commit

Permalink
Setup SPI to support Lora module, make free space for lora sw,
Browse files Browse the repository at this point in the history
setup forwarding on nonconected mavlink, setup custom mavlink stream
  • Loading branch information
slimonslimon committed Nov 30, 2023
1 parent cad595c commit c0bfea7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion boards/px4/fmu-v5/default.px4board
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ CONFIG_MODULES_FW_ATT_CONTROL=y
CONFIG_MODULES_FW_AUTOTUNE_ATTITUDE_CONTROL=y
CONFIG_MODULES_FW_POS_CONTROL=y
CONFIG_MODULES_FW_RATE_CONTROL=y
CONFIG_MODULES_GIMBAL=y
#CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_GYRO_CALIBRATION=y
CONFIG_MODULES_LAND_DETECTOR=y
CONFIG_MODULES_LANDING_TARGET_ESTIMATOR=y
Expand Down
2 changes: 1 addition & 1 deletion boards/px4/fmu-v5/src/spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSION
}),
initSPIBusExternal(SPI::Bus::SPI5, {
initSPIConfigExternal(SPI::CS{GPIO::PortI, GPIO::Pin4}, SPI::DRDY{GPIO::PortD, GPIO::Pin15}),
initSPIConfigExternal(SPI::CS{GPIO::PortI, GPIO::Pin10}),
initSPIConfigExternal(SPI::CS{GPIO::PortI, GPIO::Pin4}),
initSPIConfigExternal(SPI::CS{GPIO::PortI, GPIO::Pin11})
}),
initSPIBusExternal(SPI::Bus::SPI6, {
Expand Down
13 changes: 11 additions & 2 deletions src/modules/mavlink/mavlink_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,11 @@ Mavlink::forward_message(const mavlink_message_t *msg, Mavlink *self)
LockGuard lg{mavlink_module_mutex};

for (Mavlink *inst : mavlink_module_instances) {
if (inst && (inst != self) && (inst->get_forwarding_on())) {
if (inst && (inst != self) && (inst->get_forwarding_on())) {
// Pass message only if target component was seen before
if (inst->_receiver.component_was_seen(target_system_id, target_component_id)) {
inst->pass_message(msg);
PX4_INFO("forwarding %d %d",target_system_id,target_component_id);
}
}
}
Expand Down Expand Up @@ -1692,7 +1693,15 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream)

/* fallthrough */
case MAVLINK_MODE_CUSTOM:
//stream nothing
configure_stream_local("ATTITUDE", 0.1f);
configure_stream_local("ALTITUDE", 0.1f);
configure_stream_local("GLOBAL_POSITION_INT", 0.2f);
configure_stream_local("GPS_GLOBAL_ORIGIN", 0.1f);
configure_stream_local("GPS_RAW_INT", 0.25f);
configure_stream_local("GPS_STATUS", 0.1f);
configure_stream_local("HOME_POSITION", 0.05f);
configure_stream_local("HYGROMETER_SENSOR", 0.05f);
configure_stream_local("BATTERY_STATUS", 0.05f);
break;

case MAVLINK_MODE_CONFIG: // USB
Expand Down
3 changes: 2 additions & 1 deletion src/modules/mavlink/mavlink_receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3291,7 +3291,8 @@ bool MavlinkReceiver::component_was_seen(int system_id, int component_id)
{
// For system broadcast messages return true if at least one component was seen before
if (system_id == 0) {
return _component_states_count > 0;
//return _component_states_count > 0;
return true;
}

for (unsigned i = 0; i < _component_states_count; ++i) {
Expand Down

0 comments on commit c0bfea7

Please sign in to comment.