Skip to content

bq27441: remove no-op try/except blocks from driver#23

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/sub-pr-22
Closed

bq27441: remove no-op try/except blocks from driver#23
Copilot wants to merge 3 commits intomainfrom
copilot/sub-pr-22

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 11, 2026

Two try/except Exception: raise blocks in device.py were pure noise — catching only to immediately re-raise with no added context or recovery.

Changes

  • power_up(): removed wrapper around set_capacity(), call is now direct
  • current_average(): removed wrapper and intermediate variable, simplified to a direct return
# Before
def power_up(self):
    self.disable_shutdown_mode()
    sleep_ms(10)
    try:
        self.set_capacity(self.capacity_mAh)
    except Exception:
        raise

def current_average(self):
    try:
        result = self.current(CurrentMeasureType.AVG)
        return result
    except Exception:
        raise

# After
def power_up(self):
    self.disable_shutdown_mode()
    sleep_ms(10)
    self.set_capacity(self.capacity_mAh)

def current_average(self):
    return self.current(CurrentMeasureType.AVG)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Base automatically changed from fix/bq27441-debug-prints to main March 11, 2026 10:28
…rage

Co-authored-by: nedseb <1420729+nedseb@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix feedback on removing debug print statements from bq27441 driver bq27441: remove no-op try/except blocks from driver Mar 11, 2026
@nedseb nedseb closed this Mar 11, 2026
@nedseb nedseb deleted the copilot/sub-pr-22 branch March 11, 2026 15:44
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