Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Automatically include version numbers #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kienvo
Copy link
Member

@kienvo kienvo commented Sep 29, 2024

Resolves #44

Changes:

  • Get the version number from git
  • Apply version to BLE's Device Info, USB's Serial Number, and charging animation.

Summary by Sourcery

Automatically embed version numbers from git into various components of the system, including BLE Device Info, USB Serial Number, and charging animation. Enhance the build process to retrieve and define version information from git tags. Update the CI workflow to support versioning by fetching tags.

New Features:

  • Automatically embed version numbers from git into the BLE Device Info, USB Serial Number, and charging animation.

Enhancements:

  • Update the Makefile to retrieve the current version from git tags and define it for use in the code.

CI:

  • Modify the GitHub Actions workflow to fetch tags for versioning by setting fetch-depth to 0.

@kienvo kienvo mentioned this pull request Sep 29, 2024
@kienvo kienvo force-pushed the auto-ver branch 2 times, most recently from b0ed767 to e7cfe5b Compare October 7, 2024 02:03
@kienvo kienvo marked this pull request as ready for review October 7, 2024 02:07
Copy link

sourcery-ai bot commented Oct 7, 2024

Reviewer's Guide by Sourcery

This pull request implements automatic embedding of version numbers in the firmware. It retrieves the version from git tags and applies it to BLE's Device Info, USB's Serial Number, and the charging animation display. The changes involve modifications to several files to incorporate and display the version information.

Class diagram for version embedding changes

classDiagram
    class USBDevice {
        +uint16_t[] product_info
        +uint16_t[] serial_number
        +void desc_dev(USB_SETUP_REQ *request)
    }
    class BLEDeviceInfo {
        +uint8_t[] systemId_val
        +uint16_t systemId_UUID
        +uint8_t[] modelNumber_val
        +uint16_t modelNumber_UUID
        +uint16_t serialNumber_UUID
        +uint8_t[] serialNumber_val
        +uint16_t firmwareRev_UUID
        +uint8_t[] firmwareRev_val
        +uint16_t hardwareRev_UUID
        +uint8_t[] hardwareRev_val
        +uint16_t softwareRev_UUID
        +uint8_t[] softwareRev_val
    }
    class Makefile {
        +string VERSION_ABBR
        +string VERSION
    }
    USBDevice --> Makefile : uses
    BLEDeviceInfo --> Makefile : uses
Loading

File-Level Changes

Change Details Files
Implement automatic version number retrieval from git
  • Add commands to get current version and abbreviated version from git tags
  • Define VERSION and VERSION_ABBR variables using git describe
  • Add CFLAGS to include VERSION and VERSION_ABBR
Makefile
Update USB Serial Number to include version information
  • Modify serial_number array to include device model and firmware version
  • Remove placeholder text and implement dynamic version display
  • Add conditional compilation for USBC version
src/usb/dev.c
Update BLE Device Information Service with version details
  • Modify modelNumber_val to include USBC version suffix if applicable
  • Update firmwareRev_val to use the VERSION macro
  • Update hardwareRev_val with a new date
src/ble/profile/devinfo.c
Display version number in charging animation
  • Replace hardcoded version string with VERSION_ABBR macro
src/main.c
Modify GitHub Actions workflow to fetch full git history
  • Add fetch-depth: 0 to actions/checkout step to retrieve all tags
.github/workflows/build.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@kienvo kienvo requested a review from fcartegnie October 7, 2024 02:08
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @kienvo - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

src/ble/profile/devinfo.c Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@mariobehling mariobehling changed the title feat: Automatically embedding version numbers feat: Automatically include version numbers Oct 8, 2024
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.

Implement version recognition
1 participant