Skip to content

Refactor semantic version comparison for OTA updates#216

Merged
daveallie merged 1 commit intocrosspoint-reader:masterfrom
embedded4ever:refactoring/version-checking-of-update
Jan 3, 2026
Merged

Refactor semantic version comparison for OTA updates#216
daveallie merged 1 commit intocrosspoint-reader:masterfrom
embedded4ever:refactoring/version-checking-of-update

Conversation

@embedded4ever
Copy link
Contributor

@embedded4ever embedded4ever commented Jan 2, 2026

Summary

  • What is the goal of this PR? (e.g., Fixes a bug in the user authentication module, Implements the new feature for
    file uploading.)

This PR refactors the semantic version comparison logic used during OTA update checks.

Memory stats before :
RAM: [=== ] 30.8% (used 101068 bytes from 327680 bytes)
Flash: [========= ] 85.7% (used 5617830 bytes from 6553600 bytes)

Memory stats before :
RAM: [=== ] 30.8% (used 101068 bytes from 327680 bytes)
Flash: [========= ] 85.7% (used 5616870 bytes from 6553600 bytes)

  • What changes are included?

Replaced std::string::substr() and std::stoi() based parsing with a lightweight, heap-free approach.
Version parsing is now done in a single pass without creating temporary std::string objects.
Behavior remains identical: versions are still compared as MAJOR.MINOR.PATCH.

Additional Context

std::string::substr() creates a new string and performs heap allocation

  • Add any other information that might be helpful for the reviewer (e.g., performance implications, potential risks, specific areas to focus on).

@embedded4ever embedded4ever force-pushed the refactoring/version-checking-of-update branch 3 times, most recently from 25586a9 to ae126af Compare January 2, 2026 20:47
@embedded4ever embedded4ever force-pushed the refactoring/version-checking-of-update branch from ae126af to 6da03de Compare January 3, 2026 00:19
Copy link
Member

@daveallie daveallie left a comment

Choose a reason for hiding this comment

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

Thanks for this optimisation @embedded4ever, my C++-foo isn't super strong so I appreciate the improvements

@daveallie daveallie merged commit c8f6160 into crosspoint-reader:master Jan 3, 2026
1 check passed
@embedded4ever embedded4ever deleted the refactoring/version-checking-of-update branch January 3, 2026 11:28
yingirene pushed a commit to yingirene/crosspoint-reader that referenced this pull request Jan 16, 2026
…er#216)

## Summary

* **What is the goal of this PR?** (e.g., Fixes a bug in the user
authentication module, Implements the new feature for
  file uploading.)

This PR refactors the semantic version comparison logic used during OTA
update checks.

Memory stats before : 
RAM:   [===       ]  30.8% (used 101068 bytes from 327680 bytes)
Flash: [========= ]  85.7% (used **5617830** bytes from 6553600 bytes)

Memory stats before : 
RAM:   [===       ]  30.8% (used 101068 bytes from 327680 bytes)
Flash: [========= ]  85.7% (used **5616870** bytes from 6553600 bytes)


* **What changes are included?**

Replaced std::string::substr() and std::stoi() based parsing with a
lightweight, heap-free approach.
Version parsing is now done in a single pass without creating temporary
std::string objects.
Behavior remains identical: versions are still compared as
MAJOR.MINOR.PATCH.

## Additional Context

`std::string::substr() ` creates a new string and performs heap
allocation

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks, specific areas to
focus on).
Unintendedsideeffects pushed a commit to Unintendedsideeffects/crosspoint-reader that referenced this pull request Feb 17, 2026
…er#216)

## Summary

* **What is the goal of this PR?** (e.g., Fixes a bug in the user
authentication module, Implements the new feature for
  file uploading.)

This PR refactors the semantic version comparison logic used during OTA
update checks.

Memory stats before : 
RAM:   [===       ]  30.8% (used 101068 bytes from 327680 bytes)
Flash: [========= ]  85.7% (used **5617830** bytes from 6553600 bytes)

Memory stats before : 
RAM:   [===       ]  30.8% (used 101068 bytes from 327680 bytes)
Flash: [========= ]  85.7% (used **5616870** bytes from 6553600 bytes)


* **What changes are included?**

Replaced std::string::substr() and std::stoi() based parsing with a
lightweight, heap-free approach.
Version parsing is now done in a single pass without creating temporary
std::string objects.
Behavior remains identical: versions are still compared as
MAJOR.MINOR.PATCH.

## Additional Context

`std::string::substr() ` creates a new string and performs heap
allocation

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks, specific areas to
focus on).
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