Skip to content

Feature: configurable adc.multiplier for repeaters - #1133

Merged
ripplebiz merged 3 commits into
meshcore-dev:devfrom
oltaco:repeater-adc-multiplier-setting
Nov 22, 2025
Merged

Feature: configurable adc.multiplier for repeaters#1133
ripplebiz merged 3 commits into
meshcore-dev:devfrom
oltaco:repeater-adc-multiplier-setting

Conversation

@oltaco

@oltaco oltaco commented Nov 21, 2025

Copy link
Copy Markdown
Member

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.

adc_mult = multiplier;
}
}
float getAdcMultiplier() const override {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is referenced anywhere?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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?

Comment thread examples/simple_repeater/MyMesh.cpp
Comment thread src/helpers/CommonCLI.cpp Outdated
sprintf(reply, "> %s", _prefs->bridge_secret);
#endif
} else if (memcmp(config, "adc.multiplier", 14) == 0) {
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->adc_multiplier));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, could maybe call board.getAdcMultiplier() here

@oltaco oltaco Nov 21, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@ripplebiz
ripplebiz merged commit 5f06dc4 into meshcore-dev:dev Nov 22, 2025
@oltaco
oltaco deleted the repeater-adc-multiplier-setting branch December 3, 2025 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants