Update upslite_plugin_1_3.py#7
Open
milanojs wants to merge 3 commits intoitsdarklikehell:masterfrom
Open
Conversation
Enhance the code and fix the "startup" on the i2get interface so the battery % can be shown in the screen
Reviewer's Guide by SourceryThis pull request enhances the UPSLite plugin by improving error handling, implementing a QuickStart command for the CW2015 chip, improving capacity and charging status readings, and improving UI updates and error handling. It also adds plugin metadata. Sequence diagram for UPSLite QuickStartsequenceDiagram
participant P as Pwnagotchi
participant U as UPSLite Plugin
participant UPS
participant SMB as SMBus
P->>U: on_loaded()
U->>UPS: __init__()
UPS->>UPS: _quick_start()
UPS->>SMB: write_byte_data(CW2015_ADDRESS, CW2015_REG_MODE, CW2015_QUICKSTART_VAL)
SMB-->>UPS: OK
UPS->>UPS: time.sleep(0.1)
UPS-->>U: UPS object
U-->>P: Plugin loaded
Sequence diagram for UPSLite UI UpdatesequenceDiagram
participant P as Pwnagotchi
participant U as UPSLite Plugin
participant UPS
participant SMB as SMBus
participant GPIO
P->>U: on_ui_update()
U->>UPS: capacity()
UPS->>SMB: read_word_data(CW2015_ADDRESS, CW2015_REG_SOC)
SMB-->>UPS: capacity_data
UPS-->>U: capacity
U->>UPS: charging()
UPS->>GPIO: input(GPIO_PIN_CHARGING)
GPIO-->>UPS: charging_status
UPS-->>U: charging
U->>P: ui.set("ups", "%2i%%%s" % (int(round(capacity)), charging))
Updated class diagram for UPSclassDiagram
class UPS {
-bus
+__init__()
+_quick_start()
+voltage()
+capacity()
+charging()
}
note for UPS "Initializes SMBus and GPIO, implements QuickStart, and reads voltage, capacity, and charging status."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @milanojs - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a try-except block around the plugin's
on_ui_updatemethod to gracefully handle potential errors during UI updates. - The multiple assignments to
__author__,__version__,__license__, and__description__should be consolidated.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
review the on update ui functions by recommendations give for sourcery
create the decorator and enhance code in general
Codacy's Analysis Summary0 new issue (≤ 0 issue) Review Pull Request in Codacy →
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhance the code and fix the "startup" on the i2get interface so the battery % can be shown in the screen
Summary by Sourcery
Enhance the UPSLite plugin for Pwnagotchi to improve battery status reading and error handling for the UPS Lite v1.3 interface
New Features:
Bug Fixes:
Enhancements: