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
2 changes: 2 additions & 0 deletions Cargo.lock

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

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ path = "src/main.rs"
name = "test_parser"
path = "src/bin/test_parser.rs"

[[bin]]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This registers a dev-only tool as a first-class binary, and it duplicates examples/inject_fake_gps_mlg.rs — the two copies have already diverged (Moscow oval vs. the Vladivostok kart circuit). Please keep just the examples/ version and drop this [[bin]] so the tool isn't built into release artifacts.

Also, the doc comment in the src/bin/ copy references firmware/Lib/demo_gen.c in "the canlogger repo", which isn't part of this project — please remove or clarify that reference in whichever copy survives.

name = "inject_fake_gps_mlg"
path = "src/bin/inject_fake_gps_mlg.rs"

[dependencies]
# GUI Framework
eframe = { version = "0.36.1", default-features = false, features = [
Expand Down Expand Up @@ -63,8 +67,8 @@ zip = "8.6" # ZIP extraction for Windows updates
flate2 = "1.1" # Gzip decompression for Linux updates
tar = "0.4" # Tar archive extraction for Linux updates

# Image loading (for app icon and PNG export)
image = { version = "0.25", default-features = false, features = ["png"] }
# Image loading (for app icon, PNG export, and map tiles – Esri serves JPEG)
image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }

# PDF generation for chart export
printpdf = "0.12"
Expand Down
6 changes: 3 additions & 3 deletions docs/FORMAT_SPECIFICATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ The MLG format is used by Speeduino, rusEFI, and MegaSquirt ecosystems. It's a c
| 5 | S32 | 4 |
| 6 | S64 | 8 |
| 7 | F32 | 4 |
| 10 | U08 Bitfield | 1 |
| 11 | U16 Bitfield | 2 |
| 12 | U32 Bitfield | 4 |
| `0x10` | U08 Bitfield | 1 |
| `0x11` | U16 Bitfield | 2 |
| `0x12` | U32 Bitfield | 4 |

### Data Records

Expand Down
Binary file not shown.
Binary file added exampleLogs/rusefi/Log1_gps.mlg
Binary file not shown.
Binary file added exampleLogs/rusefi/rusefilog_gps.mlg
Binary file not shown.
Binary file added exampleLogs/speeduino/speeduino_gps.mlg
Binary file not shown.
43 changes: 43 additions & 0 deletions examples/check_gps_in_log.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//! Diagnostic: parse an MLG file and replicate `detect_gps_channels` end-to-end.

use std::env;
use std::fs;

use ultralog::adapters::registry;
use ultralog::parsers::Speeduino;

fn main() {
let path = env::args()
.nth(1)
.unwrap_or_else(|| "exampleLogs/rusefi/Log1_gps.mlg".to_string());
let data = fs::read(&path).expect("read file");
let log = Speeduino::parse_binary(&data).expect("parse");
println!("path: {}", path);
println!("channels: {}", log.channels.len());

let mut lat_idx: Option<usize> = None;
let mut lon_idx: Option<usize> = None;
let mut gps_hits = Vec::new();
for (i, ch) in log.channels.iter().enumerate() {
let name = ch.name();
if name.to_lowercase().contains("gps")
|| name.to_lowercase().contains("lat")
|| name.to_lowercase().contains("lon")
{
let canon = registry::get_channel_metadata(&name)
.map(|m| m.canonical_id)
.unwrap_or_else(|| "<no metadata>".to_string());
gps_hits.push((i, name.clone(), canon.clone()));
match canon.as_str() {
"gps_latitude" => lat_idx = Some(i),
"gps_longitude" => lon_idx = Some(i),
_ => {}
}
}
}
println!("GPS-ish channels found: {}", gps_hits.len());
for (i, name, canon) in &gps_hits {
println!(" [{}] name={:?} canonical_id={}", i, name, canon);
}
println!("detect_gps_channels result: {:?}", (lat_idx, lon_idx));
}
28 changes: 28 additions & 0 deletions examples/check_gps_lookup.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//! Quick diagnostic: do "GPS Latitude" / "GPS Longitude" resolve to canonical
//! GPS IDs in the OECUA registry the way the Track Map widget expects?

use ultralog::adapters::registry;

fn main() {
let names = [
"GPS Latitude",
"GPS Longitude",
"gps latitude",
"GPS Lat",
"Latitude",
"Lon",
];
println!("adapters loaded: {}", registry::get_adapters().len());
for name in names {
match registry::get_channel_metadata(name) {
Some(meta) => println!(
" {:<14} -> canonical_id={:<14} display={:<14} vendor={}",
format!("\"{}\"", name),
meta.canonical_id,
meta.display_name,
meta.vendor
),
None => println!(" \"{}\" -> NOT FOUND", name),
}
}
}
Loading