workin
This commit is contained in:
parent
7c7b8eebb4
commit
e9edabe3b0
|
|
@ -36,7 +36,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><br/><a class="" href="https://jakedowns.github.io/webxr.html">WebXR + WebGPU Demos!</a></li>
|
<li><br/><a class="" href="https://jakedowns.github.io/webxr.html">WebXR + WebGPU Demos!</a></li>
|
||||||
<li><br/><a class="" href="https://github.com/jakedowns/xreal-webxr">View Source For This Repo on Github</a></li>
|
<li><br/><a class="" href="https://github.com/jakedowns/xreal-webxr">View Source For This Repo on Github</a></li>
|
||||||
<li><br/><a class="" href="https://gist.github.com/CGamesPlay/b3ea7740ea8715d19e89f5511491519f">HELP! We need your help finishing these FREE, OPEN-SOURCE COMMUNITY-CONTRIBUTED, DRIVERS! Please help us fix the YAW drift!</a></li>
|
<!-- <li><br/><a class="" href="https://gist.github.com/CGamesPlay/b3ea7740ea8715d19e89f5511491519f">HELP! We need your help finishing these FREE, OPEN-SOURCE COMMUNITY-CONTRIBUTED, DRIVERS! Please help us fix the YAW drift!</a></li> -->
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@
|
||||||
<div id="connect"><button>connect</button></div>
|
<div id="connect"><button>connect</button></div>
|
||||||
<div id="disconnect" onclick="disconnectDevices()"><button>disconnect</button></div>
|
<div id="disconnect" onclick="disconnectDevices()"><button>disconnect</button></div>
|
||||||
<div id="startIMU" style="display: none;" onclick="startIMU()"><button>start headtracking</button></div>
|
<div id="startIMU" style="display: none;" onclick="startIMU()"><button>start headtracking</button></div>
|
||||||
|
<div id="stopIMU" style="display: none;" onclick="stopIMU()"><button>stop headtracking</button></div>
|
||||||
<div id="hadConnect"></div>
|
<div id="hadConnect"></div>
|
||||||
<div id="sn"></div>
|
<div id="sn"></div>
|
||||||
<div id="firmwareMcu"></div>
|
<div id="firmwareMcu"></div>
|
||||||
|
|
@ -430,7 +431,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
window.startIMU = function(){
|
window.startIMU = function(){
|
||||||
Manager.startIMU();
|
Manager.startIMU().then(result=>{
|
||||||
|
console.warn('Manager.startIMU().then...',{result})
|
||||||
|
}).catch(err=>{
|
||||||
|
console.error(err)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.stopIMU = function(){
|
||||||
|
Manager.stopIMU().then(result=>{
|
||||||
|
console.warn('Manager.stopIMU().then...',{result})
|
||||||
|
}).catch(err=>{
|
||||||
|
console.error(err)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.disconnectDevices = () => {
|
window.disconnectDevices = () => {
|
||||||
|
|
|
||||||
|
|
@ -392,18 +392,16 @@ export default class Glasses extends EventTarget {
|
||||||
sendReport(msgId, payload) {
|
sendReport(msgId, payload) {
|
||||||
const data = new Uint8Array(payload);
|
const data = new Uint8Array(payload);
|
||||||
const cmd = Protocol.cmd_build(msgId, data);
|
const cmd = Protocol.cmd_build(msgId, data);
|
||||||
// console.log({
|
|
||||||
// msgId,
|
console.warn('js_air:sendReport',{msgId,payload})
|
||||||
// payload,
|
|
||||||
// data,
|
|
||||||
// cmd
|
|
||||||
// })
|
|
||||||
|
|
||||||
console.table([{
|
console.table([{
|
||||||
|
id: 'sendReport',
|
||||||
dir: 'OUT',
|
dir: 'OUT',
|
||||||
msgId: [msgId, '0x'+(msgId.toString(16))].join(' '),
|
msgId: [msgId, '0x'+(msgId.toString(16))].join(' '),
|
||||||
key: Protocol.keyForHex(msgId),
|
key: Protocol.keyForHex(msgId),
|
||||||
payload: data.join(' '),
|
payload: data.join(' '),
|
||||||
|
_input_payload: payload,
|
||||||
cmd: cmd.map(b => b.toString(16).padStart(2, "0")).join(' ')
|
cmd: cmd.map(b => b.toString(16).padStart(2, "0")).join(' ')
|
||||||
}])
|
}])
|
||||||
this._device.sendReport(0x00, cmd);
|
this._device.sendReport(0x00, cmd);
|
||||||
|
|
|
||||||
|
|
@ -511,9 +511,9 @@ export async function getSN() {
|
||||||
/** init air IMU tracking mode */
|
/** init air IMU tracking mode */
|
||||||
export async function startIMU() {
|
export async function startIMU() {
|
||||||
if(!glasses){
|
if(!glasses){
|
||||||
return 'no device connected'
|
return Promise.reject('no device connected')
|
||||||
}
|
}
|
||||||
return glasses.sendReportTimeout(Protocol.MESSAGES.R_INIT_IMU_TRACKING_SESSION)
|
return glasses.sendReportTimeout(Protocol.MESSAGES.W_TOGGLE_IMU, [1])
|
||||||
.then(report => {
|
.then(report => {
|
||||||
console.warn('startIMU -> report',report);
|
console.warn('startIMU -> report',report);
|
||||||
if (reportSuccess(report)){
|
if (reportSuccess(report)){
|
||||||
|
|
@ -524,6 +524,22 @@ export async function startIMU() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function stopIMU() {
|
||||||
|
if(!glasses){
|
||||||
|
return 'no device connected'
|
||||||
|
}
|
||||||
|
// arg 2: 0 is what turns "off" the stream
|
||||||
|
return glasses.sendReportTimeout(Protocol.MESSAGES.W_TOGGLE_IMU, [0])
|
||||||
|
.then(report => {
|
||||||
|
console.warn('stopIMU -> report',report);
|
||||||
|
if (reportSuccess(report)){
|
||||||
|
return String.fromCharCode.apply(null, report.payload);
|
||||||
|
}else{
|
||||||
|
console.error('error w/ report',report)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/** read air glassess Brightness */
|
/** read air glassess Brightness */
|
||||||
export async function getBrightness() {
|
export async function getBrightness() {
|
||||||
let glasses = await common.connectDevice();
|
let glasses = await common.connectDevice();
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@ const RESERVED_OFS = 17;
|
||||||
|
|
||||||
export const NREAL_VENDOR_ID = 0x3318;
|
export const NREAL_VENDOR_ID = 0x3318;
|
||||||
export const BOOT_PRODUCT_ID = 0x0423;
|
export const BOOT_PRODUCT_ID = 0x0423;
|
||||||
|
export const IMU_TIMEOUT = 250;
|
||||||
|
|
||||||
export const MESSAGES = {
|
export const MESSAGES = {
|
||||||
W_CANCEL_ACTIVATION: 0x19,
|
|
||||||
R_MCU_APP_FW_VERSION: 0x26,//MCU APP FW version.
|
R_MCU_APP_FW_VERSION: 0x26,//MCU APP FW version.
|
||||||
R_GLASSID: 0x15,//MCU APP FW version.
|
R_GLASSID: 0x15,//MCU APP FW version.
|
||||||
// R_DSP_APP_FW_VERSION: 0x21,//DSP APP FW version.
|
// R_DSP_APP_FW_VERSION: 0x21,//DSP APP FW version.
|
||||||
|
|
@ -22,6 +22,9 @@ export const MESSAGES = {
|
||||||
W_ACTIVATION_TIME: 0x2A,//Write activation time
|
W_ACTIVATION_TIME: 0x2A,//Write activation time
|
||||||
W_SLEEP_TIME: 0x1E,//Write unsleep time
|
W_SLEEP_TIME: 0x1E,//Write unsleep time
|
||||||
|
|
||||||
|
W_TOGGLE_IMU: 0x19,
|
||||||
|
W_CANCEL_ACTIVATION: 0x19,
|
||||||
|
|
||||||
// R_IS_NEED_UPGRADE_DSP_FW: 0x49,//Check whether the DSP needs to be upgraded.
|
// R_IS_NEED_UPGRADE_DSP_FW: 0x49,//Check whether the DSP needs to be upgraded.
|
||||||
// W_FORCE_UPGRADE_DSP_FW: 0x69,//Force upgrade DSP.
|
// W_FORCE_UPGRADE_DSP_FW: 0x69,//Force upgrade DSP.
|
||||||
R_DSP_VERSION: 0x18,//DSP APP FW version.
|
R_DSP_VERSION: 0x18,//DSP APP FW version.
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ export default class Glasses extends EventTarget {
|
||||||
|
|
||||||
// light connect
|
// light connect
|
||||||
sendReport(msgId, payload, option) {
|
sendReport(msgId, payload, option) {
|
||||||
|
console.warn('js_light:sendReport',{msgId,payload,option})
|
||||||
const data = new Uint8Array(payload);
|
const data = new Uint8Array(payload);
|
||||||
const cmd = Protocol.cmd_build(msgId, data, option);
|
const cmd = Protocol.cmd_build(msgId, data, option);
|
||||||
this._device.sendReport(0x00, cmd);
|
this._device.sendReport(0x00, cmd);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue