Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

貌似Joycon.cs中有问题,会导致gyr_g永远都是-Infinity #9

Open
huhuime opened this issue Feb 14, 2023 · 7 comments
Open

Comments

@huhuime
Copy link

huhuime commented Feb 14, 2023

比如Joycon.cs中第1058行
gyr_g.X = (gyr_r[i] - gyr_neutral[i]) * (816.0f / (gyr_sensiti[i] - gyr_neutral[i]));
查询gyr_sensiti和gyr_neutral赋值过程

gyr_neutral[0] = (Int16)(buf_[0] | ((buf_[1] << 8) & 0xff00));
gyr_neutral[1] = (Int16)(buf_[2] | ((buf_[3] << 8) & 0xff00));
gyr_neutral[2] = (Int16)(buf_[4] | ((buf_[5] << 8) & 0xff00));
gyr_sensiti[0] = (Int16)(buf_[0] | ((buf_[1] << 8) & 0xff00));
gyr_sensiti[1] = (Int16)(buf_[2] | ((buf_[3] << 8) & 0xff00));
gyr_sensiti[2] = (Int16)(buf_[4] | ((buf_[5] << 8) & 0xff00));
 if (isSnes || thirdParty) {
                short[] temp = (short[])ConfigurationManager.AppSettings["加速度传感器灵敏度"].Split(',').Select(s => short.Parse(s)).ToArray();
                acc_sensiti[0] = temp[0]; acc_sensiti[1] = temp[1]; acc_sensiti[2] = temp[2];
                temp = (short[])ConfigurationManager.AppSettings["陀螺仪敏感度"].Split(',').Select(s => short.Parse(s)).ToArray();
                gyr_sensiti[0] = temp[0]; gyr_sensiti[1] = temp[1]; gyr_sensiti[2] = temp[2];
......

看起来第3段有额外赋值,但是查询isSnesthirdParty赋值过程可以发下在Program.cs中195行附件是这么写的

bool isPro = prod_id == product_pro;
bool isSnes = prod_id == product_snes;

这导致就算是pro手柄也必须设置为第3方手柄才能用陀螺仪?

@xiyanxy
Copy link
Owner

xiyanxy commented Feb 14, 2023

我用的是ns pro,连接后不需要设置啥的能用陀螺仪。代码可能存在问题。没去研究代码如何运行的

@huhuime
Copy link
Author

huhuime commented Feb 14, 2023

可能降级用加速度传感器来处理实现了吧,udp测试也是有问题的,你那不会一直提示“重复的时间戳加入队列”,这个也是ns pro必出bug🤣

1 similar comment
@huhuime
Copy link
Author

huhuime commented Feb 14, 2023

可能降级用加速度传感器来处理实现了吧,udp测试也是有问题的,你那不会一直提示“重复的时间戳加入队列”,这个也是ns pro必出bug🤣

@xiyanxy
Copy link
Owner

xiyanxy commented Feb 14, 2023

可能降级用加速度传感器来处理实现了吧,udp测试也是有问题的,你那不会一直提示“重复的时间戳加入队列”,这个也是ns pro必出bug🤣

😂我的ns pro连接就显示switch pro已连接之类的 没有重复队列

@huhuime
Copy link
Author

huhuime commented Feb 14, 2023

难道是电脑的蓝牙5.2有额外提升延迟?添加了非重复输出时间,结果出现了低于1ms的间隔。。。。。

@xiyanxy
Copy link
Owner

xiyanxy commented Feb 14, 2023

不清楚了。看代码也优化不出来什么。

@huhuime
Copy link
Author

huhuime commented Feb 14, 2023

不清楚了。看代码也优化不出来什么。

反复测试貌似直接吧方向传感器给干成了类似加速度的,停止运动就回归原位,估计调用这个udp协议的软件没用这些接口吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants