I think you're making this way more complicated than it needs to be.
I probably am. But I have trouble believing the land is so flat that you only have 157' of gain/loss on a 50 mile ride.
Admittedly 1 foot of change might be too little for the resolution of the sensor to reliably perceive and should probably be handled as just "noise" in the data. Still, I can't imagine you not having 3 to 5 feet of change regularly and many times on a road in the flattest of routes.