Skip to content

Commit

Permalink
Merge branch 'Lingepumpe-master'
Browse files Browse the repository at this point in the history
* Lingepumpe-master:
  Update CHANGELOG
  Specify resolver = "2" in root Cargo.toml
  Update used FitSDK Profile to 21.141.00
  • Loading branch information
stadelmanma committed Aug 13, 2024
2 parents 1fdba05 + ed3c0b9 commit 9cbf740
Show file tree
Hide file tree
Showing 5 changed files with 364 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## HEAD
* Bump packaged FIT SDK version to 21.141.00 (lingepumpe)


## v0.7.0
* Bump packaged FIT SDK version to 21.133.00 (robinkrahl)
* Remove dead code files in generate-fit-profile (robinkrahl)
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"fitparser",
"generate-fit-profile",
Expand Down
313 changes: 311 additions & 2 deletions fitparser/src/profile/decode.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![doc = "//! Auto generated profile messages from FIT SDK Release: 21.133.00"]
#![doc = "//! Auto generated profile messages from FIT SDK Release: 21.141.00"]
#![allow(unused_variables)]
use super::field_types::*;
use super::{calculate_cumulative_value, data_field_with_info, extract_component, unknown_field};
Expand All @@ -8,7 +8,7 @@ use crate::{FitDataField, Value};
use std::collections::{HashMap, HashSet, VecDeque};
use std::convert::TryInto;
#[doc = "FIT SDK version used to generate profile decoder"]
pub const VERSION: &str = "21.133.00";
pub const VERSION: &str = "21.141.00";
#[doc = "Must be first message in file."]
#[doc = " * time_created: Only set for files that are can be created/erased."]
#[doc = " * number: Only set for files that are not created/erased."]
Expand Down Expand Up @@ -12877,6 +12877,8 @@ fn activity_message_timestamp_field(
#[doc = " * total_flow: The flow score estimates how long distance wise a cyclist deaccelerates over intervals where deacceleration is unnecessary such as smooth turns or small grade angle intervals."]
#[doc = " * avg_grit: The grit score estimates how challenging a route could be for a cyclist in terms of time spent going over sharp turns or large grade slopes."]
#[doc = " * avg_flow: The flow score estimates how long distance wise a cyclist deaccelerates over intervals where deacceleration is unnecessary such as smooth turns or small grade angle intervals."]
#[doc = " * workout_feel: A 0-100 scale representing how a user felt while performing a workout. Low values are considered feeling bad, while high values are good."]
#[doc = " * workout_rpe: Common Borg CR10 / 0-10 RPE scale, multiplied 10x.. Aggregate score for all workouts in a single session."]
#[doc = " * avg_spo2: Average SPO2 for the monitoring session"]
#[doc = " * avg_stress: Average stress for the monitoring session"]
#[doc = " * sdrr_hrv: Standard deviation of R-R interval (SDRR) - Heart rate variability measure most useful for wellness users."]
Expand Down Expand Up @@ -15039,6 +15041,32 @@ fn session_message(
value,
)?);
}
192u8 => {
fields.push(session_message_workout_feel_field(
mesg_num,
accumlators,
options,
data_map,
false,
1f64,
0f64,
"",
value,
)?);
}
193u8 => {
fields.push(session_message_workout_rpe_field(
mesg_num,
accumlators,
options,
data_map,
false,
1f64,
0f64,
"",
value,
)?);
}
194u8 => {
fields.push(session_message_avg_spo2_field(
mesg_num,
Expand Down Expand Up @@ -19180,6 +19208,60 @@ fn session_message_avg_flow_field(
options,
)
}
fn session_message_workout_feel_field(
mesg_num: MesgNum,
accumlators: &mut HashMap<u32, Value>,
options: &HashSet<DecodeOption>,
data_map: &HashMap<u8, Value>,
accumulate: bool,
scale: f64,
offset: f64,
units: &'static str,
value: Value,
) -> Result<FitDataField> {
let value = if accumulate {
calculate_cumulative_value(accumlators, mesg_num.as_u16(), 192u8, value)?
} else {
value
};
data_field_with_info(
192u8,
"workout_feel",
FieldDataType::UInt8,
scale,
offset,
units,
value,
options,
)
}
fn session_message_workout_rpe_field(
mesg_num: MesgNum,
accumlators: &mut HashMap<u32, Value>,
options: &HashSet<DecodeOption>,
data_map: &HashMap<u8, Value>,
accumulate: bool,
scale: f64,
offset: f64,
units: &'static str,
value: Value,
) -> Result<FitDataField> {
let value = if accumulate {
calculate_cumulative_value(accumlators, mesg_num.as_u16(), 193u8, value)?
} else {
value
};
data_field_with_info(
193u8,
"workout_rpe",
FieldDataType::UInt8,
scale,
offset,
units,
value,
options,
)
}
fn session_message_avg_spo2_field(
mesg_num: MesgNum,
accumlators: &mut HashMap<u32, Value>,
Expand Down Expand Up @@ -64879,6 +64961,230 @@ fn sleep_assessment_message_average_stress_during_sleep_field(
options,
)
}
#[doc = "skin_temp_overnight message definition"]
#[doc = " * average_deviation: The average overnight deviation from baseline temperature in degrees C"]
#[doc = " * average_7_day_deviation: The average 7 day overnight deviation from baseline temperature in degrees C"]
#[doc = " * nightly_value: Final overnight temperature value"]
fn skin_temp_overnight_message(
mesg_num: MesgNum,
data_map: &mut HashMap<u8, Value>,
accumlators: &mut HashMap<u32, Value>,
options: &HashSet<DecodeOption>,
) -> Result<Vec<FitDataField>> {
let mut fields = Vec::new();
let mut entries: VecDeque<(u8, Value)> =
data_map.iter().map(|(k, v)| (*k, v.clone())).collect();
while let Some((def_num, value)) = entries.pop_front() {
match def_num {
0u8 => {
fields.push(skin_temp_overnight_message_local_timestamp_field(
mesg_num,
accumlators,
options,
data_map,
false,
1f64,
0f64,
"",
value,
)?);
}
1u8 => {
fields.push(skin_temp_overnight_message_average_deviation_field(
mesg_num,
accumlators,
options,
data_map,
false,
1f64,
0f64,
"",
value,
)?);
}
2u8 => {
fields.push(skin_temp_overnight_message_average_7_day_deviation_field(
mesg_num,
accumlators,
options,
data_map,
false,
1f64,
0f64,
"",
value,
)?);
}
4u8 => {
fields.push(skin_temp_overnight_message_nightly_value_field(
mesg_num,
accumlators,
options,
data_map,
false,
1f64,
0f64,
"",
value,
)?);
}
253u8 => {
fields.push(skin_temp_overnight_message_timestamp_field(
mesg_num,
accumlators,
options,
data_map,
false,
1f64,
0f64,
"",
value,
)?);
}
_ => {
if !options.contains(&DecodeOption::DropUnknownFields) {
fields.push(unknown_field(def_num, value));
}
}
}
}
Ok(fields)
}
fn skin_temp_overnight_message_local_timestamp_field(
mesg_num: MesgNum,
accumlators: &mut HashMap<u32, Value>,
options: &HashSet<DecodeOption>,
data_map: &HashMap<u8, Value>,
accumulate: bool,
scale: f64,
offset: f64,
units: &'static str,
value: Value,
) -> Result<FitDataField> {
let value = if accumulate {
calculate_cumulative_value(accumlators, mesg_num.as_u16(), 0u8, value)?
} else {
value
};
data_field_with_info(
0u8,
"local_timestamp",
FieldDataType::LocalDateTime,
scale,
offset,
units,
value,
options,
)
}
fn skin_temp_overnight_message_average_deviation_field(
mesg_num: MesgNum,
accumlators: &mut HashMap<u32, Value>,
options: &HashSet<DecodeOption>,
data_map: &HashMap<u8, Value>,
accumulate: bool,
scale: f64,
offset: f64,
units: &'static str,
value: Value,
) -> Result<FitDataField> {
let value = if accumulate {
calculate_cumulative_value(accumlators, mesg_num.as_u16(), 1u8, value)?
} else {
value
};
data_field_with_info(
1u8,
"average_deviation",
FieldDataType::Float32,
scale,
offset,
units,
value,
options,
)
}
fn skin_temp_overnight_message_average_7_day_deviation_field(
mesg_num: MesgNum,
accumlators: &mut HashMap<u32, Value>,
options: &HashSet<DecodeOption>,
data_map: &HashMap<u8, Value>,
accumulate: bool,
scale: f64,
offset: f64,
units: &'static str,
value: Value,
) -> Result<FitDataField> {
let value = if accumulate {
calculate_cumulative_value(accumlators, mesg_num.as_u16(), 2u8, value)?
} else {
value
};
data_field_with_info(
2u8,
"average_7_day_deviation",
FieldDataType::Float32,
scale,
offset,
units,
value,
options,
)
}
fn skin_temp_overnight_message_nightly_value_field(
mesg_num: MesgNum,
accumlators: &mut HashMap<u32, Value>,
options: &HashSet<DecodeOption>,
data_map: &HashMap<u8, Value>,
accumulate: bool,
scale: f64,
offset: f64,
units: &'static str,
value: Value,
) -> Result<FitDataField> {
let value = if accumulate {
calculate_cumulative_value(accumlators, mesg_num.as_u16(), 4u8, value)?
} else {
value
};
data_field_with_info(
4u8,
"nightly_value",
FieldDataType::Float32,
scale,
offset,
units,
value,
options,
)
}
fn skin_temp_overnight_message_timestamp_field(
mesg_num: MesgNum,
accumlators: &mut HashMap<u32, Value>,
options: &HashSet<DecodeOption>,
data_map: &HashMap<u8, Value>,
accumulate: bool,
scale: f64,
offset: f64,
units: &'static str,
value: Value,
) -> Result<FitDataField> {
let value = if accumulate {
calculate_cumulative_value(accumlators, mesg_num.as_u16(), 253u8, value)?
} else {
value
};
data_field_with_info(
253u8,
"timestamp",
FieldDataType::DateTime,
scale,
offset,
units,
value,
options,
)
}
fn unknown_message(
data_map: &HashMap<u8, Value>,
options: &HashSet<DecodeOption>,
Expand Down Expand Up @@ -65093,6 +65399,9 @@ impl MesgNum {
MesgNum::SleepAssessment => {
sleep_assessment_message(self, data_map, accumlators, options)
}
MesgNum::SkinTempOvernight => {
skin_temp_overnight_message(self, data_map, accumlators, options)
}
_ => unknown_message(data_map, options),
}
}
Expand Down
Loading

0 comments on commit 9cbf740

Please sign in to comment.