Skip to content

Having Deviot be more platformio compliant/tolerant #165

@jwhendy

Description

@jwhendy

In tinkering around with the Use PlatformIO Structure option, I was surprised that it overwrites things that are already there. In my mind, it would be awesome if Deviot were compatible with platformio and the Arduino IDE (based on the option). I think this could be similar to #137 in that things that are already fine as they are get rearranged a bit.


Example 1
Let's say one has been working with platformio and wants to try Deviot. They have an existing project structure like so:

[pio-struct-test]$ tree
├── lib
├── platformio.ini
└── src
    └── pio-struct-test.ino  ## just an empty setup{} and loop{}

Inside platformio.ini:

[env:nano]
platform = atmelavr
framework = arduino
board = nanoatmega328

Start ST3 and do Deviot -> Compile:

[ Deviot 2.1.1 ] Starting...
The current working directory ~/Arduino/pio-struct-test will be used for project.
[ ... ]
Error: Unknown environment names 'nanoatmega328'. Valid names are 'nano'

With platformio natively:

[pio-struct-test]$ platformio run
[Thu Sep  7 18:25:58 2017] Processing nano (platform: atmelavr; board: nanoatmega328; framework: arduino)
[ ... ]
[SUCCESS] Took 0.49 seconds

Oddly, creating a second project from scratch using Deviot -> New sketch did not prompt to ask for a board and populated the platform.ini automatically:

[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino

The platformio docs suggest that env can be anything, but Deviot seems to need env to match what it wants.


Example 2

If one has a top level file.ino file symlinked from src/file.ino, Deviot moves it anyway. The use case here is that the directory remains Arduino IDE compatible; if you try and open src/file.ino, Arduino will prompt to put it in a directory with the same name. Structure before:

[pio-struct-test]$ tree
├── lib
├── pio-struct-test.ino -> src/pio-struct-test.ino
├── platformio.ini
└── src
    └── pio-struct-test.ino

Start ST3, open the top level symlink, compile and the screen goes blank!

[pio-struct-test]$ tree
├── lib
├── platformio.ini
└── src
    └── pio-struct-test.ino -> src/pio-struct-test.ino

Deviot replaces the "real file" with a symlink pointing to itself. In my opinion, if the directory is already platformio compliant, nothing should be done.


Some ideas which I'd be happy to try and help on (with guidance/suggestions):

  • have Deviot accept Arduino and platformio compatible directories (perhaps undesirable, but doing the symlink thing has been working for me to have a 'hybrid' structure)
  • if the directory is already platformio compliant, don't touch it, or perhaps cache the contents and only add/update options if the user selects something new/different?
  • don't overwrite existing platformio.ini files, or at least work with them if they are compliant
  • make Use PlatformIO Structure a per-file setting. It appears to be universal at the moment; if the user doesn't want it made into this structure, they have to toggle the option on a per-file option
  • alternatively to any changes... just add more documentation about what Deviot can and can't work with, what users can expect with the options, etc.

Let me know if there's anything of merit here. I'm learning python and have switched to using this for all of my micro-controller tinkering... I'm happy to try and contribute as I've been looking for python projects to work on anyway for better/faster hands-on learning :) Thanks for tolerating all my activity!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions