Skip to content

Commit

Permalink
[Painter] Treaks to layout
Browse files Browse the repository at this point in the history
  • Loading branch information
drashna committed Aug 3, 2024
1 parent 24900e1 commit 567a56c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 14 deletions.
53 changes: 40 additions & 13 deletions users/drashna/display/painter/ili9341_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,21 +302,22 @@ __attribute__((weak)) void ili9341_draw_user(void) {
if (hue_redraw || last_keymap_config.raw != keymap_config.raw) {
last_keymap_config.raw = keymap_config.raw;
static int max_bpm_xpos = 0;
xpos = cg_off->width + 5;
xpos = 5;
const char* buf0 = "NKRO ";
const char* buf1 = "CRCT ";
const char* buf2 = "1SHOT";
qp_drawimage(ili9341_display, xpos, ypos, last_keymap_config.swap_lctl_lgui ? cg_on : cg_off);
xpos += cg_off->width + 5;
xpos +=
qp_drawtext_recolor(ili9341_display, xpos, ypos, font_oled, buf0, last_keymap_config.nkro ? 153 : 255,
255, 255, last_keymap_config.nkro ? 153 : 255, 255, 0) + 5;
255, 255, last_keymap_config.nkro ? 153 : 255, 255, 0) +
5;
xpos += qp_drawtext_recolor(ili9341_display, xpos, ypos, font_oled, buf1,
last_keymap_config.autocorrect_enable ? 153 : 255, 255, 255,
last_keymap_config.autocorrect_enable ? 153 : 255, 255, 0);
last_keymap_config.autocorrect_enable ? 153 : 255, 255, 255,
last_keymap_config.autocorrect_enable ? 153 : 255, 255, 0);
xpos += qp_drawtext_recolor(ili9341_display, xpos, ypos, font_oled, buf2,
last_keymap_config.oneshot_enable ? 153 : 255, 255, 255,
last_keymap_config.oneshot_enable ? 153 : 255, 255, 0);
xpos += MAX(temp_pos, 30);
last_keymap_config.oneshot_enable ? 153 : 255, 255, 255,
last_keymap_config.oneshot_enable ? 153 : 255, 255, 0);
if (max_bpm_xpos < xpos) {
max_bpm_xpos = xpos;
}
Expand All @@ -326,13 +327,13 @@ __attribute__((weak)) void ili9341_draw_user(void) {
ypos += font_oled->line_height + 4;
static user_runtime_config_t last_user_state = {0};
if (hue_redraw || last_user_state.raw != user_state.raw) {
last_user_state.raw = user_state.raw;
last_user_state.raw = user_state.raw;
static uint16_t max_upm_xpos = 0;
xpos = cg_off->width + 10;
const char* buf0 = "AUDIO";
const char* buf1 = "CLCK";
const char* buf2 = "HOST";
const char* buf3 = "SWAP";
xpos = cg_off->width + 10;
const char* buf0 = "AUDIO";
const char* buf1 = "CLCK ";
const char* buf2 = "HOST ";
const char* buf3 = "SWAP ";
xpos += qp_drawtext_recolor(ili9341_display, xpos, ypos, font_oled, buf0,
last_user_state.audio_enable ? 153 : 255, 255, 255,
last_user_state.audio_enable ? 153 : 255, 255, 0) +
Expand All @@ -354,6 +355,32 @@ __attribute__((weak)) void ili9341_draw_user(void) {
qp_rect(ili9341_display, xpos, ypos, max_upm_xpos, ypos + font_oled->line_height, 0, 0, 0, true);
}

ypos += font_oled->line_height + 4;
static led_t last_led_state = {0};
if (hue_redraw || last_led_state.raw != host_keyboard_led_state().raw) {
last_led_state.raw = host_keyboard_led_state().raw;
static uint16_t max_led_xpos = 0;
xpos = 5;
const char* buf0 = "CAPS";
const char* buf1 = "SCRL";
const char* buf2 = "NUM";
xpos += qp_drawtext_recolor(ili9341_display, xpos, ypos, font_oled, (const char*)"Locks:", 153, 255, 255,
255, 255, 0) +
5;
xpos += qp_drawtext_recolor(ili9341_display, xpos, ypos, font_oled, buf0,
last_led_state.caps_lock ? 153 : 255, 255, 255, 255, 255, 0) +
5;
xpos += qp_drawtext_recolor(ili9341_display, xpos, ypos, font_oled, buf1,
last_led_state.scroll_lock ? 153 : 255, 255, 255, 255, 255, 0) +
5;
xpos += qp_drawtext_recolor(ili9341_display, xpos, ypos, font_oled, buf2,
last_led_state.num_lock ? 153 : 255, 255, 255, 255, 255, 0);
if (max_led_xpos < xpos) {
max_led_xpos = xpos;
}
qp_rect(ili9341_display, xpos, ypos, max_led_xpos, ypos + font_oled->line_height, 0, 0, 0, true);
}

#if defined(RGBLIGHT_ENABLE)
ypos += font_oled->line_height + 4;
if (hue_redraw || rgb_effect_redraw) {
Expand Down
2 changes: 1 addition & 1 deletion users/drashna/display/painter/painter.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
char* truncate_text(const char* text, uint16_t max_width, painter_font_handle_t font, bool from_start,
bool add_ellipses) {
static char truncated_text[75];
static char truncated_text[50];
strncpy(truncated_text, text, sizeof(truncated_text) - 1);
truncated_text[sizeof(truncated_text) - 1] = '\0';

Expand Down

0 comments on commit 567a56c

Please sign in to comment.