I'm currently using VESC in duty cycle mode for a pedal generator - it works *great*, very ergonomic even without a flywheel:
Basically, once overun the duty cycle in your power phase, the motor resists, and 'dead spots' you no longer overrun and it no longer resists, absolutely same principle as riding at high speed on a bicycle, with bonus being that so long as it's torque capacity is within limits, you can pedal as hard or easy as you want without 'setting load', the process is entirely automatic and you are always in a 'correct gear', very useful for a bicycle with 'electric transmission'.
Problem is, once you stop pedalling it either starts spinning your legs or you need to install a freewheel (and turn it on and off to prevent it freewheeling and causing no-load losses).
Is it possible to add a 'duty cycle with brake' mode, with a modified brake function - as long as button is pressed, duty cycle mode functions only as 'speed limiter' above selected throttle/PMM value, but will provide no assist once you fall below that value?
Should be very easy to do I presume, I'd add it myself maybe but my programming skills are very rudimentary. It can be useful for other purposes I presume.