|
| 1 | +use crate::{structs::PossibleGroup, utils::signaled_mutex::SignaledMutex}; |
1 | 2 | use alloc::{rc::Rc, string::String, vec::Vec}; |
2 | 3 | use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, signal::Signal}; |
3 | 4 | use embassy_time::{Duration, Instant, Timer}; |
4 | 5 | use esp_hal_wifimanager::Nvs; |
5 | 6 | use serde::{Deserialize, Serialize}; |
6 | 7 |
|
7 | | -use crate::{structs::PossibleGroup, utils::signaled_mutex::SignaledMutex}; |
8 | | - |
9 | 8 | pub static mut EPOCH_BASE: u64 = 0; |
10 | 9 | pub static mut SLEEP_STATE: bool = false; |
11 | 10 | pub static mut DEEPER_SLEEP: bool = false; |
@@ -342,6 +341,26 @@ impl SignaledGlobalStateInner { |
342 | 341 | Some(false) => false, |
343 | 342 | } |
344 | 343 | } |
| 344 | + |
| 345 | + #[cfg(feature = "e2e")] |
| 346 | + pub fn snapshot_data(&self) -> crate::structs::SnapshotData { |
| 347 | + let inspection_time = self |
| 348 | + .inspection_end |
| 349 | + .zip(self.inspection_start) |
| 350 | + .map(|(end, start)| (end - start).as_millis()); |
| 351 | + |
| 352 | + crate::structs::SnapshotData { |
| 353 | + scene: self.scene.to_index(), |
| 354 | + inspection_time, |
| 355 | + penalty: self.penalty, |
| 356 | + solve_time: self.solve_time, |
| 357 | + current_judge: self.current_judge, |
| 358 | + current_competitor: self.current_competitor, |
| 359 | + group_selected_idx: self.group_selected_idx, |
| 360 | + time_confirmed: self.time_confirmed, |
| 361 | + possible_groups: self.possible_groups.len(), |
| 362 | + } |
| 363 | + } |
345 | 364 | } |
346 | 365 |
|
347 | 366 | #[cfg(not(feature = "e2e"))] |
|
0 commit comments