Skip to content

Invalid bool AND operator #9806

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

Closed
1 task done
BCsabaEngine opened this issue Jun 7, 2024 · 1 comment · Fixed by #9807
Closed
1 task done

Invalid bool AND operator #9806

BCsabaEngine opened this issue Jun 7, 2024 · 1 comment · Fixed by #9807
Assignees
Labels
Milestone

Comments

@BCsabaEngine
Copy link

Board

esp32-s3

Device Description

Wemos ESP32-s3

Hardware Configuration

not connected

Version

v3.0.1

IDE Name

PlatformIO

Operating System

linux

Flash frequency

40Mhz

PSRAM enabled

yes

Upload speed

115200

Description

In esp32-hal-adc.c file there is a potentially invalid bool operation:

void analogContinuousSetWidth(uint8_t bits) {
  if ((bits < SOC_ADC_DIGI_MIN_BITWIDTH) && (bits > SOC_ADC_DIGI_MAX_BITWIDTH)) {
    log_e("Selected width cannot be set. Range is from %d to %d", SOC_ADC_DIGI_MIN_BITWIDTH, SOC_ADC_DIGI_MAX_BITWIDTH);
    return;
  }
  __adcContinuousWidth = bits;
}

it should be OR?

Sketch

simple hello world build

Debug Message

/home/csaba/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-adc.c: In function 'analogContinuousSetWidth':
/home/csaba/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-adc.c:685:42: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
  685 |   if ((bits < SOC_ADC_DIGI_MIN_BITWIDTH) && (bits > SOC_ADC_DIGI_MAX_BITWIDTH)) {

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@BCsabaEngine BCsabaEngine added the Status: Awaiting triage Issue is waiting for triage label Jun 7, 2024
@SuGlider
Copy link
Collaborator

SuGlider commented Jun 7, 2024

@BCsabaEngine - Thanks for reporting. It should be OR. I'll add a PR to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

4 participants