>supportGrayscale = ( romVersion >= 0x03000000 ? true : false );
>supportContrast  = ( romVersion >= 0x03100000 ? true : false );
>...
>   if ( supportContrast )
>      contrastSave = SysLCDContrast (false, 0);

This is pretty good, but not 100% right.  First, a little thing: your
"supportGrayscale" really means "Can I call ScrDisplayMode" - and that's a
fine way to do the test, but the variable name just might be a little
misleading since there could well be a device with OS version > 3.1 which
had only a black and white screen.  ScrDisplayMode can tell you if a given
depth is supported; see the docs for the slightly confusing way that it
gives you a bit field.

But more importantly, assuming you can call the unsupported SysLCDContrast
function whenever you're on >= 3.1 isn't safe.  If you're trying to get
around a specific contrast bug in 3.1, for example, just call this if
you're on 3.1 and not otherwise!  Otherwise if SysLCDContrast doesn't exist
in future devices you'll be causing crashes for no good reason.

So just change the >= to an == and you should be all set for compatibility.

-David Fedor
Palm Developer Support


Reply via email to