static void scr_status_refresh_screen() { scr_controls_redraw(&controls_definition); uint8_t curr_mode = battery_is_charging()? (battery_is_full() ? 2 : 1) : 0; if (curr_mode != mode) { mode = curr_mode; scr_status_draw_battery_status(); } }
static void scr_status_draw_screen() { mlcd_draw_rect(109, 60, 6, 12); mode = battery_is_charging()? (battery_is_full() ? 2 : 1) : 0; scr_status_draw_battery_status(); mlcd_draw_text(ossw_mac_address(), 0, 135, MLCD_XRES, NULL, FONT_NORMAL_BOLD, HORIZONTAL_ALIGN_CENTER); scr_controls_draw(&controls_definition); }
/* * Callback function when the battery status timeout expires */ static void battery_status_timeout_handler(void *p_context) { char msg[256]; gfx_fillRect(0, 8, 128, 56, SSD1306_BLACK); gfx_setCursor(0, 12); gfx_setTextBackgroundColor(SSD1306_WHITE, SSD1306_BLACK); snprintf(msg, sizeof(msg), "Battery status:\n" " Voltage: %04d mV\n" " Charging: %s\n" " USB plugged: %s\n", battery_get_voltage(), battery_is_charging() ? "Yes" : "No", battery_is_usb_plugged() ? "Yes" : "No"); gfx_puts(msg); gfx_update(); }