Hi Bowey,
Valves driven by the state machine's onboard valve driver can be calibrated using the liquid calibration UI. Once calibration is set up, you can get the correct valve-open time using the GetValveTimes() function. You'd then set the state timer of a state where the valve is open to equal the output of GetValveTimes().
Unfortunately, the calibration software doesn't work with valve driver modules. For those, you'd need to write a similar calibration routine. The valve calibration software source file is here: (https://github.com/sanworks/Bpod_Gen2/blob/master/Functions/Calibration/Liquid%20Reward/BpodLiquidCalibration.m) It's a lot of code, but mostly due to the UI.
-Josh