M5Dial-UserDemo icon indicating copy to clipboard operation
M5Dial-UserDemo copied to clipboard

Demo does not build for ESP_IDF_VERSION 5.2.1

Open MotoBarsteward opened this issue 1 year ago • 1 comments

Whilst getting this code to build in VSCode using Espressif , The code would not build as comd0 was not defined.

C:/ESP-IDF/M5Dial-UserDemo-main/components/LovyanGFX/src/lgfx/v1/platforms/esp32/common.cpp:653:14: error: 'struct i2c_dev_t' has no member named 'comd0'; did you mean 'comd'?
  653 |       (&dev->comd0)[index].val = cmd_val;
      |              ^~~~~
      |              comd
ninja: build stopped: subcommand failed.

Updating the #if as below fixed the build issue...

#if defined (CONFIG_IDF_TARGET_ESP32S3)
 #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 3) && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 1, 0)) \
  || (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1) && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)) \
  || (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 1) && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0))
      (&dev->comd[0])[index].val = cmd_val;
 #else
      (&dev->comd0)[index].val = cmd_val;
 #endif
#else
      dev->command[index].val = cmd_val;
#endif

I realise that this is in a library that has just been cloned into your repo. I've checked the source repo and it needs updating there.

MotoBarsteward avatar May 31 '24 18:05 MotoBarsteward

I think you may have wanted to change the value in the 7th line too, I needed to to be able to get past the errors.

(&dev->comd[0])[index].val = cmd_val;

dande011 avatar Jun 08 '24 06:06 dande011