fix(input): use nanoseconds for device sensor intervals - #123
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthrough
Changes传感器采样间隔更新
Estimated code review effort: 1 (简单) | ~5 分钟 Merge Risk: ⚪ Minimal · up to This localized change updates sensor interval calculations and related logging; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
改了啥呀
interval按纳秒计算ns,省得以后又被这个杂鱼单位骗到啦为啥要改
HarmonyOS Sensor Service Kit 的数值型
interval单位是纳秒;原实现却按微秒计算。比如请求 100 Hz 时,原来传入的是 10,000 ns,而正确值应为 10,000,000 ns,差了 1000 倍。官方示例也以 100,000,000 ns 表示 100 ms,并说明常见支持范围为 5,000,000–200,000,000 ns:
https://gitee.com/openharmony/docs/blob/30904d2051d468bd681b08da17cbc6e87a77dbf1/en/application-dev/device/sensor-guidelines.md
本 PR 不改运动数据协议单位:陀螺仪仍从 rad/s 转成 deg/s,加速度计仍以 m/s² 发送。也不偷偷加死区或自动校准,免得把真实的慢速动作一起吃掉,哼。
验证
npm run checknode hvigorw.js assembleApp --mode project -p product=default -p buildMode=debug --no-daemon --stacktrace(unsigned,BUILD SUCCESSFUL)Summary by CodeRabbit