FreeRTOS/iot-reference-esp32

[BUG] temperature sensor pub sub and LED control demo has mixed up GPIO levels

Closed this issue · 1 comments

Describe the bug
When temperature sensor pub sub and LED control demo is enabled in menuconfig, publishing

{
  "led": {
    "power" : "0"
  }
}

message to the corresponding topic turns the LED ON instead of turning it OFF.

System information
Not relevant

Expected behavior
led.power 0 should turn the LED OFF and
led.power 1 should turn the LED ON

Screenshots or console output
not relevant

Steps to reproduce bug

  1. Enable temperature sensor pub sub and LED control demo
  2. build&run the code
  3. Publish
{
  "led": {
    "power" : "0"
  }
}

to the topic and see the led turning ON
4. Publish

{
  "led": {
    "power" : "1"
  }
}

to the topic and see the led turning OFF

Additional context
FIX:
app_driver_led_on function inside app_driver.c should contain
ret = gpio_set_level( GRI_LED_GPIO, 1 ); instead of ret = gpio_set_level( GRI_LED_GPIO, 0 );

and

app_driver_led_off function inside app_driver.c should contain
ret = gpio_set_level( GRI_LED_GPIO, 0 ); instead of ret = gpio_set_level( GRI_LED_GPIO, 1 );

Thank you for reporting this. Would you like to raise a PR to fix this?