Skip to content

Conversation

@limpkin
Copy link

@limpkin limpkin commented Dec 28, 2025

@ewowi I'm hoping these changes don't get modified now or in the future... but if they do please let me know to make sure we don't make breaking changes.

Summary by CodeRabbit

  • New Features
    • Added support for the SE16V2 board variant with full peripheral wiring presets and default power settings, mirroring SE16V1 with extended pin assignments.
    • Added RS‑485 DE as a selectable pin usage to expand I/O options.
    • Introduced "Lightcrafter 16" as a new selectable control option in setup/configuration, and exposed related pin selection choices in the UI.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 28, 2025

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'review', 'context'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

Added board_SE16V2 and pin_RS485_DE, exposed "Lightcrafter16" in UI, and implemented full SE16V2 board preset wiring and runtime pin-initialization mirroring SE16V1 with RS485_DE support.

Changes

Cohort / File(s) Summary
SE16V2 Board & RS485 Pin Support
src/MoonBase/Modules/ModuleIO.h
Added board_SE16V2 to IO_BoardsEnum and pin_RS485_DE to IO_PinUsageEnum. Exposed "Lightcrafter16" in setupDefinition UI. Implemented full SE16V2 preset defaults in setBoardPresetDefaults (maxPower, LED pins, RS485_DE, UART/SPI/PHY/ADC mappings, IRQ/CS pins). Extended runtime pin-assignment logic to initialize SE16V2-specific pins.

Sequence Diagram(s)

(Skipped — changes are confined to enums, UI options, and board preset wiring without new multi-component control flow.)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Update board definitions #73 — Modifies the same IO enums and board preset handling; closely related to the added board_SE16V2 and pin_RS485_DE.

Poem

🐰 I hopped a circuit, tiny and spry,
RS‑485 ready beneath the sky,
SE16V2 with LEDs aglow,
Pins lined up in tidy row —
A rabbit wink, and presets go! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'SE16V2 / Lightcrafter16 board support' directly and specifically describes the main change: adding board support for these two components, which aligns perfectly with the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae58dfa and 53f7343.

📒 Files selected for processing (1)
  • src/MoonBase/Modules/ModuleIO.h
🔇 Additional comments (4)
src/MoonBase/Modules/ModuleIO.h (4)

63-63: LGTM!

The addition of pin_RS485_DE (Driver Enable for RS485) follows the existing pattern and is properly integrated with UI configuration and board presets.


81-81: LGTM!

The board enum addition is properly placed and follows the existing pattern.


121-121: LGTM!

The UI labels "Lightcrafter16" and "RS-485 DE" are clear and properly integrated into the configuration interface.

Also applies to: 195-195


309-311: Well-structured board configuration with comprehensive pin assignments.

The SE16V2 preset correctly defines all necessary pins for the 16-channel board, including:

  • 16 LED output pins
  • RS485 communication with the new DE pin support
  • SPI bus for WIZ850IO Ethernet module
  • Voltage/current sensing
  • Digital input and infrared receiver

The configuration mirrors the SE16V1 pattern while adding the new RS485_DE pin, which demonstrates good consistency.

Also applies to: 313-324


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7928125 and 75ceeba.

📒 Files selected for processing (1)
  • src/MoonBase/Modules/ModuleIO.h
🔇 Additional comments (5)
src/MoonBase/Modules/ModuleIO.h (5)

63-63: LGTM!

The RS485_DE pin usage enum addition is correctly placed alongside other RS-485 pin types and follows the existing naming convention.


81-81: LGTM!

The board enum addition is correctly positioned after SE16V1 and follows the existing naming convention.


121-121: LGTM!

The UI control option correctly corresponds to the new board_SE16V2 enum value and follows the pattern of using user-friendly names.


195-195: LGTM!

The RS-485 DE pin usage UI option correctly corresponds to the new pin_RS485_DE enum and maintains consistency with existing RS-485 pin labels.


315-315: RS485_DE pin requires verification of configuration approach.

The pin is assigned during board initialization (line 315) but unlike Ethernet pins (which are configured dynamically in readPins() and applied via EthernetSettingsService), RS485_DE has no corresponding configuration service or dynamic handling in readPins(). Verify whether RS485_DE requires similar service-based initialization like Ethernet pins, or if static assignment via pinAssigner is sufficient for this hardware.

Comment on lines 308 to 324
} else if (boardID == board_SE16V2) {
object["maxPower"] = 500;
uint8_t ledPins[] = {47, 21, 14, 9, 8, 16, 15, 7, 1, 2, 42, 41, 40, 39, 38, 48}; // LED_PINS
for (uint8_t gpio : ledPins) pinAssigner.assignPin(gpio, pin_LED);
pinAssigner.assignPin(3, pin_OnBoardLed); // WIZ580_nRST, needs to be high to access RS485_DE, VBUS_DET, WIZ580_nINT. Also drives an LED.
pinAssigner.assignPin(17, pin_Serial_TX);
pinAssigner.assignPin(18, pin_Serial_RX);
pinAssigner.assignPin(46, pin_RS485_DE);
pinAssigner.assignPin(0, pin_Dig_Input); // Native USB port vbus detection
pinAssigner.assignPin(5, pin_Voltage); // Input voltage
pinAssigner.assignPin(6, pin_Current); // Input current
pinAssigner.assignPin(13, pin_SPI_MISO); // WIZ850IO MISO
pinAssigner.assignPin(11, pin_SPI_MOSI); // WIZ850IO MOSI
pinAssigner.assignPin(12, pin_SPI_SCK); // WIZ850IO CLK
pinAssigner.assignPin(10, pin_PHY_CS); // WIZ850IO nCS
pinAssigner.assignPin(45, pin_PHY_IRQ); // WIZ850IO nINT
pinAssigner.assignPin(4, pin_Infrared);
Copy link

@coderabbitai coderabbitai bot Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for OnBoardLed handling and GPIO 3 usage
rg -n -C5 'pin_OnBoardLed' --type=cpp --type=h | head -100

Repository: MoonModules/MoonLight

Length of output: 1725


🏁 Script executed:

#!/bin/bash
# Search for readPins function to understand pin handling
rg -n 'readPins|pin_LED|pin_OnBoardLed' --type=cpp --type=h | grep -E 'readPins|void.*pin|return.*pin' | head -50

Repository: MoonModules/MoonLight

Length of output: 1083


🏁 Script executed:

#!/bin/bash
# Check the pin assignment logic to understand if pins can be driven low
rg -n -B5 -A10 'struct.*PinAssigner|assignPin' --type=cpp --type=h | head -80

Repository: MoonModules/MoonLight

Length of output: 6271


🏁 Script executed:

#!/bin/bash
# Read the readPins() function implementation in ModuleIO.h
sed -n '599,700p' src/MoonBase/Modules/ModuleIO.h

Repository: MoonModules/MoonLight

Length of output: 1800


🏁 Script executed:

#!/bin/bash
# Search for LED control logic and how OnBoardLed pins are driven
rg -n -A15 'pin_OnBoardLed|pin_LED' src/MoonLight/Modules/ModuleLightsControl.h | head -60

Repository: MoonModules/MoonLight

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Check if there's any initialization code for GPIO 3 or special pin setup
rg -n -B3 -A3 'GPIO.*3|pin.*3|pinMode.*3' --type=cpp --type=h | grep -v test | head -50

Repository: MoonModules/MoonLight

Length of output: 4909


🏁 Script executed:

#!/bin/bash
# Search for ModuleLightsControl.h readPins implementation
sed -n '73,150p' src/MoonLight/Modules/ModuleLightsControl.h

Repository: MoonModules/MoonLight

Length of output: 3373


🏁 Script executed:

#!/bin/bash
# Search for any code that might control GPIO 3 or OnBoardLed
rg -n 'digitalWrite|digitalWrite|pinMode.*3|pin_LED.*[0-9]|pin_OnBoardLed' --type=cpp --type=h | head -40

Repository: MoonModules/MoonLight

Length of output: 1672


🏁 Script executed:

#!/bin/bash
# Check if there's any driver or control module that reads pin_LED or pin_OnBoardLed
rg -n 'pin_LED|pin_OnBoardLed' src/MoonLight/Nodes/Drivers/ --type=cpp --type=h

Repository: MoonModules/MoonLight

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Search for initialization of GPIO 3 or pin setup for OnBoardLed
rg -n 'setUp|init|Setup|GPIO.*3|OnBoardLed' src/MoonBase/Modules/ModuleIO.h | head -30

Repository: MoonModules/MoonLight

Length of output: 387


🏁 Script executed:

#!/bin/bash
# Check if pin_OnBoardLed is used anywhere else in the codebase
rg -rn 'pin_OnBoardLed' --type=cpp --type=h .

Repository: MoonModules/MoonLight

Length of output: 270


🏁 Script executed:

#!/bin/bash
# Verify there's no LED control for OnBoardLed specifically - check all references to pin_OnBoardLed
rg -B5 -A5 'pin_OnBoardLed' --type=cpp --type=h

Repository: MoonModules/MoonLight

Length of output: 1648


🏁 Script executed:

#!/bin/bash
# Check ModuleDrivers.h completely for any pin_OnBoardLed handling
sed -n '1,200p' src/MoonLight/Modules/ModuleDrivers.h | grep -E 'pin_OnBoardLed|readPins|usage =='

Repository: MoonModules/MoonLight

Length of output: 299


🏁 Script executed:

#!/bin/bash
# Double-check if there's ANY code that iterates through pins and checks for pin_OnBoardLed
rg -n 'usage.*pin_OnBoardLed|pin_OnBoardLed.*gpio|pin_OnBoardLed.*usage' --type=cpp --type=h

Repository: MoonModules/MoonLight

Length of output: 47


GPIO 3 assigned as pin_OnBoardLed is never managed by any control logic; ensure this critical enable pin stays high.

The comment indicates GPIO 3 "needs to be high to access RS485_DE, VBUS_DET, WIZ580_nINT," yet assigning it as pin_OnBoardLed has no effect since no code in the codebase processes pin_OnBoardLed. This leaves GPIO 3 in an unmanaged state despite being critical for peripheral access.

Either remove the pin_OnBoardLed assignment if GPIO 3 should be unmanaged, or add explicit initialization to drive GPIO 3 HIGH and ensure it remains high throughout operation.

Also fix comment inconsistency: line 312 references "WIZ580_nRST" while lines 319–323 reference "WIZ850IO"—clarify which is correct.

🤖 Prompt for AI Agents
In src/MoonBase/Modules/ModuleIO.h around lines 308–324, GPIO 3 is assigned to
pin_OnBoardLed but no code drives or manages that pin, leaving the critical WIZ
reset/enable signal potentially floating; also the inline comments mix WIZ580 vs
WIZ850 naming. Fix by (1) explicitly reserving and initializing GPIO 3 as a
driven output and set it HIGH during board/module initialization (ensure it
cannot be later re-assigned or inadvertently driven low), or if the design
expects it unmanaged, remove the pin_OnBoardLed assignment and add a clear
comment stating it is intentionally unmanaged; and (2) make the comment names
consistent (choose and use either WIZ850IO or WIZ580_nRST across the block) so
the hardware signal reference is unambiguous.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"add explicit initialization to drive GPIO 3 HIGH " << that's pretty much the comment is above.
tagging @ewowi

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

object["maxPower"] = 500;
uint8_t ledPins[] = {47, 21, 14, 9, 8, 16, 15, 7, 1, 2, 42, 41, 40, 39, 38, 48}; // LED_PINS
for (uint8_t gpio : ledPins) pinAssigner.assignPin(gpio, pin_LED);
pinAssigner.assignPin(3, pin_OnBoardLed); // WIZ580_nRST, needs to be high to access RS485_DE, VBUS_DET, WIZ580_nINT. Also drives an LED.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix comment inconsistency: WIZ580 vs WIZ850IO.

Line 312 mentions "WIZ580_nRST" while lines 319-323 consistently reference "WIZ850IO" for the Ethernet module. Ensure the correct module designation is used throughout.

🔎 Suggested fix if WIZ850IO is correct
-      pinAssigner.assignPin(3, pin_OnBoardLed);   // WIZ580_nRST, needs to be high to access RS485_DE, VBUS_DET, WIZ580_nINT. Also drives an LED.
+      pinAssigner.assignPin(3, pin_OnBoardLed);   // WIZ850IO_nRST, needs to be high to access RS485_DE, VBUS_DET, WIZ850IO_nINT. Also drives an LED.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pinAssigner.assignPin(3, pin_OnBoardLed); // WIZ580_nRST, needs to be high to access RS485_DE, VBUS_DET, WIZ580_nINT. Also drives an LED.
pinAssigner.assignPin(3, pin_OnBoardLed); // WIZ850IO_nRST, needs to be high to access RS485_DE, VBUS_DET, WIZ850IO_nINT. Also drives an LED.
🤖 Prompt for AI Agents
In src/MoonBase/Modules/ModuleIO.h around line 312, the comment uses
"WIZ580_nRST" which conflicts with the rest of the file that references the
Ethernet module as "WIZ850IO"; change the comment to use the correct module
designation (e.g., "WIZ850IO_nRST" or "WIZ850IO" as appropriate), and scan
nearby lines to ensure all mentions of WIZ580 are replaced with WIZ850IO for
consistent naming.

@ewowi
Copy link
Collaborator

ewowi commented Dec 29, 2025

I'm hoping these changes don't get modified now or in the future... but if they do please let me know to make sure we don't make breaking changes.

Every change in the future tries to preserve everything what is already working, so bugs aside this will indeed be the aim 🙂

@ewowi ewowi merged commit 6ea3af8 into MoonModules:main Dec 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants