Skip to content

Commit

Permalink
update dive-deco to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KG32 committed Jul 2, 2024
1 parent 6e08d17 commit 525e3e1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/KG32/dive-reporter.git"

[dependencies]
colored = "2.1.0"
dive-deco = "1.3.2"
dive-deco = "2.0.0"
eframe = "0.27.2"
futures = "0.3.30"
quick-xml = {version = "0.31.0", features = ["serialize"] }
Expand Down
2 changes: 1 addition & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub type Depth = f64;
pub type Seconds = usize;
pub type Seconds = u64;
pub type GF = f64;
pub type GradientFactorsSetting = (u8, u8);
10 changes: 5 additions & 5 deletions src/dive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ impl Dive {
let (gf_lo, gf_hi) = self.meta.gradient_factors;
let mut model = BuehlmannModel::new(BuehlmannConfig::new().gradient_factors(gf_lo, gf_hi));
// calc by data point
let mut last_waypoint_time: usize = 0;
let mut last_waypoint_time: Seconds = 0;
let dive_data_points = &dive_data.samples.waypoints;
for data_point in dive_data_points {
self.process_data_point(
&mut model,
&data_point,
&last_waypoint_time,
last_waypoint_time,
&gas_mixes,
);
// update last waypoint time
Expand All @@ -72,11 +72,11 @@ impl Dive {
&mut self,
model: &mut BuehlmannModel,
data_point: &WaypointElem,
last_waypoint_time: &usize,
last_waypoint_time: Seconds,
gas_mixes: &GasMixesData,
) {
// time
let step_time = data_point.dive_time - last_waypoint_time;
let step_time: Seconds = data_point.dive_time - last_waypoint_time;
self.total_time += step_time;

// depth
Expand All @@ -102,7 +102,7 @@ impl Dive {

// deco model step
let gas = &self.meta.current_mix;
model.step(&data_point.depth, &step_time, gas);
model.step(data_point.depth, step_time, gas);

// GFs
let Supersaturation { gf_99, gf_surf } = model.supersaturation();
Expand Down
2 changes: 1 addition & 1 deletion src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl Stats {
}
}

pub fn seconds_to_readable(s: usize) -> String {
pub fn seconds_to_readable(s: Seconds) -> String {
let seconds = s % 60;
let minutes = (s / 60) % 60;
let hours = (s / 60) / 60;
Expand Down

0 comments on commit 525e3e1

Please sign in to comment.