mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 08:18:02 +02: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
|
/* mm/s → units/µs */
|
||||||
print_accel_func(struct motion_filter *filter, accel_profile_func_t profile)
|
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("# gnuplot:\n");
|
||||||
printf("# set xlabel \"speed\"\n");
|
printf("# set xlabel \"speed (mm/s)\"\n");
|
||||||
printf("# set ylabel \"raw accel factor\"\n");
|
printf("# set ylabel \"raw accel factor\"\n");
|
||||||
printf("# set style data lines\n");
|
printf("# set style data lines\n");
|
||||||
printf("# plot \"gnuplot.data\" using 1:2\n");
|
printf("# plot \"gnuplot.data\" using 1:2 title 'accel factor'\n");
|
||||||
for (vel = 0.0; vel < 0.004; vel += 0.0000001) {
|
printf("#\n");
|
||||||
double result = profile(filter, NULL, vel, 0 /* time */);
|
printf("# data: velocity(mm/s) factor velocity(units/us)\n");
|
||||||
printf("%.8f\t%.4f\n", vel, result);
|
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)
|
if (print_accel)
|
||||||
print_accel_func(filter, profile);
|
print_accel_func(filter, profile, dpi);
|
||||||
else if (print_delta)
|
else if (print_delta)
|
||||||
print_ptraccel_deltas(filter, step);
|
print_ptraccel_deltas(filter, step);
|
||||||
else if (print_motion)
|
else if (print_motion)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue