Fixed compilation issue in fgrid.cpp due to int/enum

gcc 4.8 is somewhat more picky about enums, and this
patch fixes an issue where an enum variable was used
outside of the defined range.

Change-Id: Ibfd7720d1d3e575c45bc1d5dbd30daad6391400c