Prusa MINI Firmware overview
screen_version_info.cpp File Reference
#include "gui.h"
#include "config.h"
#include "screen_menu.h"
#include <stdlib.h>
#include "version.h"

Classes

struct  version_t
 

Macros

#define BOOTLOADER_VERSION_ADDRESS   0x801FFFA
 
#define OTP_START_ADDR   0x1FFF7800
 
#define SERIAL_NUM_ADDR   0x1FFF7808
 

Enumerations

enum  { TAG_QUIT = 10 }
 

Functions

void screen_menu_version_info_init (screen_t *screen)
 
void screen_menu_version_info_done (screen_t *screen)
 

Variables

char * version_info_str = nullptr
 
screen_t screen_version_info
 
const screen_tpscreen_version_info = &screen_version_info
 

Macro Definition Documentation

◆ BOOTLOADER_VERSION_ADDRESS

#define BOOTLOADER_VERSION_ADDRESS   0x801FFFA

◆ OTP_START_ADDR

#define OTP_START_ADDR   0x1FFF7800

◆ SERIAL_NUM_ADDR

#define SERIAL_NUM_ADDR   0x1FFF7808

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TAG_QUIT 
18  {
19  TAG_QUIT = 10
20 };

Function Documentation

◆ screen_menu_version_info_init()

void screen_menu_version_info_init ( screen_t screen)
30  {
31  //=============SCREEN INIT===============
32  screen_menu_init(screen, "VERSION INFO", 1, 0, 0);
33 
35 
36  psmd->items[0] = menu_item_return;
37 
38  psmd->phelp = (window_text_t *)gui_malloc(sizeof(window_text_t));
39  uint16_t id = window_create_ptr(WINDOW_CLS_TEXT, psmd->root.win.id, rect_ui16(10, 80, 220, 200), &(psmd->phelp[0]));
40  psmd->phelp[0].font = resource_font(IDR_FNT_NORMAL);
41 
42  //=============VARIABLES=================
43 
44  uint8_t board_version[3];
45  char serial_numbers[15];
46  uint8_t FW_version[3];
47  uint16_t fw_parser = FW_VERSION;
48  char FW_version_str[22] = { '\0' };
49  version_info_str = (char *)gui_malloc(150 * sizeof(char));
50  const version_t *bootloader = (const version_t *)BOOTLOADER_VERSION_ADDRESS;
51 
52  //=============ACCESS IN ADDR=================
53 
54  for (uint8_t i = 0; i < 14; i++) {
55  if (i < 3) {
56  board_version[i] = *(volatile uint8_t *)(OTP_START_ADDR + i);
57  }
58  serial_numbers[i] = *(volatile char *)(SERIAL_NUM_ADDR + i);
59  }
60  serial_numbers[14] = '\0';
61 
62  //=============FW VERSION PARSING=============
63 
64  FW_version[0] = (uint8_t)(fw_parser / 100);
65  fw_parser -= FW_version[0] * 100;
66  FW_version[1] = (uint8_t)(fw_parser / 10);
67  fw_parser -= FW_version[1] * 10;
68  FW_version[2] = (uint8_t)fw_parser;
69 
70 #ifdef PRERELEASE_STR
71  sprintf(FW_version_str, "%d.%d.%d-%s+%d",
72  FW_version[0], FW_version[1], FW_version[2],
73  PRERELEASE_STR, version_build_nr);
74 #else
75  sprintf(FW_version_str, "%d.%d.%d", FW_version[0],
76  FW_version[1], FW_version[2]);
77 #endif
78 
79  //=============SET TEXT================
80 
81  sprintf(version_info_str,
82  "Firmware version\n%s\n\nBootloader version\n%d.%d.%d\n\nBuddy board\n%d.%d.%d\n%s",
84  bootloader->major, bootloader->minor, bootloader->patch,
85  board_version[0], board_version[1], board_version[2],
86  serial_numbers);
87 
89 }
Here is the call graph for this function:

◆ screen_menu_version_info_done()

void screen_menu_version_info_done ( screen_t screen)
91  {
92 
93  if (version_info_str)
94  free(version_info_str);
95  screen_menu_done(screen);
96 }
Here is the call graph for this function:

Variable Documentation

◆ version_info_str

char* version_info_str = nullptr

◆ screen_version_info

◆ pscreen_version_info

const screen_t* pscreen_version_info = &screen_version_info
_window_text_t
Definition: window_text.h:15
version_t::patch
uint8_t patch
Definition: shared_config.h:41
screen_menu_draw
void screen_menu_draw(screen_t *screen)
Definition: screen_menu.c:90
BOOTLOADER_VERSION_ADDRESS
#define BOOTLOADER_VERSION_ADDRESS
Definition: screen_version_info.cpp:14
screen_menu_event
int screen_menu_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu.c:92
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_malloc
void * gui_malloc(unsigned int size)
Definition: gui.c:35
screen_menu_done
void screen_menu_done(screen_t *screen)
Definition: screen_menu.c:78
IDR_FNT_NORMAL
#define IDR_FNT_NORMAL
Definition: resource.h:10
i
uint8_t i
Definition: screen_test_graph.c:72
window_set_text
void window_set_text(int16_t id, const char *text)
Definition: window.c:340
screen_menu_init
void screen_menu_init(screen_t *screen, const char *label, int count, uint8_t footer, uint8_t help)
Definition: screen_menu.c:25
version_build_nr
const int version_build_nr
build number
Definition: version.c:44
screen_menu_version_info_done
void screen_menu_version_info_done(screen_t *screen)
Definition: screen_version_info.cpp:91
psmd
#define psmd
Definition: screen_menu.h:40
IDR_PNG_header_icon_info
#define IDR_PNG_header_icon_info
Definition: resource.h:66
uint8_t
const uint8_t[]
Definition: 404_html.c:3
version_t::minor
uint8_t minor
Definition: shared_config.h:40
menu_item_return
const menu_item_t menu_item_return
Definition: screen_menu.c:14
FW_version_str
char FW_version_str[22]
Definition: bsod.c:106
WINDOW_CLS_TEXT
#define WINDOW_CLS_TEXT
Definition: window.h:10
resource_font
font_t * resource_font(uint16_t id)
Definition: guitypes.c:186
TAG_QUIT
Definition: screen_version_info.cpp:19
version_info_str
char * version_info_str
Definition: screen_version_info.cpp:28
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
screen_menu_data_t
Definition: screen_menu.h:24
SERIAL_NUM_ADDR
#define SERIAL_NUM_ADDR
Definition: screen_version_info.cpp:16
screen_menu_version_info_init
void screen_menu_version_info_init(screen_t *screen)
Definition: screen_version_info.cpp:30
OTP_START_ADDR
#define OTP_START_ADDR
Definition: screen_version_info.cpp:15
version_t
Definition: shared_config.h:38
p_window_header_set_icon
void p_window_header_set_icon(window_header_t *window, uint16_t id_res)
Definition: window_header.c:121
version_t::major
uint8_t major
Definition: shared_config.h:39