first working (local only) version with all funcs

Original controller functions reengineered, including saving current
state to eeprom and reading previous state on power up