Prusa MINI Firmware overview
wizard_progress_bar.c File Reference

Functions

void wiz_set_progressbar_range_auto (window_progress_t *p_progress, int min, int max, int range_dif, int value)
 
int wiz_set_progressbar_range (window_progress_t *p_progress, int min, int max, int range_min, int range_max, int value)
 
int wiz_set_progressbar (window_progress_t *p_progress, int min, int max, int value)
 
int wiz_get_percent (int min, int max, int value)
 
static void mix_cl (color_t *ret, color_t cl_0, color_t cl_100, int progress, int chan)
 
void wiz_set_progressbar_dual_cl (window_progress_t *p_progress, int value, int cl_val, color_t cl_0, color_t cl_100)
 

Function Documentation

◆ wiz_set_progressbar_range_auto()

void wiz_set_progressbar_range_auto ( window_progress_t p_progress,
int  min,
int  max,
int  range_dif,
int  value 
)
6  {
7  int new_min = min - range_dif;
8  int new_max = max + range_dif;
9  int visible_min = new_min + 3 * (min + max) / 100;
10 
11  if (value < visible_min)
12  value = visible_min;
13  wiz_set_progressbar_range(p_progress, new_min, new_max, min, max, value);
14 }
Here is the call graph for this function:

◆ wiz_set_progressbar_range()

int wiz_set_progressbar_range ( window_progress_t p_progress,
int  min,
int  max,
int  range_min,
int  range_max,
int  value 
)
17  {
18  int percent = wiz_get_percent(min, max, value);
19  if (value < range_min)
20  p_progress->color_progress = COLOR_BLUE;
21  else if (value > range_max)
22  p_progress->color_progress = COLOR_RED;
23  else
24  p_progress->color_progress = COLOR_LIME;
25  window_set_value(p_progress->win.id, percent);
26  return percent;
27 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wiz_set_progressbar()

int wiz_set_progressbar ( window_progress_t p_progress,
int  min,
int  max,
int  value 
)
30  {
31  int percent = wiz_get_percent(min, max, value);
32  if (percent >= 100)
33  p_progress->color_progress = COLOR_LIME;
34  else
35  p_progress->color_progress = COLOR_BLUE;
36  window_set_value(p_progress->win.id, percent);
37  return percent;
38 }
Here is the call graph for this function:

◆ wiz_get_percent()

int wiz_get_percent ( int  min,
int  max,
int  value 
)
40  {
41  if (value <= min)
42  return 0;
43  if (value >= max)
44  return 100;
45 
46  return (float)(value - min) * (float)100 / (float)(max - min);
47 }
Here is the caller graph for this function:

◆ mix_cl()

static void mix_cl ( color_t ret,
color_t  cl_0,
color_t  cl_100,
int  progress,
int  chan 
)
static
49  {
50  color_t cl;
51  cl_0 = (cl_0 >> (chan * 8)) & 0xff;
52  cl_100 = (cl_100 >> (chan * 8)) & 0xff;
53 
54  cl = ((100 - progress) * cl_0) / 100;
55  cl += (progress * cl_100) / 100;
56  if (cl > 0xff)
57  cl = 0xff;
58 
59  *ret |= cl << (chan * 8);
60 }
Here is the caller graph for this function:

◆ wiz_set_progressbar_dual_cl()

void wiz_set_progressbar_dual_cl ( window_progress_t p_progress,
int  value,
int  cl_val,
color_t  cl_0,
color_t  cl_100 
)
63  {
64  if (value > 100)
65  value = 100;
66  if (value < 0)
67  value = 2; //visible minimum
68 
69  color_t color = 0;
70  for (int channel = 0; channel <= 3; ++channel) {
71  mix_cl(&color, cl_0, cl_100, cl_val, channel);
72  }
73 
74  p_progress->color_progress = color;
75  window_set_value(p_progress->win.id, value);
76 }
Here is the call graph for this function:
wiz_set_progressbar_range
int wiz_set_progressbar_range(window_progress_t *p_progress, int min, int max, int range_min, int range_max, int value)
Definition: wizard_progress_bar.c:16
_window_progress_t::color_progress
color_t color_progress
Definition: window_progress.h:19
COLOR_RED
#define COLOR_RED
Definition: guitypes.h:42
max
#define max(a, b)
Definition: wiring_constants.h:40
COLOR_LIME
#define COLOR_LIME
Definition: guitypes.h:44
_window_t::id
int16_t id
Definition: window.h:79
min
#define min(a, b)
Definition: wiring_constants.h:36
wiz_get_percent
int wiz_get_percent(int min, int max, int value)
Definition: wizard_progress_bar.c:40
window_set_value
void window_set_value(int16_t id, float value)
Definition: window.c:363
COLOR_BLUE
#define COLOR_BLUE
Definition: guitypes.h:45
color_t
uint32_t color_t
Definition: guitypes.h:62
_window_progress_t::win
window_t win
Definition: window_progress.h:16
mix_cl
static void mix_cl(color_t *ret, color_t cl_0, color_t cl_100, int progress, int chan)
Definition: wizard_progress_bar.c:49