Prusa MINI Firmware overview
window_dlg_popup.c File Reference
#include "window_dlg_popup.h"
#include "display_helper.h"
#include "gui.h"
#include "dbg.h"
#include "stm32f4xx_hal.h"

Macros

#define POPUP_DELAY_MS   1000
 

Functions

void window_dlg_popup_init (window_dlg_popup_t *window)
 
void window_dlg_popup_draw (window_dlg_popup_t *window)
 
void gui_pop_up (void)
 

Variables

int16_t WINDOW_CLS_DLG_POPUP = 0
 
window_twindow_1
 
msg_stack_t msg_stack
 
const window_class_dlg_popup_t window_class_dlg_popup
 

Macro Definition Documentation

◆ POPUP_DELAY_MS

#define POPUP_DELAY_MS   1000

Function Documentation

◆ window_dlg_popup_init()

void window_dlg_popup_init ( window_dlg_popup_t window)
21  {
22  window->win.flg |= WINDOW_FLG_ENABLED;
25  window->font = gui_defaults.font;
27  window->padding = gui_defaults.padding;
28 }

◆ window_dlg_popup_draw()

void window_dlg_popup_draw ( window_dlg_popup_t window)
30  {
31  if (window->win.f_visible) {
32  rect_ui16_t rc = window->win.rect;
33  rc.h = 140;
34 
35  if (window->win.f_invalid) {
36  display->fill_rect(rc, window->color_back);
37  rect_ui16_t text_rc = rc;
38  text_rc.x += 10;
39  text_rc.y += 20;
40  text_rc.h = 30;
41  text_rc.w -= 10;
42  render_text_align(text_rc, window->text,
43  window->font, window->color_back,
44  window->color_text, window->padding,
46  window->win.f_invalid = 0;
47  }
48  }
49 }
Here is the call graph for this function:

◆ gui_pop_up()

void gui_pop_up ( void  )
62  {
63 
64  static uint8_t opened = 0;
65  if (opened == 1)
66  return;
67  opened = 1;
68 
70 
71  int16_t id_capture = window_capture();
72  int16_t id = window_create_ptr(WINDOW_CLS_DLG_POPUP, 0, rect_ui16(0, 32, 240, 120), &dlg);
73  strncpy(dlg.text, msg_stack.msg_data[0], MSG_MAX_LENGTH);
74  dlg.text[MSG_MAX_LENGTH - 1] = '\0';
75  window_1 = (window_t *)&dlg;
78 
79  dlg.timer = HAL_GetTick();
80 
81  while ((HAL_GetTick() - dlg.timer) < POPUP_DELAY_MS) {
82  gui_loop();
83  }
84 
85  window_destroy(id);
86  window_set_capture(id_capture);
88  opened = 0;
89 }
Here is the call graph for this function:

Variable Documentation

◆ WINDOW_CLS_DLG_POPUP

int16_t WINDOW_CLS_DLG_POPUP = 0

◆ window_1

window_t* window_1

◆ msg_stack

◆ window_class_dlg_popup

window_dlg_popup_t
struct _window_dlg_popup_t window_dlg_popup_t
Definition: window_dlg_popup.h:14
window_dlg_popup_init
void window_dlg_popup_init(window_dlg_popup_t *window)
Definition: window_dlg_popup.c:21
window_capture
int16_t window_capture(void)
Definition: window.c:169
_rect_ui16_t::y
uint16_t y
Definition: guitypes.h:71
_rect_ui16_t::w
uint16_t w
Definition: guitypes.h:72
msg_stack
Definition: marlin_server.h:26
_gui_defaults_t::color_text
color_t color_text
Definition: guitypes.h:108
window_1
window_t * window_1
Definition: window.c:14
window_invalidate
void window_invalidate(int16_t id)
Definition: window.c:304
rect_ui16
static rect_ui16_t rect_ui16(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Definition: guitypes.h:159
_gui_defaults_t::font
font_t * font
Definition: guitypes.h:110
window_destroy
void window_destroy(int16_t id)
Definition: window.c:132
window_dlg_popup_draw
void window_dlg_popup_draw(window_dlg_popup_t *window)
Definition: window_dlg_popup.c:30
WINDOW_CLS_USER
#define WINDOW_CLS_USER
Definition: window.h:21
_window_dlg_popup_t::timer
uint32_t timer
Definition: window_dlg_popup.h:28
_window_dlg_popup_t::text
char text[MSG_MAX_LENGTH]
Definition: window_dlg_popup.h:30
_window_dlg_popup_t::color_text
color_t color_text
Definition: window_dlg_popup.h:24
_display_t::fill_rect
display_fill_rect_t * fill_rect
Definition: display.h:33
HAL_GetTick
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
Definition: stm32f4xx_hal.c:339
_window_t::f_invalid
uint32_t f_invalid
Definition: window.h:87
_gui_defaults_t::padding
padding_ui8_t padding
Definition: guitypes.h:112
msg_stack::msg_data
char msg_data[MSG_STACK_SIZE][MSG_MAX_LENGTH]
Definition: marlin_server.h:28
gui_invalidate
void gui_invalidate(void)
Definition: gui.c:66
_window_t
Definition: window.h:76
_gui_defaults_t::color_back
color_t color_back
Definition: guitypes.h:107
window_set_capture
void window_set_capture(int16_t id)
Definition: window.c:500
WINDOW_CLS_DLG_POPUP
int16_t WINDOW_CLS_DLG_POPUP
Definition: window_dlg_popup.c:16
_rect_ui16_t
Definition: guitypes.h:69
render_text_align
void render_text_align(rect_ui16_t rc, const char *text, font_t *font, color_t clr0, color_t clr1, padding_ui8_t padding, uint16_t flags)
Definition: display_helper.c:6
uint8_t
const uint8_t[]
Definition: 404_html.c:3
display
display_t * display
Definition: display.c:6
_rect_ui16_t::h
uint16_t h
Definition: guitypes.h:73
_window_t::rect
rect_ui16_t rect
Definition: window.h:101
POPUP_DELAY_MS
#define POPUP_DELAY_MS
Definition: window_dlg_popup.c:14
MSG_MAX_LENGTH
#define MSG_MAX_LENGTH
Definition: marlin_server.h:19
_window_dlg_popup_t::font_title
font_t * font_title
Definition: window_dlg_popup.h:26
_window_t::f_visible
uint32_t f_visible
Definition: window.h:85
window_create_ptr
int16_t window_create_ptr(int16_t cls_id, int16_t id_parent, rect_ui16_t rect, void *ptr)
Definition: window.c:102
_window_dlg_popup_t::padding
padding_ui8_t padding
Definition: window_dlg_popup.h:27
_rect_ui16_t::x
uint16_t x
Definition: guitypes.h:70
_window_dlg_popup_t::win
window_t win
Definition: window_dlg_popup.h:22
_gui_defaults_t::font_big
font_t * font_big
Definition: guitypes.h:111
window_init_t
void() window_init_t(void *window)
Definition: window.h:55
gui_defaults
gui_defaults_t gui_defaults
Definition: gui.c:20
_window_dlg_popup_t::color_back
color_t color_back
Definition: window_dlg_popup.h:23
_window_t::flg
uint32_t flg
Definition: window.h:81
WINDOW_FLG_ENABLED
#define WINDOW_FLG_ENABLED
Definition: window.h:25
_window_dlg_popup_t::font
font_t * font
Definition: window_dlg_popup.h:25
ALIGN_LEFT_CENTER
#define ALIGN_LEFT_CENTER
Definition: guitypes.h:21
_window_dlg_popup_t
Definition: window_dlg_popup.h:21