refactor(firmware): simplify configuration and diagnostics
This commit is contained in:
1 parent
ba9c97ed3b
commit
fdf82a5114
96 files changed
+1612
-2772
No files matched your search
@@ -1,44 +1,16 @@
|
||||
//! Persisted, restart-only MAVLink diagnostic-sink policy.
|
||||
|
||||
use kaptan_config::Config;
|
||||
use kaptan_log::Severity;
|
||||
use kaptan_log::LevelFilter;
|
||||
|
||||
/// Candidate policy for the MAVLink diagnostic sink.
|
||||
#[derive(Clone, Copy, Config)]
|
||||
pub(super) struct MavlinkLoggingCandidate {
|
||||
#[config(id = 24, key = "mavlink.logging.enabled", unit = "bool")]
|
||||
pub(super) enabled: bool,
|
||||
#[config(
|
||||
enum,
|
||||
id = 25,
|
||||
key = "mavlink.logging.maximum_severity",
|
||||
unit = "mav_severity"
|
||||
key = "mavlink.logging.level_filter",
|
||||
unit = "log_level"
|
||||
)]
|
||||
pub(super) maximum_severity: Severity,
|
||||
}
|
||||
|
||||
/// Immutable boot-active policy for the MAVLink diagnostic sink.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct MavlinkLoggingSettings {
|
||||
enabled: bool,
|
||||
maximum_severity: Severity,
|
||||
}
|
||||
|
||||
impl MavlinkLoggingSettings {
|
||||
pub(crate) const fn new(enabled: bool, maximum_severity: Severity) -> Self {
|
||||
Self {
|
||||
enabled,
|
||||
maximum_severity,
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the MAVLink diagnostic sink accepts records.
|
||||
pub const fn enabled(self) -> bool {
|
||||
self.enabled
|
||||
}
|
||||
|
||||
/// Maximum accepted MAVLink severity, from Emergency (0) through Debug (7).
|
||||
pub const fn maximum_severity(self) -> Severity {
|
||||
self.maximum_severity
|
||||
}
|
||||
pub(super) level_filter: LevelFilter,
|
||||
}
|
||||
Reference in new issue
Block a user