ble
免费Bluetooth context for the Megahub project. Use when working on BLE GATT server, Classic Bluetooth HID host, Web Bluetooth API integration, btremote library, connection handling, or any Bluetooth-related firmware code.
中文简介正在准备中。当前显示原文说明。
LEGO Powered Up protocol context for the Megahub project. Use when working on LEGO device communication, lpfuart library, UART parsing, motor control, sensor modes, device initialization, or debugging UART noise/corruption issues.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
lib/lpfuart/ — legodevice.cpp, lumpparser.cpp, SC16IS752serialadapter.cppDevices send identification messages on connect. Never skip any step.
LUMP_CMD_TYPE — device reports its type ID and nameLUMP_CMD_MODES — device reports number of supported modesLUMP_CMD_SPEED — device requests baud rate to switch toLUMP_CMD_VERSION — device reports firmware + hardware versionsLUMP_INFO_NAME/RAW/PCT/SI/UNITS/MAPPING/FORMAT — per-mode metadata (repeats for each mode)LUMP_INFO_MODE_COMBOS — supported mode combinationsfinishHandshake() — switch to negotiated baud rate (e.g., 115200)selectMode() — set default operating modeExample (BOOST Interactive Motor, device ID 0x26):
CMD_SELECTThis is a known hardware issue. When motors run, EMI corrupts the UART RX line.
[WARN] LUMP sync lost after N good frames (checksum expected=0xXX actual=0xYY)0xD2 bytes in discarded data (spurious detections of LEGO header byte)uartOvr=1 in parser stats — SC16IS752 FIFO overflowMotor control via M1/M2 generates high-frequency switching noise → current spikes → EMI coupling into UART RX trace → SC16IS752 FIFO fills faster than ESP32 reads via I²C.
delayMicroseconds(100) after motor speed changes (allows transients to settle)uartOvr| Priority | Fix | Expected improvement |
|---|---|---|
| 1 (best) | 68–100pF NP0/C0G ceramic cap on UART RX pin to GND | 50–70% error reduction |
| 2 | Clip-on ferrite bead on RX wire near PCB | 40–60% error reduction |
| 3 | 100Ω + 100pF RC filter on UART TX | 10–20% additional |
| 4 | 100nF decoupling cap on SC16IS752 VCC pin | standard practice |
Target: < 5 sync recoveries per minute with motor at 100% speed.
The parser (lumpparser.cpp) handles corruption gracefully:
Good state: Parser: ok=XXX csErr=0 discarded=0 recoveries=0 uartOvr=0
Watch parser stats in serial log (logged every ~5 seconds):
[INFO] logParserStats() - Parser: ok=138 csErr=0 discarded=0 recoveries=0 overflow=0 unknownSys=0 invalidSize=0 uartOvr=1
| Field | Meaning |
|---|---|
ok | Good frames parsed |
csErr | Checksum errors |
discarded | Bytes thrown away during resync |
recoveries | Number of sync-loss recovery events |
uartOvr | SC16IS752 FIFO overflow count |
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Bluetooth context for the Megahub project. Use when working on BLE GATT server, Classic Bluetooth HID host, Web Bluetooth API integration, btremote library, connection handling, or any Bluetooth-related firmware code.
中文简介正在准备中。当前显示原文说明。
Blockly visual programming context for the Megahub project. Use when adding, modifying, or debugging custom Blockly blocks, the Lua code generator, the toolbox, block colors, or the BLOCKS.md documentation generation script.
中文简介正在准备中。当前显示原文说明。
Documentation structure and maintenance rules for the Megahub project. Use whenever making user-facing changes — adding features, changing behavior, fixing hardware compatibility, or modifying configuration. Describes which files to update, the README structure, and writing style.
中文简介正在准备中。当前显示原文说明。
Core firmware context for the Megahub ESP32 project. Use when working on PlatformIO configuration, build scripts, library structure, main.cpp, or general ESP32 firmware development. Covers build system, project structure, common pitfalls, and debugging.
中文简介正在准备中。当前显示原文说明。
Frontend development context for the Megahub project. Use when working on the web-based IDE, Vite build system, Blockly visual programming, Web Bluetooth API integration, JavaScript frontend code, CSS/styles, UI components, or anything in the /frontend/ directory.
中文简介正在准备中。当前显示原文说明。
Code formatting and linting context for the Megahub project. Use when writing or reviewing code in C++ or JavaScript, or when running format/lint checks. Describes tool commands, style conventions, and when to apply them.
中文简介正在准备中。当前显示原文说明。