Patch for issue #32 and related

Patch to update device state to values stored in flash.

State init code moved from ```main()``` to ```flashstorage_keyval_update()``` and now gets run at startup and after KEYVALSET