Skip to content
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

Remove redundant checks for power of 0 #2934

Merged
merged 8 commits into from
Nov 13, 2023

Conversation

S5NC
Copy link
Contributor

@S5NC S5NC commented Nov 8, 2023

The power cannot be 0 once the execution results in whichever radio module interface initialised RadioInterface through RadioLibInterface, as the code below is executed (comment clarified)

    if ((power == 0) || ((power > myRegion->powerLimit) && !devicestate.owner.is_licensed))
        power = myRegion->powerLimit;
    
    if (power == 0)
        power = 17; // Default to this power level if we don't have a valid regional power limit (powerLimit of myRegion defaults
                    // to 0, currently no region has an actual power limit of 0 [dBm] so we can assume regions which have this
                    // variable set to 0 don't have a valid power limit)

Therefore, it is unecessary to then check again if power is 0 in each radio module's interface. This behaviour was found as the changes in #2813 which removed this check had no effect (the intention was to avoid accidentally setting 0 dBm to max power, but this should have not been done as this was intended behaviour as the default value sent in protobufs is empty (0) to reduce the message size, as in most cases you will be transmitting at the maximum allowed power), it didn't cause SX126x devices to transmit at 0 dBm, but continues behaving as before.

Copy link
Contributor

github-actions bot commented Nov 8, 2023

🤖 Pull request artifacts

file commit
pr2934-firmware-2.2.14.137c5b4.zip c301a4d

thebentern added a commit to meshtastic/artifacts that referenced this pull request Nov 8, 2023
@thebentern thebentern merged commit 0b9accc into meshtastic:master Nov 13, 2023
56 checks passed
@S5NC S5NC deleted the remove-redundant-checks branch November 13, 2023 18:48
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.

3 participants