replacing numbered options in config with rust enum implementation, unique commit to make easier to debug or rollback

This commit is contained in:
Carlos Guerra
2026-04-08 19:29:45 +02:00
committed by Will Greenberg
parent 0b91a6e5d3
commit fee082cde4
15 changed files with 87 additions and 50 deletions
+5 -4
View File
@@ -28,6 +28,7 @@ use rayhunter::diag_device::DiagDevice;
use rayhunter::qmdl::QmdlWriter;
use crate::analysis::{AnalysisCtrlMessage, AnalysisWriter};
use crate::config::GpsMode;
use crate::display;
use crate::notifications::{Notification, NotificationType};
use crate::qmdl_store::{RecordingStore, RecordingStoreError};
@@ -58,7 +59,7 @@ pub struct DiagTask {
notification_channel: tokio::sync::mpsc::Sender<Notification>,
min_space_to_start_mb: u64,
min_space_to_continue_mb: u64,
gps_mode: u8,
gps_mode: GpsMode,
gps_fixed_coords: Option<(f64, f64)>,
state: DiagState,
max_type_seen: EventType,
@@ -108,7 +109,7 @@ impl DiagTask {
notification_channel: tokio::sync::mpsc::Sender<Notification>,
min_space_to_start_mb: u64,
min_space_to_continue_mb: u64,
gps_mode: u8,
gps_mode: GpsMode,
gps_fixed_coords: Option<(f64, f64)>,
) -> Self {
Self {
@@ -163,7 +164,7 @@ impl DiagTask {
// For fixed-mode sessions, write the configured coordinates to the sidecar
// immediately so the per-session GPS is stored durably and isn't affected
// by future config changes or GPS API calls.
if self.gps_mode == 1 {
if self.gps_mode == GpsMode::Fixed {
if let Some((lat, lon)) = self.gps_fixed_coords {
if let Some((entry_idx, _)) = qmdl_store.get_current_entry() {
if let Ok(mut gps_file) = qmdl_store.open_entry_gps_for_append(entry_idx).await
@@ -409,7 +410,7 @@ pub fn run_diag_read_thread(
notification_channel: tokio::sync::mpsc::Sender<Notification>,
min_space_to_start_mb: u64,
min_space_to_continue_mb: u64,
gps_mode: u8,
gps_mode: GpsMode,
gps_fixed_coords: Option<(f64, f64)>,
) {
task_tracker.spawn(async move {