fritzing / fritzing-app

Fritzing desktop application
http://fritzing.org
Other
3.96k stars 822 forks source link

Upload code to Arduino does not work with IDE 2.x or Arduino-cli #4010

Open failiz opened 1 year ago

failiz commented 1 year ago

Current Behaviour

In Fritzing 0.9.10 (Windows), the upload to Arduino does not work with Arduino IDE 2.x or the recent version of Arduno-cli. Selecting the Arduino.exe (the IDE), the upload just gives you a very short message: "upload failed with exit code -1, 0" (This was also reported in #4001)

Selecting the arduino-cli, it outputs more info:

Running C:/Users/anfv/Downloads/arduino-cli.exe --board arduino:avr:uno --port \\.\COM15 --upload C:\Users\anfv\AppData\Roaming\Fritzing\fzz\39a6a07cb8608549653ac9b134609861\Blink_TMP\Blink_TMP.ino
Error: unknown flag: --board

Usage:
  arduino-cli [command]

Examples:
  C:\Users\anfv\Downloads\arduino-cli.exe <command> [flags...]

Available Commands:
  board           Arduino board commands.
  burn-bootloader Upload the bootloader.
  cache           Arduino cache commands.
  compile         Compiles Arduino sketches.
  completion      Generates completion scripts
  config          Arduino configuration commands.
  core            Arduino core operations.
  daemon          Run as a daemon on port: 50051
  debug           Debug Arduino sketches.
  help            Help about any command
  lib             Arduino commands about libraries.
  monitor         Open a communication port with a board.
  outdated        Lists cores and libraries that can be upgraded
  sketch          Arduino CLI sketch commands.
  update          Updates the index of cores and libraries
  upgrade         Upgrades installed cores and libraries.
  upload          Upload Arduino sketches.
  version         Shows version number of Arduino CLI.

Flags:
      --additional-urls strings   Comma-separated list of additional URLs for the Boards Manager.
      --config-file string        The custom config file (if not specified the default will be used).
      --format string             The output format for the logs, can be: text, json, jsonmini, yaml (default "text")
  -h, --help                      help for arduino-cli
      --log-file string           Path to the file where logs will be written.
      --log-format string         The output format for the logs, can be: text, json
      --log-level string          Messages with this level and above will be logged. Valid levels are: trace, debug, info, warn, error, fatal, panic
      --no-color                  Disable colored output.
  -v, --verbose                   Print the logs on the standard output.

Use "arduino-cli [command] --help" for more information about a command.

unknown flag: --board

Upload failed with exit code 1, 0

Thus, it seems that the commands have changed and the "--" needs to be removed.

Steps to reproduce:

Expected Behaviour

The Arduino is uploaded

vanepp commented 1 year ago

Looks from the usage message that we need to change the --command to -command which should be fairly easy to do. I expect when you fix the first one the next two will then fail as well (unless we do all three and any others we use all at once). We may need to add code to check for the IDE version as I believe this works on older versions of the IDE and we probably don't want to break that.