Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit fcec46e

Browse files
Update SDK and enable high resolution in Pico Neo 2 (#2931)
* Update SDK and enable high resolution in Pico Neo 2 * Fix Neo2 contollers Co-authored-by: Randall E. Barker <[email protected]>
1 parent 8d47bf1 commit fcec46e

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

app/src/picovr/cpp/DeviceDelegatePicoVR.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,23 +180,21 @@ struct DeviceDelegatePicoVR::State {
180180
controllerDelegate->SetButtonState(i, ControllerDelegate::BUTTON_OTHERS, 5, false, false);
181181
}
182182

183-
// float axes[kNumAxes] = { controller.axisX , -controller.axisY };
184-
float axes[kNumAxes] = { 0.0f, 0.0f };
183+
float axes[kNumAxes] = { controller.axisX , -controller.axisY };
185184
controllerDelegate->SetAxes(i, axes, kNumAxes);
186185

187-
/*
186+
188187
if (type == kTypeNeo2) {
189188
if (!triggerPressed) {
190189
controllerDelegate->SetScrolledDelta(i, -controller.axisX, controller.axisY);
191190
}
192191
} else {
193-
*/
194192
if (controller.touched) {
195193
controllerDelegate->SetTouchPosition(i, controller.axisX, controller.axisY);
196194
} else {
197195
controllerDelegate->EndTouch(i);
198196
}
199-
//}
197+
}
200198

201199
vrb::Matrix transform = controller.transform;
202200
if (renderMode == device::RenderMode::StandAlone) {

app/src/picovr/java/org/mozilla/vrbrowser/PlatformActivity.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ protected void onCreate(Bundle bundle) {
6262
if (ControllerClient.isControllerServiceExisted(this)) {
6363
mControllerManager = new CVControllerManager(this);
6464
mControllerManager.setListener(this);
65-
mType = 1;
65+
mType = 1; // Neo2
66+
// Enable high res
67+
PicovrSDK.SetEyeBufferSize(1920, 1920);
6668
} else {
6769
mHbManager = new HbManager(this);
6870
mHbManager.InitServices();
@@ -148,11 +150,11 @@ private void updateControllers() {
148150
}
149151
CVController main = mControllerManager.getMainController();
150152
if (main != null) {
151-
updateController(hand, main);
153+
updateController(1, main);
152154
}
153155
CVController sub = mControllerManager.getSubController();
154156
if (sub != null) {
155-
updateController(1 - hand, sub);
157+
updateController(0, sub);
156158
}
157159
} else if (mHbManager != null) {
158160
update3DofController();
@@ -202,7 +204,7 @@ private void update3DofController() {
202204
}
203205

204206
private void updateController(int aIndex, @NonNull CVController aController) {
205-
final float kMax = 25500.0f;
207+
final float kMax = 255.0f;
206208
final float kHalfMax = kMax / 2.0f;
207209
boolean connected = aController.getConnectState() > 0;
208210
if (!connected) {
@@ -213,15 +215,11 @@ private void updateController(int aIndex, @NonNull CVController aController) {
213215
float axisY = 0.0f;
214216
int[] stick = aController.getTouchPad();
215217
if (stick.length >= 2) {
216-
//Log.e(LOGTAG, "stick[" + aIndex + "] " + stick[0] + " " + stick[1]);
217-
/*
218218
axisY = ((float)stick[0] - kHalfMax) / kHalfMax;
219219
axisX = ((float)stick[1] - kHalfMax) / kHalfMax;
220220
if (axisX < 0.1f && axisX > -0.1f) { axisX = 0.0f; }
221221
if (axisY < 0.1f && axisY > -0.1f) { axisY = 0.0f; }
222-
*/
223-
axisY = (float)stick[0] / kMax;
224-
axisX = (float)stick[1] / kMax;
222+
225223
} else {
226224
stick = new int[2];
227225
}
@@ -289,12 +287,10 @@ public void surfaceChangedCallBack(int width, int height) {
289287
}
290288

291289
// CVControllerListener
292-
/*
293290
@Override
294291
public void onBindSuccess() {
295292

296293
}
297-
*/
298294

299295
@Override
300296
public void onBindFail() {
@@ -313,11 +309,12 @@ public void onConnectStateChanged(int serialNum, int state) {
313309
@Override
314310
public void onMainControllerChanged(int serialNum) {
315311
}
316-
/*
312+
317313
@Override
318-
public void onChannelChanged(int var1, int var2) {
314+
public void onChannelChanged(int i, int i1) {
315+
319316
}
320-
*/
317+
321318
protected native void nativeOnCreate();
322319
protected native void nativeInitialize(int width, int height, Object aAssetManager, int type, int focusIndex);
323320
protected native void nativeShutdown();

third_party_hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9430d0b729ccd09ed1641798090552769942b351
1+
5f3f613fa1ec0991a4e49753cb0546f4ddb95dbe

0 commit comments

Comments
 (0)