void show_view(LiquidCrystal *lcd, lcd_view view){ lcd->clear(); lcd->setCursor(0,0); switch(view){ case TEMPERATURE: lcd->print("Temperature:"); lcd->setCursor(9,1); lcd->print(get_sensor_values().temperature); lcd->print((char)223); lcd->print("C"); break; case HUMIDITY: lcd->print("Humidity:"); lcd->setCursor(10,1); lcd->print(get_sensor_values().humidity); lcd->print("%"); break; default: break; } current_view = view; }
static void query_sti_load(struct hud_graph *gr) { struct sensors_temp_info *sti = gr->query_data; uint64_t now = os_time_get(); if (sti->last_time) { if (sti->last_time + gr->pane->period <= now) { get_sensor_values(sti); switch (sti->mode) { case SENSORS_TEMP_CURRENT: hud_graph_add_value(gr, (uint64_t) sti->current); break; case SENSORS_TEMP_CRITICAL: hud_graph_add_value(gr, (uint64_t) sti->critical); break; case SENSORS_VOLTAGE_CURRENT: hud_graph_add_value(gr, (uint64_t)(sti->current * 1000)); break; case SENSORS_CURRENT_CURRENT: hud_graph_add_value(gr, (uint64_t) sti->current); break; case SENSORS_POWER_CURRENT: hud_graph_add_value(gr, (uint64_t) sti->current); break; } sti->last_time = now; } } else { /* initialize */ get_sensor_values(sti); sti->last_time = now; } }