Merge pull request #3 from Johnr24/update

double check upload of tested version
This commit is contained in:
Chaos Rogers 2025-07-19 15:52:21 +01:00 committed by GitHub
commit aa453c30bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 2344 additions and 624 deletions

1720
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -77,6 +77,14 @@ impl LtcState {
match frame.status.as_str() { match frame.status.as_str() {
"LOCK" => { "LOCK" => {
self.lock_count += 1; self.lock_count += 1;
}
"FREE" => {
self.free_count += 1;
self.clear_offsets();
self.last_match_status = "UNKNOWN".into();
}
_ => {}
}
// Every 5 seconds, recompute whether HH:MM:SS matches local time // Every 5 seconds, recompute whether HH:MM:SS matches local time
let now_secs = Utc::now().timestamp(); let now_secs = Utc::now().timestamp();
@ -88,14 +96,6 @@ impl LtcState {
}; };
self.last_match_check = now_secs; self.last_match_check = now_secs;
} }
}
"FREE" => {
self.free_count += 1;
self.clear_offsets();
self.last_match_status = "UNKNOWN".into();
}
_ => {}
}
self.latest = Some(frame); self.latest = Some(frame);
} }
@ -135,7 +135,7 @@ impl LtcState {
&self.last_match_status &self.last_match_status
} }
} }
// This module provides the logic for handling LTC (Linear Timecode) frames and maintaining state.
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
@ -190,7 +190,7 @@ mod tests {
assert_eq!(state.lock_count, 0); assert_eq!(state.lock_count, 0);
assert_eq!(state.free_count, 1); assert_eq!(state.free_count, 1);
assert!(state.offset_history.is_empty()); // Offsets should be cleared assert!(state.offset_history.is_empty()); // Offsets should be cleared
assert_eq!(state.last_match_status, "UNKNOWN"); assert_eq!(state.last_match_status, "OUT OF SYNC");
} }
#[test] #[test]