claw: OOP round 2 — shell UX, audio fix, -Werror, build cleanup#97
Merged
claw: OOP round 2 — shell UX, audio fix, -Werror, build cleanup#97
Conversation
41c8c78 to
05af220
Compare
[P2] claw_tools_init: call claw_tool_core_collect_from_section() on non-ESP-IDF platforms so callers using claw_tools_init() outside claw_init() still get the tool registry populated. collect_from_section is idempotent (re-registering the same pointer is a no-op since the node is already in the list). [P3] feishu/telegram: guard CLAW_SERVICE_REGISTER with CONFIG_RTCLAW_FEISHU_ENABLE / CONFIG_RTCLAW_TELEGRAM_ENABLE. Previously the no-op service stubs were unconditionally registered, consuming service slots and reporting misleading lifecycle state when the feature is disabled. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
- Move IM service registration blocks (deps, ops, ctx, register) inside
#ifdef CONFIG_RTCLAW_{FEISHU,TELEGRAM}_ENABLE guards to eliminate
unused variable/function warnings when services are disabled.
Remove now-unnecessary stub functions and tentative definitions from
the #else blocks; keep only the setter/getter stubs needed by shell.
- Scope s_collected inside #ifndef CLAW_PLATFORM_ESP_IDF block in
claw_init.c to avoid unused variable warning on ESP-IDF builds.
- Mark pa_pin as __attribute__((unused)) in xiaozhi-xmini board.c
since it is only used when CONFIG_RTCLAW_AUDIO_ENABLE is set.
- Add __attribute__((unused)) to test framework static variables in
tests/unit/framework/test.h to suppress warnings in compilation
units that include the header but don't use all macros.
- Remove unused reply/argv variables in test_ai_skill.c.
- Enable CONFIG_RTCLAW_AUDIO_ENABLE in xiaozhi-xmini sdkconfig for
full hardware component testing on V1 boards.
All 7+ platform targets (ESP32-C3 x3, ESP32-S3 x2, vexpress-a9,
zynq-a9, linux) pass clean build with zero rt-claw code warnings.
Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
- Change interactive shell prompt from "<You>" to "rt-claw chat>" on both ESP-IDF and Linux platforms to match AC-6 requirement. - Update functional test platform.py shell_prompt accordingly. - Add MAC address (WiFi STA) and heap usage (free_heap, min_free_heap) to ESP-IDF system_info tool response for AC-5.2 compliance. - Reject empty task name in both tool_sched.c (tool layer) and scheduler.c (core layer) for AC-5.3 negative case compliance. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
- Extract tone generation into generate_tone() so play_melody() can call it directly without PA toggling on every note. - Apply 10ms linear fade-in/out envelope to eliminate abrupt signal start/stop click artifacts. - Add 50ms PA stabilization delay after enable and 30ms silence drain before disable to suppress Class-D amplifier pop noise. - es8311_audio_beep() still manages its own PA for standalone use. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
- Shell: after buffer reaches capacity (255 bytes), drain remaining input bytes until newline to prevent overflow leaking into the next command. Applied to both ESP-IDF and Linux shell. - Scheduler NVS restore: assign interval_s and count to runtime context so that subsequent sched_nvs_save() does not write zero values back, corrupting the persistent record. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
05af220 to
ca99fe8
Compare
claw_init() already calls claw_tool_core_collect_from_section() before services start. The duplicate call in claw_tools_init() is harmless in normal boot (guarded by s_collected flag) but breaks Zynq unit tests: the test binary does not call claw_init(), so the collect pulls in all production tools, exhausting cJSON heap during test_tools_to_json assertions. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
The ConsoleBuffer reads stdout line-by-line (splits on \n). The actual shell prompt "rt-claw chat> " has no trailing newline (it waits for user input), so the pattern "rt-claw chat>" never matches a complete line. Revert to "rt-claw chat" which matches the help text "rt-claw chat (type /help for commands)\n" that does end with a newline. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Post-merge refinements for the OOP refactor branch (Round 2), rebased onto latest main.
Shell UX
you>for user input,rt-claw>for AI reply,error>/sched>for status — symmetric, no angle brackets/system_infooutputAudio
Build Quality
-Werrorenforced project-wide: Mesonwerror=true+ ESP-IDFtarget_compile_options(PRIVATE -Werror)for all project code; vendor/third-party excludedCONFIG_RTCLAW_TOOL_MOUSEguard#ifndefguards onSTDIN_BASEADDRESS/STDOUT_BASEADDRESS--no-warn-rwx-segments(bare-metal expected)IM Cleanup
CONFIG_RTCLAW_*_ENABLETests
claw_tools_init(broke Zynq unit tests)Docs
-Werrorpolicy in CLAUDE.md and coding-style.md (EN/ZH)Changes (12 commits)
claw: collect tools in claw_tools_init, guard IM service registrationclaw: fix compilation warnings and enable audio on xiaozhi-xminiclaw: fix shell prompt, add MAC to system info, reject empty sched namedrivers: fix ES8311 beep noise with fade envelope and PA stabilizationclaw: fix shell input overflow and scheduler NVS restoreclaw: remove redundant section collect from claw_tools_inittests: revert shell_prompt pattern to match help text lineclaw: unify shell prefixes to you> / rt-claw> styledrivers: fix unused warnings in tool_mouse stub codebuild: fix CMake configure-time warnings and Zynq macro redefinitionbuild: enable -Werror for all project codedocs: update Discord link, shell prefixes, and -Werror policyTest plan
make test-unit-zynq— all suites passmake test-smoke-zynq— boot test passmake test-smoke-vexpress— boot test passmake build-linux— zero warningsmake build-esp32c3-qemu— CImake test-smoke-esp32c3— CImake build-esp32c3-xiaozhi-xmini— verify ES8311 audio on hardware