Prusa MINI Firmware overview
screen_marlin.c File Reference
#include "gui.h"
#include "config.h"
#include "window_lcdsim.h"
#include "window_logo.h"
#include "cmsis_os.h"
#include "hwio_a3ides.h"
#include "lcdsim.h"

Classes

struct  screen_marlin_data_t
 
struct  _screen_marlin_t
 

Macros

#define _psd   ((screen_marlin_data_t *)screen_marlin.scr.pdata)
 

Typedefs

typedef struct _screen_marlin_t screen_marlin_t
 

Functions

void pngview (void)
 
void screen_marlin_init (screen_marlin_t *screen)
 
void screen_marlin_done (screen_marlin_t *screen)
 
void screen_marlin_draw (screen_marlin_t *screen)
 
int screen_marlin_event (screen_marlin_t *screen, window_t *window, uint8_t event, void *param)
 

Variables

osThreadId displayTaskHandle
 
screen_marlin_t screen_marlin
 
const screen_tpscreen_marlin = (screen_t *)&screen_marlin
 

Macro Definition Documentation

◆ _psd

#define _psd   ((screen_marlin_data_t *)screen_marlin.scr.pdata)

Typedef Documentation

◆ screen_marlin_t

Function Documentation

◆ pngview()

void pngview ( void  )
58  {
59  DIR dir;
60  FRESULT fres = f_opendir(&dir, "/");
61  if (fres == FR_OK) {
62  FILINFO info;
63  fres = f_findfirst(&dir, &info, "", "*.png");
64  while (fres == FR_OK) {
65  strncpy(png_fnames[png_cnt++], info.fname, 8);
66  fres = f_findnext(&dir, &info);
67  if (strncmp(png_fnames[png_cnt - 1], info.fname, 8) == 0) {
68  png_cnt--;
69  break; //hack because f_findnext returns allways FR_OK
70  }
71  }
72  }
73  f_closedir(&dir);
74  jogwheel_encoder_set(0, 0, png_cnt - 1);
75  int old_encoder = -1;
76  while (png_cnt > 0) {
77  if (jogwheel_encoder != old_encoder) {
78  old_encoder = jogwheel_encoder;
79  char fn[16] = "/";
80  _dbg("%d\n", jogwheel_encoder);
81  strncpy(fn + 1, png_fnames[jogwheel_encoder], 8);
82  strcat(fn, ".PNG");
83  _dbg("%s\n", fn);
84  FILE *pf = f_fopen(fn);
85  display->draw_png(point_ui16(0, 0), pf);
86  f_fclose(pf);
87  } else
88  osDelay(1);
89  if (jogwheel_button_down >= 1000)
90  break;
91  }
92 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ screen_marlin_init()

void screen_marlin_init ( screen_marlin_t screen)
37  {
38  int16_t id;
39  int16_t id0;
40 
41  id0 = window_create_ptr(WINDOW_CLS_FRAME, -1, rect_ui16(0, 0, 0, 0), &(_psd->frame));
42  //window_set_color_back(id0, COLOR_GRAY);
43 
44  id = window_create_ptr(WINDOW_CLS_LOGO, id0, rect_ui16(0, 20, 240, 64), &(_psd->logo_prusa_mini));
45  window_set_tag(id, 1);
46  //window_enable(id);
47 
48 #ifdef LCDSIM
49  //#if 0
50  if (!screen->lcdsim_initialized) {
51  lcdsim_init();
52  screen->lcdsim_initialized = 1;
53  } else
55  if (WINDOW_CLS_LCDSIM == 0)
57  id = window_create_ptr(WINDOW_CLS_LCDSIM, id0, rect_ui16(0, 96, 240, 72), &(_psd->lcdsim));
59 #else
60  pngview();
61 #endif //LCDSIM
62 }
Here is the call graph for this function:

◆ screen_marlin_done()

void screen_marlin_done ( screen_marlin_t screen)
64  {
65 #ifdef LCDSIM
67 #endif //LCDSIM
68  window_destroy(_psd->frame.win.id);
69 }
Here is the call graph for this function:

◆ screen_marlin_draw()

void screen_marlin_draw ( screen_marlin_t screen)
71  {
72 }

◆ screen_marlin_event()

int screen_marlin_event ( screen_marlin_t screen,
window_t window,
uint8_t  event,
void param 
)
74  {
75  if (event == WINDOW_EVENT_LOOP)
76  window_invalidate(_psd->lcdsim.win.id);
77  return 0;
78 }
Here is the call graph for this function:

Variable Documentation

◆ displayTaskHandle

osThreadId displayTaskHandle

◆ screen_marlin

◆ pscreen_marlin

const screen_t* pscreen_marlin = (screen_t *)&screen_marlin
window_register_class
int16_t window_register_class(window_class_t *cls)
Definition: window.c:90
screen_marlin_init
void screen_marlin_init(screen_marlin_t *screen)
Definition: screen_marlin.c:37
png_cnt
int png_cnt
Definition: pngview.c:10
WINDOW_CLS_LCDSIM
int16_t WINDOW_CLS_LCDSIM
Definition: window_lcdsim.c:6
_screen_marlin_t::lcdsim_initialized
int lcdsim_initialized
Definition: screen_marlin.c:25
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
window_destroy
void window_destroy(int16_t id)
Definition: window.c:132
hwio_jogwheel_disable
void hwio_jogwheel_disable(void)
Definition: hwio_a3ides_2209_02.c:472
screen_event_t
int() screen_event_t(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen.h:13
screen_marlin_draw
void screen_marlin_draw(screen_marlin_t *screen)
Definition: screen_marlin.c:71
WINDOW_CLS_LOGO
int16_t WINDOW_CLS_LOGO
Definition: window_logo.c:11
osDelay
osStatus osDelay(uint32_t millisec)
Wait for Timeout (Time Delay)
Definition: cmsis_os.c:365
screen_marlin_event
int screen_marlin_event(screen_marlin_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_marlin.c:74
lcdsim_invalidate
void lcdsim_invalidate(void)
Definition: lcdsim.c:79
jogwheel_encoder_set
void jogwheel_encoder_set(int32_t val, int32_t min, int32_t max)
Definition: jogwheel.c:83
jogwheel_encoder
int32_t jogwheel_encoder
Definition: jogwheel.c:10
f_fopen
FILE * f_fopen(char *fn)
Definition: pngview.c:31
WINDOW_CLS_FRAME
#define WINDOW_CLS_FRAME
Definition: window.h:9
_psd
#define _psd
Definition: screen_marlin.c:35
f_opendir
FRESULT f_opendir(DIR *dp, const TCHAR *path)
Definition: ff.c:4221
screen_init_t
void() screen_init_t(screen_t *screen)
Definition: screen.h:10
pngview
void pngview(void)
Definition: pngview.c:58
_display_t::draw_png
display_draw_png_t * draw_png
Definition: display.h:37
jogwheel_button_down
uint16_t jogwheel_button_down
Definition: jogwheel.c:13
window_set_tag
void window_set_tag(int16_t id, uint8_t tag)
Definition: window.c:329
f_fclose
void f_fclose(FILE *pf)
Definition: pngview.c:49
screen_marlin_data_t
Definition: screen_marlin.c:16
screen_marlin_done
void screen_marlin_done(screen_marlin_t *screen)
Definition: screen_marlin.c:64
_window_class_t
Definition: window.h:67
_dbg
#define _dbg(...)
Definition: dbg.h:50
display
display_t * display
Definition: display.c:6
FRESULT
FRESULT
Definition: ff.h:214
f_findnext
FRESULT f_findnext(DIR *dp, FILINFO *fno)
png_fnames
char png_fnames[256][8]
Definition: pngview.c:9
FR_OK
Definition: ff.h:215
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
DIR
Definition: ff.h:178
WINDOW_EVENT_LOOP
#define WINDOW_EVENT_LOOP
Definition: window.h:49
screen_draw_t
void() screen_draw_t(screen_t *screen)
Definition: screen.h:12
lcdsim_init
void lcdsim_init(void)
Definition: lcdsim.c:71
screen_done_t
void() screen_done_t(screen_t *screen)
Definition: screen.h:11
f_closedir
FRESULT f_closedir(DIR *dp)
Definition: ff.c:4291
hwio_jogwheel_enable
void hwio_jogwheel_enable(void)
Definition: hwio_a3ides_2209_02.c:468
f_findfirst
FRESULT f_findfirst(DIR *dp, FILINFO *fno, const TCHAR *path, const TCHAR *pattern)
FILINFO
Definition: ff.h:197
window_class_lcdsim
const window_class_lcdsim_t window_class_lcdsim
Definition: window_lcdsim.c:58
point_ui16
static point_ui16_t point_ui16(uint16_t x, uint16_t y)
Definition: guitypes.h:154
info
uint8_t info[12]
Definition: masstorage.h:54