Change some names. Use 18 instead of 24 pulses.

Put 'min' and 'max' at the end of the variable names. Use 18 pulses to
catch cases where the hardware decoder misses the first few sync pulses.
Remove the test for 160 bits.