Prusa MINI Firmware overview
window_temp_graph.c File Reference
#include <window_temp_graph.h>
#include "display_helper.h"
#include "gui.h"
#include "marlin_client.h"
#include <stdlib.h>

Functions

void window_temp_graph_init (window_temp_graph_t *window)
 
void window_temp_graph_draw (window_temp_graph_t *window)
 

Variables

int16_t WINDOW_CLS_TEMP_GRAPH = 0
 
const window_class_temp_graph_t window_class_temp_graph
 

Function Documentation

◆ window_temp_graph_init()

void window_temp_graph_init ( window_temp_graph_t window)
10  {
11  window->color_back = COLOR_BLACK;
12  window->color_extruder_t = COLOR_LIME;
13  window->color_bed_t = COLOR_CYAN;
15  window->color_bed_c = COLOR_BLUE;
16  window->y_min = 0.0F;
17  window->y_max = 300.0F;
18  window->count = 200;
19  uint8_t i;
20 
21  for (i = 0; i < 179; i++) {
22  window->y_bed_c[i] = 179.0F;
23  window->y_nozzle_c[i] = 179.0F;
24  window->y_bed_t[i] = 179.0F;
25  window->y_nozzle_t[i] = 179.0F;
26  }
27 }

◆ window_temp_graph_draw()

void window_temp_graph_draw ( window_temp_graph_t window)
29  {
30  if (window->win.flg & WINDOW_FLG_INVALID) {
31  rect_ui16_t rc = window->win.rect;
32  uint8_t j;
33  display->fill_rect(rc, window->color_back);
34  display->draw_line(point_ui16(window->win.rect.x, window->win.rect.y - 1),
35  point_ui16(window->win.rect.x, window->win.rect.y + window->win.rect.h - 1), COLOR_WHITE); //hotend
36 
37  display->draw_line(point_ui16(window->win.rect.x, (window->win.rect.y + window->win.rect.h) - 1),
38  point_ui16((window->win.rect.x + window->win.rect.w), (window->win.rect.y + window->win.rect.h) - 1), COLOR_WHITE); //x
39 
40  for (j = 25; j < 175; j += 25) {
41  display->draw_line(point_ui16(window->win.rect.x + 1, (window->win.rect.y + window->win.rect.h) - j),
42  point_ui16((window->win.rect.x + window->win.rect.w - 1) - 5, (window->win.rect.y + window->win.rect.h) - j), COLOR_GRAY); //x
43  }
44 
45  j = 0;
46 
47  for (j = 25; j < 175; j += 25) {
48  display->draw_line(point_ui16(window->win.rect.x + j, window->win.rect.y + window->win.rect.h),
49  point_ui16(window->win.rect.x + j, window->win.rect.y + window->win.rect.h - 5), COLOR_WHITE); //-50
50  }
51 
52  j = 0;
53 
54  window->win.flg &= ~WINDOW_FLG_INVALID;
55  }
56 
57  marlin_vars_t *vars = marlin_vars();
58 
59  window->y_bed_c[0] = (uint8_t)179 - (vars->temp_bed / 2);
60  window->y_nozzle_c[0] = (uint8_t)179 - (vars->temp_nozzle / 2);
61 
62  window->y_nozzle_t[0] = (uint8_t)179 - (vars->target_nozzle / 2);
63  window->y_bed_t[0] = (uint8_t)179 - (vars->target_bed / 2);
64 
65  if (window->win.flg & WINDOW_FLG_GRAPH_INVALID) {
66  uint8_t i;
67  uint8_t j;
68  uint8_t ynt = window->y_nozzle_t[0];
69  uint8_t ybt = window->y_bed_t[0];
70  uint8_t ync = window->y_nozzle_c[0];
71  uint8_t ybc = window->y_bed_c[0];
72 
73  for (i = 0; i < 178; i++) {
74  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_nozzle_t[i]), window->color_back);
75  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_nozzle_t[i + 1]), window->color_extruder_t);
76  window->y_nozzle_t[i] = window->y_nozzle_t[i + 1];
77 
78  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_bed_t[i]), window->color_back);
79  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_bed_t[i + 1]), window->color_bed_t);
80  window->y_bed_t[i] = window->y_bed_t[i + 1];
81 
82  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_nozzle_c[i]), window->color_back);
83  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_nozzle_c[i + 1]), window->color_extruder_c);
84  window->y_nozzle_c[i] = window->y_nozzle_c[i + 1];
85 
86  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_bed_c[i]), window->color_back);
87  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_bed_c[i + 1]), window->color_bed_c);
88  window->y_bed_c[i] = window->y_bed_c[i + 1];
89  }
90 
91  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_nozzle_t[i]), window->color_back);
92  window->y_nozzle_t[i] = ynt;
93  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_nozzle_t[i]), window->color_extruder_t);
94 
95  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_bed_t[i]), window->color_back);
96  window->y_bed_t[i] = ybt;
97  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_bed_t[i]), window->color_bed_t);
98 
99  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_nozzle_c[i]), window->color_back);
100  window->y_nozzle_c[i] = ync;
101  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_nozzle_c[i]), window->color_extruder_c);
102 
103  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_bed_c[i]), window->color_back);
104  window->y_bed_c[i] = ybc;
105  display->set_pixel(point_ui16(window->win.rect.x + i + 1, window->win.rect.y + window->y_bed_c[i]), window->color_bed_c);
106 
107  //draw y line
108  display->draw_line(point_ui16(window->win.rect.x, window->win.rect.y - 1),
109  point_ui16(window->win.rect.x, window->win.rect.y + window->win.rect.h - 1), COLOR_WHITE); //hotend
110 
111  display->draw_line(point_ui16(window->win.rect.x, (window->win.rect.y + window->win.rect.h) - 1),
112  point_ui16((window->win.rect.x + window->win.rect.w), (window->win.rect.y + window->win.rect.h) - 1), COLOR_WHITE); //x
113 
114  for (j = 25; j < 175; j += 25) {
115  display->draw_line(point_ui16(window->win.rect.x + 1, (window->win.rect.y + window->win.rect.h) - j),
116  point_ui16((window->win.rect.x + window->win.rect.w - 1), (window->win.rect.y + window->win.rect.h) - j), COLOR_GRAY); //x
117  }
118 
119  j = 0;
120 
121  for (j = 25; j < 175; j += 25) {
122  display->draw_line(point_ui16(window->win.rect.x + j, window->win.rect.y + window->win.rect.h),
123  point_ui16(window->win.rect.x + j, window->win.rect.y + window->win.rect.h - 5), COLOR_WHITE); //-50
124  }
125 
126  j = 0;
127 
128  window->win.flg &= ~WINDOW_FLG_GRAPH_INVALID;
129  }
130 }
Here is the call graph for this function:

Variable Documentation

◆ WINDOW_CLS_TEMP_GRAPH

int16_t WINDOW_CLS_TEMP_GRAPH = 0

◆ window_class_temp_graph

_window_temp_graph_t::y_bed_t
uint8_t y_bed_t[180]
Definition: window_temp_graph.h:29
_window_temp_graph_t::win
window_t win
Definition: window_temp_graph.h:19
_rect_ui16_t::y
uint16_t y
Definition: guitypes.h:71
_rect_ui16_t::w
uint16_t w
Definition: guitypes.h:72
_window_temp_graph_t::count
uint8_t count
Definition: window_temp_graph.h:27
COLOR_WHITE
#define COLOR_WHITE
Definition: guitypes.h:41
_window_temp_graph_t::y_nozzle_c
uint8_t y_nozzle_c[180]
Definition: window_temp_graph.h:30
i
uint8_t i
Definition: screen_test_graph.c:72
WINDOW_CLS_USER
#define WINDOW_CLS_USER
Definition: window.h:21
_window_temp_graph_t::y_min
float y_min
Definition: window_temp_graph.h:25
COLOR_LIME
#define COLOR_LIME
Definition: guitypes.h:44
window_temp_graph_init
void window_temp_graph_init(window_temp_graph_t *window)
Definition: window_temp_graph.c:10
_window_temp_graph_t::y_max
float y_max
Definition: window_temp_graph.h:26
_display_t::fill_rect
display_fill_rect_t * fill_rect
Definition: display.h:33
COLOR_GRAY
#define COLOR_GRAY
Definition: guitypes.h:50
_marlin_vars_t::temp_nozzle
float temp_nozzle
Definition: marlin_vars.h:83
COLOR_ORANGE
#define COLOR_ORANGE
Definition: guitypes.h:57
_window_temp_graph_t::color_extruder_t
color_t color_extruder_t
Definition: window_temp_graph.h:21
_window_temp_graph_t::color_bed_t
color_t color_bed_t
Definition: window_temp_graph.h:22
marlin_vars
marlin_vars_t * marlin_vars(void)
Definition: marlin_client.c:361
_marlin_vars_t::target_nozzle
float target_nozzle
Definition: marlin_vars.h:85
_window_temp_graph_t::y_nozzle_t
uint8_t y_nozzle_t[180]
Definition: window_temp_graph.h:28
_display_t::set_pixel
display_set_pixel_t * set_pixel
Definition: display.h:30
_rect_ui16_t
Definition: guitypes.h:69
_window_temp_graph_t::color_bed_c
color_t color_bed_c
Definition: window_temp_graph.h:24
_marlin_vars_t::temp_bed
float temp_bed
Definition: marlin_vars.h:84
uint8_t
const uint8_t[]
Definition: 404_html.c:3
display
display_t * display
Definition: display.c:6
WINDOW_FLG_GRAPH_INVALID
#define WINDOW_FLG_GRAPH_INVALID
Definition: window_temp_graph.h:8
_rect_ui16_t::h
uint16_t h
Definition: guitypes.h:73
_window_t::rect
rect_ui16_t rect
Definition: window.h:101
COLOR_BLUE
#define COLOR_BLUE
Definition: guitypes.h:45
COLOR_CYAN
#define COLOR_CYAN
Definition: guitypes.h:47
_window_temp_graph_t::color_extruder_c
color_t color_extruder_c
Definition: window_temp_graph.h:23
COLOR_BLACK
#define COLOR_BLACK
Definition: guitypes.h:40
_marlin_vars_t
Definition: marlin_vars.h:77
_rect_ui16_t::x
uint16_t x
Definition: guitypes.h:70
_window_temp_graph_t::color_back
color_t color_back
Definition: window_temp_graph.h:20
window_init_t
void() window_init_t(void *window)
Definition: window.h:55
_window_t::flg
uint32_t flg
Definition: window.h:81
window_temp_graph_draw
void window_temp_graph_draw(window_temp_graph_t *window)
Definition: window_temp_graph.c:29
_window_temp_graph_t::y_bed_c
uint8_t y_bed_c[180]
Definition: window_temp_graph.h:31
_display_t::draw_line
display_draw_line_t * draw_line
Definition: display.h:31
_marlin_vars_t::target_bed
float target_bed
Definition: marlin_vars.h:86
WINDOW_FLG_INVALID
#define WINDOW_FLG_INVALID
Definition: window.h:26
window_temp_graph_t
struct _window_temp_graph_t window_temp_graph_t
Definition: window_temp_graph.h:9
point_ui16
static point_ui16_t point_ui16(uint16_t x, uint16_t y)
Definition: guitypes.h:154