fix 40D compilation
Created originally on Bitbucket by frantony (Antony Pavlov)
Was already merged in Bitbucket before import, marked as merged by the import user
Source changeset not longer availableat the time of import. Commit listwill look empty
This pull requset is based on @jplxpto 's work (see https://bitbucket.org/hudson/magic-lantern/pull-request/176/40d-fix-some-compiler-errors/diff). I have rearranged the patches (original work contain only 2 patches; this 2 patches were transformed to the 10 patches), but I have kept @jplxpto in the author field. Also I have added the LCD sensor fix.