     }
     return v;
 };
+
+float mapf(float value, float low1, float high1, float low2, float high2){
+  return low2 + (value-low1) * (high2-low2) / (high1-low1);
+}

        case ctrl.FLY_REL:
            ctrl.navRangeThrottle = mem.read_NavRange_Throttle_Rel(); break;
    }
    stickThrottle.setRange( float(ctrl.navRangeThrottle));
    
    print("NavRange yaw: "); print(ctrl.navRangeYaw); 
    print(" pitch: "); print(ctrl.navRangePitch); 

        case ctrl.FLY_REL:
            ctrl.navRangeRoll = mem.read_NavRange_Roll_Rel(); break;
    }
    stickRoll.setOutputRange( float(ctrl.navRangeRoll));
    
    switch (ctrl.navModeThrottle) {
        case ctrl.FLY_ABS:
