static void display_temperature(void) { int16_t temp; #ifdef CONFIG_TEMPERATURE_METRIC temperature_get_C(&temp); #else temperature_get_F(&temp); #endif _printf(0, LCD_SEG_L2_3_0, "%03s", temperature.offset); _printf(0, LCD_SEG_L1_3_1, "%2s", temp/10); display_char(0, LCD_SEG_L1_0, (temp%10)+48, SEG_SET); }
//* ************************************************************************************************ /// @fn display_temperature(void) /// @brief Common display routine for metric and English units. /// @return none //* ************************************************************************************************ void display_temperature(void) { int16_t temp_inmetric; // Clear the previous value displayed display_clear(0, 1); // Display '°' and '.' display_temp_symbols(1); // Display the proper metric unit #if CONFIG_TEMPERATURE_METRIC == TEMPERATURE_DEGREES_C display_char(0, LCD_SEG_L1_0, 'C', SEG_ON); #endif #if CONFIG_TEMPERATURE_METRIC == TEMPERATURE_DEGREES_F display_char(0, LCD_SEG_L1_0, 'F', SEG_ON); #endif #if CONFIG_TEMPERATURE_METRIC == TEMPERATURE_DEGREES_BOTH if (temp_display_metric == TEMPERATURE_DEGREES_C) { display_char(0, LCD_SEG_L1_0, 'C', SEG_ON); } else { display_char(0, LCD_SEG_L1_0, 'F', SEG_ON); } #endif // Get the right temperature in the defined metric #if CONFIG_TEMPERATURE_METRIC == TEMPERATURE_DEGREES_C temperature_get_C(&temp_inmetric); #endif #if CONFIG_TEMPERATURE_METRIC == TEMPERATURE_DEGREES_F temperature_get_F(&temp_inmetric); #endif #if CONFIG_TEMPERATURE_METRIC == TEMPERATURE_DEGREES_BOTH if(temp_display_metric == TEMPERATURE_DEGREES_C) { temperature_get_C(&temp_inmetric); } else { temperature_get_F(&temp_inmetric); } #endif // Indicate temperature sign through arrow up/down icon if (temp_inmetric < 0) { // Convert negative to positive number temp_inmetric = ~temp_inmetric; display_symbol(0, LCD_SYMB_ARROW_UP, SEG_OFF); display_symbol(0, LCD_SYMB_ARROW_DOWN, SEG_ON); } else { // Temperature is >= 0 display_symbol(0, LCD_SYMB_ARROW_UP, SEG_ON); display_symbol(0, LCD_SYMB_ARROW_DOWN, SEG_OFF); } // Display result in xx.x format display_chars(0, LCD_SEG_L1_3_1, _sprintf("%2s", temp_inmetric), SEG_ON); }