add periodic method
add AWB timer
deal gracefully with corrupt flash
fix various bugs