added reset if disconnected logic
Fix sampling interval value resolution range handling
Cleanup logging
Fix pin modes
#ifdef => #if
merged upstream