Conversation
- removed constant print infos in debug mode - spacing - removed splitter indicator
There was a problem hiding this comment.
Looks good. See review comments in the XPlat PR.
Also, see the latest PR template, specifically the Testing section. Let's conform this PR to that.
|
@coderabbitai perform an review |
|
@nitin710 I'll perform a comprehensive review of this PR focusing on the packet splitter refactoring, new debugger commands, and error handling improvements. ✅ Actions performedReview triggered.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests
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 |
There was a problem hiding this comment.
Actionable comments posted: 7
🔭 Outside diff range comments (1)
EmotiBit.cpp (1)
2421-2421: Fix debug print to use correct variable name.The debug print references an undefined variable
tinstead of the parametertype.size_t EmotiBit::getData(DataType type, float** data, uint32_t * timestamp) { #ifdef DEBUG Serial.print("getData: type="); - Serial.println((uint8_t) t); + Serial.println((uint8_t) type); #endif // DEBUG
🧹 Nitpick comments (2)
testing/PacketFixedLengthTest/README.md (2)
2-2: Grammar fixes: “This tests verifies” → “This test verifies.”Minor but visible in the first sentence.
Apply this diff (already included in a previous suggestion but calling it out explicitly due to prominence):
- This tests verifies + This test verifies
10-10: Spelling: “oscilliscope” → “oscilloscope.”Caught by static analysis; fix for professionalism.
Apply this diff (already included in a previous suggestion but calling it out explicitly for traceability):
-4. Pressing record in the oscilliscope and waiting for the test to finish +4. Pressing record in the oscilloscope and waiting for the test to finish
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
EmotiBit.cpp(8 hunks)EmotiBit.h(3 hunks)EmotiBitWiFi.cpp(1 hunks)library.properties(1 hunks)testing/PacketFixedLengthTest/README.md(1 hunks)testing/PacketFixedLengthTest/run_test.sh(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
EmotiBit.cpp (1)
EmotiBitWiFi.cpp (2)
sendData(407-416)sendData(407-407)
🪛 LanguageTool
testing/PacketFixedLengthTest/README.md
[grammar] ~10-~10: Ensure spelling is correct
Context: ...tter test '@' 4. Pressing record in the oscilliscope and waiting for the test to finish 5. C...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (10)
library.properties (1)
2-2: LGTM! Version bump is appropriate for the refactor.The version increment from 1.14.0 to 1.14.1 correctly follows semantic versioning for a patch release containing the packet splitter refactor and bug fixes.
EmotiBit.h (2)
301-301: Good rename to better reflect the constant's broader usage.The rename from
MAX_SD_WRITE_LENtoMAX_SEND_LENbetter reflects that this constant is now used for both SD card writes and network sends.
428-428: LGTM! Well-structured test data type addition.The addition of
_testDataTypewith a sensible default ofSAWTOOTHprovides good flexibility for different test data patterns.EmotiBit.cpp (7)
1651-1651: Good fix for the debug input processing issue.Using
Serial.peek()instead ofSerial.read()correctly addresses the issue from #318 where the 'F' character was being consumed prematurely, preventing FTP mode from being triggered.
1749-1753: LGTM! Cleaner main loop data flow.Moving
processData()andsendData()out of conditional logic ensures data is always processed consistently, regardless of test mode.
3409-3488: Well-implemented centralized packet splitting logic.The refactored
sendData()function successfully centralizes packet splitting from WiFi and SD card write functions. The implementation correctly:
- Handles test data injection when enabled
- Splits messages into chunks respecting
MAX_SEND_LENboundaries- Preserves packet integrity by splitting at delimiter boundaries
- Handles both the main buffer and remainder consistently
3665-3678: Good error handling for oversized SD card writes.The new overflow detection correctly identifies when a message exceeds
MAX_SEND_LENand logs aDATA_OVERFLOWpacket with the attempted size. This provides valuable debugging information.
3876-3876: Appropriate use of new test data API.The updated call to
EmotiBitPacket::createTestDataPacketcorrectly passes the_testDataTypeparameter to support different test patterns.
3983-3986: Well-designed debug commands for test data control.The new debug commands provide good runtime control over test data:
>and<for enabling/disabling test data@and#for selecting test type
Clear user prompts make the functionality discoverable.Also applies to: 4333-4351
3411-3422: Consider edge case: empty test data when not recording.The logic only adds test data when
_sdWriteis true (line 3875), but test data mode can be enabled without recording. This might confuse users who enable test mode but don't see any test data because recording isn't active.Consider whether test data should be generated regardless of recording state, or if the current behavior should be documented more clearly in the debug help text.
produceconsumerobot
left a comment
There was a problem hiding this comment.
Some minor comments, but overall looks great.
There was a problem hiding this comment.
From this description, I'm not sure I can understand what this test is doing. Perhaps improving the clarity would be helpful.
There was a problem hiding this comment.
Edited for clarity
|
Ready for merge |
Description
This PR moves the packet splitter functionality into
sendData, out ofEmotiBitWifiandwriteSdCardMessage. This sets us up to split packets in a single spot, so when we enable Bluetooth we won't add yet another splitter.Requirements
To run this branch you need:
PR #30
Issues Referenced
replacing "read" with "peek" allowed me to input the other debugging commands
Documentation update
None
Notes for Reviewer
sendUDPis moved into EmotiBitsendData. The WiFi splitter was chosen over the splitter in writeSdCardMessage as it splits based on the delimiter.Testing
Please follow "Packet Fixed Length Test" in the "EmotiBit Feature Test Protocols" document. This has been updated with the new changes
Results
Detailed results located in PR #30
Feature Tests
Shared files
Checklist to allow merge
masterofxEmotiBitVersion.hDIGITAL_WRITE_DEBUG= false (if set true while testing)Screenshots:
Summary by CodeRabbit