bq27441: remove debug print statements from driver.#22
Conversation
There was a problem hiding this comment.
Pull request overview
This PR cleans up the bq27441 MicroPython driver by removing leftover debug console output and simplifying several battery read helpers.
Changes:
- Removed production
print()debug statements throughout the driver. - Simplified several battery characteristic wrapper methods by removing try/except + print patterns.
- Removed unused
sysimport.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try: | ||
| self.set_capacity(self.capacity_mAh) | ||
| except Exception as e: | ||
| print("Failed to wake up fuel gauge: %s" % e) | ||
| sys.print_exception(e) | ||
| except Exception: | ||
| raise |
There was a problem hiding this comment.
power_up() wraps set_capacity() in try/except Exception: raise, which is a no-op and adds noise. Either remove the try/except entirely, or catch a specific exception type and raise a more informative driver-specific error if you want added context.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
| def current_average(self): | ||
| """Return average current""" | ||
| try: | ||
| result = self.current(CurrentMeasureType.AVG) | ||
| return result | ||
| except Exception as e: | ||
| print("Failed to get average current (mA): %s" % e) | ||
| sys.print_exception(e) | ||
| except Exception: | ||
| raise |
There was a problem hiding this comment.
current_average() still uses try/except Exception: raise, which is redundant. This can be simplified to a direct return (or, if you intend to translate I2C errors, catch specific exceptions and raise a clearer error).
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
print()statements from the BQ27441 driversysimportCloses #16