AnnyCaroline / ceu-selectdevice

0 stars 0 forks source link

Céu-Maker: Select device

Intended to be used together with Céu-Maker, SelectDevice is an application that lists the connected Arduino boards and allows the user to select one.

In Céu-Maker, all Céu-Arduino applications should contain a board.conf file, which defines for which Arduino board and port the application should be uploaded to. It stores 3 settings, separated by a blank space:

If this file doesn't exists, the Céu-Arduino.exe run SelectDevice so the user select a connected board. This process generates a board.conf file in the application's folder. The following uploads will not ask for board selection, since the file already exists. If you want to change the upload configurations without change the board.conf manually, drag and drop your application's folder or file to SelectDevice.exe.

There is also possible to define a global configuration, so all uploads uses it in case no board.conf is provided with the application.

Dev notes

This app was developed using Visual Studio Community 2017 and only supports boards from package "arduino" and arch "avr". Actually, it only supports boards from /hardware/arduino/avr/ that have vid and pid specified. Here is the list for expected boards to work:

Inspiration

The Arduino IDE uses the file hardware\arduino\avr\boards.txt to identify ports and boards. With a VID/PID combination we can identify the USB device that is plugged and then search in this file for more information, such as the name of the board.

Create a new release version

To create a new release version, make sure to move the exe generated by the Visual Studio from SelectDevices/bin/Release/ to ceu-maker/ceu-maker-windows/bin

if DEBUG

In the SelectDevice/Form1.cs, we can find blocks of code using #if DEBUG:

#if DEBUG
    string text = System.IO.File.ReadAllText(@"absolute-path-to\arduino-1.8.3\hardware\arduino\avr\boards.txt");
#else
    string text = System.IO.File.ReadAllText(@"..\arduino-1.8.3\hardware\arduino\avr\boards.txt");
#endif

The above code was included to facilitate the location of boards.txt file in develop stage. If you're compiling a debug version o SelectDevice, you can use the absolute path of boards.txtchanging the string in the second line. For release, use a relative path.

References and links