PeterWone / vscode-arduino-cli

Integration of the Arduino CLI into VS Code
Other
9 stars 2 forks source link

Selecting a board stores all boards for that core in settings #17

Closed trullock closed 3 years ago

trullock commented 3 years ago

I chose a board, my settings.json now contains:

"arduinoCli.selectedBoard": {
        "label": "Arduino Nano",
        "description": "uses arduino:avr core",
        "board": {
            "name": "Arduino Nano",
            "fqbn": "arduino:avr:nano"
        },
        "core": {
            "ID": "arduino:avr",
            "Latest": "1.8.3",
            "Name": "Arduino AVR Boards",
            "Maintainer": "Arduino",
            "Website": "http://www.arduino.cc/",
            "Email": "packages@arduino.cc",
            "Boards": [
                {
                    "name": "Linino One",
                    "fqbn": "arduino:avr:one"
                },
                {
                    "name": "Arduino Mini",
                    "fqbn": "arduino:avr:mini"
                },
                {
                    "name": "Arduino Industrial 101",
                    "fqbn": "arduino:avr:chiwawa"
                },
                {
                    "name": "Arduino Uno",
                    "fqbn": "arduino:avr:uno"
                },
                {
                    "name": "LilyPad Arduino USB",
                    "fqbn": "arduino:avr:LilyPadUSB"
                },
                {
                    "name": "Arduino Micro",
                    "fqbn": "arduino:avr:micro"
                },
                {
                    "name": "Arduino Ethernet",
                    "fqbn": "arduino:avr:ethernet"
                },
                {
                    "name": "Arduino Robot Motor",
                    "fqbn": "arduino:avr:robotMotor"
                },
                {
                    "name": "Arduino Duemilanove or Diecimila",
                    "fqbn": "arduino:avr:diecimila"
                },
                {
                    "name": "Arduino NG or older",
                    "fqbn": "arduino:avr:atmegang"
                },
                {
                    "name": "Arduino Pro or Pro Mini",
                    "fqbn": "arduino:avr:pro"
                },
                {
                    "name": "Arduino BT",
                    "fqbn": "arduino:avr:bt"
                },
                {
                    "name": "Arduino Yún Mini",
                    "fqbn": "arduino:avr:yunmini"
                },
                {
                    "name": "Arduino Mega ADK",
                    "fqbn": "arduino:avr:megaADK"
                },
                {
                    "name": "Arduino Uno WiFi",
                    "fqbn": "arduino:avr:unowifi"
                },
                {
                    "name": "Arduino Gemma",
                    "fqbn": "arduino:avr:gemma"
                },
                {
                    "name": "Arduino Yún",
                    "fqbn": "arduino:avr:yun"
                },
                {
                    "name": "Arduino Leonardo",
                    "fqbn": "arduino:avr:leonardo"
                },
                {
                    "name": "Arduino Nano",
                    "fqbn": "arduino:avr:nano"
                },
                {
                    "name": "Arduino Mega or Mega 2560",
                    "fqbn": "arduino:avr:mega"
                },
                {
                    "name": "LilyPad Arduino",
                    "fqbn": "arduino:avr:lilypad"
                },
                {
                    "name": "Arduino Robot Control",
                    "fqbn": "arduino:avr:robotControl"
                },
                {
                    "name": "Arduino Leonardo ETH",
                    "fqbn": "arduino:avr:leonardoeth"
                },
                {
                    "name": "Arduino Esplora",
                    "fqbn": "arduino:avr:esplora"
                },
                {
                    "name": "Adafruit Circuit Playground",
                    "fqbn": "arduino:avr:circuitplay32u4cat"
                },
                {
                    "name": "Arduino Fio",
                    "fqbn": "arduino:avr:fio"
                }
            ]
        }
    }

Doesnt seem desireable

PeterWone commented 3 years ago

The board has a reference to its core which has a collection of boards. It's harmless if a bit wasteful. To prevent it you would have to make a new object and copy just the necessary properties, and then serialise that. Let's not complicate the code for a minor efficiency until we run out of serious issues.

trullock commented 3 years ago

I agree this isnt a high priority, and I understand how the serialization as led to this, but settings.json should contain settings. This info isnt a setting, but because its in settings it looks like a setting, which is bad.

PeterWone commented 3 years ago

What do you propose then? I argue that the board selection is a workspace setting — this project targets that board. I would accept the proposition that FQBN fully identifies the selection. I was just being lazy storing the whole damn object,

trullock commented 3 years ago

Yea just trim the object and only store what's needed, is that just the fqbn?

ghost commented 3 years ago

Just my $0.02...this doesn't have any impact of the memory space used on the controllers, does it? If not, then I don't care what the settings.json file contains...

PeterWone commented 3 years ago

No effect at all on the Arduino binary.