-
-
Notifications
You must be signed in to change notification settings - Fork 747
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
Add macro to enable tip types for supported hardware only #2031
Conversation
@@ -218,6 +218,7 @@ | |||
#define TEMP_NTC 1 | |||
#define ACCEL_I2CBB1 1 | |||
#define POW_EPR 1 | |||
#define TIP_TYPE_SUPPORT 1 // Support for tips of different types, i.e. resistance |
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.
Basically, I try to make the similar approach as for PROFILE_SUPPORT
: we just enable everything related under the macro.
typedef enum { | ||
TIP_TYPE_AUTO = 0, // value for the default case | ||
TIP_TYPE_MAX = 0, // marker for settings when not supported | ||
} tipType_t; |
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.
Implement duplicated tipType_t
stub for two reasons:
TIP_TYPE_MAX = 0
for settings struct to avoid compile-time error and set0/auto
as default right there for non-supported models;TIP_TYPE_AUTO = 0
for backward compatibility with the stub function (see below).
@@ -370,3 +374,6 @@ uint8_t getUserSelectedTipResistance() { | |||
break; | |||
} | |||
} | |||
#else | |||
uint8_t getUserSelectedTipResistance() { return tipType_t::TIP_TYPE_AUTO; } |
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.
Instead of twisting my head about how to do it inside of the existed instance of getUserSelectedTipResistance()
, I thought that the most simple & straight-forward approach is just to make the duplicated stub with the single return.
#ifdef TIP_TYPE_SUPPORT | ||
/* Tip Type */ | ||
{SETTINGS_DESC(SettingsItemIndex::SolderingTipType), nullptr, displaySolderingTipType, showSolderingTipType, SettingsOptions::SolderingTipType, SettingsItemIndex::SolderingTipType, 5}, | ||
#endif /* TIP_TYPE_SUPPORT */ |
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 took liberty to move the setting down inside of the soldering menu since in the UX design & usability usually they put variable/non-constant options closer to "the end" of "the list". So while temperature settings are applied to nearly every target (hence, "first in a row"), targets with support of different tips are limited. Just for the same reason we don't put "[thermo] profiles" submenu in the top of the list.
And the original problem with displaying tip type setting on TS80P takes root probably here because none of these macros inside UPD. Yeap (this is from
|
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 agree this is a cleaner way to do this
Thank you for this, definitely glad you cleaned it up, and my bad for not doing this from the start 😁 |
Please, don't worry. As I say I understand this is very raw & experimental feature. And it's better to separate this early while it have only prototypes, than some time later for larger code base. You're always welcome. ;) As of for the feature itself, I really think it will be super great if, let's say, Pine short tips can be used not only with Pinecil V2 but with other T12-compatible irons. |
That was the motivating goal here :) |
What kind of change does this PR introduce?
Enable
Soldering Tip Type
routines for supported hardware only.What is the current behavior?
There are parts of code which are not relevant for all supported models, but yet the code is compiled & takes space on flash.
What is the new behavior (if this is a feature change)?
TIP_TYPE_SUPPORT
macro;TIP_TYPE_SUPPORT
only for TS101 and Pinecil v2 as main targets for this feature;Soldering Tip Type
down the list in the settings, since it's optional.Hello. I understand that this is raw & experimental feature. And I'm sorry I wasn't around when it was implemented, because probably even back then I would suggest the same what I propose now. When I was testing some translations on TS80P, I did end up with this:
Apparently,
Soldering Tip Type
is enabled for TS80P but none of available options (even Auto) are picked from the relatedswitch/case
block. But instead of fixing the symptom (i.e., just enable Auto for TS80P & others), I took some liberty to look around the related parts of code scattered in the project and came out with this suggestion. Further I will add a couple of comments as code review to clarify the decisions.And just as an illustration - the results which I did get for TS80P/EN:
dev
:I know that ~0.15% is just laughable, but to keep beefing up code base with unused code for some of the targets is just not quite reasonable approach, while the same space can be used for really useful features & code in the future.
Please, let me know what you think.