Sammy1Am / Moppy2

The evolution of the Musical flOPPY controller
Other
311 stars 51 forks source link

Added support for ESP32 #119

Closed ZwoCa closed 3 years ago

ZwoCa commented 3 years ago

Hi Sammy1Am, thank you for launching this awesome project. I've added support for ESP32 - in essence, I've added new preprocessor macros for the ESP32 specific things and ported the timer.

It's running well on my ESP32 module with INSTRUMENT_SHIFTED_FLOPPIES and NETWORK_UDP, but should also work with other instruments and networks. Of cause, it will require defining valid pins.

Since ESP32 modules usually have two cores, one could certainly optimize this and use the FreeRTOS to schedule the tick method and the readMessages method on different cores. But I am just starting to get to know the ESP platform, so I didn't look into this yet.

Sammy1Am commented 3 years ago

Hey, looks great! Thank you for leaving the new esp32 bits in platformio.ini commented out so that the Uno is still the default (it makes the out of the box experience for new people easier). That's probably the fastest I've ever looked at a pull request and said, "Oh yeah, that's all fine!".

Splitting cores would definitely be worth a look for optimization (in practical terms the ESP32 clock speed is fast enough that it's rare to actually have so many notes to process that it would start to choke, but if you also wanted to control a light show or a dancing robot or something you might need those extra cycles!). Off hand I don't know if FreeRTOS's scheduling would use the hardware interrupt timer-- the timing of the tick method is sensitive since irregularities there would affect the note pitch.

I only have a small bit of FreeRTOS experience, but I think porting Moppy over might be a bit of work since the libraries we're using all assume the Arduino framework is available (maybe there's an Arduino library for FreeRTOS or they can live together though, I'm not sure)