theelims / ESP32-sveltekit

A simple and extensible framework for ESP32 based IoT projects with a feature-rich, beautiful, and responsive front-end build with Sveltekit, Tailwind CSS and DaisyUI. This is a project template to get you started in no time with a fully integrated build chain.
https://theelims.github.io/ESP32-sveltekit/
Other
90 stars 15 forks source link

Suggestion : add support for esp32-devkit-v1 board #20

Closed leokeba closed 4 months ago

leokeba commented 4 months ago

Hi, although it might not be the best choice to run this project, the "doit" devkit-v1 board and its numerous clones are one of the most common, cheap and available esp32 boards so I thought it might be useful to add it to the template.

theelims commented 4 months ago

Likely the doit devkit had the same schematic as the regular devkit from Espressif. Likely the board type "esp32dev" will work for it as well. If so, I would prefer the more generic board.

leokeba commented 4 months ago

Makes sense, shoud I just edit the PR then ?

leokeba commented 4 months ago

I just tried compiling with the template for it but it's missing the LED_BUILTIN define. It can be fixed by adding the "-D LED_BUILTIN=2" build flag, but it makes me wonder, maybe the regular devkit doesn't have a builtin led in the first place ? I went looking for the schematics on espressif's website, but not sure which devkit this refers to, maybe it was discontinued ?

theelims commented 4 months ago

It should be as generic as possible. Could be that "esp32dev" just refers to the bare module. There is a complete overview on the platformio website. Maybe it's a good idea to reduce the platformio.ini just to the official devboard for each chip.

On the one hand the default should be as accessible as possible and on the other hand I want to avoid a pull request for each single board or there.

leokeba commented 4 months ago

Yep totally understand your point. For my own purposes, using the more generic esp32dev with added build flag for the LED seems to be pretty much equivalent to the bare "doit" board, so either works for me.

I would say the first option, being more generic, offers more power to the user as they can just edit the LED_BUILTIN flag to adapt it for their own board. But it can also trick users into believing that their board will work when it will not, either because there is not builtin LED, or because it's on another pin.

On the other hand, my experience tells me that the "doit" style devkit-v1 boards are the most common and available by a huge margin (not the "doit" brand itself but all the "clones"). Usually, the "devkit-v1" reference is clearly written on the back of the PCB, so for not-so-experienced users who own this board it would be the most frictionless way of getting started, just select the name that's written on your board and hit upload.

Each has its merit, and of course there's also the option of not adding another board and keeping the list short, this was just a suggestion in the first place. Anyway, just tell me if you have a final recommandation for this, or just close the PR if you wanna go the third route.

Have a good day, and thanks for your work, it's a great project. I was trying to build something very similar myself, but I would never have made it so slick and streamlined, so I'm happy I ran into this :)

leokeba commented 4 months ago

Just for good measure, I dug into espressif's arduino framework to have a look at the differences between board definitions. The devkit-v1 is exactly the same as the esp32dev but adds the LED_BUILTIN define, but I also discovered that the nodemcu-32s is the same as devkit-v1 but also adds a KEY_BUILTIN define. Fortunately, this key also works on the devkit-v1 variants as it is used as a boot strapping pin.

So if the goal is to be as generic as possible, we might replace the nodemcu-32s by the following, and it would work for both boards, and probably others :

[env:esp32dev]
; Works for nodemcu-32s, devkit-v1 boards and probably others. You can change the pin defines below if needed.
board = esp32dev
board_build.partitions = min_spiffs.csv
build_flags =
    ${env.build_flags}
    -D LED_BUILTIN=2
    -D KEY_BUILTIN=0

What do you think about this option ?

theelims commented 4 months ago

I find it hard to map the board definitions from the Arduino framework with the platformio boards. But I like your suggestion. Should make it more universal. With the next feature branch I'll clean up the platformio.ini and get a Espressif devboard for each major chip for testing.