Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org).

## [1.5.0] - 2025-12-18

- Fix bug that caused a variable number of blocks at the end of a file to not be decoded
- Limit the number of threads used for small files
- Update TDF definitions

## [1.4.1] - 2025-11-27

- Update MacOS signing certificate
Expand Down
2 changes: 1 addition & 1 deletion 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
@@ -1,6 +1,6 @@
[package]
name = "infuse_decoder"
version = "1.4.1"
version = "1.5.0"
edition = "2024"

[[bin]]
Expand Down
24 changes: 22 additions & 2 deletions scripts/tdf.json
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,26 @@
}
]
},
"8": {
"name": "SOC_TEMPERATURE",
"description": "SoC die temperature",
"fields": [
{
"name": "temperature",
"type": "int16_t",
"description": "SoC die temperature (centidegrees)",
"display": {
"fmt": "float",
"digits": 2,
"postfix": "deg"
},
"conversion": {
"m": 0.01,
"c": 0
}
}
]
},
"10": {
"name": "ACC_2G",
"description": "Accelerometer +-2G",
Expand Down Expand Up @@ -1437,7 +1457,7 @@
{
"name": "h_speed_acc",
"type": "uint32_t",
"description": "Horizonal speed accuracy estimate",
"description": "Horizontal speed accuracy estimate",
"display": {
"postfix": "m/s"
},
Expand All @@ -1461,7 +1481,7 @@
{
"name": "v_speed_acc",
"type": "uint32_t",
"description": "Horizonal speed accuracy estimate",
"description": "Horizontal speed accuracy estimate",
"display": {
"postfix": "m/s"
},
Expand Down
10 changes: 4 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use chrono::SecondsFormat;
use itertools::Itertools;
use memmap::Mmap;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::fs::File;
use std::io::{self, BufRead, BufReader, BufWriter, Cursor, Write};
use std::path::PathBuf;
Expand Down Expand Up @@ -275,13 +275,11 @@ pub fn run<T: ProgressReporter + Clone + Send + 'static>(
(f, s)
};

let mut num_workers = num_cpus::get();
let num_blocks = size / blocks::BLOCK_SIZE;
if num_blocks < num_workers {
num_workers = 1;
}
let max_workers = (num_blocks / 100) + 1;
let num_workers = std::cmp::min(max_workers, num_cpus::get());
let blocks_per_worker = num_blocks / num_workers;
let trailing = num_blocks % blocks_per_worker;
let trailing = num_blocks - (blocks_per_worker * num_workers);

args.decode_reporter.start("Decoding blocks", num_blocks);

Expand Down
7 changes: 7 additions & 0 deletions tdf/src/decoders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub fn tdf_name(tdf_id: &u16) -> String
5 => String::from("TIME_SYNC"),
6 => String::from("REBOOT_INFO"),
7 => String::from("ANNOUNCE_V2"),
8 => String::from("SOC_TEMPERATURE"),
10 => String::from("ACC_2G"),
11 => String::from("ACC_4G"),
12 => String::from("ACC_8G"),
Expand Down Expand Up @@ -77,6 +78,7 @@ pub fn tdf_fields(tdf_id: &u16) -> Vec<&'static str>
5 => vec!["source","shift"],
6 => vec!["reason","hardware_flags","count","uptime","param_1","param_2","thread"],
7 => vec!["application","major","minor","revision","build_num","board_crc","kv_crc","blocks","uptime","reboots","flags"],
8 => vec!["temperature"],
10 => vec!["x","y","z"],
11 => vec!["x","y","z"],
12 => vec!["x","y","z"],
Expand Down Expand Up @@ -230,6 +232,11 @@ pub fn tdf_read_into_str(tdf_id: &u16, size: u8, cursor: &mut Cursor<&[u8]>) ->
cursor.read_u16::<LittleEndian>()?,
cursor.read_u8()?,
)),
8 =>
Ok(format!(
"{}",
cursor.read_i16::<LittleEndian>()? as f64 / 100.0,
)),
10 =>
Ok(format!(
"{},{},{}",
Expand Down