Skip to content

Invalid bool AND operator #9806

Closed
Closed
@BCsabaEngine

Description

@BCsabaEngine

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.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions