mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-06 13:00:15 +01:00
tools: switch the ptraccel-debug printf to use mm/s
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
84ab969c26
commit
ec63ecd485
1 changed files with 21 additions and 9 deletions
|
|
@ -141,19 +141,31 @@ print_ptraccel_sequence(struct motion_filter *filter,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_accel_func(struct motion_filter *filter, accel_profile_func_t profile)
|
||||
/* mm/s → units/µs */
|
||||
static inline double
|
||||
mmps_to_upus(double mmps, int dpi)
|
||||
{
|
||||
double vel;
|
||||
return mmps * (dpi/25.4) / 1e6;
|
||||
}
|
||||
|
||||
static void
|
||||
print_accel_func(struct motion_filter *filter,
|
||||
accel_profile_func_t profile,
|
||||
int dpi)
|
||||
{
|
||||
double mmps;
|
||||
|
||||
printf("# gnuplot:\n");
|
||||
printf("# set xlabel \"speed\"\n");
|
||||
printf("# set xlabel \"speed (mm/s)\"\n");
|
||||
printf("# set ylabel \"raw accel factor\"\n");
|
||||
printf("# set style data lines\n");
|
||||
printf("# plot \"gnuplot.data\" using 1:2\n");
|
||||
for (vel = 0.0; vel < 0.004; vel += 0.0000001) {
|
||||
double result = profile(filter, NULL, vel, 0 /* time */);
|
||||
printf("%.8f\t%.4f\n", vel, result);
|
||||
printf("# plot \"gnuplot.data\" using 1:2 title 'accel factor'\n");
|
||||
printf("#\n");
|
||||
printf("# data: velocity(mm/s) factor velocity(units/us)\n");
|
||||
for (mmps = 0.0; mmps < 300.0; mmps += 1) {
|
||||
double units_per_us = mmps_to_upus(mmps, dpi);
|
||||
double result = profile(filter, NULL, units_per_us, 0 /* time */);
|
||||
printf("%.8f\t%.4f\t%.8f\n", mmps, result, units_per_us);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -338,7 +350,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if (print_accel)
|
||||
print_accel_func(filter, profile);
|
||||
print_accel_func(filter, profile, dpi);
|
||||
else if (print_delta)
|
||||
print_ptraccel_deltas(filter, step);
|
||||
else if (print_motion)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue