GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Atomic HRS reads by mark9064 · Pull Request #1845 · InfiniTimeOrg/InfiniTime

Conversation

@mark9064

@mark9064 mark9064 commented Aug 28, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Combines the reading of all HRS3300 registers into one I2C read so data is not partial
  • Downsizes both HRS and ALS to 16bit as the sensor does not generate larger than 16bit values in its current configuration
    • Increasing the resolution by 1 bit doubles the sensor acquisition time, since we are already at 10Hz we are never going to use a higher resolution
    • The PPG algorithm buffers for ALS/HRS are already 16bit anyway
  • Removes functions for setting gain / drive that are unused throughout the codebase

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Saarsk and NeroBurner reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@github-actions

github-actions Bot commented Aug 28, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Build size and comparison to main:

Section Size Difference
text 374216B -32B
data 948B 0B
bss 63480B 0B
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JF002
JF002 approved these changes May 12, 2024
View reviewed changes
@JF002 JF002 added this to the 1.15.0 milestone May 12, 2024
NeroBurner
NeroBurner requested changes Sep 20, 2024
View reviewed changes

@NeroBurner NeroBurner left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'd like to see some compile time checks, just to be sure the algorithm isn't (silently) destroyed when changing the registers

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/drivers/Hrs3300.cpp Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/drivers/Hrs3300.cpp Resolved

Uh oh!

There was an error while loading. Please reload this page.

NeroBurner
NeroBurner requested changes Sep 21, 2024
View reviewed changes

@NeroBurner NeroBurner left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

just the constexpr documentation please and then we're good to go from my side

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/drivers/Hrs3300.cpp Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/drivers/Hrs3300.cpp Resolved

Uh oh!

There was an error while loading. Please reload this page.

mark9064 added 2 commits September 21, 2024 21:53
@mark9064
Atomic HRS reads
6b68799
@mark9064
Calculate constants with constexpr
7518252
@mark9064
mark9064 force-pushed the atomic-hrs branch from 907367d to 7518252 Compare September 21, 2024 20:55
@mark9064

mark9064 commented Sep 21, 2024

Copy link
Copy Markdown
Member Author

Thought I may as well calculate the required buffer length too. Fewer magic numbers

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

NeroBurner
NeroBurner approved these changes Sep 21, 2024
View reviewed changes

@NeroBurner NeroBurner left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

temporarily hit a compiler bug in with InfiniSim with gcc 14.2.1. Worked on gcc 14.1.1 and gcc 13.3.0 and and clang 18.1.8. Reinstalled 14.2.1 to generate the error message... and gone.

So looks good to me. Especially the constexpr stuff :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@NeroBurner
NeroBurner merged commit ad3bf49 into InfiniTimeOrg:main Sep 21, 2024
@NeroBurner

NeroBurner commented Sep 21, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Well seems to be back 🙈

found an issue that maybe is related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116634

[build] /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp: In member function ‘Pinetime::Drivers::Hrs3300::PackedHrsAls Pinetime::Drivers::Hrs3300::ReadHrsAls()’:
[build] /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp:74:83: error: no matching function for call to ‘begin(const Pinetime::Drivers::Hrs3300::Registers [6])’
[build]    74 |   constexpr uint8_t baseOffset = static_cast<uint8_t>(*std::min_element(std::begin(dataRegisters), std::end(dataRegisters)));
[build]       |                                                                         ~~~~~~~~~~^~~~~~~~~~~~~~~
[build] In file included from /usr/include/c++/14.2.1/bits/algorithmfwd.h:39,
[build]                  from /usr/include/c++/14.2.1/bits/stl_algo.h:59,
[build]                  from /usr/include/c++/14.2.1/algorithm:61,
[build]                  from /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp:8:
[build] /usr/include/c++/14.2.1/initializer_list:88:5: note: candidate: ‘template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)’
[build]    88 |     begin(initializer_list<_Tp> __ils) noexcept
[build]       |     ^~~~~
[build] /usr/include/c++/14.2.1/initializer_list:88:5: note:   template argument deduction/substitution failed:
[build] /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp:74:83: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘const Pinetime::Drivers::Hrs3300::Registers*’
[build]    74 |   constexpr uint8_t baseOffset = static_cast<uint8_t>(*std::min_element(std::begin(dataRegisters), std::end(dataRegisters)));
[build]       |                                                                         ~~~~~~~~~~^~~~~~~~~~~~~~~
[build] /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp:74:108: error: no matching function for call to ‘end(const Pinetime::Drivers::Hrs3300::Registers [6])’
[build]    74 |   constexpr uint8_t baseOffset = static_cast<uint8_t>(*std::min_element(std::begin(dataRegisters), std::end(dataRegisters)));
[build]       |                                                                                                    ~~~~~~~~^~~~~~~~~~~~~~~
[build] /usr/include/c++/14.2.1/initializer_list:99:5: note: candidate: ‘template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)’
[build]    99 |     end(initializer_list<_Tp> __ils) noexcept
[build]       |     ^~~
[build] /usr/include/c++/14.2.1/initializer_list:99:5: note:   template argument deduction/substitution failed:
[build] /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp:74:108: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘const Pinetime::Drivers::Hrs3300::Registers*’
[build]    74 |   constexpr uint8_t baseOffset = static_cast<uint8_t>(*std::min_element(std::begin(dataRegisters), std::end(dataRegisters)));
[build]       |                                                                                                    ~~~~~~~~^~~~~~~~~~~~~~~
[build] /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp:77:79: error: no matching function for call to ‘begin(const Pinetime::Drivers::Hrs3300::Registers [6])’
[build]    77 |   constexpr uint8_t length = static_cast<uint8_t>(*std::max_element(std::begin(dataRegisters), std::end(dataRegisters))) - baseOffset + 1;
[build]       |                                                                     ~~~~~~~~~~^~~~~~~~~~~~~~~
[build] /usr/include/c++/14.2.1/initializer_list:88:5: note: candidate: ‘template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)’
[build]    88 |     begin(initializer_list<_Tp> __ils) noexcept
[build]       |     ^~~~~
[build] /usr/include/c++/14.2.1/initializer_list:88:5: note:   template argument deduction/substitution failed:
[build] /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp:77:79: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘const Pinetime::Drivers::Hrs3300::Registers*’
[build]    77 |   constexpr uint8_t length = static_cast<uint8_t>(*std::max_element(std::begin(dataRegisters), std::end(dataRegisters))) - baseOffset + 1;
[build]       |                                                                     ~~~~~~~~~~^~~~~~~~~~~~~~~
[build] /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp:77:104: error: no matching function for call to ‘end(const Pinetime::Drivers::Hrs3300::Registers [6])’
[build]    77 |   constexpr uint8_t length = static_cast<uint8_t>(*std::max_element(std::begin(dataRegisters), std::end(dataRegisters))) - baseOffset + 1;
[build]       |                                                                                                ~~~~~~~~^~~~~~~~~~~~~~~
[build] /usr/include/c++/14.2.1/initializer_list:99:5: note: candidate: ‘template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)’
[build]    99 |     end(initializer_list<_Tp> __ils) noexcept
[build]       |     ^~~
[build] /usr/include/c++/14.2.1/initializer_list:99:5: note:   template argument deduction/substitution failed:
[build] /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp:77:104: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘const Pinetime::Drivers::Hrs3300::Registers*’
[build]    77 |   constexpr uint8_t length = static_cast<uint8_t>(*std::max_element(std::begin(dataRegisters), std::end(dataRegisters))) - baseOffset + 1;
[build]       |                                                                                                ~~~~~~~~^~~~~~~~~~~~~~~
[build] /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/drivers/Hrs3300.cpp:80:15: error: size of array ‘buf’ is not an integral constant-expression
[build]    80 |   uint8_t buf[length];
[build]       |               ^~~~~~

and I get rid of it including <vector> after <algorithm>??? something is definitely going on with gcc 14.2.1 🙈

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064

mark9064 commented Sep 21, 2024

Copy link
Copy Markdown
Member Author

Strange that it's intermittent. If adding some headers fixes it I suppose it doesn't hurt to?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

NeroBurner added a commit that referenced this pull request Sep 22, 2024
@NeroBurner
Hrs3300: fix includes for std::begin/std::end
aa029cd
Fix for Hrs3300 PR about Atomic HRS reads:
#1845

We use `std::begin` and `std::end`, but we don't include one of the
headers that define those functions.
See https://en.cppreference.com/w/cpp/iterator/begin for a list of
headers that define `std::begin` and `std::end`.

Starting with GCC 14 this leads to a compilation error presumably
because they cleaned up their headers.

Fix code by inlcuding `<iterator>`
@NeroBurner NeroBurner mentioned this pull request Sep 22, 2024
Hrs3300: fix includes for std::begin/std::end #2128
Merged
@NeroBurner

NeroBurner commented Sep 22, 2024

Copy link
Copy Markdown
Contributor

after more investigating I can say, not a compiler bug. GCC 14 is now more correct and somewhere cleaned up their stlib headers.
We use std::begin, but we don't include any headers that define std::begin

List of headers that define std::begin std::end (from: https://en.cppreference.com/w/cpp/iterator/begin )

Defined in header [<array>](https://en.cppreference.com/w/cpp/header/array)
Defined in header [<deque>](https://en.cppreference.com/w/cpp/header/deque)
Defined in header [<flat_map>](https://en.cppreference.com/w/cpp/header/flat_map)
Defined in header [<flat_set>](https://en.cppreference.com/w/cpp/header/flat_set)
Defined in header [<forward_list>](https://en.cppreference.com/w/cpp/header/forward_list)
Defined in header [<inplace_vector>](https://en.cppreference.com/w/cpp/header/inplace_vector)
Defined in header [<iterator>](https://en.cppreference.com/w/cpp/header/iterator)
Defined in header [<list>](https://en.cppreference.com/w/cpp/header/list)
Defined in header [<map>](https://en.cppreference.com/w/cpp/header/map)
Defined in header [<regex>](https://en.cppreference.com/w/cpp/header/regex)
Defined in header [<set>](https://en.cppreference.com/w/cpp/header/set)
Defined in header [<span>](https://en.cppreference.com/w/cpp/header/span)
Defined in header [<string>](https://en.cppreference.com/w/cpp/header/string)
Defined in header [<string_view>](https://en.cppreference.com/w/cpp/header/string_view)
Defined in header [<unordered_map>](https://en.cppreference.com/w/cpp/header/unordered_map)
Defined in header [<unordered_set>](https://en.cppreference.com/w/cpp/header/unordered_set)
Defined in header [<vector>](https://en.cppreference.com/w/cpp/header/vector)

Opened a PR: #2128

mark9064 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

FintasticMan pushed a commit that referenced this pull request Sep 22, 2024
@NeroBurner @FintasticMan
Hrs3300: fix includes for std::begin/std::end
997e4ce
Fix for Hrs3300 PR about Atomic HRS reads:
#1845

We use `std::begin` and `std::end`, but we don't include one of the
headers that define those functions.
See https://en.cppreference.com/w/cpp/iterator/begin for a list of
headers that define `std::begin` and `std::end`.

Starting with GCC 14 this leads to a compilation error presumably
because they cleaned up their headers.

Fix code by inlcuding `<iterator>`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JF002 JF002 JF002 approved these changes
@NeroBurner NeroBurner NeroBurner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

1.15.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mark9064 @NeroBurner @JF002
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.