Skip to content

Update Code-Dump with the limelight implementation from main. - #8

Merged
vladuzzul merged 15 commits into
Code-Dumpfrom
main
Aug 5, 2026
Merged

Update Code-Dump with the limelight implementation from main.#8
vladuzzul merged 15 commits into
Code-Dumpfrom
main

Conversation

@vladuzzul

Copy link
Copy Markdown
Member

Before issuing a pull request, please see the contributing page.

Copilot AI lite review requested due to automatic review settings August 5, 2026 09:18
@vladuzzul
vladuzzul merged commit 3fb8f49 into Code-Dump Aug 5, 2026
1 check was pending
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f9c30ed-fcba-4643-9947-92b00ff15372

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR syncs the codebase with a “Limelight implementation from main” by adding a Limelight subsystem, integrating it into turret auto-aim + driver controls, and aligning supporting utilities/constants (I2C expander packaging/imports, build SDK level).

Changes:

  • Added a Limelight subsystem to Robot with polling, pipeline switching, result freshness handling, and telemetry; turret auto-aim can now use Limelight tx correction when available.
  • Introduced a new I2cLcd driver built on the PCF8574 I/O expander and cleaned up PCF8574 packaging/import usage.
  • Updated constants (Limelight tuning + basket coordinates) and bumped compileSdkVersion in build.common.gradle.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/utils/devices/PCF8574.java Fixes package declaration to match directory and support direct imports.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/utils/Constants.java Adds Limelight tuning constants and updates basket Y coordinates.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/utils/components/I2cLedBar.java Updates PCF8574 import to match package fix.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/utils/components/I2cLcd.java Adds new LCD driver via PCF8574 (currently has correctness issues noted in comments).
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/Robot.java Adds Limelight subsystem + turret integration; includes minor cleanup opportunities.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/manual/MainDrivingOp.java Initializes/stops Limelight, adds telemetry, and switches pipeline on target toggle (also exposes a double-toggle bug).
build.common.gradle Updates compile SDK level to 36 (aligns with FtcRobotController module’s compileSdkVersion).
Suppressed comments (4)

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/utils/components/I2cLcd.java:111

  • writeData() doesn't properly strobe the EN line for the high nibble: it raises EN but never drops it with data held stable, and it also doesn't mask the shifted low nibble. This can prevent characters from latching correctly on the LCD.
        byte snd = (byte)((data & 0xF0 | RS_BIT | backlight));
        pcf.writeByte(snd | EN_BIT);

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/utils/components/I2cLcd.java:129

  • writeCommand() has the same EN-strobe issue as writeData(): it raises EN for the high nibble but never drops it while data is stable, which can corrupt command writes. It should pulse EN high then low for each nibble.
        byte snd = (byte)((cmd & 0xF0) | backlight);
        pcf.writeByte(snd | EN_BIT);

        snd = (byte)((cmd << 4) | backlight);

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/utils/components/I2cLcd.java:153

  • read() overwrites the first (high) nibble with the second (low) nibble, so the returned byte is incorrect and busy() can behave unpredictably. The second nibble should be OR'ed into the low 4 bits, not replace the whole value.
        pcf.writeByte(snd | EN_BIT);
        readData = (byte)(pcf.readByte() & 0xF0);
        pcf.writeByte(snd);
        pcf.writeByte(snd | EN_BIT);
        readData = (byte)(pcf.readByte() >> 4);

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/utils/components/I2cLcd.java:169

  • setBacklight() never clears the backlight bit when backlightOn is false, and the immediate write always sends BL_BIT even when turning off. This makes it impossible to reliably turn the backlight off and can desync the cached backlight state from what was sent.
    public void setBacklight(boolean backlightOn, boolean immediate) {
        if(backlightOn)
            backlight = BL_BIT;
        if(immediate)
            pcf.writeByte(BL_BIT);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +50 to +52
case 3:
address += 60;
break;
Comment on lines +54 to +59
import com.qualcomm.hardware.limelightvision.LLResult;
import com.qualcomm.hardware.limelightvision.LLResultTypes;
import com.qualcomm.hardware.limelightvision.LLStatus;
import com.qualcomm.hardware.limelightvision.Limelight3A;

import com.qualcomm.robotcore.util.ElapsedTime;
Comment on lines +166 to +168
private static final int POLL_RATE_HZ = 30;
private static final int PIPELINE_INDEX = 7;
private static final long STALE_RESULT_MS = 500;
Comment on lines +113 to +116
if(drivingGP.rightStick.button.justPressed()) {
robot.Blue_Target = !robot.Blue_Target;
robot.limelight.switchPipeline(robot.Blue_Target);
}
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.

5 participants