GPS 外设。通过 UART 读取任意发送端(talker)的 NMEA,自行找出接收器的通信速率,并报告卫星和海拔。
仓库:github.com/dekiengine/deki-gps · 最新版本:0.19.0 · 需要引擎 0.19.0 或更高版本 · 依赖:deki-http, deki-uart
使用 DekiEditor --packages-add deki-gps <project> 或通过包管理器安装。引擎自身的组件和 C++ API 见 Deki 文档。
在编辑器中显示为 **GPS (NMEA over UART)**。
组件
功能开关
可以从构建中去掉的部分。带有 define 的功能通过该 define 开关,其余的随其组件一起被剥离。
| 功能 | define | 默认值 |
| NMEA UART | DEKI_FEATURE_GPS_NMEA | 开 |
组件参考
DesktopGPSComponent
在桌面平台上代替 GPS 接收器,无需硬件即可获取位置。
检视器中的名称:桌面 GPS · 类别:系统 · 类型:DekiGps::DesktopGPSComponent
没有反射的属性。
NEO6MGPSComponent
通过 UART 从 u-blox NEO-6M GPS 读取位置。
检视器中的名称:NEO-6M GPS · 类别:传感器 · 类型:DekiGps::NEO6MGPSComponent
| 属性 | 类型 | 默认值 | 约束 | 说明 |
| txPin | int32 | 17 | 0 到 48 | 开发板用于发送的 GPIO,连接到模块的 RX。交叉连接:这个引脚发送,模块接收。 |
| rxPin | int32 | 16 | 0 到 48 | 开发板用于接收的 GPIO,连接到模块的 TX。位置数据通过这个引脚传入,所以一直无法定位时,通常是这个引脚的问题。 |
| baudRate | int32 | 9600 | 0 到 921600 | 串口速度,必须与模块的配置一致。NEO-6M 出厂为 9600;如果模块改成了 38400 而这里仍为 9600,读到的会是乱码,而不是没有数据。设为 0 时会自动查找:依次尝试 9600、38400、115200、57600 和 4800,直到收到有效的 NMEA,适用于搭载多种模块的开发板。 |
| uartPort | int32 | 1 | 0 到 2 | 使用芯片的哪个串口控制器。端口 0 通常是 USB 控制台,所以 GPS 一般使用 1 或 2。 |
更新日志
更新日志为英文。
0.19.0
Changed
- minEngine 0.19.0: built against engine 0.19.0, whose component metadata records the package each class is in. A build of this package from before does not load and is rebuilt.
Added
- Japanese, Simplified Chinese and Korean: editor/lang/ja.json, zh.json and ko.json translate the names, tooltips and enum values this package's components show in the Inspector.
0.18.2
Added
- IDekiGPS::Status(): sentences read, satellites in view (all constellations) and in use, altitude, and the serial speed. Indoors, where there may never be a fix, it shows whether the receiver is talking and how the search is going.
- baudRate 0 on NEO6MGPSComponent finds the speed: 9600, 38400, 115200, 57600 and 4800 are tried until a valid sentence arrives. For a board that ships with more than one kind of module (the LilyGO T-Deck Plus: L76K or u-blox M10).
- Reads $–GGA and $–GSV besides $–RMC, from any talker.
- DekiGPSStatus::bytes: bytes read from the receiver, valid or not. With no sentences, bytes mean a wrong speed; none, a wrong pin or no power.
Fixed
- A device never read its GPS. Nothing called the NMEA driver's update, so its UART was never read and there was never a fix. NEO6MGPSComponent now updates it every frame.
- A position sentence with an empty field (no course, as when standing still) shifted every field after it, losing the date and time: fields were split with strtok, which skips empty ones.
更早的版本:CHANGELOG.md
由包的反射数据生成(引擎 0.19.0)。属性名就是场景文件中使用的键。重命名后会保留别名(兼容性)。