Why is core library source file Tone.cpp not refactored any further?

(deleted)

Tone.cpp (5.8 KB)

It may be easier to suggest improvements directly to the library's repository.

 static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255, 255, 255, 255, 255 */ };
 const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 3, 4, 5, 1, 0 */ };

It looks to me like the code is designed to work on more pins than are currently set up to be used; ie my un-commenting those other pins. Probably “any 16bit timer.”

Yeah, it’s pretty awful looking, although I have different complaints: since tone is part of the core, a lot of that chip-specific stuff ought to be off in the variants files…

Alas, code changes based on “i looked at the code is it’s ugly” are even less likely to get implemented than code changes resulting in substantial performance or functionality improvement. Since there have been essentially no “user” complaints about tone, it’s unlikely to change.

(deleted)

Not related to your question at all. Your rtek1000 url is mangled. Which OS, which browser do you use?

Can you remember how you entered it? Quick edit or more -> edit?

sterretje:
Not related to your question at all. Your rtek1000 url is mangled. Which OS, which browser do you use?

Can you remember how you entered it? Quick edit or more -> edit?

Hi sterretje, thanks for letting me know, I didn't actually indicate a link because I was a little tired, but I found this link: Tone - Arduino Libraries

I was more curious about OS and browser and so on as there is an issue on the site that seems to cause this. Maybe post that info in https://forum.arduino.cc/index.php?topic=712270.0 so developpers have some more insight.

(deleted)