motform / arduino-cli-mode

emacs support for the arduino-cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Symbol's function definition is void: mapcar*

jaromrax opened this issue · comments

Hi,
I managed to install arduino-cli and installed all core stuff, was able to compile in comandline with --fqbn arduino:avr:nano.
I managed to install your arduino-cli.el by copying to ~/.emacs.d/lisp/ and making request and I run some commands from emacs.
However - when trying to arduino-cli-compile it crashes. I dont know how to convince emacs to pass --fqbn parameter, which possibly makes the problem.

thank you
Jaro

Edit: I see I dont get my board recognized, one nano is connected via USB:

$ arduino-cli board list      
Port         Type              Board Name FQBN Core
/dev/ttyS4   Serial Port       Unknown             
/dev/ttyUSB0 Serial Port (USB) Unknown             

After some playing around, I found I cannot get the expected output fromarduino-cli board list. Can I somehow convince the arduino-cli-mode.el file about getting --fqbn and probably also the PORT from e.g. json file in the directory?

Hi jaromrax ,

Thank you for reporting this issue and using my package! As I see it, there are two problems here.

The first is the use of mapcar*, which was a deprecated alias for the cl-lib function cl-mapcar. I have replaced all occurrences of this as of dbba262.

The other issue is that fact that you cannot see your board through board list. The package relates heavily on this in order to automate board selection, which is problematic as I've experienced that functionality of arduino-cli as a bit... fragile.

I have created a pull request with a version that includes the ability to define a default board by setting custom vars, like this (setq arduino-cli-mode-default-fqbn "arduino:avr:uno" arduino-cli-mode-default-port "/dev/cu.usbmodem14201"). One could imagine setting these vars on a per project/file basis using file or directory variables.

Could you try it out and see if it fixes your problem? It appears to be working for me.

Thank you very much for the advice.

  1. Error is not reported anymore.
    but on arduino-cli-compile I get No Board connected
    I have put the line with (setq to .emacs file, but no help.

Sorry, I dont know too much howto play with variables, set and check from emacs to make more tests...

Cheers, Jaromir

My bad, the fix I wrote assumed that you would always provide full board information. I've pushed a new version to this branch that is ok with partial information, with a more robust way of handling user-defined defaults and more helpful, localised errors. I also shortened the variable name, so in your case you should now be able to compile with:

(setq arduino-cli-mode-fqbn "arduino:avr:nano")

If you want to upload the sketch to your board, you have to specify the path to the USB port the board is currently connected to with:

(setq arduino-cli-mode-port $PORT)

Hope this fixes the issue!