m5stack / M5Dial-UserDemo

M5Dial user demo for hardware evaluation.
MIT License
43 stars 16 forks source link

Demo does not build for ESP_IDF_VERSION 5.2.1 #14

Open MotoBarsteward opened 4 months ago

MotoBarsteward commented 4 months ago

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.

dande011 commented 3 months ago

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;