Skip to content

Commit

Permalink
dataman: remove obsolete persistence and reset reason
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar authored Dec 12, 2021
1 parent ad1bfb5 commit 986cf28
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 287 deletions.
28 changes: 0 additions & 28 deletions src/modules/commander/Commander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,6 @@ Commander::Commander() :

// default for vtol is rotary wing
_vtol_status.vtol_in_rw_mode = true;

/* init mission state, do it here to allow navigator to use stored mission even if mavlink failed to start */
mission_init();
}

bool
Expand Down Expand Up @@ -3401,31 +3398,6 @@ void Commander::enable_hil()
_status.hil_state = vehicle_status_s::HIL_STATE_ON;
}

void Commander::mission_init()
{
/* init mission state, do it here to allow navigator to use stored mission even if mavlink failed to start */
mission_s mission;

if (dm_read(DM_KEY_MISSION_STATE, 0, &mission, sizeof(mission_s)) == sizeof(mission_s)) {
if (mission.dataman_id == DM_KEY_WAYPOINTS_OFFBOARD_0 || mission.dataman_id == DM_KEY_WAYPOINTS_OFFBOARD_1) {
if (mission.count > 0) {
PX4_INFO("Mission #%" PRIu8 " loaded, %" PRIu16 " WPs, curr: %" PRId32, mission.dataman_id, mission.count,
mission.current_seq);
}

} else {
PX4_ERR("reading mission state failed");

/* initialize mission state in dataman */
mission.timestamp = hrt_absolute_time();
mission.dataman_id = DM_KEY_WAYPOINTS_OFFBOARD_0;
dm_write(DM_KEY_MISSION_STATE, 0, DM_PERSIST_POWER_ON_RESET, &mission, sizeof(mission_s));
}

_mission_pub.publish(mission);
}
}

void Commander::data_link_check()
{
for (auto &telemetry_status : _telemetry_status_subs) {
Expand Down
4 changes: 0 additions & 4 deletions src/modules/commander/Commander.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
#include <uORB/topics/geofence_result.h>
#include <uORB/topics/iridiumsbd_status.h>
#include <uORB/topics/manual_control_setpoint.h>
#include <uORB/topics/mission.h>
#include <uORB/topics/mission_result.h>
#include <uORB/topics/offboard_control_mode.h>
#include <uORB/topics/parameter_update.h>
Expand Down Expand Up @@ -154,8 +153,6 @@ class Commander : public ModuleBase<Commander>, public ModuleParams

void executeActionRequest(const action_request_s &action_request);

void mission_init();

void offboard_control_update();

void print_reject_mode(uint8_t main_state);
Expand Down Expand Up @@ -444,7 +441,6 @@ class Commander : public ModuleBase<Commander>, public ModuleParams
uORB::Publication<vehicle_control_mode_s> _control_mode_pub{ORB_ID(vehicle_control_mode)};
uORB::Publication<vehicle_status_flags_s> _vehicle_status_flags_pub{ORB_ID(vehicle_status_flags)};
uORB::Publication<vehicle_status_s> _status_pub{ORB_ID(vehicle_status)};
uORB::Publication<mission_s> _mission_pub{ORB_ID(mission)};

uORB::PublicationData<home_position_s> _home_pub{ORB_ID(home_position)};

Expand Down
Loading

0 comments on commit 986cf28

Please sign in to comment.