-
Notifications
You must be signed in to change notification settings - Fork 237
Make SoundAnalyzer a template, remove Mic type; Use proper TFT_eSPI includes, fines; #746
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
Changes from all commits
21e47cf
3ca0e0c
6e29a3e
374ebdd
c4868ef
c7dd6f8
a748af7
ce9fae0
2741df2
4abbc67
c6b46b1
4d98009
5eb820f
360bf57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -777,6 +777,7 @@ inline String str_sprintf(const char *fmt, ...) | |
|
|
||
| #include <random> | ||
| #include <type_traits> | ||
| #include <iterator> | ||
|
|
||
| template <typename T> | ||
| inline static T random_range(T lower, T upper) | ||
|
|
@@ -893,6 +894,20 @@ constexpr std::array<T, N> to_array(const T (&arr)[N]) { | |
| return result; | ||
| } | ||
|
|
||
| // Provide a single-parameter std::accumulate overload for ranges/containers | ||
| // This allows: auto total = std::accumulate(container); | ||
| namespace std { | ||
| template <typename Range> | ||
| inline auto accumulate(const Range& r) | ||
| -> std::remove_cv_t<std::remove_reference_t<decltype(*std::begin(r))>> | ||
|
rbergen marked this conversation as resolved.
|
||
| { | ||
| using T = std::remove_cv_t<std::remove_reference_t<decltype(*std::begin(r))>>; | ||
|
Comment on lines
+900
to
+904
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You may have to |
||
| T total{}; | ||
| for (const auto& v : r) total += v; | ||
| return total; | ||
| } | ||
| } | ||
|
|
||
| // 16-bit (5:6:5) color definitions for common colors | ||
|
|
||
| #define BLACK16 0x0000 | ||
|
|
@@ -917,6 +932,12 @@ constexpr std::array<T, N> to_array(const T (&arr)[N]) { | |
|
|
||
| #if USE_TFTSPI | ||
| #define DISABLE_ALL_LIBRARY_WARNINGS 1 | ||
| // If the project provides its own TFT_eSPI setup via USER_SETUP_LOADED | ||
| // and build_flags, do not include the TTGO default user setup to avoid | ||
| // macro redefinition warnings. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we please keep this stuff out of globals? Plop it into screen.cc or something of smaller scope. |
||
| #if TTGO && !defined(USER_SETUP_LOADED) | ||
| #include <User_Setups/Setup25_TTGO_T_Display.h> | ||
| #endif | ||
| #include <TFT_eSPI.h> | ||
| #include <SPI.h> | ||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,8 +150,12 @@ class Screen : public GFXBase | |
| #endif | ||
|
|
||
| #if USE_TFTSPI | ||
| #if TTGO | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same file, different scope, different manifest. Bleeah. |
||
| #include <User_Setups/Setup25_TTGO_T_Display.h> | ||
| #endif | ||
| #include <TFT_eSPI.h> | ||
| #include <SPI.h> | ||
|
|
||
|
|
||
| // TFTScreen | ||
| // | ||
|
|
||
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.
Adding functions to the std namespace is undefined behavior according to the C++ standard. Consider using a custom namespace like 'nds' or 'nightdriver' instead.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.