# Limit driver amount to only a certain part of a rotation

I am making corrective shapekeys for a character's knee. I have created the shapekey and now need to setup the driver. So far I have followed this tutorial: https://www.youtube.com/watch?v=f3JWNIkwBZ8

I currently have a variable of the shin bone's local X rotation, with a type of Averaged Value. The current behavior is that as i rotate the bone, the driver value hits 1 at ~65 degrees of rotation, and then goes back to 0 as rotation continues. This means that my corrective shape key kicks in far too early, and then shuts off by the time it should be coming on.

I want the shapekey to start coming in at 90degrees and be at the full value of 1 by 135degrees. How do I achieve this?

 (r - radians(90)) / radians(45)

 min(max(0, (r - radians(90)) / radians(45)), 1)