Skip to content

Commit

Permalink
Update settings path for Microsot Store package
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianEddy committed Jan 8, 2025
1 parent b543250 commit dadef9a
Showing 4 changed files with 123 additions and 102 deletions.
17 changes: 7 additions & 10 deletions src/controller.rs
Original file line number Diff line number Diff line change
@@ -425,11 +425,10 @@ impl Controller {
for x in offsets {
::log::info!("Setting offset at {:.4}: {:.4} (cost {:.4})", x.0, x.1, x.2);
let new_ts = ((x.0 - x.1) * 1000.0) as i64;
//Here the offsets are checked
if !this.sync_rank.is_empty(){
let index = ((x.0 - x.1) as f64 / (this.sync_ratio*1000.0)).round() as usize;
if index < this.sync_rank.len() && this.sync_rank[index] < 20.0{
println!("be={}",this.sync_rank[index]);
// Check the offset
if !this.sync_rank.is_empty() {
let index = ((x.0 - x.1) as f64 / (this.sync_ratio * 1000.0)).round() as usize;
if index < this.sync_rank.len() && this.sync_rank[index] < 20.0 {
continue
}
}
@@ -566,19 +565,17 @@ impl Controller {

fn get_optimal_sync_points(&mut self, target_sync_points: usize) -> QString {
let dur_ms = self.stabilizer.params.read().get_scaled_duration_ms();
//let trim_ranges = self.stabilizer.params.read().trim_ranges.iter().map(|x| (x.0 * dur_ms / 1000.0, x.1 * dur_ms / 1000.0)).collect::<Vec<_>>();
let trim_ranges = {
let params = self.stabilizer.params.read();
let original_trim_ranges = params.trim_ranges.iter();
if original_trim_ranges.clone().next().is_none() {
if params.trim_ranges.is_empty() {
vec![(0.0, dur_ms as f64 / 1000.0)]
} else {
original_trim_ranges.map(|x| (x.0 * dur_ms as f64 / 1000.0, x.1 * dur_ms as f64 / 1000.0)).collect()
params.trim_ranges.iter().map(|x| (x.0 * dur_ms / 1000.0, x.1 * dur_ms / 1000.0)).collect()
}
};

if let Some(mut optsync) = core::synchronization::optimsync::OptimSync::new(&self.stabilizer.gyro.read()) {
let (points, rank,ratio) = optsync.run(target_sync_points, trim_ranges);
let (points, rank, ratio) = optsync.run(target_sync_points, trim_ranges);
self.sync_rank = rank.clone();
self.sync_ratio = ratio;
let s: String = points.iter().map(|x| x / dur_ms).map(|x| x.to_string()).join(";").chars().collect();
Loading

0 comments on commit dadef9a

Please sign in to comment.