Decreasing large DC motor power usage by coasting
I suggest you also consider the load going up in inclines. if you turn off the engine going uphill based on speed, you're most likely to turn it on again soon because of the load. You might be able to get a hint of load from the current drawn by the motor. Combining speed and load might also optimize your bike going downhill.