Skip to content

Commit

Permalink
rc throwmeter 1.6.1 (#8)
Browse files Browse the repository at this point in the history
* new stl files from prondel (doc only)

* permission bug fixes, permission check ignore option added

* some update/corrections in built-in html docu

* add percentage diff display option

* html doc update for diff screen

---------

Co-authored-by: Alois Hahn <[email protected]>
  • Loading branch information
ahahn61 and Alois Hahn authored Feb 27, 2024
1 parent baa405f commit 940c211
Show file tree
Hide file tree
Showing 48 changed files with 518 additions and 157 deletions.
42 changes: 30 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ The app displays a description and instructions on the first screen, just instal

![RC Throwmeter](/doc/start_screen.jpg)



This is an example of the throwmeter display screen.

![RC Throwmeter](/doc/main_screen.jpg)


## Resources

Expand All @@ -32,32 +36,46 @@ WitMotion
[BWT901CL](/doc/BWT901CL)



![RC Throwmeter](/doc/main_screen.jpg)

# 3D Printed Holding Clip

You can print your own universal mounting clip.

![RC Throwmeter](/doc/clip/image003.jpg)
<img src="/doc/clip/clip-02.jpg" alt="drawing" width="300"/>

All parts and more are published on [Thingiverse (Part 6479899)](https://www.thingiverse.com/thing:6479899)

[Mounting Clip STL](/doc/clip/clips_V2.stl)

STL file
[Sensor Sticker PDF](/doc/clip/sticker.pdf)

[Mounting Clip STL File](/doc/clip/clips_V2.stl)
<img src="/doc/clip/clip-03.jpg" alt="drawing" width="300"/>

Sticker
<img src="/doc/clip/clip-04.jpg" alt="drawing" width="300"/>

<img src="/doc/clip/clip-05.jpg" alt="drawing" width="300"/>

<img src="/doc/clip/clip-06.jpg" alt="drawing" width="300"/>

<img src="/doc/clip/clip-07.jpg" alt="drawing" width="300"/>

[Mounting Clip Sticker PDF](/doc/clip/sticker.pdf)

[More 3d printed parts](https://www.thingiverse.com/thing:6479899/apps?fbclid=IwAR3RKmbelq7ynDV4Q1acz99nUar9Vw82zQ2zmdLvJ-FWQSZJtKdPMc9MMN8)

# Measuring Incidence Angle

Use this idea to make your own incidence angle gauge.
Use this ideas to make your own incidence angle gauge.

See here for ![More Details about Incidence Angle Gauge ](/doc/incidence_angle/README-wing-incidence.md)

## Design 1 by Pierre Rondel
<img src="/doc/incidence_angle/thingiverse/images/ab188025-2032-4a18-9bfb-140bcdd05252.jpg" alt="drawing" width="300"/>

## Design 2 by Thommy
<img src="/doc/incidence_angle/incidence-gauge.jpg" alt="drawing" width="300"/>




![Incidence Angle Gauge](/doc/incidence_angle/incidence-gauge_small.jpg)

![Incidence Angle Gauge ](/doc/incidence_angle/README-wing-incidence.md)



Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
273 changes: 197 additions & 76 deletions app/src/main/assets/Make-your-own-BlueTooth-RC-Throwmeter-V2.0.htm

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ protected void connectDevices() {

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_ENABLE_BT) {
if (resultCode == Activity.RESULT_OK) {
if(requestCode == REQUEST_ENABLE_BT) {
if(resultCode == Activity.RESULT_OK) {

mBluetoothPipe.setupService(mBluetoothService, mHandler);
mBluetoothPipe.startService();
Expand Down
53 changes: 34 additions & 19 deletions app/src/main/java/com/pitchgauge/j9pr/pitchgauge/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ private boolean hasPermissions(String[] permissions) {
// permissions result callback (not used)
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], int[] grantResults) {

super.onRequestPermissionsResult(requestCode, permissions, grantResults);
for (int i = 0; i < permissions.length; i++) {
if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, permissions[i] + " permission denied");
Expand Down Expand Up @@ -165,23 +164,40 @@ public boolean onNavigationItemSelected(MenuItem item) {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
Resources res = getResources();

// warning if user has denied permissions, android app can not ask again
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { // do not check for Android Version < 12
if (!hasPermissions(PERMISSIONS)) {
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(res.getString(R.string.txt_missing_permission) + " " + res.getString(R.string.app_name))
.setMessage(res.getString(R.string.txt_notify_nearby_devices))
.setPositiveButton("Exit", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
.setNegativeButton("Cancel", null)
.show();
drawer.closeDrawer(GravityCompat.START);
return true;
// warning if user has denied permissions, android app can not ask again
MainPrefs prefs = new MainPrefs();
prefs = BluetoothPreferences.getMainPrefs(getApplicationContext());

if (prefs.permissionCheck != MainPrefs.permissionCheckT.IGNORE) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) { // do not check for Android Version < 12
if (!hasPermissions(PERMISSIONS)) {
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(res.getString(R.string.txt_missing_permission) + " " + res.getString(R.string.app_name))
.setMessage(res.getString(R.string.txt_notify_nearby_devices))
.setPositiveButton("Exit", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
// ignore button is a workaround for devices, which fail at hasPermissions() for unknown reasonss
// e.g. xiaomi android 12
.setNeutralButton("Ignore", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// read main preferences
MainPrefs prefs = new MainPrefs();
prefs = BluetoothPreferences.getMainPrefs(getApplicationContext());
prefs.setPermissionCheck(MainPrefs.permissionCheckT.IGNORE);
BluetoothPreferences.setMainPrefs(getApplicationContext(), prefs);
}
})
.setNegativeButton("Cancel", null)
.show();
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
}

Expand Down Expand Up @@ -217,7 +233,6 @@ public void onClick(DialogInterface dialog, int which) {
}

public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQ_DATA_ACTIVITY:
if (resultCode == RESULT_OK) {
Expand Down
17 changes: 16 additions & 1 deletion app/src/main/java/com/pitchgauge/j9pr/pitchgauge/MainPrefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public MainPrefs() {
throwCalcMethod = throwCalcMethodT.ORTHO;
witModel = witModelT.AUTO;
sensorConfigMode = sensorConfigModeT.MANUAL; // use manual mode, as auto mode is still not finalized
permissionCheck = permissionCheckT.NORMAL;
}

enum unitsT {
Expand Down Expand Up @@ -44,25 +45,36 @@ enum sensorConfigModeT {
MANUAL
};

// permission check fails for some devices (xiaomi android 12)
// can be ignored manually, just a workaround
enum permissionCheckT {
NORMAL,
IGNORE //
};

unitsT units;
zmodeT zMode;
throwCalcMethodT throwCalcMethod;
witModelT witModel;
sensorConfigModeT sensorConfigMode;
permissionCheckT permissionCheck;

protected MainPrefs(Parcel in) {
units = unitsT.valueOf(in.readString());
zMode = zmodeT.valueOf(in.readString());
throwCalcMethod = throwCalcMethodT.valueOf(in.readString());
witModel = witModelT.valueOf(in.readString());
sensorConfigMode = sensorConfigModeT.valueOf(in.readString());
permissionCheck = permissionCheckT.valueOf(in.readString());
}

@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(units.toString());
dest.writeString(zMode.toString());
dest.writeString(witModel.toString());
dest.writeString(throwCalcMethod.toString());
dest.writeString(witModel.toString());
dest.writeString(permissionCheck.toString());
}

@Override
Expand Down Expand Up @@ -114,4 +126,7 @@ public void setSensorConfigMode(sensorConfigModeT sensorConfigMode) {
this.sensorConfigMode = sensorConfigMode;
}

public void setPermissionCheck(permissionCheckT t) {
this.permissionCheck = t;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ private enum bwtModelT {
private btStatusWatcherClass btWatcher = new btStatusWatcherClass();

public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CONNECT_DEVICE) {
if (resultCode == Activity.RESULT_OK) {
if(requestCode == REQUEST_CONNECT_DEVICE) {
if(resultCode == Activity.RESULT_OK) {
//TODO
// mBluetoothPipe.connect(data);
}
Expand Down
58 changes: 50 additions & 8 deletions app/src/main/java/com/pitchgauge/j9pr/pitchgauge/ThrowGauge.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,54 @@ public void SetMinTravel(double travel){
mMinTravelAlarm = travel;
}

public boolean IsAboveAngleMax(){
if (mMaxTravelAlarm == 0) {
return false;
}
if (mChord == 0) {
return Math.toDegrees(mQuatAngleFiltered) > mMaxTravelAlarm;
} else {
return false;
}
}

public boolean IsBelowAngleMin(){
if (mMinTravelAlarm == 0) {
return false;
}
if (mChord == 0) {
return Math.toDegrees(mQuatAngleFiltered) < mMinTravelAlarm;
} else {
return false;
}
}

public boolean IsAboveTravelMax(){
if (mMaxTravelAlarm == 0)
if (mMaxTravelAlarm == 0) {
return false;
return mCurrentTravel > mMaxTravelAlarm;
}
if (mChord == 0) {
return false;
} else {
return mCurrentTravel > mMaxTravelAlarm;
}
}

public boolean IsBelowTravelMin(){
if (mMinTravelAlarm == 0)
if (mMinTravelAlarm == 0) {
return false;
return mCurrentTravel < mMinTravelAlarm;
}
if (mChord == 0) {
return false;
} else {
return mCurrentTravel < mMinTravelAlarm;
}
}

public double ResolveQuatsThrow() {

double mCurrentTmp = 0;

if (ignoreZ) {
toQuaternion(mQBoard, 0, mEulerPitch, mEulerRoll);
} else {
Expand Down Expand Up @@ -276,10 +311,17 @@ public double ResolveQuatsThrow() {
break;
}

// chord=0 show angle min/max instead travel min/max being 0.0
if (mChord == 0) {
mCurrentTmp = Math.toDegrees(mQuatAngleFiltered);
} else {
mCurrentTmp = mCurrentTravel;
}

// min/max travel with glitch filter
if(mCurrentTravel < mMinThrow) {
if(mCurrentTmp < mMinThrow) {
tMin += deltaT;
sumMin += mCurrentTravel;
sumMin += mCurrentTmp;
iMin ++;
if (tMin > 800) {
mMinThrow = sumMin / iMin;
Expand All @@ -292,9 +334,9 @@ public double ResolveQuatsThrow() {
iMin = 0;
sumMin = 0;
}
if(mCurrentTravel > mMaxThrow) {
if(mCurrentTmp > mMaxThrow) {
tMax += deltaT;
sumMax += mCurrentTravel;
sumMax += mCurrentTmp;
iMax ++;
if (tMax > 800) {
mMaxThrow = sumMax / iMax;
Expand Down
Loading

0 comments on commit 940c211

Please sign in to comment.