Prusa MINI Firmware overview
screen_test_temperature.cpp File Reference
#include <menu_vars.h>
#include "gui.h"
#include "screen_menu.h"
#include "cmsis_os.h"
#include "hwio_a3ides.h"
#include "../Marlin/src/module/temperature.h"

Enumerations

enum  MI_t {
  MI_RETURN, MI_RETURN, MI_WIZARD, MI_Z_OFFSET,
  MI_AUTO_HOME, MI_MESH_BED, MI_SELFTEST, MI_CALIB_FIRST,
  MI_RETURN, MI_LOAD, MI_UNLOAD, MI_CHANGE,
  MI_PURGE, MI_RETURN, MI_ALWAYS, MI_ON_RESTART,
  MI_COUNT, MI_RETURN, MI_SYS_INFO, MI_VERSIONS,
  MI_RETURN, MI_MOVE_X, MI_MOVE_Y, MI_MOVE_Z,
  MI_MOVE_E, MI_RETURN, MI_SYS_RESET, MI_CLR_EEPROM,
  MI_WDG_TEST, MI_PLL, MI_SSCG, MI_SSCG_FREQ,
  MI_SSCG_DEPTH, MI_SPI_PRESC, MI_MESH, MI_BSOD,
  MI_BSOD_HARD_FAULT, MI_COUNT, MI_RETURN, MI_TEMPERATURE,
  MI_MOVE_AXIS, MI_DISABLE_STEP, MI_FACTORY_DEFAULTS, MI_FW_UPDATE,
  MI_FILAMENT_SENSOR, MI_TIMEOUT, MI_LAN_SETTINGS, MI_RETURN,
  MI_NOZZLE, MI_HEATBED, MI_PRINTFAN, MI_COOLDOWN,
  MI_RETURN, MI_NOZZLE, MI_HEAT_PWM_PERIOD, MI_HEATBED,
  MI_FAN_PWM_PERIOD, MI_PRINTFAN, MI_COOLDOWN, MI_COUNT
}
 

Functions

void screen_test_temperature_init (screen_t *screen)
 
int screen_test_temperature_event (screen_t *screen, window_t *window, uint8_t event, void *param)
 

Variables

static const char * period_pwm_range []
 
static const size_t pwm_size = sizeof(period_pwm_range) / sizeof(const char *)
 
screen_t screen_test_temperature
 
const screen_tpscreen_test_temperature = &screen_test_temperature
 

Enumeration Type Documentation

◆ MI_t

enum MI_t
Enumerator
MI_RETURN 
MI_RETURN 
MI_WIZARD 
MI_Z_OFFSET 
MI_AUTO_HOME 
MI_MESH_BED 
MI_SELFTEST 
MI_CALIB_FIRST 
MI_RETURN 
MI_LOAD 
MI_UNLOAD 
MI_CHANGE 
MI_PURGE 
MI_RETURN 
MI_ALWAYS 
MI_ON_RESTART 
MI_COUNT 
MI_RETURN 
MI_SYS_INFO 
MI_VERSIONS 
MI_RETURN 
MI_MOVE_X 
MI_MOVE_Y 
MI_MOVE_Z 
MI_MOVE_E 
MI_RETURN 
MI_SYS_RESET 
MI_CLR_EEPROM 
MI_WDG_TEST 
MI_PLL 
MI_SSCG 
MI_SSCG_FREQ 
MI_SSCG_DEPTH 
MI_SPI_PRESC 
MI_MESH 
MI_BSOD 
MI_BSOD_HARD_FAULT 
MI_COUNT 
MI_RETURN 
MI_TEMPERATURE 
MI_MOVE_AXIS 
MI_DISABLE_STEP 
MI_FACTORY_DEFAULTS 
MI_FW_UPDATE 
MI_FILAMENT_SENSOR 
MI_TIMEOUT 
MI_LAN_SETTINGS 
MI_RETURN 
MI_NOZZLE 
MI_HEATBED 
MI_PRINTFAN 
MI_COOLDOWN 
MI_RETURN 
MI_NOZZLE 
MI_HEAT_PWM_PERIOD 
MI_HEATBED 
MI_FAN_PWM_PERIOD 
MI_PRINTFAN 
MI_COOLDOWN 
MI_COUNT 
22  {
23  MI_RETURN,
24  MI_NOZZLE,
26  MI_HEATBED,
30  MI_COUNT
31 } MI_t;

Function Documentation

◆ screen_test_temperature_init()

void screen_test_temperature_init ( screen_t screen)
33  {
34  screen_menu_init(screen, "TEMPERATURE", MI_COUNT, 1, 0);
35 
37 
38  psmd->items[MI_NOZZLE] = (menu_item_t) { { "Nozzle", 0, WI_SPIN }, SCREEN_MENU_NO_SCREEN };
39  psmd->items[MI_NOZZLE].item.wi_spin.value = thermalManager.degTargetHotend(0) * 1000;
40  psmd->items[MI_NOZZLE].item.wi_spin.range = nozzle_range;
41 
42  psmd->items[MI_HEAT_PWM_PERIOD] = (menu_item_t) { { "Ht. PWM T", 0, WI_SELECT }, SCREEN_MENU_NO_SCREEN };
43  psmd->items[MI_HEAT_PWM_PERIOD].item.wi_switch_select.index = hwio_pwm_get_prescaler_log2(HWIO_PWM_HEATER_BED);
44  psmd->items[MI_HEAT_PWM_PERIOD].item.wi_switch_select.strings = period_pwm_range;
45 
46  psmd->items[MI_HEATBED] = (menu_item_t) { { "Heatbed", 0, WI_SPIN }, SCREEN_MENU_NO_SCREEN };
47  psmd->items[MI_HEATBED].item.wi_spin.value = thermalManager.degTargetBed() * 1000;
48  psmd->items[MI_HEATBED].item.wi_spin.range = heatbed_range;
49 
50  psmd->items[MI_FAN_PWM_PERIOD] = (menu_item_t) { { "Fan PWM T", 0, WI_SELECT }, SCREEN_MENU_NO_SCREEN };
51  psmd->items[MI_FAN_PWM_PERIOD].item.wi_switch_select.index = hwio_pwm_get_prescaler_log2(HWIO_PWM_HEATER_BED);
52  psmd->items[MI_FAN_PWM_PERIOD].item.wi_switch_select.strings = period_pwm_range;
53 
54  psmd->items[MI_PRINTFAN] = (menu_item_t) { { "Print Fan", 0, WI_SPIN }, SCREEN_MENU_NO_SCREEN };
55  psmd->items[MI_PRINTFAN].item.wi_spin.value = thermalManager.fan_speed[0] * 1000;
56  psmd->items[MI_PRINTFAN].item.wi_spin.range = printfan_range;
57 
58  psmd->items[MI_COOLDOWN] = (menu_item_t) { { "Cooldown", 0, WI_LABEL }, SCREEN_MENU_NO_SCREEN };
59 }
Here is the call graph for this function:

◆ screen_test_temperature_event()

int screen_test_temperature_event ( screen_t screen,
window_t window,
uint8_t  event,
void param 
)
62  {
63  if (screen_menu_event(screen, window, event, param)) {
64  return 1;
65  }
66 
67  if (event == WINDOW_EVENT_CHANGING) {
68  switch ((int)param) {
69  case MI_NOZZLE:
70  thermalManager.setTargetHotend(psmd->items[MI_NOZZLE].item.wi_spin.value / 1000, 0);
71  break;
72  case MI_HEATBED:
73  thermalManager.setTargetBed(psmd->items[MI_HEATBED].item.wi_spin.value / 1000);
74  break;
75  case MI_PRINTFAN:
76  thermalManager.set_fan_speed(0, psmd->items[MI_PRINTFAN].item.wi_spin.value / 1000);
77  break;
78  case MI_HEAT_PWM_PERIOD:
79  hwio_pwm_set_prescaler_exp2(HWIO_PWM_HEATER_BED, psmd->items[MI_HEAT_PWM_PERIOD].item.wi_switch_select.index);
80  break;
81  case MI_FAN_PWM_PERIOD:
82  hwio_pwm_set_prescaler_exp2(HWIO_PWM_FAN, psmd->items[MI_FAN_PWM_PERIOD].item.wi_switch_select.index);
83  break;
84  }
85  } else if (event == WINDOW_EVENT_CLICK && (int)param == MI_COOLDOWN) {
86  thermalManager.setTargetHotend(0, 0);
87  thermalManager.setTargetBed(0);
88  thermalManager.set_fan_speed(0, 0);
89  psmd->items[MI_NOZZLE].item.wi_spin.value = 0;
90  psmd->items[MI_HEATBED].item.wi_spin.value = 0;
91  psmd->items[MI_PRINTFAN].item.wi_spin.value = 0;
92  _window_invalidate(&(psmd->root.win));
93  }
94 
95  return 0;
96 }
Here is the call graph for this function:

Variable Documentation

◆ period_pwm_range

const char* period_pwm_range[]
static
Initial value:
= {
"1.5us", " 3us", " 6us", " 12us", " 24us", " 48us", " 97us", "195us", "390us",
"780us", "1.5ms", "3.1ms", "6.2ms", " 12ms", " 25ms", " 50ms", "100ms", NULL
}

◆ pwm_size

const size_t pwm_size = sizeof(period_pwm_range) / sizeof(const char *)
static

◆ screen_test_temperature

◆ pscreen_test_temperature

const screen_t* pscreen_test_temperature = &screen_test_temperature
printfan_range
const int32_t printfan_range[3]
Definition: menu_vars.cpp:33
screen_menu_draw
void screen_menu_draw(screen_t *screen)
Definition: screen_menu.c:90
Temperature::degTargetHotend
static FORCE_INLINE int16_t degTargetHotend(const uint8_t E_NAME)
Definition: temperature.h:562
MI_HEATBED
Definition: screen_test_temperature.cpp:26
screen_menu_event
int screen_menu_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu.c:92
screen_menu_done
void screen_menu_done(screen_t *screen)
Definition: screen_menu.c:78
SCREEN_MENU_NO_SCREEN
#define SCREEN_MENU_NO_SCREEN
Definition: screen_menu.h:39
MI_t
MI_t
Definition: screen_test_temperature.cpp:22
period_pwm_range
static const char * period_pwm_range[]
Definition: screen_test_temperature.cpp:16
WI_SPIN
Definition: window_menu.h:15
MI_NOZZLE
Definition: screen_test_temperature.cpp:24
NULL
#define NULL
Definition: usbd_def.h:53
hwio_pwm_get_prescaler_log2
int hwio_pwm_get_prescaler_log2(int i_pwm)
Definition: hwio_a3ides_2209_02.c:349
menu_item_t
struct _menu_item_t menu_item_t
HWIO_PWM_HEATER_BED
#define HWIO_PWM_HEATER_BED
Definition: hwio_a3ides.h:54
hwio_pwm_set_prescaler_exp2
void hwio_pwm_set_prescaler_exp2(int i_pwm, int exp)
Definition: hwio_a3ides_2209_02.c:343
MI_COOLDOWN
Definition: screen_test_temperature.cpp:29
MI_FAN_PWM_PERIOD
Definition: screen_test_temperature.cpp:27
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
screen_test_temperature_init
void screen_test_temperature_init(screen_t *screen)
Definition: screen_test_temperature.cpp:33
MI_RETURN
Definition: screen_test_temperature.cpp:23
MI_HEAT_PWM_PERIOD
Definition: screen_test_temperature.cpp:25
psmd
#define psmd
Definition: screen_menu.h:40
WINDOW_EVENT_CHANGING
#define WINDOW_EVENT_CHANGING
Definition: window.h:48
WI_LABEL
Definition: window_menu.h:14
HWIO_PWM_FAN
#define HWIO_PWM_FAN
Definition: hwio_a3ides.h:57
screen_test_temperature_event
int screen_test_temperature_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_test_temperature.cpp:61
menu_item_return
const menu_item_t menu_item_return
Definition: screen_menu.c:14
WINDOW_EVENT_CLICK
#define WINDOW_EVENT_CLICK
Definition: window.h:46
screen_menu_data_t
Definition: screen_menu.h:24
MI_PRINTFAN
Definition: screen_test_temperature.cpp:28
WI_SELECT
Definition: window_menu.h:17
MI_COUNT
Definition: screen_test_temperature.cpp:30
nozzle_range
const int32_t nozzle_range[3]
Definition: menu_vars.cpp:31
thermalManager
Temperature thermalManager
Definition: temperature.cpp:89
_window_invalidate
static void _window_invalidate(window_t *window)
Definition: window.h:257
heatbed_range
const int32_t heatbed_range[3]
Definition: menu_vars.cpp:32