Skip to content

Make compatible with newer ESP-Arduino core#438

Open
markmentovai wants to merge 1 commit into
Open-Smartwatch:developfrom
markmentovai:arduino-esp32_3
Open

Make compatible with newer ESP-Arduino core#438
markmentovai wants to merge 1 commit into
Open-Smartwatch:developfrom
markmentovai:arduino-esp32_3

Conversation

@markmentovai
Copy link
Copy Markdown

This updates the codebase for compatibility with
https://github.com/pioarduino/platform-espressif32 55.03.35, which in turn uses https://github.com/espressif/arduino-esp32 3.3.5. An additional change along the lines of
T-vK/ESP32-BLE-Keyboard#382 is needed to make lib/ESP32-BLE-Keyboard compatibile as well.

This does not change the platform definition, which remains at https://github.com/platformio/platform-espressif32 6.8.1, using https://github.com/espressif/arduino-esp32 2.0.17. All changed code is correct regardless of Arduino-ESP version, and all changed code is compatible with both versions.

@markmentovai
Copy link
Copy Markdown
Author

A guide to the errors that this fixes, for reference:

Compiling .pio/build/LIGHT_EDITION_V3_3/lib31f/ESP32-BLE-Keyboard/BleKeyboard.cpp.o
lib/ESP32-BLE-Keyboard/BleKeyboard.cpp: In member function 'void BleKeyboard::begin()':
lib/ESP32-BLE-Keyboard/BleKeyboard.cpp:106:19: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'String'
  106 |   BLEDevice::init(deviceName);
      |                   ^~~~~~~~~~
      |                   |
      |                   std::string {aka std::__cxx11::basic_string<char>}
In file included from …/packages/framework-arduinoespressif32/libraries/BLE/src/BLEServer.h:26,
                 from …/packages/framework-arduinoespressif32/libraries/BLE/src/BLEService.h:25,
                 from …/packages/framework-arduinoespressif32/libraries/BLE/src/BLEHIDDevice.h:21,
                 from lib/ESP32-BLE-Keyboard/BleKeyboard.h:24,
                 from lib/ESP32-BLE-Keyboard/BleKeyboard.cpp:1:
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLEDevice.h:184:27: note:   initializing argument 1 of 'static void BLEDevice::init(String)'
  184 |   static void init(String deviceName);
      |                    ~~~~~~~^~~~~~~~~~
lib/ESP32-BLE-Keyboard/BleKeyboard.cpp:117:32: error: no matching function for call to 'BLECharacteristic::setValue(std::string&)'
  117 |   hid->manufacturer()->setValue(deviceManufacturer);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from …/packages/framework-arduinoespressif32/libraries/BLE/src/BLEHIDDevice.h:20:
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:195:8: note: candidate: 'void BLECharacteristic::setValue(const uint8_t*, size_t)'
  195 |   void setValue(const uint8_t *data, size_t size);
      |        ^~~~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:195:8: note:   candidate expects 2 arguments, 1 provided
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:196:8: note: candidate: 'void BLECharacteristic::setValue(const String&)'
  196 |   void setValue(const String &value);
      |        ^~~~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:196:31: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const String&'
  196 |   void setValue(const String &value);
      |                 ~~~~~~~~~~~~~~^~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:197:8: note: candidate: 'void BLECharacteristic::setValue(uint16_t)'
  197 |   void setValue(uint16_t data16);
      |        ^~~~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:197:26: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'uint16_t' {aka 'short unsigned int'}
  197 |   void setValue(uint16_t data16);
      |                 ~~~~~~~~~^~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:198:8: note: candidate: 'void BLECharacteristic::setValue(uint32_t)'
  198 |   void setValue(uint32_t data32);
      |        ^~~~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:198:26: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'uint32_t' {aka 'long unsigned int'}
  198 |   void setValue(uint32_t data32);
      |                 ~~~~~~~~~^~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:199:8: note: candidate: 'void BLECharacteristic::setValue(int)'
  199 |   void setValue(int data32);
      |        ^~~~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:199:21: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int'
  199 |   void setValue(int data32);
      |                 ~~~~^~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:200:8: note: candidate: 'void BLECharacteristic::setValue(float)'
  200 |   void setValue(float data32);
      |        ^~~~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:200:23: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'float'
  200 |   void setValue(float data32);
      |                 ~~~~~~^~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:201:8: note: candidate: 'void BLECharacteristic::setValue(double)'
  201 |   void setValue(double data64);
      |        ^~~~~~~~
…/packages/framework-arduinoespressif32/libraries/BLE/src/BLECharacteristic.h:201:24: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'double'
  201 |   void setValue(double data64);
      |                 ~~~~~~~^~~~~~
Compiling .pio/build/LIGHT_EDITION_V3_3/src/animations/anim_doom_fire_old.cpp.o
In file included from include/animations/anim_doom_fire_old.h:4,
                 from src/animations/anim_doom_fire_old.cpp:1:
include/gfx_2d.h: In member function 'void Graphics2D::drawTick(int16_t, int16_t, int16_t, int16_t, int, uint16_t)':
include/gfx_2d.h:242:21: error: call of overloaded 'rpx(int16_t&, int16_t&, int&)' is ambiguous
  242 |         drawLine(rpx(cx, r1, angle), rpy(cy, r1, angle), rpx(cx, r2, angle), rpy(cy, r2, angle), color);
      |                  ~~~^~~~~~~~~~~~~~~
In file included from include/gfx_2d.h:7:
include/math_angles.h:21:16: note: candidate: 'int32_t rpx(int32_t, int32_t, float)'
   21 | inline int32_t rpx(int32_t cx, int32_t r, float deg) {
      |                ^~~
include/math_angles.h:26:16: note: candidate: 'int32_t rpx(int32_t, int32_t, int32_t)'
   26 | inline int32_t rpx(int32_t cx, int32_t r, int32_t deg) {
      |                ^~~
Compiling .pio/build/LIGHT_EDITION_V3_3/src/OswImage.cpp.o
src/OswImage.cpp: In member function 'void OswImage::draw(Graphics2D*, int, int, float, Alignment, Alignment)':
src/OswImage.cpp:54:28: error: invalid conversion from 'void (*)(pngle_t*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char*)' {aka 'void (*)(_pngle_t*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char*)'} to 'pngle_draw_callback_t' {aka 'void (*)(_pngle_t*, long unsigned int, long unsigned int, long unsigned int, long unsigned int, unsigned char*)'} [-fpermissive]
   54 |     pngle_set_draw_callback(pngle, OswImage::drawCallback);
      |     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                            |
      |                            void (*)(pngle_t*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char*) {aka void (*)(_pngle_t*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char*)}
In file included from include/OswImage.h:5,
                 from src/OswImage.cpp:1:
lib/pngle/src/pngle.h:55:66: note:   initializing argument 2 of 'void pngle_set_draw_callback(pngle_t*, pngle_draw_callback_t)'
   55 | void pngle_set_draw_callback(pngle_t *png, pngle_draw_callback_t callback);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Compiling .pio/build/LIGHT_EDITION_V3_3/src/gfx_2d.cpp.o
src/gfx_2d.cpp: In member function 'void Graphics2D::drawNTicksAA(int16_t, int16_t, int16_t, int16_t, int16_t, uint16_t, int16_t)':
src/gfx_2d.cpp:1396:27: error: call of overloaded 'drawTickAA(int16_t&, int16_t&, int16_t&, int16_t&, int, uint16_t&)' is ambiguous
 1396 |                 drawTickAA(cx, cy, r1, r2, h * deltaAngle, color);
      |                 ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/gfx_2d.cpp:4:
include/gfx_2d.h:245:17: note: candidate: 'void Graphics2D::drawTickAA(int16_t, int16_t, int16_t, int16_t, float, uint16_t)'
  245 |     inline void drawTickAA(int16_t cx, int16_t cy, int16_t r1, int16_t r2, float angle, uint16_t color) {
      |                 ^~~~~~~~~~
include/gfx_2d.h:249:17: note: candidate: 'void Graphics2D::drawTickAA(int16_t, int16_t, int16_t, int16_t, int32_t, uint16_t)'
  249 |     inline void drawTickAA(int16_t cx, int16_t cy, int16_t r1, int16_t r2, int32_t angle, uint16_t color) {
      |                 ^~~~~~~~~~
Compiling .pio/build/LIGHT_EDITION_V3_3/src/hal/display.cpp.o
src/hal/display.cpp: In member function 'void OswHal::setupDisplay(bool)':
src/hal/display.cpp:75:5: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'?
   75 |     ledcAttachPin(OSW_PLATFORM_HARDWARE_DISPLAY_LED, 1);
      |     ^~~~~~~~~~~~~
      |     ledcAttach
src/hal/display.cpp:76:5: error: 'ledcSetup' was not declared in this scope
   76 |     ledcSetup(1, 12000, 8);  // 12 kHz PWM, 8-bit resolution
      |     ^~~~~~~~~
src/hal/display.cpp: In member function 'void OswHal::stopDisplay(bool)':
src/hal/display.cpp:112:5: error: 'ledcDetachPin' was not declared in this scope; did you mean 'ledcDetach'?
  112 |     ledcDetachPin(OSW_PLATFORM_HARDWARE_DISPLAY_LED);
      |     ^~~~~~~~~~~~~
      |     ledcDetach

This updates the codebase for compatibility with
https://github.com/pioarduino/platform-espressif32 55.03.35, which in
turn uses https://github.com/espressif/arduino-esp32 3.3.5. An
additional change along the lines of
T-vK/ESP32-BLE-Keyboard#382 is needed to make
lib/ESP32-BLE-Keyboard compatibile as well.

This does not change the platform definition, which remains at
https://github.com/platformio/platform-espressif32 6.8.1, using
https://github.com/espressif/arduino-esp32 2.0.17. All changed code is
correct regardless of Arduino-ESP version, and all changed code is
compatible with both versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant