mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
MAVLink app: Stop spamming the user with file system errors after two failures.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -35,9 +35,9 @@
|
|||||||
* @file mavlink_mission.cpp
|
* @file mavlink_mission.cpp
|
||||||
* MAVLink mission manager implementation.
|
* MAVLink mission manager implementation.
|
||||||
*
|
*
|
||||||
* @author Lorenz Meier <lm@inf.ethz.ch>
|
* @author Lorenz Meier <lorenz@px4.io>
|
||||||
* @author Julian Oes <joes@student.ethz.ch>
|
* @author Julian Oes <julian@px4.io>
|
||||||
* @author Anton Babushkin <anton.babushkin@me.com>
|
* @author Anton Babushkin <anton@px4.io>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mavlink_mission.h"
|
#include "mavlink_mission.h"
|
||||||
@@ -77,6 +77,7 @@ MavlinkMissionManager::MavlinkMissionManager(Mavlink *mavlink) : MavlinkStream(m
|
|||||||
_action_timeout(MAVLINK_MISSION_PROTOCOL_TIMEOUT_DEFAULT),
|
_action_timeout(MAVLINK_MISSION_PROTOCOL_TIMEOUT_DEFAULT),
|
||||||
_retry_timeout(MAVLINK_MISSION_RETRY_TIMEOUT_DEFAULT),
|
_retry_timeout(MAVLINK_MISSION_RETRY_TIMEOUT_DEFAULT),
|
||||||
_max_count(DM_KEY_WAYPOINTS_OFFBOARD_0_MAX),
|
_max_count(DM_KEY_WAYPOINTS_OFFBOARD_0_MAX),
|
||||||
|
_filesystem_errcount(0),
|
||||||
_my_dataman_id(0),
|
_my_dataman_id(0),
|
||||||
_transfer_dataman_id(0),
|
_transfer_dataman_id(0),
|
||||||
_transfer_count(0),
|
_transfer_count(0),
|
||||||
@@ -169,8 +170,10 @@ MavlinkMissionManager::update_active_mission(int dataman_id, unsigned count, int
|
|||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
warnx("ERROR: can't save mission state");
|
warnx("WPM: ERROR: can't save mission state");
|
||||||
_mavlink->send_statustext(MAV_SEVERITY_CRITICAL, "ERROR: can't save mission state");
|
if (_filesystem_errcount++ < FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT) {
|
||||||
|
_mavlink->send_statustext_critical("Mission storage: Unable to write to microSD");
|
||||||
|
}
|
||||||
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
@@ -253,7 +256,9 @@ MavlinkMissionManager::send_mission_item(uint8_t sysid, uint8_t compid, uint16_t
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR);
|
send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR);
|
||||||
_mavlink->send_statustext_critical("Unable to read from micro SD");
|
if (_filesystem_errcount++ < FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT) {
|
||||||
|
_mavlink->send_statustext_critical("Mission storage: Unable to read from microSD");
|
||||||
|
}
|
||||||
|
|
||||||
if (_verbose) { warnx("WPM: Send MISSION_ITEM ERROR: could not read seq %u from dataman ID %i", seq, _dataman_id); }
|
if (_verbose) { warnx("WPM: Send MISSION_ITEM ERROR: could not read seq %u from dataman ID %i", seq, _dataman_id); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -35,9 +35,9 @@
|
|||||||
* @file mavlink_mission.h
|
* @file mavlink_mission.h
|
||||||
* MAVLink mission manager interface definition.
|
* MAVLink mission manager interface definition.
|
||||||
*
|
*
|
||||||
* @author Lorenz Meier <lm@inf.ethz.ch>
|
* @author Lorenz Meier <lorenz@px4.io>
|
||||||
* @author Julian Oes <joes@student.ethz.ch>
|
* @author Julian Oes <julian@px4.io>
|
||||||
* @author Anton Babushkin <anton.babushkin@me.com>
|
* @author Anton Babushkin <anton@px4.io>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -108,13 +108,14 @@ private:
|
|||||||
uint32_t _action_timeout;
|
uint32_t _action_timeout;
|
||||||
uint32_t _retry_timeout;
|
uint32_t _retry_timeout;
|
||||||
unsigned _max_count; ///< Maximum number of mission items
|
unsigned _max_count; ///< Maximum number of mission items
|
||||||
|
unsigned _filesystem_errcount; ///< File system error count
|
||||||
|
|
||||||
static int _dataman_id; ///< Global Dataman storage ID for active mission
|
static int _dataman_id; ///< Global Dataman storage ID for active mission
|
||||||
int _my_dataman_id; ///< class Dataman storage ID
|
int _my_dataman_id; ///< class Dataman storage ID
|
||||||
static bool _dataman_init; ///< Dataman initialized
|
static bool _dataman_init; ///< Dataman initialized
|
||||||
|
|
||||||
static unsigned _count; ///< Count of items in active mission
|
static unsigned _count; ///< Count of items in active mission
|
||||||
static int _current_seq; ///< Current item sequence in active mission
|
static int _current_seq; ///< Current item sequence in active mission
|
||||||
|
|
||||||
int _transfer_dataman_id; ///< Dataman storage ID for current transmission
|
int _transfer_dataman_id; ///< Dataman storage ID for current transmission
|
||||||
unsigned _transfer_count; ///< Items count in current transmission
|
unsigned _transfer_count; ///< Items count in current transmission
|
||||||
@@ -122,7 +123,7 @@ private:
|
|||||||
unsigned _transfer_current_seq; ///< Current item ID for current transmission (-1 means not initialized)
|
unsigned _transfer_current_seq; ///< Current item ID for current transmission (-1 means not initialized)
|
||||||
unsigned _transfer_partner_sysid; ///< Partner system ID for current transmission
|
unsigned _transfer_partner_sysid; ///< Partner system ID for current transmission
|
||||||
unsigned _transfer_partner_compid; ///< Partner component ID for current transmission
|
unsigned _transfer_partner_compid; ///< Partner component ID for current transmission
|
||||||
static bool _transfer_in_progress; ///< Global variable checking for current transmission
|
static bool _transfer_in_progress; ///< Global variable checking for current transmission
|
||||||
|
|
||||||
int _offboard_mission_sub;
|
int _offboard_mission_sub;
|
||||||
int _mission_result_sub;
|
int _mission_result_sub;
|
||||||
@@ -132,6 +133,8 @@ private:
|
|||||||
|
|
||||||
bool _verbose;
|
bool _verbose;
|
||||||
|
|
||||||
|
static constexpr int FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT = 2; ///< Error count limit before stopping to report FS errors
|
||||||
|
|
||||||
/* do not allow top copying this class */
|
/* do not allow top copying this class */
|
||||||
MavlinkMissionManager(MavlinkMissionManager &);
|
MavlinkMissionManager(MavlinkMissionManager &);
|
||||||
MavlinkMissionManager& operator = (const MavlinkMissionManager &);
|
MavlinkMissionManager& operator = (const MavlinkMissionManager &);
|
||||||
|
|||||||
Reference in New Issue
Block a user