Skip to content

Conversation

@gemenerik
Copy link
Member

Starting address allocation at RANGER_DECKS_ADDRESS_START+1 wasted the first address (0x6A), causing the 6th sensor to exceed the range (0x6F). Flow Deck v2 (1 sensor) + Multi-ranger (5 sensors) = 6 sensors, which exactly fits 0x6A-0x6F when starting at 0x6A instead of 0x6B.

Fixes initialization failure of Multi-ranger right sensor when both decks are attached.

Starting address allocation at RANGER_DECKS_ADDRESS_START+1 wasted the
first address (0x6A), causing the 6th sensor to exceed the range (0x6F).
Flow Deck v2 (1 sensor) + Multi-ranger (5 sensors) = 6 sensors, which
exactly fits 0x6A-0x6F when starting at 0x6A instead of 0x6B.

Fixes initialization failure of Multi-ranger right sensor when both
decks are attached.
Copy link

Copilot AI left a comment

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 fixes an I2C address allocation bug that prevented the simultaneous use of Flow Deck v2 and Multi-ranger deck. The fix changes the VL53L1 sensor address allocation to start at 0x6A instead of 0x6B, utilizing the full available address range (0x6A-0x6F) to accommodate 6 sensors.

Key changes:

  • Modified VL53L1 initial address allocation to start at RANGER_DECKS_ADDRESS_START (0x6A) instead of RANGER_DECKS_ADDRESS_START+1 (0x6B)
  • Removed outdated comment about VL53L0 dynamic address spacing

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

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.


// Set the start address 1 step after the VL53L0 dynamic addresses
static int nextI2CAddress = RANGER_DECKS_ADDRESS_START +1;
static int nextI2CAddress = RANGER_DECKS_ADDRESS_START;
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

The VL53L0 and VL53L1 drivers share the same address space but have separate static nextI2CAddress variables. This creates a potential conflict if both sensor types are initialized simultaneously (e.g., Flow Deck v1 with VL53L0 and Multi-ranger with VL53L1). Consider using a shared address counter or documenting that these drivers cannot be mixed.

Suggested change
static int nextI2CAddress = RANGER_DECKS_ADDRESS_START;
// Shared I2C address counter for VL53L0 and VL53L1 drivers.
// Must be defined in a single source file (e.g., vl53l0x.c or a new shared file):
// int nextI2CAddress = RANGER_DECKS_ADDRESS_START;
extern int nextI2CAddress;

Copilot uses AI. Check for mistakes.
@tobbeanton tobbeanton merged commit 39542aa into master Nov 28, 2025
31 checks passed
@tobbeanton tobbeanton deleted the rik/ranger_deck_addresses branch November 28, 2025 13:42
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.

3 participants