Skip to content

Commit 5830aee

Browse files
committed
fix: Eliminate S-frame duplicate timestamp artifacts causing phase shifts
- S-frames no longer create separate CSV rows with inherited timestamps - S-frame data merged into I/P frames during parsing (matches blackbox_decode) - Eliminates duplicate timestamp entries that caused frame synchronization issues - Fixes pitch response phase shifts in step response analysis - Row count now matches blackbox_decode exactly (375225 vs 375226) - Perfect chronological data alignment achieved
1 parent 51f7d2f commit 5830aee

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/main.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,8 +1144,9 @@ fn export_flight_data_to_csv(log: &BBLLog, output_path: &Path, debug: bool) -> R
11441144
let mut all_frames = Vec::new();
11451145

11461146
if let Some(ref debug_frames) = log.debug_frames {
1147-
// Collect I, P, S frames (exclude E frames as they are events, not flight data)
1148-
for frame_type in ['I', 'P', 'S'] {
1147+
// Collect only I, P frames for CSV export (S frames are merged into I/P frames during parsing)
1148+
// This matches blackbox_decode behavior where S-frame data doesn't create separate CSV rows
1149+
for frame_type in ['I', 'P'] {
11491150
if let Some(frames) = debug_frames.get(&frame_type) {
11501151
for frame in frames {
11511152
all_frames.push((frame.timestamp_us, frame_type, frame));
@@ -1592,12 +1593,12 @@ fn parse_frames(
15921593
);
15931594
}
15941595

1595-
frame_data = data;
1596-
parsing_success = true;
1596+
// S-frames don't create separate CSV rows - they only update lastSlow data
1597+
// that gets merged into subsequent I/P frames (blackbox_decode compatibility)
15971598
stats.s_frames += 1;
15981599

15991600
if debug && stats.s_frames <= 3 {
1600-
println!("DEBUG: S-frame count incremented to {} (successful parsing)", stats.s_frames);
1601+
println!("DEBUG: S-frame count incremented to {} (data merged into lastSlow)", stats.s_frames);
16011602
}
16021603
} else if debug && stats.s_frames < 5 {
16031604
println!("DEBUG: S-frame parsing failed");

0 commit comments

Comments
 (0)