Prusa MINI Firmware overview
screen_sysinf.c File Reference
#include "gui.h"
#include "config.h"
#include "window_logo.h"
#include "stm32f4xx_hal.h"
#include "sys.h"
#include "../Middlewares/ST/Utilites/CPU/cpu_utils.h"

Classes

struct  screen_sysinfo_data_t
 

Macros

#define pd   ((screen_sysinfo_data_t *)screen->pdata)
 
#define RECT_MACRO(col)   rect_ui16(col_##col, row2draw, col_##col##_w, row_h)
 

Enumerations

enum  { col_0 = 2, col_1 = 96 }
 
enum  { col_0_w = col_1 - col_0, col_1_w = 240 - col_1 - col_0 }
 
enum  { col_2_w = 38 }
 
enum  { TAG_QUIT = 10 }
 

Functions

void screen_sysinfo_init (screen_t *screen)
 
void screen_sysinfo_done (screen_t *screen)
 
void screen_sysinfo_draw (screen_t *screen)
 
int screen_sysinfo_event (screen_t *screen, window_t *window, uint8_t event, void *param)
 

Variables

static int actual_CPU_load = -1
 
static int last_CPU_load = -1
 
screen_t screen_sysinfo
 
const screen_tpscreen_sysinfo = &screen_sysinfo
 

Macro Definition Documentation

◆ pd

#define pd   ((screen_sysinfo_data_t *)screen->pdata)

◆ RECT_MACRO

#define RECT_MACRO (   col)    rect_ui16(col_##col, row2draw, col_##col##_w, row_h)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
col_0 
col_1 
43  { col_0 = 2,
44  col_1 = 96 };

◆ anonymous enum

anonymous enum
Enumerator
col_0_w 
col_1_w 
45  { col_0_w = col_1 - col_0,
46  col_1_w = 240 - col_1 - col_0 };

◆ anonymous enum

anonymous enum
Enumerator
col_2_w 
47 { col_2_w = 38 };

◆ anonymous enum

anonymous enum
Enumerator
TAG_QUIT 
50  {
51  TAG_QUIT = 10
52 
53 };

Function Documentation

◆ screen_sysinfo_init()

void screen_sysinfo_init ( screen_t screen)
55  {
56  int16_t row2draw = 0;
57  int16_t id;
58  int16_t row_h = 20;
59 
60  int16_t id0 = window_create_ptr(WINDOW_CLS_FRAME, -1, rect_ui16(0, 0, 0, 0), &(pd->frame));
61 
62  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(0, 0, display->w, 22), &(pd->textMenuName));
63  pd->textMenuName.font = resource_font(IDR_FNT_BIG);
64  window_set_text(id, (const char *)"Disp. TEST rd mem.");
65 
66  row2draw += 25;
67 
68  //write pattern
69  id = window_create_ptr(WINDOW_CLS_TEXT, id0, RECT_MACRO(0), &(pd->textCPU_load));
70  pd->textCPU_load.font = resource_font(IDR_FNT_NORMAL);
71  window_set_text(id, (const char *)"CPU load");
72 
73  id = window_create_ptr(WINDOW_CLS_NUMB, id0, RECT_MACRO(1), &(pd->textCPU_load_val));
74  window_set_format(id, (const char *)"%.0f");
76 
77  row2draw += 25;
78 
79  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(col_0, 290, 60, 22), &(pd->textExit));
80  pd->textExit.font = resource_font(IDR_FNT_BIG);
81  window_set_text(id, (const char *)"EXIT");
82  window_enable(id);
84 }
Here is the call graph for this function:

◆ screen_sysinfo_done()

void screen_sysinfo_done ( screen_t screen)
86  {
87  window_destroy(pd->frame.win.id);
88 }
Here is the call graph for this function:

◆ screen_sysinfo_draw()

void screen_sysinfo_draw ( screen_t screen)
90  {
91 }

◆ screen_sysinfo_event()

int screen_sysinfo_event ( screen_t screen,
window_t window,
uint8_t  event,
void param 
)
93  {
94  if (event == WINDOW_EVENT_CLICK)
95  switch ((int)param) {
96  case TAG_QUIT:
97  screen_close();
98  return 1;
99  }
100 
101  if (event == WINDOW_EVENT_LOOP) {
104  window_set_value(pd->textCPU_load_val.win.id, actual_CPU_load);
106  }
107  }
108 
109  return 0;
110 }
Here is the call graph for this function:

Variable Documentation

◆ actual_CPU_load

int actual_CPU_load = -1
static

◆ last_CPU_load

int last_CPU_load = -1
static

◆ screen_sysinfo

◆ pscreen_sysinfo

const screen_t* pscreen_sysinfo = &screen_sysinfo
last_CPU_load
static int last_CPU_load
Definition: screen_sysinf.c:36
osGetCPUUsage
uint16_t osGetCPUUsage(void)
Stop Idle monitor.
Definition: cpu_utils.c:139
col_1
Definition: screen_sysinf.c:44
screen_sysinfo_event
int screen_sysinfo_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_sysinf.c:93
WINDOW_CLS_NUMB
#define WINDOW_CLS_NUMB
Definition: window.h:11
actual_CPU_load
static int actual_CPU_load
Definition: screen_sysinf.c:35
window_set_format
void window_set_format(int16_t id, const char *format)
Definition: window.c:403
rect_ui16
static rect_ui16_t rect_ui16(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Definition: guitypes.h:159
window_destroy
void window_destroy(int16_t id)
Definition: window.c:132
IDR_FNT_NORMAL
#define IDR_FNT_NORMAL
Definition: resource.h:10
TAG_QUIT
Definition: screen_sysinf.c:51
col_1_w
Definition: screen_sysinf.c:46
screen_close
void screen_close(void)
Definition: screen.c:80
screen_sysinfo_data_t
Definition: screen_sysinf.c:19
pd
#define pd
Definition: screen_sysinf.c:31
screen_sysinfo_done
void screen_sysinfo_done(screen_t *screen)
Definition: screen_sysinf.c:86
window_set_text
void window_set_text(int16_t id, const char *text)
Definition: window.c:340
WINDOW_CLS_FRAME
#define WINDOW_CLS_FRAME
Definition: window.h:9
window_set_value
void window_set_value(int16_t id, float value)
Definition: window.c:363
screen_sysinfo_draw
void screen_sysinfo_draw(screen_t *screen)
Definition: screen_sysinf.c:90
window_set_tag
void window_set_tag(int16_t id, uint8_t tag)
Definition: window.c:329
col_0_w
Definition: screen_sysinf.c:45
IDR_FNT_BIG
#define IDR_FNT_BIG
Definition: resource.h:11
col_2_w
Definition: screen_sysinf.c:47
display
display_t * display
Definition: display.c:6
WINDOW_CLS_TEXT
#define WINDOW_CLS_TEXT
Definition: window.h:10
resource_font
font_t * resource_font(uint16_t id)
Definition: guitypes.c:186
WINDOW_EVENT_CLICK
#define WINDOW_EVENT_CLICK
Definition: window.h:46
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_enable
void window_enable(int16_t id)
Definition: window.c:517
_display_t::w
uint16_t w
Definition: display.h:25
WINDOW_EVENT_LOOP
#define WINDOW_EVENT_LOOP
Definition: window.h:49
RECT_MACRO
#define RECT_MACRO(col)
Definition: screen_sysinf.c:48
screen_sysinfo_init
void screen_sysinfo_init(screen_t *screen)
Definition: screen_sysinf.c:55
col_0
Definition: screen_sysinf.c:43
row2draw
static int16_t row2draw
Definition: screen_test_disp_mem.c:84