khoih-prog / SinricPro_Generic

Simple way to control your IOT development boards like ESP8226, ESP32, Arduino SAMD21, Adafruit SAMD21, SAMD51, nRF52, STM32, Teensy, SAM DUE with Amazon Alexa or Google Home
28 stars 7 forks source link

Difficulties to compile on PlatformIO #4

Closed RoSchmi closed 3 years ago

RoSchmi commented 3 years ago

Hi, I wanted to say thank you for your great libraries. Despite this, I would like to report some difficulties I experienced when I tried to compile an example App using SinricPro_Generic on PlatformIO for the Seeed Wio Terminal. The compiler complained of missing files (stm32_def.h), which are obviously not needed on SAMD based devices. May be that I did something wrong when adapting your PlatformIO.ini file for the application. Finally I got it working by including the WebSockets_generic library directly into the project. -https://github.com/RoSchmi/Wio_Terminal_SinricPro_DimSwitch I hope that this hints may help to improve the setup to make it easier for others to use your libraries on PlatformIO.

khoih-prog commented 3 years ago

Hi @RoSchmi

Thanks for using the library and your encouraging words.

As you know, the WioTerminal-IoTs-Dimmer project, posted by Seeed, is independent from the library. IMHO, it's better to have some note to ask users to include certain libraries when using the project.

This library has no control on future projects using it.

Whenever this library is included as dependency, the dependent libraries will be loaded automatically by PIO, thanks to info provided in library.json.

You can verify that in library.json, the WebSockets_Generic and other libraries have been included.

"dependencies": 
  [
    {
      "owner": "bblanchon",
      "name": "ArduinoJson",
      "version": ">=6.17.2",
      "platforms": ["*"]
    },
    {
      "owner": "khoih.prog",
      "name": "WebSockets_Generic",
      "version": ">=2.3.4",
      "platforms": ["*"]
    },
    {
      "owner": "khoih.prog",
      "name": "WiFiNINA_Generic",
      "version": ">=1.8.0",
      "platforms": ["*"]
    },
    {
      "owner": "stm32duino",
      "name": "STM32duino LwIP",
      "version": ">=2.1.2",
      "platforms": ["ststm32", "stm32"]
    },
    {
      "owner": "stm32duino",
      "name": "STM32Ethernet",
      "version": ">=1.2.0",
      "platforms": ["ststm32", "stm32"]
    },
    {
      "owner": "uipethernet",
      "name": "UIPEthernet",
      "version": ">=2.0.8",
      "platforms": ["*"]
    },
    {
      "owner": "jandrassy",
      "name": "EthernetENC",
      "version": ">=2.0.0",
      "platforms": ["*"]
    },
    {
      "owner": "jandrassy",
      "name": "WiFiEspAT",
      "version": ">=1.3.1",
      "platforms": ["*"]
    },
    {
      "owner": "adafruit",
      "name": "Ethernet2",
      "version": ">=1.0.4",
      "platforms": ["*"]
    },
    {
      "owner": "sstaub",
      "name": "Ethernet3",
      "version": ">=1.5.3",
      "platforms": ["*"]
    },
    {
      "owner": "arduino-libraries",
      "name": "Ethernet",
      "version": ">=2.0.0",
      "platforms": ["*"]
    },
    {
      "owner": "openslab-osu",
      "name": "EthernetLarge",
      "version": ">=2.0.0",
      "platforms": ["*"]
    }
  ],

Thanks for your post as it'll be helpful to other users.

Please also check other WIO Terminal examples in WebSockets WIO_Terminal as well in this library WIO_Terminal Switch examples

RoSchmi commented 3 years ago

@khoih-prog Thanks for your answer, the problem in my setup seems that the library STM32Ethernet is always included when I add this line in my platformio.ini

lib_deps = https://github.com/khoih-prog/SinricPro_Generic#v2.8.0

If I understand the process of the inclusion of dependencies right, STM32Ethernet should not be included as the platform is atmelsam and not 'ststm32' or 'stm32'. I didn't find any obvious reasons in the library.json files of your library. So, if STM32Ethernet is not included on your side for the Wio Terminal, there may be something wrong with my PIO/VS-Code installation.

khoih-prog commented 3 years ago

@RoSchmi

As the library is designed for too many platforms and boards, I try to use the "better safe than ..." way by including more dependent libraries than necessary, even not actually used by the platform/board. Many users are not so experienced as you are.

By doing so, I hope to avoid so many questions not actually related to this library.

That leads to what you're observing: STM32Ethernet is installed even for SAMD51 WIO Terminal. Certainly the IDE/PIO is smart to know what to use or not.

You can choose to delete the unnecessary dependencies, if you now know what you're doing.

RoSchmi commented 3 years ago

Thanks, now, since I learned something about the process of managing dependencies, I will get it working.

khoih-prog commented 3 years ago

Good to know that you're a very active, experienced and contributing member in Seeed Forum, especially with WIO Terminal.

Did you have a chance to try the new WIOTerminal_WiFiManager which provides the similar features as ESP32/ESP8266 WiFiManager ?

RoSchmi commented 3 years ago

@khoih-prog The library now built flawlessly on PlatformIO for the Wio Terminal when I added this lib_ignore entries:

lib_ignore = STM32Ethernet DueFlashStorage ESP_AT_Lib Ethernet Ethernet2 Ethernet3 EthernetENC EthernetLarge EthernetWebServer EthernetWebServer_STM32 STM32duino LwIP STM32Ethernet UIPEthernet
WiFi101 WiFiEspAT WiFiNINA_Generic WiFiWebServer

In the meantime I adapted the Wio Terminal SinricPro_Generic Temp/Humidity example

https://github.com/RoSchmi/PlatformIO/tree/master/Proj/Wio_Terminal_IoT_TempHumidity_Display

Didn't yet get the time to try WioTerminal_WiFiManager Thanks for your help