-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
add support for custom VCC monitoring #1048
base: dev
Are you sure you want to change the base?
Conversation
Sync with original
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.
Logic looks good.
I would just add ifddef guards around ADC_VCC_CUSTOM.
@@ -646,6 +646,17 @@ | |||
#define ADC_MODE_VALUE ADC_VCC | |||
#endif | |||
|
|||
// custom Vcc mode (ADC_TOUT mode with correction) | |||
#define ADC_VCC_CUSTOM 1 |
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.
why not make this a configuration parameter, guarded by ifndefs?
#if ADC_MODE_VALUE == ADC_VCC | ||
mqttSend(MQTT_TOPIC_VCC, String(ESP.getVcc()).c_str()); | ||
#endif | ||
int Vcc = custom_getVcc(ADC_MODE_VALUE); |
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.
if would be great to introduce this feature with conditions, like:
#if ADC_VCC_CUSTOM
int Vcc = custom_getVcc()
#else
int Vcc = ESP.getVcc()...
#endif
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.
ah, I see that it's actually done in custom_getVcc()
custom VCC monitoring with correction. enabled with defines:
// for example
#define ADC_MODE_VALUE ADC_VCC_CUSTOM
#define ADC_VCC_CUSTOM_MUL (15.63)
#define ADC_VCC_CUSTOM_ADD (0)
in hardware section description (hardware.h)