What I know about the regulations in Europe for electric bikes:
When you stop pedaling and beyond 25 km / h, the electric assistance must switch off automatically. The power (electric or mechanical?) must not exceed 250W. The automatic assistance cutoff should be carried out in 2m maximum, that is to 25km / h in 288ms.
I checked with a supplier who delivers a front electric wheel for bikes that can be controlled directly from a smartphone. And which encloses a certificate of conformity to the European standard. There is no pedaling sensor or limit switch on the brakes, nor an accelerator. He informs me that "assistance is cut off when you no longer give forward impulse". And that "energy regeneration works with the slope sensor and only downhill". It’s a direct drive engine.
I know there is an accelerometer in the VESC project. And that our bikes have brakes capable of decelerating almost as well as on a car. So if I brake the accelerometer must detect a deceleration to stop the engine.
Is it possible to switch off the electric motor without a ramp as soon as an adjustable deceleration is detected? Start regeneration automatically when deceleration (which is also proportional to the sine of the slope angle at constant speed)? And why not uphill automatically activate assistance?
Currently I'm fixing the skateboard remote on my handlebars. When I go up in the mountains I activate the rotary button in the motor direction then I switch to cruise mode by pressing the power button at the same time. If I want to stop, I have to touch any button to stop cruise mode. When going downhill I turn the rotary button in the other direction to recharge the battery.
In the future, in addition to my skateboard remote control (or with a smartphone), I would like to use the accelerometer of the controller and set 3 gamma ranges. The first filtered to start the assistance, the second to cut the assistance without delay, the third filtered to start the regeneration. Is it possible to add this function in "app setting" "vesc remote" "general". And, I don't know much about it, but I also think that it would be necessary to calibrate the 3 axes of the accelerometer by putting the horizontal bike in static then by making it move forwards and backwards. Because the controller can be mounted in any position.
If you need it to try what's on the market, I can order an electric wheel and ship it to the person who can write the program. In this case indicate the size of your front tire and the delivery address.