Feature: configurable adc.multiplier for repeaters - #1133
Conversation
| adc_mult = multiplier; | ||
| } | ||
| } | ||
| float getAdcMultiplier() const override { |
There was a problem hiding this comment.
I don't think this is referenced anywhere?
There was a problem hiding this comment.
You're right, I was thinking about calling it from CommonCLI and return the default board multiplier if the saved multiplier is 0.0f, what do you think?
| sprintf(reply, "> %s", _prefs->bridge_secret); | ||
| #endif | ||
| } else if (memcmp(config, "adc.multiplier", 14) == 0) { | ||
| sprintf(reply, "> %s", StrHelper::ftoa(_prefs->adc_multiplier)); |
There was a problem hiding this comment.
Yeah, could maybe call board.getAdcMultiplier() here
There was a problem hiding this comment.
Ok I tweaked the logic in CommonCLI and changed setAdcMultiplier to return a bool. Now if the board doesn't support these methods the CLI will let you know, so there is no ambiguity.
Setting adc.multiplier to 0 lets you know that it will use the default board multiplier as well.
Let me know if you think it's too over the top.
edited to add: If the multiplier is set to 0 and you do get adc.multiplier it will return the default setting for the board.
This PR adds a new persistent preference for adc.multiplier to allow setting of the ADC multiplier value.
It came up that washtastic (a promicro based board) uses a different ADC multiplier to what is set on the standard promicro and to me it makes more sense to allow setting the adc.multiplier rather than adding another variant just to set a different ADC multiplier.
I added virtual methods for getAdcMultiplier() and setAdcMultiplier() to the MainBoard class, and examples are implemented in PromicroBoard.h. When adc.multiplier is set to 0 it uses the board definition, otherwise it uses whatever you have set in adc.multiplier. The value is constrained to between 0.0f and 10.0f.