Skip to content

Commit 0b2b998

Browse files
committed
initial commit
0 parents  commit 0b2b998

24 files changed

+1424
-0
lines changed

.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# The .vscode folder contains launch configuration and tasks you configure in
19+
# VS Code which you may wish to be included in version control, so this line
20+
# is commented out by default.
21+
#.vscode/
22+
23+
# Flutter/Dart/Pub related
24+
**/doc/api/
25+
**/ios/Flutter/.last_build_id
26+
.dart_tool/
27+
.flutter-plugins
28+
.flutter-plugins-dependencies
29+
.packages
30+
.pub-cache/
31+
.pub/
32+
/build/
33+
34+
# Web related
35+
lib/generated_plugin_registrant.dart
36+
37+
# Symbolication related
38+
app.*.symbols
39+
40+
# Obfuscation related
41+
app.*.map.json
42+
43+
# Android Studio will place build artifacts here
44+
/android/app/debug
45+
/android/app/profile
46+
/android/app/release

.metadata

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: 097d3313d8e2c7f901932d63e537c1acefb87800
8+
channel: unknown
9+
10+
project_type: app

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# flutter_libinput_calibrator
2+
3+
A flutter app for calculating a libinput touchscreen calibration matrix. For use with [flutter-pi](https://github.com/ardera/flutter-pi) and linux.
4+
5+
To use:
6+
- build & deploy the app using the instructions given in the flutter-pi readme
7+
- start the app and follow the instructions.
8+
- the command for actually applying the calibration will be outputed to the terminal.

analysis_options.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
24+
rules:
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

assets/fonts/RobotoMono-Bold.ttf

85 KB
Binary file not shown.
91.9 KB
Binary file not shown.
85.7 KB
Binary file not shown.
91.2 KB
Binary file not shown.

assets/fonts/RobotoMono-Italic.ttf

91.7 KB
Binary file not shown.

assets/fonts/RobotoMono-Light.ttf

85.5 KB
Binary file not shown.
91.6 KB
Binary file not shown.

assets/fonts/RobotoMono-Medium.ttf

84.8 KB
Binary file not shown.
91.7 KB
Binary file not shown.

assets/fonts/RobotoMono-Regular.ttf

84.9 KB
Binary file not shown.

assets/fonts/RobotoMono-SemiBold.ttf

85 KB
Binary file not shown.
91.7 KB
Binary file not shown.

assets/fonts/RobotoMono-Thin.ttf

85.8 KB
Binary file not shown.
90.9 KB
Binary file not shown.

lib/common.dart

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import 'dart:async';
2+
import 'dart:math';
3+
4+
import 'package:equations/equations.dart';
5+
6+
class CalibrationResult {
7+
CalibrationResult(this.matrix);
8+
9+
final RealMatrix matrix;
10+
11+
late final a = matrix.itemAt(0, 0);
12+
late final b = matrix.itemAt(0, 1);
13+
late final c = matrix.itemAt(0, 2);
14+
late final d = matrix.itemAt(1, 0);
15+
late final e = matrix.itemAt(1, 1);
16+
late final f = matrix.itemAt(1, 2);
17+
18+
CalibrationResult rounded(int digitsAfterDecimal) {
19+
final factor = pow(10, digitsAfterDecimal);
20+
return CalibrationResult(
21+
RealMatrix.fromFlattenedData(
22+
rows: 3,
23+
columns: 3,
24+
data: matrix
25+
.toList()
26+
.map((e) => (e * factor).roundToDouble() / factor)
27+
.toList(),
28+
),
29+
);
30+
}
31+
}
32+
33+
extension MaybeComplete<T> on Completer<T> {
34+
void maybeComplete([FutureOr<T>? result]) {
35+
if (!isCompleted) {
36+
complete(result);
37+
}
38+
}
39+
40+
void maybeCompleteError(Object error, [StackTrace? stackTrace]) {
41+
if (!isCompleted) {
42+
completeError(error, stackTrace);
43+
}
44+
}
45+
}
46+
47+
class Touchscreen {
48+
const Touchscreen(
49+
this.name,
50+
this.bustype,
51+
this.product,
52+
this.vendor,
53+
this.calibrationMatrix,
54+
);
55+
56+
final String name;
57+
final String bustype;
58+
final String product;
59+
final String vendor;
60+
final RealMatrix? calibrationMatrix;
61+
}

0 commit comments

Comments
 (0)