Skip to content

Commit

Permalink
Add lut scaling output
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuuuube committed Jul 25, 2024
1 parent c72ea95 commit b2ae9dd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
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
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
rawaccel_convert = { git = "https://github.com/Kuuuube/rawaccel_convert.git", rev = "4417e69f20976b1948eb21362c98b12c74b8f190" }
rawaccel_convert = { git = "https://github.com/Kuuuube/rawaccel_convert.git", rev = "6120d1dcc079a7ffffa41b0c74fc1a062281fe55" }
egui = "0.28.1"
eframe = { version = "0.28.1", features = [ "default_fonts", "glow", "persistence" ] }
env_logger = "0.11.3"
Expand Down
22 changes: 20 additions & 2 deletions src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ fn get_point(x: f64, args: &AccelArgs) -> f64 {
};
match args.point_scaling {
PointScaling::Sens => return y,
PointScaling::Velocity | PointScaling::Libinput | PointScaling::LibinputDebug => {
PointScaling::Velocity | PointScaling::Libinput | PointScaling::LibinputDebug | PointScaling::Lookup => {
let converted_point = rawaccel_convert::convert_curve::sensitivity_point_to_velocity(
rawaccel_convert::types::Point { x, y },
);
Expand Down Expand Up @@ -1090,6 +1090,11 @@ fn add_points_dump(rawaccel_convert_gui: &mut RawaccelConvertGui, ui: &mut egui:
PointScaling::LibinputDebug,
"LibinputDebug",
);
ui.selectable_value(
&mut rawaccel_convert_gui.export_point_scaling,
PointScaling::Lookup,
"Lookup",
);
})
});

Expand All @@ -1107,6 +1112,12 @@ fn add_points_dump(rawaccel_convert_gui: &mut RawaccelConvertGui, ui: &mut egui:
rawaccel_convert_gui.settings.point_count_string = "64".to_string();
}
}
PointScaling::Lookup => {
if ok != 256 {
color = ui.visuals().error_fg_color;
rawaccel_convert_gui.settings.point_count_string = "256".to_string();
}
}
_ => {
if ok > 1 {
rawaccel_convert_gui.accel_args.point_count = ok;
Expand Down Expand Up @@ -1181,7 +1192,7 @@ fn add_points_dump(rawaccel_convert_gui: &mut RawaccelConvertGui, ui: &mut egui:

rawaccel_convert_gui.accel_args.optimize_curve =
match rawaccel_convert_gui.export_point_scaling {
PointScaling::Sens | PointScaling::Velocity | PointScaling::Gain => true,
PointScaling::Sens | PointScaling::Velocity | PointScaling::Gain | PointScaling::Lookup => true,
PointScaling::Libinput | PointScaling::LibinputDebug => false,
};

Expand All @@ -1205,6 +1216,13 @@ fn add_points_dump(rawaccel_convert_gui: &mut RawaccelConvertGui, ui: &mut egui:
}
output_string
}
rawaccel_convert::types::PointScaling::Lookup => {
let mut output_string = String::default();
for point in &rawaccel_convert_gui.curvegen_export.points {
output_string += &format!("{},{};", point.x, point.y);
}
output_string
}
_ => {
format!("{:?}", rawaccel_convert_gui.curvegen_export.points)
}
Expand Down

0 comments on commit b2ae9dd

Please sign in to comment.