gepd / Deviot

Sublime Text plugin for IoT development based in PlatformIO ecosystem (Arduino IDE)
Apache License 2.0
306 stars 55 forks source link

select custom board #79

Open jon-daemon opened 7 years ago

jon-daemon commented 7 years ago

Hello, I have created a few custom boards but I cannot find them in Deviot. I can see my boards if I execute platformio boards in terminal. Should I update the list in Deviot somehow?

gepd commented 7 years ago

I'm improving this feature in v2 of deviot, in this version you should remove the file located in: Packages\User\Deviot\Preset\platformio_boards.json and restart ST

It will took a few seconds to refresh and show the new board

jon-daemon commented 7 years ago

I deleted this file but it didn't reappear after restarting ST. Also it wasn't showing the boards list to select one. It reappeared after building a project, disabling and enabling Deviot. I found that it changed the structure of my boards json files. I had something like that:

{
"my_board_name":{
"build": {},
    "frameworks": [], 
    "name": "", 
    "platform": "", 
    "upload": {}, 
    "url": "", 
    "vendor": ""
  }
}

which turned into this:

{
  "build": {}, 
  "frameworks": [], 
  "name": "", 
  "platform": "", 
  "upload": {}, 
  "url": "", 
  "vendor": ""
}

After this change I can see my boards on Deviot but it gives me an error if I execute platformio boards in terminal.

gepd commented 7 years ago

Your first structure is like this:? https://github.com/gepd/Deviot/issues/77#issuecomment-253287689

Try again, and this time after delete the file in the Preset folder, go to Deviot > Language and select your current language, it will ask to restart Deviot, accept it and tell me if the behavior is the same

jon-daemon commented 7 years ago

No, the structure I was using is like this because I found that only with this structure I'm not getting errors on terminal.

After the structure change they are like the commment you posted but I get this error

Error: Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/platformio/__main__.py", line 107, in main
    cli(None, None, None)
  File "/Library/Python/2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/platformio/commands/boards.py", line 36, in cli
    if data['platform'] not in grpboards:
TypeError: string indices must be integers

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  http://docs.platformio.org/en/latest/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio/issues

============================================================
gepd commented 7 years ago

it seems to be a problem with PlatformIO.

The last structure is working only with PlatformIO 3, having open a cpp or ino file, Deviot will show you the version installed in the status bar, if your version is 2.x I suggest you to update from

Deviot Menu > Options > Upgrade PlatformIO

After install the last version (3.1.0 in this moment) you shouldn't have problem but If you keep getting errors, you can remove the folder Deviot in Packages\User it will make to install PlatformIO again, this time all errors should be gone

And you should use this json structure for your board

jon-daemon commented 7 years ago

I have Deviot 1.2.5 and PlatformIO 3.1.0 I use Mac OS X 10.12 and ST build 3126. I tried all your suggestions with no luck. I created just one board with the structure you suggested. Everything is working fine on ST but still getting the same error in Terminal.

edit: It seems to be fixed after upgrading platformio with

sudo pip install -U platformio