Change control code to use a single function for either temp or humidity to eliminate code duplication.