Skip to content

Add get/set dutycycle command#1961

Open
weebl2000 wants to merge 2 commits intomeshcore-dev:devfrom
weebl2000:dutycycle-command
Open

Add get/set dutycycle command#1961
weebl2000 wants to merge 2 commits intomeshcore-dev:devfrom
weebl2000:dutycycle-command

Conversation

@weebl2000
Copy link
Contributor

@weebl2000 weebl2000 commented Mar 7, 2026

Allow users to simply set dutycycle percentage instead of having to deal with converting to airtime factor.

Old command still works but shows it's deprecated in favor of dutycycle command. We store internally all the same - this avoids breaking any prefs and works well enough internally.

Build it HERE

@jbrazio
Copy link
Contributor

jbrazio commented Mar 7, 2026

I'm not so sure if we should keep the old command.
"Duty Cycle" is the technical [and legal term] for this, "air time factor" is more about the actual time a signal uses the airwaves. I prefer the DRY principle here. :-P

@weebl2000
Copy link
Contributor Author

I'm not so sure if we should keep the old command. "Duty Cycle" is the technical [and legal term] for this, "air time factor" is more about the actual time a signal uses the airwaves. I prefer the DRY principle here. :-P

I say keep it for one release, users will see it's deprecated, remove in the release after.

DRY is nice, but confusing users by disappearing commands instead of deprecating is also bad.

int dc_frac = (int)((dc - dc_int) * 10.0f + 0.5f);
sprintf(reply, "> %d.%d%%", dc_int, dc_frac);
} else if (memcmp(config, "af", 2) == 0) {
sprintf(reply, "> %s (deprecated, use 'get dutycycle')", StrHelper::ftoa(_prefs->airtime_factor));
Copy link

Choose a reason for hiding this comment

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

👍

float actual = 100.0f / (_prefs->airtime_factor + 1.0f);
int a_int = (int)actual;
int a_frac = (int)((actual - a_int) * 10.0f + 0.5f);
sprintf(reply, "OK - %d.%d%% (deprecated, use 'set dutycycle')", a_int, a_frac);
Copy link

Choose a reason for hiding this comment

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

👍

@weebl2000 weebl2000 force-pushed the dutycycle-command branch from 4c31f8d to 94e6f0c Compare March 8, 2026 14:19
We translate to af internally, it's easier to store and doesn't break
stored prefs. Made get/set af command show deprecated, but it still
works fine.
@weebl2000 weebl2000 force-pushed the dutycycle-command branch from 94e6f0c to f633843 Compare March 9, 2026 12:43
@towerviewcams
Copy link

I'm not so sure if we should keep the old command. "Duty Cycle" is the technical [and legal term] for this, "air time factor" is more about the actual time a signal uses the airwaves. I prefer the DRY principle here. :-P

I say keep it for one release, users will see it's deprecated, remove in the release after.

DRY is nice, but confusing users by disappearing commands instead of deprecating is also bad.

Keep yes, very much. Soft transition is always best.

@ViezeVingertjes
Copy link
Contributor

We could call it an alias and call it the day haha.
But i think this approach is nice, most people will know this percentage 'if' its applicable to their country. 👍🏼

Co-authored-by: ViezeVingertjes <michael.overhorst@gmail.com>
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.

5 participants