correct pin definitions, ensure ui operations happen on main thread