Arduino EVERY support

Issue #60 resolved
Former user created an issue

Any chance this library will ever be updated to work with the EVERY version of Arduino?

Comments (7)

  1. Andrew Wasson

    I followed the discussion on the Arduino forums (https://forum.arduino.cc/t/newping-library-hc-sr04-srf05-srf06-dyp-me007-parallax-ping-v1-7/103737/1222) and I’ve attached a patch for the current release of Arduino New Ping. It works for my use case but I think it would be helpful to test it to see if it causes any trouble or incompatibilities. Then we can make a pull request to have it included in the next release.

    Cheers,
    Andrew

    EDIT: I disabled the timer by default as it seems to have been part of the discussion but that might have been a mistake. Perhaps someone can weigh in about that and whether it is detrimental. It doesn’t seem to have made any difference in my use of the library for robotics distance measuring and navigation.

  2. Tim Eckel repo owner

    You’re just doing the:

    #define TIMER_ENABLED false
    

    command, which is exactly how you would disable the timer functions on a device that doesn’t support AVR timer commands. There’s no reason to make any code changes, as disabling the timer functions is the provision for devices like this. To properly support a new microcontroller, it would either need include the timer functions for that microcontroller, or totally disable timer functions if not available. This was discussed in the above linked forum thread.

    Basically, setting TIMER_ENABLED to false is all you need to do. As far as making the library automatically work without modification would require someone with timer knowledge of the microcontroller to submit a pull request. I don’t have this microcontroller nor have any timer knowledge to write it.

  3. Tim Eckel repo owner

    You can try v1.9.2 to see if that works for you. It should disable the timers by default on the Nano Every.

  4. Andrew Wasson

    Hi Tim,
    Sorry for the delayed response. I’ve been tied up with client development work since the beginning of the year and it has kept me away from the stuff I like to do for my own interest.

    When I made the changes in my patch I found that just disabling the timer still threw errors and would not compile. I had to also adjust line 190 to include defined(AVR_NANO_EVERY)`. Without this line I could not compile.

    I also adjust line 209 to include defined(__AVR_ATmega4809__). I am not sure that this is necessary but the adjustment to line 190 definitely was.

    I will carve some time aside to try v1.9.2 to see if it compiles with a NANO EVERY. I have several of these boards on hand and am happy to give them a whirl.

    Cheers,
    Andrew

  5. Andrew Wasson

    v1.9.2 appears to work fine with the Arduino NANO Every from my testing.

    The compiler complains that the library isn’t compatible with the Every. I resolved that by adjusting the libraries architecture property to include megaavr (architectures=avr,arm,megaavr).

    Otherwise it seems like it’s working as advertised.

  6. Log in to comment