🎨 Standardize naming (ProUI) (#25982)
This commit is contained in:
@@ -759,7 +759,7 @@ void unified_bed_leveling::shift_mesh_height() {
|
|||||||
|
|
||||||
TERN_(HAS_MARLINUI_MENU, ui.capture());
|
TERN_(HAS_MARLINUI_MENU, ui.capture());
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
|
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart());
|
TERN_(DWIN_LCD_PROUI, dwinLevelingStart());
|
||||||
|
|
||||||
save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
|
save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
|
||||||
grid_count_t count = GRID_MAX_POINTS;
|
grid_count_t count = GRID_MAX_POINTS;
|
||||||
@@ -820,7 +820,7 @@ void unified_bed_leveling::shift_mesh_height() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
|
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_LevelingDone());
|
TERN_(DWIN_LCD_PROUI, dwinLevelingDone());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_BED_PROBE
|
#endif // HAS_BED_PROBE
|
||||||
|
@@ -88,7 +88,7 @@ void event_filament_runout(const uint8_t extruder) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder)));
|
TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder)));
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_FilamentRunout(extruder));
|
TERN_(DWIN_LCD_PROUI, dwinFilamentRunout(extruder));
|
||||||
|
|
||||||
#if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR)
|
#if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR)
|
||||||
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder);
|
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder);
|
||||||
|
@@ -429,7 +429,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> 3-point Leveling");
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> 3-point Leveling");
|
||||||
points[0].z = points[1].z = points[2].z = 0; // Probe at 3 arbitrary points
|
points[0].z = points[1].z = points[2].z = 0; // Probe at 3 arbitrary points
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart());
|
TERN_(DWIN_LCD_PROUI, dwinLevelingStart());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
|
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
|
||||||
@@ -440,7 +440,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||||||
#if ENABLED(PREHEAT_BEFORE_LEVELING)
|
#if ENABLED(PREHEAT_BEFORE_LEVELING)
|
||||||
if (!abl.dryrun) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP,
|
if (!abl.dryrun) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP,
|
||||||
#if ALL(DWIN_LCD_PROUI, HAS_HEATED_BED)
|
#if ALL(DWIN_LCD_PROUI, HAS_HEATED_BED)
|
||||||
HMI_data.BedLevT
|
hmiData.bedLevT
|
||||||
#else
|
#else
|
||||||
LEVELING_BED_TEMP
|
LEVELING_BED_TEMP
|
||||||
#endif
|
#endif
|
||||||
|
@@ -143,7 +143,7 @@ void GcodeSuite::G29() {
|
|||||||
queue.inject(F("G29S2"));
|
queue.inject(F("G29S2"));
|
||||||
|
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
|
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart());
|
TERN_(DWIN_LCD_PROUI, dwinLevelingStart());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ void GcodeSuite::G29() {
|
|||||||
// Save Z for the previous mesh position
|
// Save Z for the previous mesh position
|
||||||
bedlevel.set_zigzag_z(mbl_probe_index - 1, current_position.z);
|
bedlevel.set_zigzag_z(mbl_probe_index - 1, current_position.z);
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z));
|
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z));
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(_MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS), current_position.z));
|
TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(_MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS), current_position.z));
|
||||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||||
}
|
}
|
||||||
// If there's another point to sample, move there with optional lift.
|
// If there's another point to sample, move there with optional lift.
|
||||||
@@ -236,7 +236,7 @@ void GcodeSuite::G29() {
|
|||||||
if (parser.seenval('Z')) {
|
if (parser.seenval('Z')) {
|
||||||
bedlevel.z_values[ix][iy] = parser.value_linear_units();
|
bedlevel.z_values[ix][iy] = parser.value_linear_units();
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, bedlevel.z_values[ix][iy]));
|
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, bedlevel.z_values[ix][iy]));
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(ix, iy, bedlevel.z_values[ix][iy]));
|
TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(ix, iy, bedlevel.z_values[ix][iy]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return echo_not_entered('Z');
|
return echo_not_entered('Z');
|
||||||
|
@@ -69,7 +69,7 @@ void GcodeSuite::M421() {
|
|||||||
float &zval = bedlevel.z_values[ij.x][ij.y]; // Altering this Mesh Point
|
float &zval = bedlevel.z_values[ij.x][ij.y]; // Altering this Mesh Point
|
||||||
zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0); // N=NAN, Z=NEWVAL, or Q=ADDVAL
|
zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0); // N=NAN, Z=NEWVAL, or Q=ADDVAL
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval)); // Ping ExtUI in case it's showing the mesh
|
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval)); // Ping ExtUI in case it's showing the mesh
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(ij.x, ij.y, zval));
|
TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(ij.x, ij.y, zval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ void GcodeSuite::M302() {
|
|||||||
if (seen_S) {
|
if (seen_S) {
|
||||||
thermalManager.extrude_min_temp = parser.value_celsius();
|
thermalManager.extrude_min_temp = parser.value_celsius();
|
||||||
thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
|
thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
|
||||||
TERN_(DWIN_LCD_PROUI, HMI_data.ExtMinT = thermalManager.extrude_min_temp);
|
TERN_(DWIN_LCD_PROUI, hmiData.extMinT = thermalManager.extrude_min_temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.seen('P'))
|
if (parser.seen('P'))
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
*/
|
*/
|
||||||
void GcodeSuite::M997() {
|
void GcodeSuite::M997() {
|
||||||
|
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_RebootScreen());
|
TERN_(DWIN_LCD_PROUI, dwinRebootScreen());
|
||||||
|
|
||||||
flashFirmware(parser.intval('S'));
|
flashFirmware(parser.intval('S'));
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ void GcodeSuite::M1000() {
|
|||||||
#elif HAS_DWIN_E3V2_BASIC
|
#elif HAS_DWIN_E3V2_BASIC
|
||||||
recovery.dwin_flag = true;
|
recovery.dwin_flag = true;
|
||||||
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented
|
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented
|
||||||
jyersDWIN.popupHandler(Resume);
|
jyersDWIN.popupHandler(Popup_Resume);
|
||||||
#elif ENABLED(EXTENSIBLE_UI)
|
#elif ENABLED(EXTENSIBLE_UI)
|
||||||
ExtUI::onPowerLossResume();
|
ExtUI::onPowerLossResume();
|
||||||
#else
|
#else
|
||||||
|
@@ -73,9 +73,9 @@ void GcodeSuite::M0_M1() {
|
|||||||
ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_USERWAIT));
|
ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_USERWAIT));
|
||||||
#elif ENABLED(DWIN_LCD_PROUI)
|
#elif ENABLED(DWIN_LCD_PROUI)
|
||||||
if (parser.string_arg)
|
if (parser.string_arg)
|
||||||
DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT));
|
dwinPopupConfirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT));
|
||||||
else
|
else
|
||||||
DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT));
|
dwinPopupConfirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT));
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if (parser.string_arg) {
|
if (parser.string_arg) {
|
||||||
|
@@ -49,8 +49,6 @@
|
|||||||
|
|
||||||
#if ENABLED(EXTENSIBLE_UI)
|
#if ENABLED(EXTENSIBLE_UI)
|
||||||
#include "../../lcd/extui/ui_api.h"
|
#include "../../lcd/extui/ui_api.h"
|
||||||
#elif ENABLED(DWIN_LCD_PROUI)
|
|
||||||
#include "../../lcd/e3v2/proui/dwin.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
void GcodeSuite::M75() {
|
void GcodeSuite::M75() {
|
||||||
startOrResumeJob();
|
startOrResumeJob();
|
||||||
#if ENABLED(DWIN_LCD_PROUI)
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
|
if (!IS_SD_PRINTING()) dwinPrintHeader(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#if ENABLED(EXTENSIBLE_UI)
|
#if ENABLED(EXTENSIBLE_UI)
|
||||||
#include "../../lcd/extui/ui_api.h"
|
#include "../../lcd/extui/ui_api.h"
|
||||||
#elif ENABLED(DWIN_LCD_PROUI)
|
#elif ENABLED(PROUI_PID_TUNE)
|
||||||
#include "../../lcd/e3v2/proui/dwin.h"
|
#include "../../lcd/e3v2/proui/dwin.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ void GcodeSuite::M303() {
|
|||||||
SERIAL_ECHOPGM(STR_PID_AUTOTUNE);
|
SERIAL_ECHOPGM(STR_PID_AUTOTUNE);
|
||||||
SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID);
|
SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID);
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_HEATER_ID));
|
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_HEATER_ID));
|
||||||
TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_BAD_HEATER_ID));
|
TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_BAD_HEATER_ID));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ void GcodeSuite::M303() {
|
|||||||
const celsius_t temp = seenS ? parser.value_celsius() : default_temp;
|
const celsius_t temp = seenS ? parser.value_celsius() : default_temp;
|
||||||
const bool u = parser.boolval('U');
|
const bool u = parser.boolval('U');
|
||||||
|
|
||||||
TERN_(DWIN_PID_TUNE, DWIN_StartM303(seenC, c, seenS, hid, temp));
|
TERN_(PROUI_PID_TUNE, dwinStartM303(seenC, c, seenS, hid, temp));
|
||||||
|
|
||||||
IF_DISABLED(BUSY_WHILE_HEATING, KEEPALIVE_STATE(NOT_BUSY));
|
IF_DISABLED(BUSY_WHILE_HEATING, KEEPALIVE_STATE(NOT_BUSY));
|
||||||
|
|
||||||
|
@@ -2386,10 +2386,10 @@
|
|||||||
|
|
||||||
#if ENABLED(DWIN_LCD_PROUI)
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
#if ANY(PIDTEMP, PIDTEMPBED)
|
#if ANY(PIDTEMP, PIDTEMPBED)
|
||||||
#define DWIN_PID_TUNE 1
|
#define PROUI_PID_TUNE 1
|
||||||
#endif
|
#endif
|
||||||
#if ANY(DWIN_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH)
|
#if ANY(PROUI_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH)
|
||||||
#define SHOW_TUNING_GRAPH 1
|
#define PROUI_TUNING_GRAPH 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -27,18 +27,18 @@
|
|||||||
#define GetGColor(color) ((color >> 5) & 0x3F)
|
#define GetGColor(color) ((color >> 5) & 0x3F)
|
||||||
#define GetBColor(color) ((color >> 0) & 0x1F)
|
#define GetBColor(color) ((color >> 0) & 0x1F)
|
||||||
|
|
||||||
#define Color_White 0xFFFF
|
#define COLOR_WHITE 0xFFFF
|
||||||
#define Color_Yellow RGB(0x1F,0x3F,0x00)
|
#define COLOR_YELLOW RGB(0x1F,0x3F,0x00)
|
||||||
#define Color_Red RGB(0x1F,0x00,0x00)
|
#define COLOR_RED RGB(0x1F,0x00,0x00)
|
||||||
#define Color_Error_Red 0xB000 // Error!
|
#define COLOR_ERROR_RED 0xB000 // Error!
|
||||||
#define Color_Bg_Red 0xF00F // Red background color
|
#define COLOR_BG_RED 0xF00F // Red background color
|
||||||
#define Color_Bg_Window 0x31E8 // Popup background color
|
#define COLOR_BG_WINDOW 0x31E8 // Popup background color
|
||||||
#define Color_Bg_Blue 0x1125 // Dark blue background color
|
#define COLOR_BG_BLUE 0x1125 // Dark blue background color
|
||||||
#define Color_Bg_Black 0x0841 // Black background color
|
#define COLOR_BG_BLACK 0x0841 // Black background color
|
||||||
#define Color_IconBlue 0x45FA // Lighter blue that matches icons/accents
|
#define COLOR_ICONBLUE 0x45FA // Lighter blue that matches icons/accents
|
||||||
#define Popup_Text_Color 0xD6BA // Popup font background color
|
#define COLOR_POPUP_TEXT 0xD6BA // Popup font background color
|
||||||
#define Line_Color 0x3A6A // Split line color
|
#define COLOR_LINE 0x3A6A // Split line color
|
||||||
#define Rectangle_Color 0xEE2F // Blue square cursor color
|
#define COLOR_RECTANGLE 0xEE2F // Blue square cursor color
|
||||||
#define Percent_Color 0xFE29 // Percentage color
|
#define COLOR_PERCENT 0xFE29 // Percentage color
|
||||||
#define BarFill_Color 0x10E4 // Fill color of progress bar
|
#define COLOR_BARFILL 0x10E4 // Fill color of progress bar
|
||||||
#define Select_Color 0x33BB // Selected color
|
#define COLOR_SELECT 0x33BB // Selected color
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -34,69 +34,56 @@
|
|||||||
|
|
||||||
enum processID : uint8_t {
|
enum processID : uint8_t {
|
||||||
// Process ID
|
// Process ID
|
||||||
MainMenu,
|
ID_MainMenu,
|
||||||
SelectFile,
|
ID_SelectFile,
|
||||||
Prepare,
|
ID_Prepare,
|
||||||
Control,
|
ID_Control,
|
||||||
Leveling,
|
ID_Leveling,
|
||||||
PrintProcess,
|
ID_PrintProcess,
|
||||||
AxisMove,
|
ID_AxisMove,
|
||||||
TemperatureID,
|
ID_TemperatureID,
|
||||||
Motion,
|
ID_Motion,
|
||||||
Info,
|
ID_Info,
|
||||||
Tune,
|
ID_Tune,
|
||||||
#if HAS_PREHEAT
|
#if HAS_PREHEAT
|
||||||
PLAPreheat,
|
ID_PLAPreheat,
|
||||||
#if PREHEAT_COUNT > 1
|
#if PREHEAT_COUNT > 1
|
||||||
ABSPreheat,
|
ID_ABSPreheat,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
MaxSpeed,
|
ID_MaxSpeed, ID_MaxSpeedValue,
|
||||||
MaxSpeed_value,
|
ID_MaxAcceleration, ID_MaxAccelerationValue,
|
||||||
MaxAcceleration,
|
ID_MaxJerk, ID_MaxJerkValue,
|
||||||
MaxAcceleration_value,
|
ID_Step, ID_StepValue,
|
||||||
MaxJerk,
|
ID_HomeOff, ID_HomeOffX, ID_HomeOffY, ID_HomeOffZ,
|
||||||
MaxJerk_value,
|
|
||||||
Step,
|
|
||||||
Step_value,
|
|
||||||
HomeOff,
|
|
||||||
HomeOffX,
|
|
||||||
HomeOffY,
|
|
||||||
HomeOffZ,
|
|
||||||
|
|
||||||
// Last Process ID
|
// Last Process ID
|
||||||
Last_Prepare,
|
ID_LastPrepare,
|
||||||
|
|
||||||
// Advance Settings
|
// Advance Settings
|
||||||
AdvSet,
|
ID_AdvSet,
|
||||||
ProbeOff,
|
ID_ProbeOff, ID_ProbeOffX, ID_ProbeOffY,
|
||||||
ProbeOffX,
|
|
||||||
ProbeOffY,
|
|
||||||
|
|
||||||
// Back Process ID
|
// Back Process ID
|
||||||
Back_Main,
|
ID_BackMain, ID_BackPrint,
|
||||||
Back_Print,
|
|
||||||
|
|
||||||
// Date variable ID
|
// Date variable ID
|
||||||
Move_X,
|
ID_MoveX, ID_MoveY, ID_MoveZ,
|
||||||
Move_Y,
|
|
||||||
Move_Z,
|
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
Extruder,
|
ID_Extruder,
|
||||||
ETemp,
|
ID_ETemp,
|
||||||
#endif
|
#endif
|
||||||
Homeoffset,
|
ID_HomeOffset,
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
BedTemp,
|
ID_BedTemp,
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN
|
#if HAS_FAN
|
||||||
FanSpeed,
|
ID_FanSpeed,
|
||||||
#endif
|
#endif
|
||||||
PrintSpeed,
|
ID_PrintSpeed,
|
||||||
|
|
||||||
// Window ID
|
// Window ID
|
||||||
Print_window,
|
ID_PrintWindow, ID_PopupWindow
|
||||||
Popup_Window
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern uint8_t checkkey;
|
extern uint8_t checkkey;
|
||||||
@@ -107,32 +94,54 @@ extern millis_t dwin_heat_time;
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
celsius_t E_Temp = 0;
|
celsius_t tempE = 0;
|
||||||
#endif
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
celsius_t Bed_Temp = 0;
|
celsius_t tempBed = 0;
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN
|
#if HAS_FAN
|
||||||
int16_t Fan_speed = 0;
|
int16_t fanSpeed = 0;
|
||||||
#endif
|
|
||||||
int16_t print_speed = 100;
|
|
||||||
float Max_Feedspeed = 0;
|
|
||||||
float Max_Acceleration = 0;
|
|
||||||
float Max_Jerk_scaled = 0;
|
|
||||||
float Max_Step_scaled = 0;
|
|
||||||
float Move_X_scaled = 0;
|
|
||||||
float Move_Y_scaled = 0;
|
|
||||||
float Move_Z_scaled = 0;
|
|
||||||
#if HAS_HOTEND
|
|
||||||
float Move_E_scaled = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
int16_t printSpeed = 100;
|
||||||
|
float maxFeedSpeed = 0;
|
||||||
|
float maxAcceleration = 0;
|
||||||
|
float maxJerkScaled = 0;
|
||||||
|
float maxStepScaled = 0;
|
||||||
float offset_value = 0;
|
float offset_value = 0;
|
||||||
int8_t show_mode = 0; // -1: Temperature control 0: Printing temperature
|
int8_t show_mode = 0; // -1: Temperature control 0: Printing temperature
|
||||||
float Home_OffX_scaled = 0;
|
struct {
|
||||||
float Home_OffY_scaled = 0;
|
#if HAS_X_AXIS
|
||||||
float Home_OffZ_scaled = 0;
|
float x = 0;
|
||||||
float Probe_OffX_scaled = 0;
|
#endif
|
||||||
float Probe_OffY_scaled = 0;
|
#if HAS_Y_AXIS
|
||||||
|
float y = 0;
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
float z = 0;
|
||||||
|
#endif
|
||||||
|
#if HAS_HOTEND
|
||||||
|
float e = 0;
|
||||||
|
#endif
|
||||||
|
} moveScaled;
|
||||||
|
struct {
|
||||||
|
#if HAS_X_AXIS
|
||||||
|
float x = 0;
|
||||||
|
#endif
|
||||||
|
#if HAS_Y_AXIS
|
||||||
|
float y = 0;
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
float z = 0;
|
||||||
|
#endif
|
||||||
|
} homeOffsScaled;
|
||||||
|
struct {
|
||||||
|
#if HAS_X_AXIS
|
||||||
|
float x = 0;
|
||||||
|
#endif
|
||||||
|
#if HAS_Y_AXIS
|
||||||
|
float y = 0;
|
||||||
|
#endif
|
||||||
|
} probeOffsScaled;
|
||||||
} hmi_value_t;
|
} hmi_value_t;
|
||||||
|
|
||||||
#define DWIN_CHINESE 123
|
#define DWIN_CHINESE 123
|
||||||
@@ -198,19 +207,13 @@ void hmiMaxJerkXYZE();
|
|||||||
void hmiStepXYZE();
|
void hmiStepXYZE();
|
||||||
void hmiSetLanguageCache();
|
void hmiSetLanguageCache();
|
||||||
|
|
||||||
void update_variable();
|
void updateVariable();
|
||||||
void dwinDrawSigned_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
|
void dwinDrawSignedFloat(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
|
||||||
|
|
||||||
// SD Card
|
// SD Card
|
||||||
void hmiSDCardInit();
|
void hmiSDCardInit();
|
||||||
void hmiSDCardUpdate();
|
void hmiSDCardUpdate();
|
||||||
|
|
||||||
// Main Process
|
|
||||||
void Icon_print(bool value);
|
|
||||||
void Icon_control(bool value);
|
|
||||||
void Icon_temperature(bool value);
|
|
||||||
void Icon_leveling(bool value);
|
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
void drawStatusArea(const bool with_update); // Status Area
|
void drawStatusArea(const bool with_update); // Status Area
|
||||||
void hmiStartFrame(const bool with_update); // Prepare the menu view
|
void hmiStartFrame(const bool with_update); // Prepare the menu view
|
||||||
|
@@ -47,7 +47,7 @@ void dwinStartup() {
|
|||||||
if (dwinHandshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
|
if (dwinHandshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
|
||||||
dwinFrameSetDir(1);
|
dwinFrameSetDir(1);
|
||||||
#if DISABLED(SHOW_BOOTSCREEN)
|
#if DISABLED(SHOW_BOOTSCREEN)
|
||||||
dwinFrameClear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here
|
dwinFrameClear(COLOR_BG_BLACK); // MarlinUI handles the bootscreen so just clear here
|
||||||
#endif
|
#endif
|
||||||
dwinJPGShowAndCache(3);
|
dwinJPGShowAndCache(3);
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -38,61 +38,87 @@
|
|||||||
//#define DWIN_CREALITY_LCD_CUSTOM_ICONS
|
//#define DWIN_CREALITY_LCD_CUSTOM_ICONS
|
||||||
|
|
||||||
enum processID : uint8_t {
|
enum processID : uint8_t {
|
||||||
Main, Print, Menu, Value, Option, File, Popup, Confirm, Wait
|
Proc_Main, Proc_Print, Proc_Menu, Proc_Value, Proc_Option,
|
||||||
|
Proc_File, Proc_Popup, Proc_Confirm, Proc_Wait
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PopupID : uint8_t {
|
enum PopupID : uint8_t {
|
||||||
Pause, Stop, Resume, SaveLevel, ETemp, ConfFilChange, PurgeMore, MeshSlot,
|
Popup_Pause,
|
||||||
Level, Home, MoveWait, Heating, FilLoad, FilChange, TempWarn, Runout, PIDWait, MPCWait, Resuming, ManualProbing,
|
Popup_Stop,
|
||||||
FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete, Custom
|
Popup_Resume,
|
||||||
|
Popup_SaveLevel,
|
||||||
|
Popup_ETemp,
|
||||||
|
Popup_ConfFilChange,
|
||||||
|
Popup_PurgeMore,
|
||||||
|
Popup_MeshSlot,
|
||||||
|
Popup_Level,
|
||||||
|
Popup_Home,
|
||||||
|
Popup_MoveWait,
|
||||||
|
Popup_Heating,
|
||||||
|
Popup_FilLoad,
|
||||||
|
Popup_FilChange,
|
||||||
|
Popup_TempWarn,
|
||||||
|
Popup_Runout,
|
||||||
|
Popup_PIDWait,
|
||||||
|
Popup_MPCWait,
|
||||||
|
Popup_Resuming,
|
||||||
|
Popup_ManualProbing,
|
||||||
|
Popup_FilInsert,
|
||||||
|
Popup_HeaterTime,
|
||||||
|
Popup_UserInput,
|
||||||
|
Popup_LevelError,
|
||||||
|
Popup_InvalidMesh,
|
||||||
|
Popup_UI,
|
||||||
|
Popup_Complete,
|
||||||
|
Popup_Custom
|
||||||
};
|
};
|
||||||
|
|
||||||
enum menuID : uint8_t {
|
enum menuID : uint8_t {
|
||||||
MainMenu,
|
ID_MainMenu,
|
||||||
Prepare,
|
ID_Prepare,
|
||||||
Move,
|
ID_Move,
|
||||||
HomeMenu,
|
ID_HomeMenu,
|
||||||
ManualLevel,
|
ID_ManualLevel,
|
||||||
ZOffset,
|
ID_ZOffset,
|
||||||
Preheat,
|
ID_Preheat,
|
||||||
ChangeFilament,
|
ID_ChangeFilament,
|
||||||
MenuCustom,
|
ID_MenuCustom,
|
||||||
Control,
|
ID_Control,
|
||||||
TempMenu,
|
ID_TempMenu,
|
||||||
PID,
|
ID_PID,
|
||||||
HotendPID,
|
ID_HotendPID,
|
||||||
BedPID,
|
ID_BedPID,
|
||||||
#if HAS_PREHEAT
|
#if HAS_PREHEAT
|
||||||
#define _PREHEAT_ID(N) Preheat##N,
|
#define _PREHEAT_ID(N) ID_Preheat##N,
|
||||||
REPEAT_1(PREHEAT_COUNT, _PREHEAT_ID)
|
REPEAT_1(PREHEAT_COUNT, _PREHEAT_ID)
|
||||||
#endif
|
#endif
|
||||||
#if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU)
|
#if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU)
|
||||||
MPC,
|
ID_MPC,
|
||||||
#endif
|
#endif
|
||||||
Motion,
|
ID_Motion,
|
||||||
HomeOffsets,
|
ID_HomeOffsets,
|
||||||
MaxSpeed,
|
ID_MaxSpeed,
|
||||||
MaxAcceleration,
|
ID_MaxAcceleration,
|
||||||
MaxJerk,
|
ID_MaxJerk,
|
||||||
Steps,
|
ID_Steps,
|
||||||
Visual,
|
ID_Visual,
|
||||||
ColorSettings,
|
ID_ColorSettings,
|
||||||
Advanced,
|
ID_Advanced,
|
||||||
ProbeMenu,
|
ID_ProbeMenu,
|
||||||
#if HAS_TRINAMIC_CONFIG
|
#if HAS_TRINAMIC_CONFIG
|
||||||
TMCMenu,
|
ID_TMCMenu,
|
||||||
#endif
|
#endif
|
||||||
Info,
|
ID_Info,
|
||||||
Leveling,
|
ID_Leveling,
|
||||||
LevelManual,
|
ID_LevelManual,
|
||||||
LevelView,
|
ID_LevelView,
|
||||||
MeshViewer,
|
ID_MeshViewer,
|
||||||
LevelSettings,
|
ID_LevelSettings,
|
||||||
ManualMesh,
|
ID_ManualMesh,
|
||||||
UBLMesh,
|
ID_UBLMesh,
|
||||||
InfoMain,
|
ID_InfoMain,
|
||||||
Tune,
|
ID_Tune,
|
||||||
PreheatHotend
|
ID_PreheatHotend
|
||||||
};
|
};
|
||||||
|
|
||||||
// Custom icons
|
// Custom icons
|
||||||
@@ -129,27 +155,27 @@ enum colorID : uint8_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define Custom_Colors 10
|
#define Custom_Colors 10
|
||||||
#define Color_Aqua RGB(0x00,0x3F,0x1F)
|
#define COLOR_AQUA RGB(0x00,0x3F,0x1F)
|
||||||
#define Color_Light_White 0xBDD7
|
#define COLOR_LIGHT_WHITE 0xBDD7
|
||||||
#define Color_Green RGB(0x00,0x3F,0x00)
|
#define COLOR_GREEN RGB(0x00,0x3F,0x00)
|
||||||
#define Color_Light_Green 0x3460
|
#define COLOR_LIGHT_GREEN 0x3460
|
||||||
#define Color_Cyan 0x07FF
|
#define COLOR_CYAN 0x07FF
|
||||||
#define Color_Light_Cyan 0x04F3
|
#define COLOR_LIGHT_CYAN 0x04F3
|
||||||
#define Color_Blue 0x015F
|
#define COLOR_BLUE 0x015F
|
||||||
#define Color_Light_Blue 0x3A6A
|
#define COLOR_LIGHT_BLUE 0x3A6A
|
||||||
#define Color_Magenta 0xF81F
|
#define COLOR_MAGENTA 0xF81F
|
||||||
#define Color_Light_Magenta 0x9813
|
#define COLOR_LIGHT_MAGENTA 0x9813
|
||||||
#define Color_Light_Red 0x8800
|
#define COLOR_LIGHT_RED 0x8800
|
||||||
#define Color_Orange 0xFA20
|
#define COLOR_ORANGE 0xFA20
|
||||||
#define Color_Light_Orange 0xFBC0
|
#define COLOR_LIGHT_ORANGE 0xFBC0
|
||||||
#define Color_Light_Yellow 0x8BE0
|
#define COLOR_LIGHT_YELLOW 0x8BE0
|
||||||
#define Color_Brown 0xCC27
|
#define COLOR_BROWN 0xCC27
|
||||||
#define Color_Light_Brown 0x6204
|
#define COLOR_LIGHT_BROWN 0x6204
|
||||||
#define Color_Black 0x0000
|
#define COLOR_BLACK 0x0000
|
||||||
#define Color_Grey 0x18E3
|
#define COLOR_GREY 0x18E3
|
||||||
#define Check_Color 0x4E5C // Check-box check color
|
#define COLOR_CHECKBOX 0x4E5C // Check-box check color
|
||||||
#define Confirm_Color 0x34B9
|
#define COLOR_CONFIRM 0x34B9
|
||||||
#define Cancel_Color 0x3186
|
#define COLOR_CANCEL 0x3186
|
||||||
|
|
||||||
class JyersDWIN {
|
class JyersDWIN {
|
||||||
public:
|
public:
|
||||||
|
@@ -45,7 +45,7 @@ void dwinStartup() {
|
|||||||
const bool success = dwinHandshake();
|
const bool success = dwinHandshake();
|
||||||
if (success) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
|
if (success) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
|
||||||
dwinFrameSetDir(TERN(DWIN_MARLINUI_LANDSCAPE, 0, 1));
|
dwinFrameSetDir(TERN(DWIN_MARLINUI_LANDSCAPE, 0, 1));
|
||||||
dwinFrameClear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here
|
dwinFrameClear(COLOR_BG_BLACK); // MarlinUI handles the bootscreen so just clear here
|
||||||
dwinJPGShowAndCache(3);
|
dwinJPGShowAndCache(3);
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
// DWIN printing specifies the font on each string operation
|
// DWIN printing specifies the font on each string operation
|
||||||
// but we'll make the font modal for Marlin
|
// but we'll make the font modal for Marlin
|
||||||
dwin_font_t dwin_font = { font8x16, 8, 16, Color_White, Color_Bg_Black, true };
|
dwin_font_t dwin_font = { font8x16, 8, 16, COLOR_WHITE, COLOR_BG_BLACK, true };
|
||||||
void MarlinUI::set_font(const uint8_t font_nr) {
|
void MarlinUI::set_font(const uint8_t font_nr) {
|
||||||
if (font_nr != dwin_font.index) {
|
if (font_nr != dwin_font.index) {
|
||||||
dwin_font.index = font_nr;
|
dwin_font.index = font_nr;
|
||||||
@@ -84,7 +84,7 @@ void MarlinUI::init_lcd() { dwinStartup(); }
|
|||||||
void MarlinUI::clear_lcd() {
|
void MarlinUI::clear_lcd() {
|
||||||
dwinIconAnimationControl(0x0000); // disable all icon animations
|
dwinIconAnimationControl(0x0000); // disable all icon animations
|
||||||
dwinJPGShowAndCache(3);
|
dwinJPGShowAndCache(3);
|
||||||
dwinFrameClear(Color_Bg_Black);
|
dwinFrameClear(COLOR_BG_BLACK);
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
|
|
||||||
did_first_redraw = false;
|
did_first_redraw = false;
|
||||||
@@ -109,7 +109,7 @@ void MarlinUI::clear_lcd() {
|
|||||||
#define VERSION_Y 84
|
#define VERSION_Y 84
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dwinDrawString(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
|
dwinDrawString(false, font10x20, COLOR_YELLOW, COLOR_BG_BLACK, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
|
||||||
TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT));
|
TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT));
|
||||||
clear_lcd();
|
clear_lcd();
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ void MarlinUI::clear_lcd() {
|
|||||||
dwinIconShow(BOOT_ICON, ICON_MarlinURL, INFO_CENTER - 100 / 2, 152);
|
dwinIconShow(BOOT_ICON, ICON_MarlinURL, INFO_CENTER - 100 / 2, 152);
|
||||||
dwinIconShow(BOOT_ICON, ICON_Copyright, INFO_CENTER - 126 / 2, 200);
|
dwinIconShow(BOOT_ICON, ICON_Copyright, INFO_CENTER - 126 / 2, 200);
|
||||||
#endif
|
#endif
|
||||||
dwinDrawString(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
|
dwinDrawString(false, font10x20, COLOR_YELLOW, COLOR_BG_BLACK, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,14 +140,14 @@ void MarlinUI::clear_lcd() {
|
|||||||
// The kill screen is displayed for unrecoverable conditions
|
// The kill screen is displayed for unrecoverable conditions
|
||||||
void MarlinUI::draw_kill_screen() {
|
void MarlinUI::draw_kill_screen() {
|
||||||
set_font(DWIN_FONT_ALERT);
|
set_font(DWIN_FONT_ALERT);
|
||||||
dwinFrameClear(Color_Bg_Black);
|
dwinFrameClear(COLOR_BG_BLACK);
|
||||||
dwin_font.fg = Color_Error_Red;
|
dwin_font.fg = COLOR_ERROR_RED;
|
||||||
dwin_font.solid = false;
|
dwin_font.solid = false;
|
||||||
dwinDrawRectangle(1, Color_Bg_Window, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
|
dwinDrawRectangle(1, COLOR_BG_WINDOW, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
|
||||||
// make the frame a few pixels thick
|
// make the frame a few pixels thick
|
||||||
dwinDrawRectangle(0, Color_Yellow, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
|
dwinDrawRectangle(0, COLOR_YELLOW, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
|
||||||
dwinDrawRectangle(0, Color_Yellow, 21, 21, LCD_PIXEL_WIDTH - 21, LCD_PIXEL_HEIGHT - 21);
|
dwinDrawRectangle(0, COLOR_YELLOW, 21, 21, LCD_PIXEL_WIDTH - 21, LCD_PIXEL_HEIGHT - 21);
|
||||||
dwinDrawRectangle(0, Color_Yellow, 22, 22, LCD_PIXEL_WIDTH - 22, LCD_PIXEL_HEIGHT - 22);
|
dwinDrawRectangle(0, COLOR_YELLOW, 22, 22, LCD_PIXEL_WIDTH - 22, LCD_PIXEL_HEIGHT - 22);
|
||||||
|
|
||||||
uint8_t cx = (LCD_PIXEL_WIDTH / dwin_font.width / 2),
|
uint8_t cx = (LCD_PIXEL_WIDTH / dwin_font.width / 2),
|
||||||
cy = (LCD_PIXEL_HEIGHT / dwin_font.height / 2);
|
cy = (LCD_PIXEL_HEIGHT / dwin_font.height / 2);
|
||||||
@@ -178,8 +178,8 @@ void MarlinUI::draw_kill_screen() {
|
|||||||
void MarlinUI::draw_status_message(const bool blink) {
|
void MarlinUI::draw_status_message(const bool blink) {
|
||||||
set_font(DWIN_FONT_STAT);
|
set_font(DWIN_FONT_STAT);
|
||||||
dwin_font.solid = true;
|
dwin_font.solid = true;
|
||||||
dwin_font.fg = Color_White;
|
dwin_font.fg = COLOR_WHITE;
|
||||||
dwin_font.bg = Color_Bg_Black;
|
dwin_font.bg = COLOR_BG_BLACK;
|
||||||
lcd_moveto_xy(0, LCD_PIXEL_HEIGHT - (STAT_FONT_HEIGHT) - 1);
|
lcd_moveto_xy(0, LCD_PIXEL_HEIGHT - (STAT_FONT_HEIGHT) - 1);
|
||||||
|
|
||||||
constexpr uint8_t max_status_chars = (LCD_PIXEL_WIDTH) / (STAT_FONT_WIDTH);
|
constexpr uint8_t max_status_chars = (LCD_PIXEL_WIDTH) / (STAT_FONT_WIDTH);
|
||||||
@@ -267,7 +267,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
|
void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
|
||||||
|
|
||||||
dwin_font.solid = false;
|
dwin_font.solid = false;
|
||||||
dwin_font.fg = Color_White;
|
dwin_font.fg = COLOR_WHITE;
|
||||||
dwin_string.set('E');
|
dwin_string.set('E');
|
||||||
dwin_string.add('1' + extruder);
|
dwin_string.add('1' + extruder);
|
||||||
dwin_string.add(' ');
|
dwin_string.add(' ');
|
||||||
@@ -293,10 +293,10 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
dwinDrawBox(1, Color_Bg_Heading, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
dwinDrawBox(1, Color_Bg_Heading, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
||||||
else {
|
else {
|
||||||
#if ENABLED(MENU_HOLLOW_FRAME)
|
#if ENABLED(MENU_HOLLOW_FRAME)
|
||||||
dwinDrawBox(1, Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
dwinDrawBox(1, COLOR_BG_BLACK, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
||||||
if (sel) dwinDrawBox(0, Select_Color, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
if (sel) dwinDrawBox(0, COLOR_SELECT, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
||||||
#else
|
#else
|
||||||
dwinDrawBox(1, sel ? Select_Color : Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
dwinDrawBox(1, sel ? COLOR_SELECT : COLOR_BG_BLACK, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
if (mark_as_selected(row, (bool)(style & SS_INVERT), true)) {
|
if (mark_as_selected(row, (bool)(style & SS_INVERT), true)) {
|
||||||
ui.set_font(DWIN_FONT_MENU);
|
ui.set_font(DWIN_FONT_MENU);
|
||||||
dwin_font.solid = false;
|
dwin_font.solid = false;
|
||||||
dwin_font.fg = Color_White;
|
dwin_font.fg = COLOR_WHITE;
|
||||||
|
|
||||||
dwin_string.set();
|
dwin_string.set();
|
||||||
|
|
||||||
@@ -356,7 +356,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
if (mark_as_selected(row, sel)) {
|
if (mark_as_selected(row, sel)) {
|
||||||
ui.set_font(DWIN_FONT_MENU);
|
ui.set_font(DWIN_FONT_MENU);
|
||||||
dwin_font.solid = false;
|
dwin_font.solid = false;
|
||||||
dwin_font.fg = Color_White;
|
dwin_font.fg = COLOR_WHITE;
|
||||||
|
|
||||||
dwin_string.set(ftpl, itemIndex, itemStringC, itemStringF);
|
dwin_string.set(ftpl, itemIndex, itemStringC, itemStringF);
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
if (mark_as_selected(row, sel)) {
|
if (mark_as_selected(row, sel)) {
|
||||||
ui.set_font(DWIN_FONT_MENU);
|
ui.set_font(DWIN_FONT_MENU);
|
||||||
dwin_font.solid = false;
|
dwin_font.solid = false;
|
||||||
dwin_font.fg = Color_White;
|
dwin_font.fg = COLOR_WHITE;
|
||||||
|
|
||||||
const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen(S(inStr)));
|
const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen(S(inStr)));
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
lcd_put_dwin_string();
|
lcd_put_dwin_string();
|
||||||
|
|
||||||
if (vallen) {
|
if (vallen) {
|
||||||
dwin_font.fg = Color_Yellow;
|
dwin_font.fg = COLOR_YELLOW;
|
||||||
dwin_string.set(inStr);
|
dwin_string.set(inStr);
|
||||||
lcd_moveto(LCD_WIDTH - vallen - 1, row);
|
lcd_moveto(LCD_WIDTH - vallen - 1, row);
|
||||||
lcd_put_dwin_string();
|
lcd_put_dwin_string();
|
||||||
@@ -410,7 +410,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
// Assume the label is alpha-numeric (with a descender)
|
// Assume the label is alpha-numeric (with a descender)
|
||||||
const uint16_t row = (LCD_HEIGHT / 2) - 1;
|
const uint16_t row = (LCD_HEIGHT / 2) - 1;
|
||||||
|
|
||||||
dwin_font.fg = Color_White;
|
dwin_font.fg = COLOR_WHITE;
|
||||||
dwin_font.solid = true;
|
dwin_font.solid = true;
|
||||||
lcd_moveto((LCD_WIDTH - labellen + !!vallen) / 2, row);
|
lcd_moveto((LCD_WIDTH - labellen + !!vallen) / 2, row);
|
||||||
lcd_put_dwin_string();
|
lcd_put_dwin_string();
|
||||||
@@ -420,7 +420,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
dwin_string.set(value);
|
dwin_string.set(value);
|
||||||
|
|
||||||
const dwin_coord_t by = (row * MENU_LINE_HEIGHT) + MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT / 2;
|
const dwin_coord_t by = (row * MENU_LINE_HEIGHT) + MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT / 2;
|
||||||
dwinDrawString(true, font16x32, Color_Yellow, Color_Bg_Black, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string()));
|
dwinDrawString(true, font16x32, COLOR_YELLOW, COLOR_BG_BLACK, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string()));
|
||||||
|
|
||||||
if (ui.can_show_slider()) {
|
if (ui.can_show_slider()) {
|
||||||
|
|
||||||
@@ -430,11 +430,11 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
slider_y = by + 32 + 4,
|
slider_y = by + 32 + 4,
|
||||||
amount = ui.encoderPosition * slider_length / maxEditValue;
|
amount = ui.encoderPosition * slider_length / maxEditValue;
|
||||||
|
|
||||||
dwinDrawRectangle(1, Color_Bg_Window, slider_x - 1, slider_y - 1, slider_x - 1 + slider_length + 2 - 1, slider_y - 1 + slider_height + 2 - 1);
|
dwinDrawRectangle(1, COLOR_BG_WINDOW, slider_x - 1, slider_y - 1, slider_x - 1 + slider_length + 2 - 1, slider_y - 1 + slider_height + 2 - 1);
|
||||||
if (amount > 0)
|
if (amount > 0)
|
||||||
dwinDrawBox(1, BarFill_Color, slider_x, slider_y, amount, slider_height);
|
dwinDrawBox(1, COLOR_BARFILL, slider_x, slider_y, amount, slider_height);
|
||||||
if (amount < slider_length)
|
if (amount < slider_length)
|
||||||
dwinDrawBox(1, Color_Bg_Black, slider_x + amount, slider_y, slider_length - amount, slider_height);
|
dwinDrawBox(1, COLOR_BG_BLACK, slider_x + amount, slider_y, slider_length - amount, slider_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -445,7 +445,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
col = yesopt ? LCD_WIDTH - mar - len : mar,
|
col = yesopt ? LCD_WIDTH - mar - len : mar,
|
||||||
row = (LCD_HEIGHT >= 8 ? LCD_HEIGHT / 2 + 3 : LCD_HEIGHT - 1);
|
row = (LCD_HEIGHT >= 8 ? LCD_HEIGHT / 2 + 3 : LCD_HEIGHT - 1);
|
||||||
lcd_moveto(col, row);
|
lcd_moveto(col, row);
|
||||||
dwinDrawBox(1, inv ? Select_Color : Color_Bg_Black, cursor.x - dwin_font.width, cursor.y + 1, dwin_font.width * (len + 2), dwin_font.height + 2);
|
dwinDrawBox(1, inv ? COLOR_SELECT : COLOR_BG_BLACK, cursor.x - dwin_font.width, cursor.y + 1, dwin_font.width * (len + 2), dwin_font.height + 2);
|
||||||
lcd_put_u8str(col, row, fstr);
|
lcd_put_u8str(col, row, fstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,7 +455,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
) {
|
) {
|
||||||
ui.set_font(DWIN_FONT_MENU);
|
ui.set_font(DWIN_FONT_MENU);
|
||||||
dwin_font.solid = false;
|
dwin_font.solid = false;
|
||||||
dwin_font.fg = Color_White;
|
dwin_font.fg = COLOR_WHITE;
|
||||||
ui.draw_select_screen_prompt(pref, string, suff);
|
ui.draw_select_screen_prompt(pref, string, suff);
|
||||||
if (no) draw_boxed_string(false, no, !yesno);
|
if (no) draw_boxed_string(false, no, !yesno);
|
||||||
if (yes) draw_boxed_string(true, yes, yesno);
|
if (yes) draw_boxed_string(true, yes, yesno);
|
||||||
@@ -507,9 +507,9 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
// Clear the Mesh Map
|
// Clear the Mesh Map
|
||||||
|
|
||||||
// First draw the bigger box in White so we have a border around the mesh map box
|
// First draw the bigger box in White so we have a border around the mesh map box
|
||||||
dwinDrawRectangle(1, Color_White, x_offset - 2, y_offset - 2, x_offset + 2 + x_map_pixels, y_offset + 2 + y_map_pixels);
|
dwinDrawRectangle(1, COLOR_WHITE, x_offset - 2, y_offset - 2, x_offset + 2 + x_map_pixels, y_offset + 2 + y_map_pixels);
|
||||||
// Now actually clear the mesh map box
|
// Now actually clear the mesh map box
|
||||||
dwinDrawRectangle(1, Color_Bg_Black, x_offset, y_offset, x_offset + x_map_pixels, y_offset + y_map_pixels);
|
dwinDrawRectangle(1, COLOR_BG_BLACK, x_offset, y_offset, x_offset + x_map_pixels, y_offset + y_map_pixels);
|
||||||
|
|
||||||
// Fill in the Specified Mesh Point
|
// Fill in the Specified Mesh Point
|
||||||
|
|
||||||
@@ -517,7 +517,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
// invert the Y to get it to plot in the right location.
|
// invert the Y to get it to plot in the right location.
|
||||||
|
|
||||||
const dwin_coord_t by = y_offset + y_plot_inv * pixels_per_y_mesh_pnt;
|
const dwin_coord_t by = y_offset + y_plot_inv * pixels_per_y_mesh_pnt;
|
||||||
dwinDrawRectangle(1, Select_Color,
|
dwinDrawRectangle(1, COLOR_SELECT,
|
||||||
x_offset + (x_plot * pixels_per_x_mesh_pnt), by,
|
x_offset + (x_plot * pixels_per_x_mesh_pnt), by,
|
||||||
x_offset + (x_plot * pixels_per_x_mesh_pnt) + pixels_per_x_mesh_pnt, by + pixels_per_y_mesh_pnt
|
x_offset + (x_plot * pixels_per_x_mesh_pnt) + pixels_per_x_mesh_pnt, by + pixels_per_y_mesh_pnt
|
||||||
);
|
);
|
||||||
@@ -527,12 +527,12 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
dwin_coord_t y = y_offset + pixels_per_y_mesh_pnt / 2;
|
dwin_coord_t y = y_offset + pixels_per_y_mesh_pnt / 2;
|
||||||
for (uint8_t j = 0; j < (GRID_MAX_POINTS_Y); j++, y += pixels_per_y_mesh_pnt)
|
for (uint8_t j = 0; j < (GRID_MAX_POINTS_Y); j++, y += pixels_per_y_mesh_pnt)
|
||||||
for (uint8_t i = 0, x = sx; i < (GRID_MAX_POINTS_X); i++, x += pixels_per_x_mesh_pnt)
|
for (uint8_t i = 0, x = sx; i < (GRID_MAX_POINTS_X); i++, x += pixels_per_x_mesh_pnt)
|
||||||
dwinDrawPoint(Color_White, 1, 1, x, y);
|
dwinDrawPoint(COLOR_WHITE, 1, 1, x, y);
|
||||||
|
|
||||||
// Put Relevant Text on Display
|
// Put Relevant Text on Display
|
||||||
|
|
||||||
// Show X and Y positions at top of screen
|
// Show X and Y positions at top of screen
|
||||||
dwin_font.fg = Color_White;
|
dwin_font.fg = COLOR_WHITE;
|
||||||
dwin_font.solid = true;
|
dwin_font.solid = true;
|
||||||
const xy_pos_t pos = { bedlevel.get_mesh_x(x_plot), bedlevel.get_mesh_y(y_plot) },
|
const xy_pos_t pos = { bedlevel.get_mesh_x(x_plot), bedlevel.get_mesh_y(y_plot) },
|
||||||
lpos = pos.asLogical();
|
lpos = pos.asLogical();
|
||||||
@@ -586,7 +586,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
const int nozzle = (LCD_PIXEL_WIDTH / 2) - 20;
|
const int nozzle = (LCD_PIXEL_WIDTH / 2) - 20;
|
||||||
|
|
||||||
// Draw a representation of the nozzle
|
// Draw a representation of the nozzle
|
||||||
dwinDrawBox(1, Color_Bg_Black, nozzle + 3, 8, 48, 52); // 'clear' the area where the nozzle is drawn in case it was moved up/down
|
dwinDrawBox(1, COLOR_BG_BLACK, nozzle + 3, 8, 48, 52); // 'clear' the area where the nozzle is drawn in case it was moved up/down
|
||||||
dwinIconShow(ICON, ICON_HotendOff, nozzle + 3, 10 - dir);
|
dwinIconShow(ICON, ICON_HotendOff, nozzle + 3, 10 - dir);
|
||||||
dwinIconShow(ICON, ICON_BedLine, nozzle, 10 + 36);
|
dwinIconShow(ICON, ICON_BedLine, nozzle, 10 + 36);
|
||||||
|
|
||||||
|
@@ -72,7 +72,7 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
|
|||||||
const bool x_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning();
|
const bool x_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning();
|
||||||
if (x_redraw) {
|
if (x_redraw) {
|
||||||
dwin_string.set('X' + axis);
|
dwin_string.set('X' + axis);
|
||||||
dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black,
|
dwinDrawString(true, font16x32, COLOR_ICONBLUE, COLOR_BG_BLACK,
|
||||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||||
x + (utf8_strlen(value) * 14 - 14) / 2, y + 2
|
x + (utf8_strlen(value) * 14 - 14) / 2, y + 2
|
||||||
#else
|
#else
|
||||||
@@ -96,7 +96,7 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
|
|||||||
if (TERN0(LCD_SHOW_E_TOTAL, x_redraw && axis == X_AXIS))
|
if (TERN0(LCD_SHOW_E_TOTAL, x_redraw && axis == X_AXIS))
|
||||||
dwin_string.add(F(" "));
|
dwin_string.add(F(" "));
|
||||||
|
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black,
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK,
|
||||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||||
x, y + 32
|
x, y + 32
|
||||||
#else
|
#else
|
||||||
@@ -117,26 +117,26 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
|
|||||||
if (e_redraw) {
|
if (e_redraw) {
|
||||||
// Extra spaces to erase previous value
|
// Extra spaces to erase previous value
|
||||||
dwin_string.set(F("E "));
|
dwin_string.set(F("E "));
|
||||||
dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string()));
|
dwinDrawString(true, font16x32, COLOR_ICONBLUE, COLOR_BG_BLACK, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
dwin_string.set(ui16tostr5rj(value / scale));
|
dwin_string.set(ui16tostr5rj(value / scale));
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x, y + 32, S(dwin_string.string()));
|
||||||
|
|
||||||
// Extra spaces to erase previous value
|
// Extra spaces to erase previous value
|
||||||
dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (5 * 14), y + 32, S(scale == 1 ? "mm " : "cm "));
|
dwinDrawString(true, font14x28, COLOR_ICONBLUE, COLOR_BG_BLACK, x + (5 * 14), y + 32, S(scale == 1 ? "mm " : "cm "));
|
||||||
|
|
||||||
#else // !DWIN_MARLINUI_PORTRAIT
|
#else // !DWIN_MARLINUI_PORTRAIT
|
||||||
|
|
||||||
if (e_redraw) {
|
if (e_redraw) {
|
||||||
dwin_string.set(F("E "));
|
dwin_string.set(F("E "));
|
||||||
dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string()));
|
dwinDrawString(true, font16x32, COLOR_ICONBLUE, COLOR_BG_BLACK, x, y, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
dwin_string.set(ui16tostr5rj(value / scale));
|
dwin_string.set(ui16tostr5rj(value / scale));
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x + 32, y + 4, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x + 32, y + 4, S(dwin_string.string()));
|
||||||
|
|
||||||
dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (32 + 70), y + 4, S(scale == 1 ? "mm " : "cm "));
|
dwinDrawString(true, font14x28, COLOR_ICONBLUE, COLOR_BG_BLACK, x + (32 + 70), y + 4, S(scale == 1 ? "mm " : "cm "));
|
||||||
|
|
||||||
#endif // !DWIN_MARLINUI_PORTRAIT
|
#endif // !DWIN_MARLINUI_PORTRAIT
|
||||||
}
|
}
|
||||||
@@ -154,13 +154,13 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
|
|||||||
dwinIconAnimation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25);
|
dwinIconAnimation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25);
|
||||||
dwin_string.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0)));
|
dwin_string.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0)));
|
||||||
dwin_string.add('%');
|
dwin_string.add('%');
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dwinIconAnimationControl(0x0000); // disable all icon animations (this is the only one)
|
dwinIconAnimationControl(0x0000); // disable all icon animations (this is the only one)
|
||||||
dwinIconShow(ICON, ICON_Fan0, x + fanx, y);
|
dwinIconShow(ICON, ICON_Fan0, x + fanx, y);
|
||||||
dwin_string.set(F(" "));
|
dwin_string.set(F(" "));
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -230,7 +230,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
|
|||||||
if (t_draw) {
|
if (t_draw) {
|
||||||
dwin_string.set(i16tostr3rj(tt + 0.5));
|
dwin_string.set(i16tostr3rj(tt + 0.5));
|
||||||
dwin_string.add(LCD_STR_DEGREE);
|
dwin_string.add(LCD_STR_DEGREE);
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x, y, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw heater icon with on / off / leveled states
|
// Draw heater icon with on / off / leveled states
|
||||||
@@ -243,7 +243,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
|
|||||||
if (c_draw) {
|
if (c_draw) {
|
||||||
dwin_string.set(i16tostr3rj(tc + 0.5));
|
dwin_string.set(i16tostr3rj(tc + 0.5));
|
||||||
dwin_string.add(LCD_STR_DEGREE);
|
dwin_string.add(LCD_STR_DEGREE);
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + 70, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x, y + 70, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,12 +253,12 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
|
|||||||
FORCE_INLINE void _draw_feedrate_status(const char *value, uint16_t x, uint16_t y) {
|
FORCE_INLINE void _draw_feedrate_status(const char *value, uint16_t x, uint16_t y) {
|
||||||
if (!ui.did_first_redraw) {
|
if (!ui.did_first_redraw) {
|
||||||
dwin_string.set(LCD_STR_FEEDRATE);
|
dwin_string.set(LCD_STR_FEEDRATE);
|
||||||
dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_ICONBLUE, COLOR_BG_BLACK, x, y, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
dwin_string.set(value);
|
dwin_string.set(value);
|
||||||
dwin_string.add('%');
|
dwin_string.add('%');
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x + 14, y, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x + 14, y, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -281,7 +281,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Draw a frame around the x/y/z values
|
// Draw a frame around the x/y/z values
|
||||||
dwinDrawRectangle(0, Select_Color,
|
dwinDrawRectangle(0, COLOR_SELECT,
|
||||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||||
0, 193, LCD_PIXEL_WIDTH - 1, 260
|
0, 193, LCD_PIXEL_WIDTH - 1, 260
|
||||||
#else
|
#else
|
||||||
@@ -358,7 +358,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
time.toDigital(buffer);
|
time.toDigital(buffer);
|
||||||
dwin_string.add(prefix);
|
dwin_string.add(prefix);
|
||||||
dwin_string.add(buffer);
|
dwin_string.add(buffer);
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, (LCD_PIXEL_WIDTH - ((dwin_string.length + 1) * 14)), 290, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, (LCD_PIXEL_WIDTH - ((dwin_string.length + 1) * 14)), 290, S(dwin_string.string()));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -367,23 +367,23 @@ void MarlinUI::draw_status_screen() {
|
|||||||
time.toDigital(buffer);
|
time.toDigital(buffer);
|
||||||
dwin_string.set(' ');
|
dwin_string.set(' ');
|
||||||
dwin_string.add(buffer);
|
dwin_string.add(buffer);
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, 230, 170, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, 230, 170, S(dwin_string.string()));
|
||||||
|
|
||||||
#if ENABLED(SHOW_REMAINING_TIME)
|
#if ENABLED(SHOW_REMAINING_TIME)
|
||||||
if (print_job_timer.isRunning()) {
|
if (print_job_timer.isRunning()) {
|
||||||
time = get_remaining_time();
|
time = get_remaining_time();
|
||||||
dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(" R "));
|
dwinDrawString(true, font14x28, COLOR_ICONBLUE, COLOR_BG_BLACK, 336, 170, S(" R "));
|
||||||
if (print_job_timer.isPaused() && blink)
|
if (print_job_timer.isPaused() && blink)
|
||||||
dwin_string.set(F(" "));
|
dwin_string.set(F(" "));
|
||||||
else {
|
else {
|
||||||
time.toDigital(buffer);
|
time.toDigital(buffer);
|
||||||
dwin_string.set(buffer);
|
dwin_string.set(buffer);
|
||||||
}
|
}
|
||||||
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, 378, 170, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, 378, 170, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
else if (!ui.did_first_redraw || old_is_printing != print_job_timer.isRunning()) {
|
else if (!ui.did_first_redraw || old_is_printing != print_job_timer.isRunning()) {
|
||||||
dwin_string.set(F(" "));
|
dwin_string.set(F(" "));
|
||||||
dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(dwin_string.string()));
|
dwinDrawString(true, font14x28, COLOR_ICONBLUE, COLOR_BG_BLACK, 336, 170, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -403,7 +403,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)();
|
const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)();
|
||||||
|
|
||||||
if (!ui.did_first_redraw)
|
if (!ui.did_first_redraw)
|
||||||
dwinDrawRectangle(0, Select_Color, pb_left, pb_top, pb_right, pb_bottom); // Outline
|
dwinDrawRectangle(0, COLOR_SELECT, pb_left, pb_top, pb_right, pb_bottom); // Outline
|
||||||
|
|
||||||
static uint16_t old_solid = 50;
|
static uint16_t old_solid = 50;
|
||||||
const uint16_t pb_solid = (pb_width - 2) * (progress / (PROGRESS_SCALE)) * 0.01f;
|
const uint16_t pb_solid = (pb_width - 2) * (progress / (PROGRESS_SCALE)) * 0.01f;
|
||||||
@@ -411,16 +411,16 @@ void MarlinUI::draw_status_screen() {
|
|||||||
|
|
||||||
if (p_draw) {
|
if (p_draw) {
|
||||||
//if (pb_solid)
|
//if (pb_solid)
|
||||||
dwinDrawRectangle(1, Select_Color, pb_left + 1, pb_top + 1, pb_left + pb_solid, pb_bottom - 1); // Fill the solid part
|
dwinDrawRectangle(1, COLOR_SELECT, pb_left + 1, pb_top + 1, pb_left + pb_solid, pb_bottom - 1); // Fill the solid part
|
||||||
|
|
||||||
//if (pb_solid < old_solid)
|
//if (pb_solid < old_solid)
|
||||||
dwinDrawRectangle(1, Color_Bg_Black, pb_left + 1 + pb_solid, pb_top + 1, pb_right - 1, pb_bottom - 1); // Erase the rest
|
dwinDrawRectangle(1, COLOR_BG_BLACK, pb_left + 1 + pb_solid, pb_top + 1, pb_right - 1, pb_bottom - 1); // Erase the rest
|
||||||
|
|
||||||
#if ENABLED(SHOW_PROGRESS_PERCENT)
|
#if ENABLED(SHOW_PROGRESS_PERCENT)
|
||||||
dwin_string.set(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
|
dwin_string.set(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
|
||||||
dwin_string.add('%');
|
dwin_string.add('%');
|
||||||
dwinDrawString(
|
dwinDrawString(
|
||||||
false, font16x32, Percent_Color, Color_Bg_Black,
|
false, font16x32, COLOR_PERCENT, COLOR_BG_BLACK,
|
||||||
pb_left + (pb_width - dwin_string.length * 16) / 2,
|
pb_left + (pb_width - dwin_string.length * 16) / 2,
|
||||||
pb_top + (pb_height - 32) / 2 - 1,
|
pb_top + (pb_height - 32) / 2 - 1,
|
||||||
S(dwin_string.string())
|
S(dwin_string.string())
|
||||||
|
@@ -63,22 +63,22 @@
|
|||||||
#include "dwin_popup.h"
|
#include "dwin_popup.h"
|
||||||
#include "bedlevel_tools.h"
|
#include "bedlevel_tools.h"
|
||||||
|
|
||||||
BedLevelToolsClass bedLevelTools;
|
BedLevelTools bedLevelTools;
|
||||||
|
|
||||||
#if ENABLED(USE_GRID_MESHVIEWER)
|
#if ENABLED(USE_GRID_MESHVIEWER)
|
||||||
bool BedLevelToolsClass::viewer_asymmetric_range = false;
|
bool BedLevelTools::viewer_asymmetric_range = false;
|
||||||
bool BedLevelToolsClass::viewer_print_value = false;
|
bool BedLevelTools::viewer_print_value = false;
|
||||||
#endif
|
#endif
|
||||||
bool BedLevelToolsClass::goto_mesh_value = false;
|
bool BedLevelTools::goto_mesh_value = false;
|
||||||
uint8_t BedLevelToolsClass::mesh_x = 0;
|
uint8_t BedLevelTools::mesh_x = 0;
|
||||||
uint8_t BedLevelToolsClass::mesh_y = 0;
|
uint8_t BedLevelTools::mesh_y = 0;
|
||||||
uint8_t BedLevelToolsClass::tilt_grid = 1;
|
uint8_t BedLevelTools::tilt_grid = 1;
|
||||||
|
|
||||||
bool drawing_mesh = false;
|
bool drawing_mesh = false;
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
|
||||||
void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) {
|
void BedLevelTools::manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) {
|
||||||
MString<MAX_CMD_SIZE> cmd;
|
MString<MAX_CMD_SIZE> cmd;
|
||||||
cmd.set(F("M421 I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3));
|
cmd.set(F("M421 I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3));
|
||||||
if (undefined) cmd += F(" N");
|
if (undefined) cmd += F(" N");
|
||||||
@@ -86,7 +86,7 @@ bool drawing_mesh = false;
|
|||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BedLevelToolsClass::create_plane_from_mesh() {
|
bool BedLevelTools::createPlaneFromMesh() {
|
||||||
struct linear_fit_data lsf_results;
|
struct linear_fit_data lsf_results;
|
||||||
incremental_LSF_reset(&lsf_results);
|
incremental_LSF_reset(&lsf_results);
|
||||||
GRID_LOOP(x, y) {
|
GRID_LOOP(x, y) {
|
||||||
@@ -126,7 +126,7 @@ bool drawing_mesh = false;
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y) {
|
void BedLevelTools::manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y) {
|
||||||
gcode.process_subcommands_now(
|
gcode.process_subcommands_now(
|
||||||
TS(F("G29 I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3))
|
TS(F("G29 I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3))
|
||||||
);
|
);
|
||||||
@@ -135,7 +135,7 @@ bool drawing_mesh = false;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) {
|
void BedLevelTools::manualMove(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) {
|
||||||
gcode.process_subcommands_now(F("G28O"));
|
gcode.process_subcommands_now(F("G28O"));
|
||||||
if (zmove) {
|
if (zmove) {
|
||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
@@ -144,48 +144,48 @@ void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y,
|
|||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DWIN_Show_Popup(ICON_BLTouch, F("Moving to Point"), F("Please wait until done."));
|
dwinShowPopup(ICON_BLTouch, F("Moving to Point"), F("Please wait until done."));
|
||||||
HMI_SaveProcessID(NothingToDo);
|
hmiSaveProcessID(ID_NothingToDo);
|
||||||
gcode.process_subcommands_now(TS(F("G0 F300 Z"), p_float_t(Z_CLEARANCE_BETWEEN_PROBES, 3)));
|
gcode.process_subcommands_now(TS(F("G0 F300 Z"), p_float_t(Z_CLEARANCE_BETWEEN_PROBES, 3)));
|
||||||
gcode.process_subcommands_now(TS(F("G42 F4000 I"), mesh_x, F(" J"), mesh_y));
|
gcode.process_subcommands_now(TS(F("G42 F4000 I"), mesh_x, F(" J"), mesh_y));
|
||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES;
|
current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES;
|
||||||
planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder);
|
planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder);
|
||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
HMI_ReturnScreen();
|
hmiReturnScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move / Probe methods. As examples, not yet used.
|
// Move / Probe methods. As examples, not yet used.
|
||||||
void BedLevelToolsClass::MoveToXYZ() {
|
void BedLevelTools::moveToXYZ() {
|
||||||
bedLevelTools.goto_mesh_value = true;
|
goto_mesh_value = true;
|
||||||
bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, false);
|
manualMove(mesh_x, mesh_y, false);
|
||||||
}
|
}
|
||||||
void BedLevelToolsClass::MoveToXY() {
|
void BedLevelTools::moveToXY() {
|
||||||
bedLevelTools.goto_mesh_value = false;
|
goto_mesh_value = false;
|
||||||
bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, false);
|
manualMove(mesh_x, mesh_y, false);
|
||||||
}
|
}
|
||||||
void BedLevelToolsClass::MoveToZ() {
|
void BedLevelTools::moveToZ() {
|
||||||
bedLevelTools.goto_mesh_value = true;
|
goto_mesh_value = true;
|
||||||
bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, true);
|
manualMove(mesh_x, mesh_y, true);
|
||||||
}
|
}
|
||||||
void BedLevelToolsClass::ProbeXY() {
|
void BedLevelTools::probeXY() {
|
||||||
gcode.process_subcommands_now(
|
gcode.process_subcommands_now(
|
||||||
MString<MAX_CMD_SIZE>(
|
MString<MAX_CMD_SIZE>(
|
||||||
F("G28O\nG0Z"), uint16_t(Z_CLEARANCE_DEPLOY_PROBE),
|
F("G28O\nG0Z"), uint16_t(Z_CLEARANCE_DEPLOY_PROBE),
|
||||||
F("\nG30X"), p_float_t(bedlevel.get_mesh_x(bedLevelTools.mesh_x), 2),
|
F("\nG30X"), p_float_t(bedlevel.get_mesh_x(mesh_x), 2),
|
||||||
F("Y"), p_float_t(bedlevel.get_mesh_y(bedLevelTools.mesh_y), 2)
|
F("Y"), p_float_t(bedlevel.get_mesh_y(mesh_y), 2)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BedLevelToolsClass::mesh_reset() {
|
void BedLevelTools::meshReset() {
|
||||||
ZERO(bedlevel.z_values);
|
ZERO(bedlevel.z_values);
|
||||||
TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level());
|
TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
float BedLevelToolsClass::get_max_value() {
|
float BedLevelTools::getMaxValue() {
|
||||||
float max = __FLT_MAX__ * -1;
|
float max = __FLT_MAX__ * -1;
|
||||||
GRID_LOOP(x, y) {
|
GRID_LOOP(x, y) {
|
||||||
if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max)
|
if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max)
|
||||||
@@ -194,7 +194,7 @@ float BedLevelToolsClass::get_max_value() {
|
|||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
float BedLevelToolsClass::get_min_value() {
|
float BedLevelTools::getMinValue() {
|
||||||
float min = __FLT_MAX__;
|
float min = __FLT_MAX__;
|
||||||
GRID_LOOP(x, y) {
|
GRID_LOOP(x, y) {
|
||||||
if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min)
|
if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min)
|
||||||
@@ -204,7 +204,7 @@ float BedLevelToolsClass::get_min_value() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return 'true' if mesh is good and within LCD limits
|
// Return 'true' if mesh is good and within LCD limits
|
||||||
bool BedLevelToolsClass::meshvalidate() {
|
bool BedLevelTools::meshValidate() {
|
||||||
GRID_LOOP(x, y) {
|
GRID_LOOP(x, y) {
|
||||||
const float v = bedlevel.z_values[x][y];
|
const float v = bedlevel.z_values[x][y];
|
||||||
if (isnan(v) || !WITHIN(v, UBL_Z_OFFSET_MIN, UBL_Z_OFFSET_MAX)) return false;
|
if (isnan(v) || !WITHIN(v, UBL_Z_OFFSET_MIN, UBL_Z_OFFSET_MAX)) return false;
|
||||||
@@ -216,21 +216,21 @@ bool BedLevelToolsClass::meshvalidate() {
|
|||||||
|
|
||||||
constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12);
|
constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12);
|
||||||
|
|
||||||
void BedLevelToolsClass::Draw_Bed_Mesh(int16_t selected/*=-1*/, uint8_t gridline_width/*=1*/, uint16_t padding_x/*=8*/, uint16_t padding_y_top/*=(40 + 53 - 7)*/) {
|
void BedLevelTools::drawBedMesh(int16_t selected/*=-1*/, uint8_t gridline_width/*=1*/, uint16_t padding_x/*=8*/, uint16_t padding_y_top/*=(40 + 53 - 7)*/) {
|
||||||
drawing_mesh = true;
|
drawing_mesh = true;
|
||||||
const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x;
|
const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x;
|
||||||
const uint16_t cell_width_px = total_width_px / (GRID_MAX_POINTS_X);
|
const uint16_t cell_width_px = total_width_px / (GRID_MAX_POINTS_X);
|
||||||
const uint16_t cell_height_px = total_width_px / (GRID_MAX_POINTS_Y);
|
const uint16_t cell_height_px = total_width_px / (GRID_MAX_POINTS_Y);
|
||||||
const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max);
|
const float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max);
|
||||||
|
|
||||||
// Clear background from previous selection and select new square
|
// Clear background from previous selection and select new square
|
||||||
dwinDrawRectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px);
|
dwinDrawRectangle(1, COLOR_BG_BLACK, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px);
|
||||||
if (selected >= 0) {
|
if (selected >= 0) {
|
||||||
const auto selected_y = selected / (GRID_MAX_POINTS_X);
|
const auto selected_y = selected / (GRID_MAX_POINTS_X);
|
||||||
const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y;
|
const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y;
|
||||||
const auto start_y_px = padding_y_top + selected_y * cell_height_px;
|
const auto start_y_px = padding_y_top + selected_y * cell_height_px;
|
||||||
const auto start_x_px = padding_x + selected_x * cell_width_px;
|
const auto start_x_px = padding_x + selected_x * cell_width_px;
|
||||||
dwinDrawRectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px);
|
dwinDrawRectangle(1, COLOR_WHITE, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw value square grid
|
// Draw value square grid
|
||||||
@@ -240,7 +240,7 @@ bool BedLevelToolsClass::meshvalidate() {
|
|||||||
const auto start_y_px = padding_y_top + ((GRID_MAX_POINTS_Y) - y - 1) * cell_height_px;
|
const auto start_y_px = padding_y_top + ((GRID_MAX_POINTS_Y) - y - 1) * cell_height_px;
|
||||||
const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width;
|
const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width;
|
||||||
dwinDrawRectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/
|
dwinDrawRectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/
|
||||||
isnan(bedlevel.z_values[x][y]) ? Color_Grey : ( // gray if undefined
|
isnan(bedlevel.z_values[x][y]) ? COLOR_GREY : ( // gray if undefined
|
||||||
(bedlevel.z_values[x][y] < 0 ?
|
(bedlevel.z_values[x][y] < 0 ?
|
||||||
(uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative
|
(uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative
|
||||||
(uint16_t)round(0x3F * bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_max)) << 5) | // green if mesh point value is positive
|
(uint16_t)round(0x3F * bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_max)) << 5) | // green if mesh point value is positive
|
||||||
@@ -257,7 +257,7 @@ bool BedLevelToolsClass::meshvalidate() {
|
|||||||
if (viewer_print_value) {
|
if (viewer_print_value) {
|
||||||
int8_t offset_x, offset_y = cell_height_px / 2 - fs;
|
int8_t offset_x, offset_y = cell_height_px / 2 - fs;
|
||||||
if (isnan(bedlevel.z_values[x][y])) { // undefined
|
if (isnan(bedlevel.z_values[x][y])) { // undefined
|
||||||
dwinDrawString(false, meshfont, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X"));
|
dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X"));
|
||||||
}
|
}
|
||||||
else { // has value
|
else { // has value
|
||||||
if (GRID_MAX_POINTS_X < (ENABLED(TJC_DISPLAY) ? 8 : 10))
|
if (GRID_MAX_POINTS_X < (ENABLED(TJC_DISPLAY) ? 8 : 10))
|
||||||
@@ -266,8 +266,8 @@ bool BedLevelToolsClass::meshvalidate() {
|
|||||||
sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100));
|
sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100));
|
||||||
offset_x = cell_width_px / 2 - (fs/2) * (strlen(buf)) - 2;
|
offset_x = cell_width_px / 2 - (fs/2) * (strlen(buf)) - 2;
|
||||||
if (!(GRID_MAX_POINTS_X < (ENABLED(TJC_DISPLAY) ? 8 : 10)))
|
if (!(GRID_MAX_POINTS_X < (ENABLED(TJC_DISPLAY) ? 8 : 10)))
|
||||||
dwinDrawString(false, meshfont, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y, F("."));
|
dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px - 2 + offset_x, start_y_px + offset_y, F("."));
|
||||||
dwinDrawString(false, meshfont, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y, buf);
|
dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + 1 + offset_x, start_y_px + offset_y, buf);
|
||||||
}
|
}
|
||||||
safe_delay(10);
|
safe_delay(10);
|
||||||
LCD_SERIAL.flushTX();
|
LCD_SERIAL.flushTX();
|
||||||
@@ -275,8 +275,8 @@ bool BedLevelToolsClass::meshvalidate() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BedLevelToolsClass::Set_Mesh_Viewer_Status() { // TODO: draw gradient with values as a legend instead
|
void BedLevelTools::setMeshViewerStatus() { // TODO: draw gradient with values as a legend instead
|
||||||
float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max);
|
float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max);
|
||||||
if (v_min > 3e+10f) v_min = 0.0000001;
|
if (v_min > 3e+10f) v_min = 0.0000001;
|
||||||
if (v_max > 3e+10f) v_max = 0.0000001;
|
if (v_max > 3e+10f) v_max = 0.0000001;
|
||||||
if (range > 3e+10f) range = 0.0000001;
|
if (range > 3e+10f) range = 0.0000001;
|
||||||
|
@@ -50,36 +50,35 @@
|
|||||||
#define UBL_Z_OFFSET_MIN -3.0
|
#define UBL_Z_OFFSET_MIN -3.0
|
||||||
#define UBL_Z_OFFSET_MAX 3.0
|
#define UBL_Z_OFFSET_MAX 3.0
|
||||||
|
|
||||||
class BedLevelToolsClass {
|
class BedLevelTools {
|
||||||
public:
|
public:
|
||||||
#if ENABLED(USE_GRID_MESHVIEWER)
|
#if ENABLED(USE_GRID_MESHVIEWER)
|
||||||
static bool viewer_asymmetric_range;
|
static bool viewer_asymmetric_range;
|
||||||
static bool viewer_print_value;
|
static bool viewer_print_value;
|
||||||
#endif
|
#endif
|
||||||
static bool goto_mesh_value;
|
static bool goto_mesh_value;
|
||||||
static uint8_t mesh_x;
|
static uint8_t mesh_x, mesh_y;
|
||||||
static uint8_t mesh_y;
|
|
||||||
static uint8_t tilt_grid;
|
static uint8_t tilt_grid;
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined=false);
|
static void manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined=false);
|
||||||
static bool create_plane_from_mesh();
|
static bool createPlaneFromMesh();
|
||||||
#else
|
#else
|
||||||
static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y);
|
static void manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y);
|
||||||
#endif
|
#endif
|
||||||
static void manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove=false);
|
static void manualMove(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove=false);
|
||||||
static void MoveToXYZ();
|
static void moveToXYZ();
|
||||||
static void MoveToXY();
|
static void moveToXY();
|
||||||
static void MoveToZ();
|
static void moveToZ();
|
||||||
static void ProbeXY();
|
static void probeXY();
|
||||||
static void mesh_reset();
|
static void meshReset();
|
||||||
static float get_max_value();
|
static float getMaxValue();
|
||||||
static float get_min_value();
|
static float getMinValue();
|
||||||
static bool meshvalidate();
|
static bool meshValidate();
|
||||||
#if ENABLED(USE_GRID_MESHVIEWER)
|
#if ENABLED(USE_GRID_MESHVIEWER)
|
||||||
static void Draw_Bed_Mesh(int16_t selected=-1, uint8_t gridline_width=1, uint16_t padding_x=8, uint16_t padding_y_top=(40 + 53 - 7));
|
static void drawBedMesh(int16_t selected=-1, uint8_t gridline_width=1, uint16_t padding_x=8, uint16_t padding_y_top=(40 + 53 - 7));
|
||||||
static void Set_Mesh_Viewer_Status();
|
static void setMeshViewerStatus();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
extern BedLevelToolsClass bedLevelTools;
|
extern BedLevelTools bedLevelTools;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -54,31 +54,31 @@ namespace GET_LANG(LCD_LANGUAGE) {
|
|||||||
|
|
||||||
enum processID : uint8_t {
|
enum processID : uint8_t {
|
||||||
// Process ID
|
// Process ID
|
||||||
MainMenu,
|
ID_MainMenu,
|
||||||
Menu,
|
ID_Menu,
|
||||||
SetInt,
|
ID_SetInt,
|
||||||
SetPInt,
|
ID_SetPInt,
|
||||||
SetIntNoDraw,
|
ID_SetIntNoDraw,
|
||||||
SetFloat,
|
ID_SetFloat,
|
||||||
SetPFloat,
|
ID_SetPFloat,
|
||||||
PrintProcess,
|
ID_PrintProcess,
|
||||||
Popup,
|
ID_Popup,
|
||||||
Leveling,
|
ID_Leveling,
|
||||||
Locked,
|
ID_Locked,
|
||||||
Reboot,
|
ID_Reboot,
|
||||||
PrintDone,
|
ID_PrintDone,
|
||||||
ESDiagProcess,
|
ID_ESDiagProcess,
|
||||||
WaitResponse,
|
ID_WaitResponse,
|
||||||
Homing,
|
ID_Homing,
|
||||||
PidProcess,
|
ID_PIDProcess,
|
||||||
MPCProcess,
|
ID_MPCProcess,
|
||||||
NothingToDo
|
ID_NothingToDo
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ANY(DWIN_PID_TUNE, MPC_AUTOTUNE)
|
#if ANY(PROUI_PID_TUNE, MPC_AUTOTUNE)
|
||||||
|
|
||||||
enum tempcontrol_t : uint8_t {
|
enum tempcontrol_t : uint8_t {
|
||||||
#if DWIN_PID_TUNE
|
#if PROUI_PID_TUNE
|
||||||
PIDTEMP_START,
|
PIDTEMP_START,
|
||||||
PIDTEMPBED_START,
|
PIDTEMPBED_START,
|
||||||
PID_BAD_HEATER_ID,
|
PID_BAD_HEATER_ID,
|
||||||
@@ -100,69 +100,69 @@ enum processID : uint8_t {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// Color settings
|
// Color settings
|
||||||
uint16_t Background_Color;
|
uint16_t colorBackground;
|
||||||
uint16_t Cursor_Color;
|
uint16_t colorCursor;
|
||||||
uint16_t TitleBg_Color;
|
uint16_t colorTitleBg;
|
||||||
uint16_t TitleTxt_Color;
|
uint16_t colorTitleTxt;
|
||||||
uint16_t Text_Color;
|
uint16_t colorText;
|
||||||
uint16_t Selected_Color;
|
uint16_t colorSelected;
|
||||||
uint16_t SplitLine_Color;
|
uint16_t colorSplitLine;
|
||||||
uint16_t Highlight_Color;
|
uint16_t colorHighlight;
|
||||||
uint16_t StatusBg_Color;
|
uint16_t colorStatusBg;
|
||||||
uint16_t StatusTxt_Color;
|
uint16_t colorStatusTxt;
|
||||||
uint16_t PopupBg_Color;
|
uint16_t colorPopupBg;
|
||||||
uint16_t PopupTxt_Color;
|
uint16_t colorPopupTxt;
|
||||||
uint16_t AlertBg_Color;
|
uint16_t colorAlertBg;
|
||||||
uint16_t AlertTxt_Color;
|
uint16_t colorAlertTxt;
|
||||||
uint16_t PercentTxt_Color;
|
uint16_t colorPercentTxt;
|
||||||
uint16_t Barfill_Color;
|
uint16_t colorBarfill;
|
||||||
uint16_t Indicator_Color;
|
uint16_t colorIndicator;
|
||||||
uint16_t Coordinate_Color;
|
uint16_t colorCoordinate;
|
||||||
|
|
||||||
// Temperatures
|
// Temperatures
|
||||||
#if DWIN_PID_TUNE
|
#if PROUI_PID_TUNE
|
||||||
int16_t PidCycles = DEF_PIDCYCLES;
|
int16_t pidCycles = DEF_PIDCYCLES;
|
||||||
#if ENABLED(PIDTEMP)
|
#if ENABLED(PIDTEMP)
|
||||||
int16_t HotendPidT = DEF_HOTENDPIDT;
|
int16_t hotendPidT = DEF_HOTENDPIDT;
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(PIDTEMPBED)
|
#if ENABLED(PIDTEMPBED)
|
||||||
int16_t BedPidT = DEF_BEDPIDT;
|
int16_t bedPidT = DEF_BEDPIDT;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||||
int16_t ExtMinT = EXTRUDE_MINTEMP;
|
int16_t extMinT = EXTRUDE_MINTEMP;
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(PREHEAT_BEFORE_LEVELING)
|
#if ENABLED(PREHEAT_BEFORE_LEVELING)
|
||||||
int16_t BedLevT = LEVELING_BED_TEMP;
|
int16_t bedLevT = LEVELING_BED_TEMP;
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(BAUD_RATE_GCODE)
|
#if ENABLED(BAUD_RATE_GCODE)
|
||||||
bool Baud115K = false;
|
bool baud115K = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool FullManualTramming = false;
|
bool fullManualTramming = false;
|
||||||
bool MediaSort = true;
|
bool mediaSort = true;
|
||||||
bool MediaAutoMount = ENABLED(HAS_SD_EXTENDER);
|
bool mediaAutoMount = ENABLED(HAS_SD_EXTENDER);
|
||||||
#if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING)
|
#if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING)
|
||||||
uint8_t z_after_homing = DEF_Z_AFTER_HOMING;
|
uint8_t zAfterHoming = DEF_Z_AFTER_HOMING;
|
||||||
#endif
|
#endif
|
||||||
#if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
#if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
||||||
LEDColor Led_Color = Def_Leds_Color;
|
LEDColor ledColor = defColorLeds;
|
||||||
#endif
|
#endif
|
||||||
bool AdaptiveStepSmoothing = true;
|
bool adaptiveStepSmoothing = true;
|
||||||
bool EnablePreview = true;
|
bool enablePreview = true;
|
||||||
} HMI_data_t;
|
} hmi_data_t;
|
||||||
|
|
||||||
extern HMI_data_t HMI_data;
|
extern hmi_data_t hmiData;
|
||||||
static constexpr size_t eeprom_data_size = sizeof(HMI_data_t);
|
static constexpr size_t eeprom_data_size = sizeof(hmi_data_t);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t Color[3]; // Color components
|
int8_t Color[3]; // Color components
|
||||||
#if ANY(DWIN_PID_TUNE, MPCTEMP)
|
#if ANY(PROUI_PID_TUNE, MPCTEMP)
|
||||||
tempcontrol_t tempcontrol = AUTOTUNE_DONE;
|
tempcontrol_t tempControl = AUTOTUNE_DONE;
|
||||||
#endif
|
#endif
|
||||||
uint8_t Select = 0; // Auxiliary selector variable
|
uint8_t select = 0; // Auxiliary selector variable
|
||||||
AxisEnum axis = X_AXIS; // Axis Select
|
AxisEnum axis = X_AXIS; // Axis Select
|
||||||
} HMI_value_t;
|
} hmi_value_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t language;
|
uint8_t language;
|
||||||
@@ -171,10 +171,10 @@ typedef struct {
|
|||||||
bool pause_flag:1; // printing is paused
|
bool pause_flag:1; // printing is paused
|
||||||
bool select_flag:1; // Popup button selected
|
bool select_flag:1; // Popup button selected
|
||||||
bool home_flag:1; // homing in course
|
bool home_flag:1; // homing in course
|
||||||
} HMI_flag_t;
|
} hmi_flag_t;
|
||||||
|
|
||||||
extern HMI_value_t HMI_value;
|
extern hmi_value_t hmiValue;
|
||||||
extern HMI_flag_t hmiFlag;
|
extern hmi_flag_t hmiFlag;
|
||||||
extern uint8_t checkkey;
|
extern uint8_t checkkey;
|
||||||
|
|
||||||
// Popups
|
// Popups
|
||||||
@@ -182,217 +182,214 @@ extern uint8_t checkkey;
|
|||||||
void dwinPopupTemperature(const bool toohigh);
|
void dwinPopupTemperature(const bool toohigh);
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||||
void Popup_PowerLossRecovery();
|
void popupPowerLossRecovery();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Tool Functions
|
// Tool Functions
|
||||||
uint32_t GetHash(char * str);
|
uint32_t getHash(char * str);
|
||||||
#if ENABLED(EEPROM_SETTINGS)
|
#if ENABLED(EEPROM_SETTINGS)
|
||||||
void WriteEeprom();
|
void writeEEPROM();
|
||||||
void ReadEeprom();
|
void readEEPROM();
|
||||||
void ResetEeprom();
|
void resetEEPROM();
|
||||||
#if HAS_MESH
|
#if HAS_MESH
|
||||||
void SaveMesh();
|
void saveMesh();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
void RebootPrinter();
|
void rebootPrinter();
|
||||||
void DisableMotors();
|
void disableMotors();
|
||||||
void AutoLev();
|
void autoLevel();
|
||||||
void AutoHome();
|
void autoHome();
|
||||||
#if HAS_PREHEAT
|
#if HAS_PREHEAT
|
||||||
#define _DOPREHEAT(N) void DoPreheat##N();
|
#define _DOPREHEAT(N) void DoPreheat##N();
|
||||||
REPEAT_1(PREHEAT_COUNT, _DOPREHEAT)
|
REPEAT_1(PREHEAT_COUNT, _DOPREHEAT)
|
||||||
#endif
|
#endif
|
||||||
void DoCoolDown();
|
void doCoolDown();
|
||||||
#if ENABLED(BAUD_RATE_GCODE)
|
#if ENABLED(BAUD_RATE_GCODE)
|
||||||
void HMI_SetBaudRate();
|
void hmiSetBaudRate();
|
||||||
void SetBaud115K();
|
void setBaud115K();
|
||||||
void SetBaud250K();
|
void setBaud250K();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_LCD_BRIGHTNESS
|
#if HAS_LCD_BRIGHTNESS
|
||||||
void TurnOffBacklight();
|
void turnOffBacklight();
|
||||||
#endif
|
#endif
|
||||||
void ApplyExtMinT();
|
void applyExtMinT();
|
||||||
void ParkHead();
|
void parkHead();
|
||||||
#if HAS_ONESTEP_LEVELING
|
#if HAS_ONESTEP_LEVELING
|
||||||
void Trammingwizard();
|
void trammingwizard();
|
||||||
#endif
|
#endif
|
||||||
#if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
#if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
||||||
void ApplyLEDColor();
|
void applyLEDColor();
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
void UBLMeshTilt();
|
void ublMeshTilt();
|
||||||
void UBLMeshSave();
|
void ublMeshSave();
|
||||||
void UBLMeshLoad();
|
void ublMeshLoad();
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(HOST_SHUTDOWN_MENU_ITEM) && defined(SHUTDOWN_ACTION)
|
#if ENABLED(HOST_SHUTDOWN_MENU_ITEM) && defined(SHUTDOWN_ACTION)
|
||||||
void HostShutDown();
|
void hostShutDown();
|
||||||
#endif
|
#endif
|
||||||
#if DISABLED(HAS_BED_PROBE)
|
#if DISABLED(HAS_BED_PROBE)
|
||||||
void HomeZandDisable();
|
void homeZAndDisable();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
void Goto_PrintProcess();
|
void gotoPrintProcess();
|
||||||
void Goto_Main_Menu();
|
void gotoMainMenu();
|
||||||
void Goto_Info_Menu();
|
void gotoInfoMenu();
|
||||||
void Goto_PowerLossRecovery();
|
void gotoPowerLossRecovery();
|
||||||
void Goto_ConfirmToPrint();
|
void gotoConfirmToPrint();
|
||||||
void DWIN_Draw_Dashboard(const bool with_update); // Status Area
|
void dwinDrawDashboard(const bool with_update); // Status Area
|
||||||
void Draw_Main_Area(); // Redraw main area
|
void drawMainArea(); // Redraw main area
|
||||||
void DWIN_DrawStatusLine(const char *text = ""); // Draw simple status text
|
void dwinDrawStatusLine(const char *text = ""); // Draw simple status text
|
||||||
void DWIN_RedrawDash(); // Redraw Dash and Status line
|
void dwinRedrawDash(); // Redraw Dash and Status line
|
||||||
void DWIN_RedrawScreen(); // Redraw all screen elements
|
void dwinRedrawScreen(); // Redraw all screen elements
|
||||||
void HMI_MainMenu(); // Main process screen
|
void hmiMainMenu(); // Main process screen
|
||||||
void HMI_Printing(); // Print page
|
void hmiPrinting(); // Print page
|
||||||
void HMI_ReturnScreen(); // Return to previous screen before popups
|
void hmiReturnScreen(); // Return to previous screen before popups
|
||||||
void HMI_WaitForUser();
|
void hmiWaitForUser();
|
||||||
void HMI_SaveProcessID(const uint8_t id);
|
void hmiSaveProcessID(const uint8_t id);
|
||||||
void HMI_SDCardUpdate();
|
void hmiSDCardUpdate();
|
||||||
void EachMomentUpdate();
|
void eachMomentUpdate();
|
||||||
void update_variable();
|
void updateVariable();
|
||||||
void dwinInitScreen();
|
void dwinInitScreen();
|
||||||
void DWIN_HandleScreen();
|
void dwinHandleScreen();
|
||||||
void DWIN_CheckStatusMessage();
|
void dwinCheckStatusMessage();
|
||||||
void dwinHomingStart();
|
void dwinHomingStart();
|
||||||
void dwinHomingDone();
|
void dwinHomingDone();
|
||||||
#if HAS_MESH
|
#if HAS_MESH
|
||||||
void DWIN_MeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval);
|
void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval);
|
||||||
#endif
|
#endif
|
||||||
void DWIN_LevelingStart();
|
void dwinLevelingStart();
|
||||||
void DWIN_LevelingDone();
|
void dwinLevelingDone();
|
||||||
void DWIN_Print_Started();
|
void dwinPrintStarted();
|
||||||
void DWIN_Print_Pause();
|
void dwinPrintPause();
|
||||||
void DWIN_Print_Resume();
|
void dwinPrintResume();
|
||||||
void DWIN_Print_Finished();
|
void dwinPrintFinished();
|
||||||
void DWIN_Print_Aborted();
|
void dwinPrintAborted();
|
||||||
#if HAS_FILAMENT_SENSOR
|
#if HAS_FILAMENT_SENSOR
|
||||||
void DWIN_FilamentRunout(const uint8_t extruder);
|
void dwinFilamentRunout(const uint8_t extruder);
|
||||||
#endif
|
#endif
|
||||||
void DWIN_Print_Header(const char *text);
|
void dwinPrintHeader(const char *text);
|
||||||
void DWIN_SetColorDefaults();
|
void dwinSetColorDefaults();
|
||||||
void DWIN_CopySettingsTo(char * const buff);
|
void dwinCopySettingsTo(char * const buff);
|
||||||
void DWIN_CopySettingsFrom(const char * const buff);
|
void dwinCopySettingsFrom(const char * const buff);
|
||||||
void DWIN_SetDataDefaults();
|
void dwinSetDataDefaults();
|
||||||
void DWIN_RebootScreen();
|
void dwinRebootScreen();
|
||||||
|
|
||||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button=0);
|
void dwinPopupPause(FSTR_P const fmsg, uint8_t button=0);
|
||||||
void Draw_Popup_FilamentPurge();
|
void drawPopupFilamentPurge();
|
||||||
void Goto_FilamentPurge();
|
void gotoFilamentPurge();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Utility and extensions
|
// Utility and extensions
|
||||||
#if HAS_LOCKSCREEN
|
#if HAS_LOCKSCREEN
|
||||||
void DWIN_LockScreen();
|
void dwinLockScreen();
|
||||||
void DWIN_UnLockScreen();
|
void dwinUnLockScreen();
|
||||||
void HMI_LockScreen();
|
void hmiLockScreen();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_MESH
|
#if HAS_MESH
|
||||||
void DWIN_MeshViewer();
|
void dwinMeshViewer();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_GCODE_PREVIEW
|
#if HAS_GCODE_PREVIEW
|
||||||
void HMI_ConfirmToPrint();
|
void hmiConfirmToPrint();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_ESDIAG
|
#if HAS_ESDIAG
|
||||||
void Draw_EndStopDiag();
|
void drawEndStopDiag();
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(PRINTCOUNTER)
|
#if ENABLED(PRINTCOUNTER)
|
||||||
void Draw_PrintStats();
|
void drawPrintStats();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Menu drawing functions
|
// Menu drawing functions
|
||||||
void Draw_Print_File_Menu();
|
void drawPrintFileMenu();
|
||||||
void Draw_Control_Menu();
|
void drawControlMenu();
|
||||||
void Draw_AdvancedSettings_Menu();
|
void drawAdvancedSettingsMenu();
|
||||||
void Draw_Prepare_Menu();
|
void drawPrepareMenu();
|
||||||
void Draw_Move_Menu();
|
void drawMoveMenu();
|
||||||
void Draw_Tramming_Menu();
|
void drawTrammingMenu();
|
||||||
#if HAS_HOME_OFFSET
|
#if HAS_HOME_OFFSET
|
||||||
void Draw_HomeOffset_Menu();
|
void drawHomeOffsetMenu();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_BED_PROBE
|
#if HAS_BED_PROBE
|
||||||
void Draw_ProbeSet_Menu();
|
void drawProbeSetMenu();
|
||||||
#endif
|
#endif
|
||||||
void Draw_FilSet_Menu();
|
void drawFilSetMenu();
|
||||||
#if ENABLED(NOZZLE_PARK_FEATURE)
|
#if ENABLED(NOZZLE_PARK_FEATURE)
|
||||||
void Draw_ParkPos_Menu();
|
void drawParkPosMenu();
|
||||||
#endif
|
#endif
|
||||||
void Draw_PhySet_Menu();
|
void drawPhySetMenu();
|
||||||
#if ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS)
|
#if ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS)
|
||||||
void Draw_CaseLight_Menu();
|
void drawCaseLightMenu();
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(LED_CONTROL_MENU)
|
#if ENABLED(LED_CONTROL_MENU)
|
||||||
void Draw_LedControl_Menu();
|
void drawLedControlMenu();
|
||||||
#endif
|
#endif
|
||||||
void Draw_Tune_Menu();
|
void drawTuneMenu();
|
||||||
void Draw_Motion_Menu();
|
void drawMotionMenu();
|
||||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
void Draw_FilamentMan_Menu();
|
void drawFilamentManMenu();
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(MESH_BED_LEVELING)
|
#if ENABLED(MESH_BED_LEVELING)
|
||||||
void Draw_ManualMesh_Menu();
|
void drawManualMeshMenu();
|
||||||
#endif
|
#endif
|
||||||
void Draw_Temperature_Menu();
|
void drawTemperatureMenu();
|
||||||
void Draw_MaxSpeed_Menu();
|
void drawMaxSpeedMenu();
|
||||||
void Draw_MaxAccel_Menu();
|
void drawMaxAccelMenu();
|
||||||
#if HAS_CLASSIC_JERK
|
#if HAS_CLASSIC_JERK
|
||||||
void Draw_MaxJerk_Menu();
|
void drawMaxJerkMenu();
|
||||||
#endif
|
#endif
|
||||||
void Draw_Steps_Menu();
|
void drawStepsMenu();
|
||||||
#if ANY(HAS_BED_PROBE, BABYSTEPPING)
|
#if ANY(HAS_BED_PROBE, BABYSTEPPING)
|
||||||
void Draw_ZOffsetWiz_Menu();
|
void drawZOffsetWizMenu();
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
|
#if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
|
||||||
void Draw_Homing_Menu();
|
void drawHomingMenu();
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(FWRETRACT)
|
#if ENABLED(FWRETRACT)
|
||||||
void Draw_FWRetract_Menu();
|
void drawFWRetractMenu();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_MESH
|
#if HAS_MESH
|
||||||
void Draw_MeshSet_Menu();
|
void drawMeshSetMenu();
|
||||||
#if ENABLED(MESH_EDIT_MENU)
|
#if ENABLED(MESH_EDIT_MENU)
|
||||||
void Draw_EditMesh_Menu();
|
void drawEditMeshMenu();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TRINAMIC_CONFIG
|
|
||||||
void Draw_TrinamicConfig_menu();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Custom colors editing
|
// Custom colors editing
|
||||||
#if HAS_CUSTOM_COLORS
|
#if HAS_CUSTOM_COLORS
|
||||||
void DWIN_ApplyColor();
|
void dwinApplyColor();
|
||||||
void Draw_SelectColors_Menu();
|
void drawSelectColorsMenu();
|
||||||
void Draw_GetColor_Menu();
|
void drawGetColorMenu();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// PID
|
// PID
|
||||||
#if DWIN_PID_TUNE
|
#if PROUI_PID_TUNE
|
||||||
#include "../../../module/temperature.h"
|
#include "../../../module/temperature.h"
|
||||||
void DWIN_StartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp);
|
void dwinStartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp);
|
||||||
void DWIN_PidTuning(tempcontrol_t result);
|
void dwinPidTuning(tempcontrol_t result);
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(PIDTEMP)
|
#if ENABLED(PIDTEMP)
|
||||||
#if ENABLED(PID_AUTOTUNE_MENU)
|
#if ENABLED(PID_AUTOTUNE_MENU)
|
||||||
void HotendPID();
|
void hotendPID();
|
||||||
#endif
|
#endif
|
||||||
#if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU)
|
#if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU)
|
||||||
void Draw_HotendPID_Menu();
|
void drawHotendPIDMenu();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(PIDTEMPBED)
|
#if ENABLED(PIDTEMPBED)
|
||||||
#if ENABLED(PID_AUTOTUNE_MENU)
|
#if ENABLED(PID_AUTOTUNE_MENU)
|
||||||
void BedPID();
|
void bedPID();
|
||||||
#endif
|
#endif
|
||||||
#if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU)
|
#if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU)
|
||||||
void Draw_BedPID_Menu();
|
void drawBedPIDMenu();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MPC
|
// MPC
|
||||||
#if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU)
|
#if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU)
|
||||||
void Draw_HotendMPC_Menu();
|
void drawHotendMPCMenu();
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(MPC_AUTOTUNE)
|
#if ENABLED(MPC_AUTOTUNE)
|
||||||
void DWIN_MPCTuning(tempcontrol_t result);
|
void dwinMPCTuning(tempcontrol_t result);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -46,30 +46,30 @@
|
|||||||
#define HAS_ZOFFSET_ITEM 1
|
#define HAS_ZOFFSET_ITEM 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define Def_Background_Color RGB( 1, 12, 8)
|
#define defColorBackground RGB( 1, 12, 8)
|
||||||
#define Def_Cursor_Color RGB(20, 49, 31)
|
#define defColorCursor RGB(20, 49, 31)
|
||||||
#define Def_TitleBg_Color RGB( 0, 23, 16)
|
#define defColorTitleBg RGB( 0, 23, 16)
|
||||||
#define Def_TitleTxt_Color Color_White
|
#define defColorTitleTxt COLOR_WHITE
|
||||||
#define Def_Text_Color Color_White
|
#define defColorText COLOR_WHITE
|
||||||
#define Def_Selected_Color Select_Color
|
#define defColorSelected COLOR_SELECT
|
||||||
#define Def_SplitLine_Color RGB( 0, 23, 16)
|
#define defColorSplitLine RGB( 0, 23, 16)
|
||||||
#define Def_Highlight_Color Color_White
|
#define defColorHighlight COLOR_WHITE
|
||||||
#define Def_StatusBg_Color RGB( 0, 23, 16)
|
#define defColorStatusBg RGB( 0, 23, 16)
|
||||||
#define Def_StatusTxt_Color Color_Yellow
|
#define defColorStatusTxt COLOR_YELLOW
|
||||||
#define Def_PopupBg_Color Color_Bg_Window
|
#define defColorPopupBg COLOR_BG_WINDOW
|
||||||
#define Def_PopupTxt_Color Popup_Text_Color
|
#define defColorPopupTxt COLOR_POPUP_TEXT
|
||||||
#define Def_AlertBg_Color Color_Bg_Red
|
#define defColorAlertBg COLOR_BG_RED
|
||||||
#define Def_AlertTxt_Color Color_Yellow
|
#define defColorAlertTxt COLOR_YELLOW
|
||||||
#define Def_PercentTxt_Color Percent_Color
|
#define defColorPercentTxt COLOR_PERCENT
|
||||||
#define Def_Barfill_Color BarFill_Color
|
#define defColorBarfill COLOR_BARFILL
|
||||||
#define Def_Indicator_Color Color_White
|
#define defColorIndicator COLOR_WHITE
|
||||||
#define Def_Coordinate_Color Color_White
|
#define defColorCoordinate COLOR_WHITE
|
||||||
#define Def_Button_Color RGB( 0, 23, 16)
|
#define defColorButton RGB( 0, 23, 16)
|
||||||
#if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
#if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
||||||
#define Def_Leds_Color LEDColorWhite()
|
#define defColorLeds LEDColorWhite()
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(CASELIGHT_USES_BRIGHTNESS)
|
#if ENABLED(CASELIGHT_USES_BRIGHTNESS)
|
||||||
#define Def_CaseLight_Brightness 255
|
#define defCaseLightBrightness 255
|
||||||
#endif
|
#endif
|
||||||
#ifdef Z_AFTER_HOMING
|
#ifdef Z_AFTER_HOMING
|
||||||
#define DEF_Z_AFTER_HOMING Z_AFTER_HOMING
|
#define DEF_Z_AFTER_HOMING Z_AFTER_HOMING
|
||||||
|
@@ -42,7 +42,7 @@
|
|||||||
// QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16)
|
// QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16)
|
||||||
// (Nx, Ny): The coordinates of the upper left corner displayed by the QR code
|
// (Nx, Ny): The coordinates of the upper left corner displayed by the QR code
|
||||||
// str: multi-bit data
|
// str: multi-bit data
|
||||||
void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string) {
|
void dwinDrawQR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string) {
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
dwinByte(i, 0x21);
|
dwinByte(i, 0x21);
|
||||||
dwinWord(i, x);
|
dwinWord(i, x);
|
||||||
@@ -64,7 +64,7 @@ void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
|
|||||||
// xStart/yStart: Upper-left of virtual area
|
// xStart/yStart: Upper-left of virtual area
|
||||||
// xEnd/yEnd: Lower-right of virtual area
|
// xEnd/yEnd: Lower-right of virtual area
|
||||||
// x/y: Screen paste point
|
// x/y: Screen paste point
|
||||||
void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
|
void dwinFrameAreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
dwinByte(i, 0x26);
|
dwinByte(i, 0x26);
|
||||||
dwinWord(i, xStart);
|
dwinWord(i, xStart);
|
||||||
@@ -84,7 +84,7 @@ void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16
|
|||||||
// xStart/yStart: Upper-left of virtual area
|
// xStart/yStart: Upper-left of virtual area
|
||||||
// xEnd/yEnd: Lower-right of virtual area
|
// xEnd/yEnd: Lower-right of virtual area
|
||||||
// x/y: Screen paste point
|
// x/y: Screen paste point
|
||||||
void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
|
void dwinFrameAreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
dwinByte(i, 0x27);
|
dwinByte(i, 0x27);
|
||||||
dwinByte(i, (IBD & 1) << 7 | (BIR & 1) << 6 | (BFI & 1) << 5 | cacheID);
|
dwinByte(i, (IBD & 1) << 7 | (BIR & 1) << 6 | (BFI & 1) << 5 | cacheID);
|
||||||
@@ -102,8 +102,8 @@ void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t
|
|||||||
// xStart/yStart: Upper-left of virtual area
|
// xStart/yStart: Upper-left of virtual area
|
||||||
// xEnd/yEnd: Lower-right of virtual area
|
// xEnd/yEnd: Lower-right of virtual area
|
||||||
// x/y: Screen paste point
|
// x/y: Screen paste point
|
||||||
void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
|
void dwinFrameAreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
|
||||||
DWIN_Frame_AreaCopy(false, false, true, cacheID, xStart, yStart, xEnd, yEnd, x, y);
|
dwinFrameAreaCopy(false, false, true, cacheID, xStart, yStart, xEnd, yEnd, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write buffer data to the SRAM or Flash
|
// Write buffer data to the SRAM or Flash
|
||||||
@@ -111,7 +111,7 @@ void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint
|
|||||||
// addr: start address
|
// addr: start address
|
||||||
// length: Bytes to write
|
// length: Bytes to write
|
||||||
// data: address of the buffer with data
|
// data: address of the buffer with data
|
||||||
void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) {
|
void dwinWriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) {
|
||||||
const uint8_t max_size = 128;
|
const uint8_t max_size = 128;
|
||||||
uint16_t pending = length;
|
uint16_t pending = length;
|
||||||
uint16_t to_send;
|
uint16_t to_send;
|
||||||
@@ -156,7 +156,7 @@ void dwinIconShow(uint16_t x, uint16_t y, uint16_t addr) {
|
|||||||
|
|
||||||
// Write the contents of the 32KB SRAM data memory into the designated image memory space.
|
// Write the contents of the 32KB SRAM data memory into the designated image memory space.
|
||||||
// picID: Picture memory space location, 0x00-0x0F, each space is 32Kbytes
|
// picID: Picture memory space location, 0x00-0x0F, each space is 32Kbytes
|
||||||
void DWIN_SRAMToPic(uint8_t picID) {
|
void dwinSRAMToPic(uint8_t picID) {
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
dwinByte(i, 0x33);
|
dwinByte(i, 0x33);
|
||||||
dwinByte(i, 0x5A);
|
dwinByte(i, 0x5A);
|
||||||
@@ -167,7 +167,7 @@ void DWIN_SRAMToPic(uint8_t picID) {
|
|||||||
|
|
||||||
//--------------------------Test area -------------------------
|
//--------------------------Test area -------------------------
|
||||||
|
|
||||||
//void DWIN_ReadSRAM(uint16_t addr, const uint8_t length, const char * const data) {
|
//void dwinReadSRAM(uint16_t addr, const uint8_t length, const char * const data) {
|
||||||
// size_t i = 0;
|
// size_t i = 0;
|
||||||
// dwinByte(i, 0x32);
|
// dwinByte(i, 0x32);
|
||||||
// dwinByte(i, 0x5A); // 0x5A Read from SRAM - 0xA5 Read from Flash
|
// dwinByte(i, 0x5A); // 0x5A Read from SRAM - 0xA5 Read from Flash
|
||||||
|
@@ -35,10 +35,10 @@
|
|||||||
// QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16)
|
// QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16)
|
||||||
// (Nx, Ny): The coordinates of the upper left corner displayed by the QR code
|
// (Nx, Ny): The coordinates of the upper left corner displayed by the QR code
|
||||||
// str: multi-bit data
|
// str: multi-bit data
|
||||||
void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string);
|
void dwinDrawQR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string);
|
||||||
|
|
||||||
inline void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P title) {
|
inline void dwinDrawQR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P fTitle) {
|
||||||
DWIN_Draw_QR(QR_Pixel, x, y, (char *)title);
|
dwinDrawQR(QR_Pixel, x, y, (char *)fTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy area from virtual display area to current screen
|
// Copy area from virtual display area to current screen
|
||||||
@@ -46,13 +46,13 @@ inline void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P title)
|
|||||||
// xStart/yStart: Upper-left of virtual area
|
// xStart/yStart: Upper-left of virtual area
|
||||||
// xEnd/yEnd: Lower-right of virtual area
|
// xEnd/yEnd: Lower-right of virtual area
|
||||||
// x/y: Screen paste point
|
// x/y: Screen paste point
|
||||||
void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);
|
void dwinFrameAreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);
|
||||||
|
|
||||||
// Copy area from current virtual display area to current screen
|
// Copy area from current virtual display area to current screen
|
||||||
// xStart/yStart: Upper-left of virtual area
|
// xStart/yStart: Upper-left of virtual area
|
||||||
// xEnd/yEnd: Lower-right of virtual area
|
// xEnd/yEnd: Lower-right of virtual area
|
||||||
// x/y: Screen paste point
|
// x/y: Screen paste point
|
||||||
void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);
|
void dwinFrameAreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);
|
||||||
|
|
||||||
// Copy area from virtual display area to current screen
|
// Copy area from virtual display area to current screen
|
||||||
// IBD: background display: 0=Background filtering is not displayed, 1=Background display \\When setting the background filtering not to display, the background must be pure black
|
// IBD: background display: 0=Background filtering is not displayed, 1=Background display \\When setting the background filtering not to display, the background must be pure black
|
||||||
@@ -62,14 +62,14 @@ void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16
|
|||||||
// xStart/yStart: Upper-left of virtual area
|
// xStart/yStart: Upper-left of virtual area
|
||||||
// xEnd/yEnd: Lower-right of virtual area
|
// xEnd/yEnd: Lower-right of virtual area
|
||||||
// x/y: Screen paste point
|
// x/y: Screen paste point
|
||||||
void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);
|
void dwinFrameAreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);
|
||||||
|
|
||||||
// Write buffer data to the SRAM or Flash
|
// Write buffer data to the SRAM or Flash
|
||||||
// mem: 0x5A=32KB SRAM, 0xA5=16KB Flash
|
// mem: 0x5A=32KB SRAM, 0xA5=16KB Flash
|
||||||
// addr: start address
|
// addr: start address
|
||||||
// length: Bytes to write
|
// length: Bytes to write
|
||||||
// data: address of the buffer with data
|
// data: address of the buffer with data
|
||||||
void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data);
|
void dwinWriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data);
|
||||||
|
|
||||||
// Draw an Icon from SRAM
|
// Draw an Icon from SRAM
|
||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
@@ -78,4 +78,4 @@ void dwinIconShow(uint16_t x, uint16_t y, uint16_t addr);
|
|||||||
|
|
||||||
// Write the contents of the 32KB SRAM data memory into the designated image memory space.
|
// Write the contents of the 32KB SRAM data memory into the designated image memory space.
|
||||||
// picID: Picture memory space location, 0x00-0x0F, each space is 32Kbytes
|
// picID: Picture memory space location, 0x00-0x0F, each space is 32Kbytes
|
||||||
void DWIN_SRAMToPic(uint8_t picID);
|
void dwinSRAMToPic(uint8_t picID);
|
||||||
|
@@ -43,41 +43,41 @@ popupChangeFunc_t popupChange = nullptr;
|
|||||||
|
|
||||||
uint16_t HighlightYPos = 280;
|
uint16_t HighlightYPos = 280;
|
||||||
|
|
||||||
void Draw_Select_Highlight(const bool sel, const uint16_t ypos) {
|
void drawSelectHighlight(const bool sel, const uint16_t ypos) {
|
||||||
HighlightYPos = ypos;
|
HighlightYPos = ypos;
|
||||||
hmiFlag.select_flag = sel;
|
hmiFlag.select_flag = sel;
|
||||||
const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_Color,
|
const uint16_t c1 = sel ? hmiData.colorHighlight : hmiData.colorPopupBg,
|
||||||
c2 = sel ? HMI_data.PopupBg_Color : HMI_data.Highlight_Color;
|
c2 = sel ? hmiData.colorPopupBg : hmiData.colorHighlight;
|
||||||
dwinDrawRectangle(0, c1, 25, ypos - 1, 126, ypos + 38);
|
dwinDrawRectangle(0, c1, 25, ypos - 1, 126, ypos + 38);
|
||||||
dwinDrawRectangle(0, c1, 24, ypos - 2, 127, ypos + 39);
|
dwinDrawRectangle(0, c1, 24, ypos - 2, 127, ypos + 39);
|
||||||
dwinDrawRectangle(0, c2, 145, ypos - 1, 246, ypos + 38);
|
dwinDrawRectangle(0, c2, 145, ypos - 1, 246, ypos + 38);
|
||||||
dwinDrawRectangle(0, c2, 144, ypos - 2, 247, ypos + 39);
|
dwinDrawRectangle(0, c2, 144, ypos - 2, 247, ypos + 39);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) {
|
void dwinPopupContinue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) {
|
||||||
HMI_SaveProcessID(WaitResponse);
|
hmiSaveProcessID(ID_WaitResponse);
|
||||||
DWIN_Draw_Popup(icon, fmsg1, fmsg2, BTN_Continue); // Button Continue
|
dwinDrawPopup(icon, fmsg1, fmsg2, BTN_Continue); // Button Continue
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) {
|
void dwinPopupConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) {
|
||||||
DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), fmsg2);
|
dwinDrawPopup(ICON_BLTouch, F("Please confirm"), fmsg2);
|
||||||
DWINUI::Draw_Button(BTN_Confirm, 26, 280);
|
DWINUI::drawButton(BTN_Confirm, 26, 280);
|
||||||
DWINUI::Draw_Button(BTN_Cancel, 146, 280);
|
DWINUI::drawButton(BTN_Cancel, 146, 280);
|
||||||
Draw_Select_Highlight(hmiFlag.select_flag);
|
drawSelectHighlight(hmiFlag.select_flag);
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/, const popupChangeFunc_t fnChange/*=nullptr*/) {
|
void gotoPopup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/, const popupChangeFunc_t fnChange/*=nullptr*/) {
|
||||||
popupDraw = fnDraw;
|
popupDraw = fnDraw;
|
||||||
popupClick = fnClick;
|
popupClick = fnClick;
|
||||||
popupChange = fnChange;
|
popupChange = fnChange;
|
||||||
HMI_SaveProcessID(Popup);
|
hmiSaveProcessID(ID_Popup);
|
||||||
hmiFlag.select_flag = false;
|
hmiFlag.select_flag = false;
|
||||||
popupDraw();
|
popupDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HMI_Popup() {
|
void hmiPopup() {
|
||||||
if (!wait_for_user) {
|
if (!wait_for_user) {
|
||||||
if (popupClick) popupClick();
|
if (popupClick) popupClick();
|
||||||
return;
|
return;
|
||||||
@@ -86,7 +86,7 @@ void HMI_Popup() {
|
|||||||
EncoderState encoder_diffState = get_encoder_state();
|
EncoderState encoder_diffState = get_encoder_state();
|
||||||
if (encoder_diffState == ENCODER_DIFF_CW || encoder_diffState == ENCODER_DIFF_CCW) {
|
if (encoder_diffState == ENCODER_DIFF_CW || encoder_diffState == ENCODER_DIFF_CCW) {
|
||||||
const bool change = encoder_diffState != ENCODER_DIFF_CW;
|
const bool change = encoder_diffState != ENCODER_DIFF_CW;
|
||||||
if (popupChange) popupChange(change); else Draw_Select_Highlight(change, HighlightYPos);
|
if (popupChange) popupChange(change); else drawSelectHighlight(change, HighlightYPos);
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,38 +36,38 @@ typedef void (*popupClickFunc_t)();
|
|||||||
typedef void (*popupChangeFunc_t)(const bool state);
|
typedef void (*popupChangeFunc_t)(const bool state);
|
||||||
extern popupDrawFunc_t popupDraw;
|
extern popupDrawFunc_t popupDraw;
|
||||||
|
|
||||||
void Draw_Select_Highlight(const bool sel, const uint16_t ypos);
|
void drawSelectHighlight(const bool sel, const uint16_t ypos);
|
||||||
inline void Draw_Select_Highlight(const bool sel) { Draw_Select_Highlight(sel, 280); };
|
inline void drawSelectHighlight(const bool sel) { drawSelectHighlight(sel, 280); };
|
||||||
void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2);
|
void dwinPopupContinue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2);
|
||||||
void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2);
|
void dwinPopupConfirmCancel(const uint8_t icon, FSTR_P const fmsg2);
|
||||||
void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nullptr, const popupChangeFunc_t fnChange=nullptr);
|
void gotoPopup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nullptr, const popupChangeFunc_t fnChange=nullptr);
|
||||||
void HMI_Popup();
|
void hmiPopup();
|
||||||
|
|
||||||
inline void Draw_Popup_Bkgd() {
|
inline void drawPopupBkgd() {
|
||||||
dwinDrawRectangle(1, HMI_data.PopupBg_Color, 14, 60, 258, 330);
|
dwinDrawRectangle(1, hmiData.colorPopupBg, 14, 60, 258, 330);
|
||||||
dwinDrawRectangle(0, HMI_data.Highlight_Color, 14, 60, 258, 330);
|
dwinDrawRectangle(0, hmiData.colorHighlight, 14, 60, 258, 330);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
|
void dwinDrawPopup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
|
||||||
DWINUI::ClearMainArea();
|
DWINUI::clearMainArea();
|
||||||
Draw_Popup_Bkgd();
|
drawPopupBkgd();
|
||||||
if (icon) DWINUI::Draw_Icon(icon, 101, 105);
|
if (icon) DWINUI::drawIcon(icon, 101, 105);
|
||||||
if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1);
|
if (amsg1) DWINUI::drawCenteredString(hmiData.colorPopupTxt, 210, amsg1);
|
||||||
if (amsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, amsg2);
|
if (amsg2) DWINUI::drawCenteredString(hmiData.colorPopupTxt, 240, amsg2);
|
||||||
if (button) DWINUI::Draw_Button(button, 86, 280);
|
if (button) DWINUI::drawButton(button, 86, 280);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
void DWIN_Show_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
|
void dwinShowPopup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
|
||||||
DWIN_Draw_Popup(icon, amsg1, amsg2, button);
|
dwinDrawPopup(icon, amsg1, amsg2, button);
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
|
void dwinPopupConfirm(const uint8_t icon, T amsg1, U amsg2) {
|
||||||
HMI_SaveProcessID(WaitResponse);
|
hmiSaveProcessID(ID_WaitResponse);
|
||||||
DWIN_Draw_Popup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm
|
dwinDrawPopup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,26 +35,26 @@
|
|||||||
#include "dwinui.h"
|
#include "dwinui.h"
|
||||||
|
|
||||||
xy_int_t DWINUI::cursor = { 0 };
|
xy_int_t DWINUI::cursor = { 0 };
|
||||||
uint16_t DWINUI::pencolor = Color_White;
|
uint16_t DWINUI::penColor = COLOR_WHITE;
|
||||||
uint16_t DWINUI::textcolor = Def_Text_Color;
|
uint16_t DWINUI::textColor = defColorText;
|
||||||
uint16_t DWINUI::backcolor = Def_Background_Color;
|
uint16_t DWINUI::backColor = defColorBackground;
|
||||||
uint16_t DWINUI::buttoncolor = Def_Button_Color;
|
uint16_t DWINUI::buttonColor = defColorButton;
|
||||||
uint8_t DWINUI::fontid = font8x16;
|
uint8_t DWINUI::fontID = font8x16;
|
||||||
FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR);
|
FSTR_P const DWINUI::author = F(STRING_CONFIG_H_AUTHOR);
|
||||||
|
|
||||||
void (*DWINUI::onTitleDraw)(TitleClass* title) = nullptr;
|
void (*DWINUI::onTitleDraw)(Title* t) = nullptr;
|
||||||
|
|
||||||
void DWINUI::init() {
|
void DWINUI::init() {
|
||||||
cursor.reset();
|
cursor.reset();
|
||||||
pencolor = Color_White;
|
penColor = COLOR_WHITE;
|
||||||
textcolor = Def_Text_Color;
|
textColor = defColorText;
|
||||||
backcolor = Def_Background_Color;
|
backColor = defColorBackground;
|
||||||
buttoncolor = Def_Button_Color;
|
buttonColor = defColorButton;
|
||||||
fontid = font8x16;
|
fontID = font8x16;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set text/number font
|
// Set text/number font
|
||||||
void DWINUI::setFont(fontid_t fid) { fontid = fid; }
|
void DWINUI::setFont(fontid_t fid) { fontID = fid; }
|
||||||
|
|
||||||
// Get font character width
|
// Get font character width
|
||||||
uint8_t DWINUI::fontWidth(fontid_t fid) {
|
uint8_t DWINUI::fontWidth(fontid_t fid) {
|
||||||
@@ -95,33 +95,33 @@ uint8_t DWINUI::fontHeight(fontid_t fid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get screen x coordinates from text column
|
// Get screen x coordinates from text column
|
||||||
uint16_t DWINUI::ColToX(uint8_t col) { return col * fontWidth(fontid); }
|
uint16_t DWINUI::colToX(uint8_t col) { return col * fontWidth(fontID); }
|
||||||
|
|
||||||
// Get screen y coordinates from text row
|
// Get screen y coordinates from text row
|
||||||
uint16_t DWINUI::RowToY(uint8_t row) { return row * fontHeight(fontid); }
|
uint16_t DWINUI::rowToY(uint8_t row) { return row * fontHeight(fontID); }
|
||||||
|
|
||||||
// Set text/number color
|
// Set text/number color
|
||||||
void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) {
|
void DWINUI::setColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) {
|
||||||
textcolor = fgcolor;
|
textColor = fgcolor;
|
||||||
backcolor = bgcolor;
|
backColor = bgcolor;
|
||||||
buttoncolor = alcolor;
|
buttonColor = alcolor;
|
||||||
}
|
}
|
||||||
void DWINUI::SetTextColor(uint16_t fgcolor) {
|
void DWINUI::setTextColor(uint16_t fgcolor) {
|
||||||
textcolor = fgcolor;
|
textColor = fgcolor;
|
||||||
}
|
}
|
||||||
void DWINUI::SetBackgroundColor(uint16_t bgcolor) {
|
void DWINUI::setBackgroundColor(uint16_t bgcolor) {
|
||||||
backcolor = bgcolor;
|
backColor = bgcolor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Moves cursor to point
|
// Moves cursor to point
|
||||||
// x: abscissa of the display
|
// x: abscissa of the display
|
||||||
// y: ordinate of the display
|
// y: ordinate of the display
|
||||||
// point: xy coordinate
|
// point: xy coordinate
|
||||||
void DWINUI::MoveTo(int16_t x, int16_t y) {
|
void DWINUI::moveTo(int16_t x, int16_t y) {
|
||||||
cursor.x = x;
|
cursor.x = x;
|
||||||
cursor.y = y;
|
cursor.y = y;
|
||||||
}
|
}
|
||||||
void DWINUI::MoveTo(xy_int_t point) {
|
void DWINUI::moveTo(xy_int_t point) {
|
||||||
cursor = point;
|
cursor = point;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,16 +129,16 @@ void DWINUI::MoveTo(xy_int_t point) {
|
|||||||
// x: abscissa of the display
|
// x: abscissa of the display
|
||||||
// y: ordinate of the display
|
// y: ordinate of the display
|
||||||
// point: xy coordinate
|
// point: xy coordinate
|
||||||
void DWINUI::MoveBy(int16_t x, int16_t y) {
|
void DWINUI::moveBy(int16_t x, int16_t y) {
|
||||||
cursor.x += x;
|
cursor.x += x;
|
||||||
cursor.y += y;
|
cursor.y += y;
|
||||||
}
|
}
|
||||||
void DWINUI::MoveBy(xy_int_t point) {
|
void DWINUI::moveBy(xy_int_t point) {
|
||||||
cursor += point;
|
cursor += point;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a Centered string using arbitrary x1 and x2 margins
|
// Draw a Centered string using arbitrary x1 and x2 margins
|
||||||
void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) {
|
void DWINUI::drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) {
|
||||||
const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(fid)) / 2 - 1;
|
const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(fid)) / 2 - 1;
|
||||||
dwinDrawString(bShow, fid, color, bColor, x, y, string);
|
dwinDrawString(bShow, fid, color, bColor, x, y, string);
|
||||||
}
|
}
|
||||||
@@ -148,28 +148,28 @@ void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint1
|
|||||||
// x: abscissa of the display
|
// x: abscissa of the display
|
||||||
// y: ordinate of the display
|
// y: ordinate of the display
|
||||||
// c: ASCII code of char
|
// c: ASCII code of char
|
||||||
void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) {
|
void DWINUI::drawChar(uint16_t color, uint16_t x, uint16_t y, const char c) {
|
||||||
const char string[2] = { c, 0};
|
const char string[2] = { c, 0};
|
||||||
dwinDrawString(false, fontid, color, backcolor, x, y, string, 1);
|
dwinDrawString(false, fontID, color, backColor, x, y, string, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a char at cursor position and increment cursor
|
// Draw a char at cursor position and increment cursor
|
||||||
void DWINUI::Draw_Char(uint16_t color, const char c) {
|
void DWINUI::drawChar(uint16_t color, const char c) {
|
||||||
Draw_Char(color, cursor.x, cursor.y, c);
|
drawChar(color, cursor.x, cursor.y, c);
|
||||||
MoveBy(fontWidth(fontid), 0);
|
moveBy(fontWidth(fontID), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a string at cursor position
|
// Draw a string at cursor position
|
||||||
// color: Character color
|
// color: Character color
|
||||||
// *string: The string
|
// *string: The string
|
||||||
// rlimit: For draw less chars than string length use rlimit
|
// rlimit: For draw less chars than string length use rlimit
|
||||||
void DWINUI::Draw_String(const char * const string, uint16_t rlimit) {
|
void DWINUI::drawString(const char * const string, uint16_t rlimit) {
|
||||||
dwinDrawString(false, fontid, textcolor, backcolor, cursor.x, cursor.y, string, rlimit);
|
dwinDrawString(false, fontID, textColor, backColor, cursor.x, cursor.y, string, rlimit);
|
||||||
MoveBy(strlen(string) * fontWidth(fontid), 0);
|
moveBy(strlen(string) * fontWidth(fontID), 0);
|
||||||
}
|
}
|
||||||
void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rlimit) {
|
void DWINUI::drawString(uint16_t color, const char * const string, uint16_t rlimit) {
|
||||||
dwinDrawString(false, fontid, color, backcolor, cursor.x, cursor.y, string, rlimit);
|
dwinDrawString(false, fontID, color, backColor, cursor.x, cursor.y, string, rlimit);
|
||||||
MoveBy(strlen(string) * fontWidth(fontid), 0);
|
moveBy(strlen(string) * fontWidth(fontID), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a numeric integer value
|
// Draw a numeric integer value
|
||||||
@@ -181,7 +181,7 @@ void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rli
|
|||||||
// iNum: Number of digits
|
// iNum: Number of digits
|
||||||
// x/y: Upper-left coordinate
|
// x/y: Upper-left coordinate
|
||||||
// value: Integer value
|
// value: Integer value
|
||||||
void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) {
|
void DWINUI::drawInt(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) {
|
||||||
char nstr[10];
|
char nstr[10];
|
||||||
sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value);
|
sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value);
|
||||||
dwinDrawString(bShow, fid, color, bColor, x, y, nstr);
|
dwinDrawString(bShow, fid, color, bColor, x, y, nstr);
|
||||||
@@ -197,7 +197,7 @@ void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t col
|
|||||||
// fNum: Number of decimal digits
|
// fNum: Number of decimal digits
|
||||||
// x/y: Upper-left coordinate
|
// x/y: Upper-left coordinate
|
||||||
// value: float value
|
// value: float value
|
||||||
void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
void DWINUI::drawFloat(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
char nstr[10];
|
char nstr[10];
|
||||||
dwinDrawString(bShow, fid, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr));
|
dwinDrawString(bShow, fid, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr));
|
||||||
}
|
}
|
||||||
@@ -217,19 +217,19 @@ void DWINUI::ICON_Show(bool BG, uint8_t icon, uint16_t x, uint16_t y) {
|
|||||||
|
|
||||||
// ------------------------- Buttons ------------------------------//
|
// ------------------------- Buttons ------------------------------//
|
||||||
|
|
||||||
void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) {
|
void DWINUI::drawButton(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) {
|
||||||
dwinDrawRectangle(1, bcolor, x1, y1, x2, y2);
|
dwinDrawRectangle(1, bcolor, x1, y1, x2, y2);
|
||||||
Draw_CenteredString(0, fontid, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption);
|
drawCenteredString(0, fontID, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) {
|
void DWINUI::drawButton(uint8_t id, uint16_t x, uint16_t y) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case BTN_Cancel : Draw_Button(GET_TEXT_F(MSG_BUTTON_CANCEL), x, y); break;
|
case BTN_Cancel : drawButton(GET_TEXT_F(MSG_BUTTON_CANCEL), x, y); break;
|
||||||
case BTN_Confirm : Draw_Button(GET_TEXT_F(MSG_BUTTON_CONFIRM), x, y); break;
|
case BTN_Confirm : drawButton(GET_TEXT_F(MSG_BUTTON_CONFIRM), x, y); break;
|
||||||
case BTN_Continue: Draw_Button(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break;
|
case BTN_Continue: drawButton(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break;
|
||||||
case BTN_Print : Draw_Button(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break;
|
case BTN_Print : drawButton(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break;
|
||||||
case BTN_Save : Draw_Button(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break;
|
case BTN_Save : drawButton(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break;
|
||||||
case BTN_Purge : Draw_Button(GET_TEXT_F(MSG_BUTTON_PURGE), x, y); break;
|
case BTN_Purge : drawButton(GET_TEXT_F(MSG_BUTTON_PURGE), x, y); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) {
|
|||||||
// x: the abscissa of the center of the circle
|
// x: the abscissa of the center of the circle
|
||||||
// y: ordinate of the center of the circle
|
// y: ordinate of the center of the circle
|
||||||
// r: circle radius
|
// r: circle radius
|
||||||
void DWINUI::Draw_Circle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) {
|
void DWINUI::drawCircle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) {
|
||||||
int a = 0, b = 0;
|
int a = 0, b = 0;
|
||||||
while (a <= b) {
|
while (a <= b) {
|
||||||
b = SQRT(sq(r) - sq(a));
|
b = SQRT(sq(r) - sq(a));
|
||||||
@@ -263,7 +263,7 @@ void DWINUI::Draw_Circle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) {
|
|||||||
// x: the abscissa of the center of the circle
|
// x: the abscissa of the center of the circle
|
||||||
// y: ordinate of the center of the circle
|
// y: ordinate of the center of the circle
|
||||||
// r: circle radius
|
// r: circle radius
|
||||||
void DWINUI::Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) {
|
void DWINUI::drawFillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) {
|
||||||
dwinDrawLine(bcolor, x - r, y, x + r, y);
|
dwinDrawLine(bcolor, x - r, y, x + r, y);
|
||||||
uint16_t b = 1;
|
uint16_t b = 1;
|
||||||
while (b <= r) {
|
while (b <= r) {
|
||||||
@@ -322,54 +322,54 @@ uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) {
|
|||||||
// bColor: Background color
|
// bColor: Background color
|
||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
// mode : 0 : unchecked, 1 : checked
|
// mode : 0 : unchecked, 1 : checked
|
||||||
void DWINUI::Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) {
|
void DWINUI::drawCheckbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) {
|
||||||
dwinDrawRectangle(0, color, x + 2, y + 2, x + 17, y + 17);
|
dwinDrawRectangle(0, color, x + 2, y + 2, x + 17, y + 17);
|
||||||
dwinDrawRectangle(1, checked ? color : bcolor, x + 6, y + 6, x + 13, y + 13);
|
dwinDrawRectangle(1, checked ? color : bcolor, x + 6, y + 6, x + 13, y + 13);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear Menu by filling the menu area with background color
|
// Clear Menu by filling the menu area with background color
|
||||||
void DWINUI::ClearMainArea() {
|
void DWINUI::clearMainArea() {
|
||||||
dwinDrawRectangle(1, backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1);
|
dwinDrawRectangle(1, backColor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Title Class ==============================================================*/
|
/* Title Class ==============================================================*/
|
||||||
|
|
||||||
TitleClass Title;
|
Title title;
|
||||||
|
|
||||||
void TitleClass::draw() {
|
void Title::draw() {
|
||||||
if (DWINUI::onTitleDraw != nullptr) (*DWINUI::onTitleDraw)(this);
|
if (DWINUI::onTitleDraw != nullptr) (*DWINUI::onTitleDraw)(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleClass::SetCaption(const char * const title) {
|
void Title::setCaption(const char * const titleStr) {
|
||||||
frameid = 0;
|
frameid = 0;
|
||||||
if ( caption == title ) return;
|
if ( caption == titleStr ) return;
|
||||||
const uint8_t len = _MIN(sizeof(caption) - 1, strlen(title));
|
const uint8_t len = _MIN(sizeof(caption) - 1, strlen(titleStr));
|
||||||
memcpy(&caption[0], title, len);
|
memcpy(&caption[0], titleStr, len);
|
||||||
caption[len] = '\0';
|
caption[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleClass::ShowCaption(const char * const title) {
|
void Title::showCaption(const char * const titleStr) {
|
||||||
SetCaption(title);
|
setCaption(titleStr);
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleClass::SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
|
void Title::setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
|
||||||
caption[0] = '\0';
|
caption[0] = '\0';
|
||||||
frameid = id;
|
frameid = id;
|
||||||
frame = { x1, y1, x2, y2 };
|
frame = { x1, y1, x2, y2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleClass::SetFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
|
void Title::setFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
|
||||||
SetFrame(1, x, y, x + w - 1, y + h - 1);
|
setFrame(1, x, y, x + w - 1, y + h - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleClass::FrameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
|
void Title::frameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
|
||||||
SetFrame(id, x1, y1, x2, y2);
|
setFrame(id, x1, y1, x2, y2);
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleClass::FrameCopy(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
|
void Title::frameCopy(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
|
||||||
FrameCopy(1, x, y, x + w - 1, y + h - 1);
|
frameCopy(1, x, y, x + w - 1, y + h - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DWIN_LCD_PROUI
|
#endif // DWIN_LCD_PROUI
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
#define ICON_Cancel ICON_StockConfiguration
|
#define ICON_Cancel ICON_StockConfiguration
|
||||||
#define ICON_CustomPreheat ICON_SetEndTemp
|
#define ICON_CustomPreheat ICON_SetEndTemp
|
||||||
#define ICON_Error ICON_TempTooHigh
|
#define ICON_Error ICON_TempTooHigh
|
||||||
#define ICON_ESDiag ICON_Info
|
#define ICON_esDiag ICON_Info
|
||||||
#define ICON_ExtrudeMinT ICON_HotendTemp
|
#define ICON_ExtrudeMinT ICON_HotendTemp
|
||||||
#define ICON_FilLoad ICON_WriteEEPROM
|
#define ICON_FilLoad ICON_WriteEEPROM
|
||||||
#define ICON_FilMan ICON_ResumeEEPROM
|
#define ICON_FilMan ICON_ResumeEEPROM
|
||||||
@@ -170,24 +170,24 @@
|
|||||||
#define BTN_Purge 92
|
#define BTN_Purge 92
|
||||||
|
|
||||||
// Extended and default UI Colors
|
// Extended and default UI Colors
|
||||||
#define Color_Black 0
|
#define COLOR_BLACK 0
|
||||||
#define Color_Green RGB(0,63,0)
|
#define COLOR_GREEN RGB(0,63,0)
|
||||||
#define Color_Aqua RGB(0,63,31)
|
#define COLOR_AQUA RGB(0,63,31)
|
||||||
#define Color_Blue RGB(0,0,31)
|
#define COLOR_BLUE RGB(0,0,31)
|
||||||
#define Color_Light_White 0xBDD7
|
#define COLOR_LIGHT_WHITE 0xBDD7
|
||||||
#define Color_Light_Green 0x3460
|
#define COLOR_LIGHT_GREEN 0x3460
|
||||||
#define Color_Cyan 0x07FF
|
#define COLOR_CYAN 0x07FF
|
||||||
#define Color_Light_Cyan 0x04F3
|
#define COLOR_LIGHT_CYAN 0x04F3
|
||||||
#define Color_Light_Blue 0x3A6A
|
#define COLOR_LIGHT_BLUE 0x3A6A
|
||||||
#define Color_Magenta 0xF81F
|
#define COLOR_MAGENTA 0xF81F
|
||||||
#define Color_Light_Magenta 0x9813
|
#define COLOR_LIGHT_MAGENTA 0x9813
|
||||||
#define Color_Light_Red 0x8800
|
#define COLOR_LIGHT_RED 0x8800
|
||||||
#define Color_Orange 0xFA20
|
#define COLOR_ORANGE 0xFA20
|
||||||
#define Color_Light_Orange 0xFBC0
|
#define COLOR_LIGHT_ORANGE 0xFBC0
|
||||||
#define Color_Light_Yellow 0x8BE0
|
#define COLOR_LIGHT_YELLOW 0x8BE0
|
||||||
#define Color_Brown 0xCC27
|
#define COLOR_BROWN 0xCC27
|
||||||
#define Color_Light_Brown 0x6204
|
#define COLOR_LIGHT_BROWN 0x6204
|
||||||
#define Color_Grey 0x18E3
|
#define COLOR_GREY 0x18E3
|
||||||
|
|
||||||
// UI element defines and constants
|
// UI element defines and constants
|
||||||
#define DWIN_FONT_MENU font8x16
|
#define DWIN_FONT_MENU font8x16
|
||||||
@@ -195,7 +195,7 @@
|
|||||||
#define DWIN_FONT_HEAD font10x20
|
#define DWIN_FONT_HEAD font10x20
|
||||||
#define DWIN_FONT_ALERT font10x20
|
#define DWIN_FONT_ALERT font10x20
|
||||||
#define STATUS_Y 354
|
#define STATUS_Y 354
|
||||||
#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default fontid is font8x16
|
#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default fontID is font8x16
|
||||||
|
|
||||||
// Minimum unit (0.1) : multiple (10)
|
// Minimum unit (0.1) : multiple (10)
|
||||||
#define UNITFDIGITS 1
|
#define UNITFDIGITS 1
|
||||||
@@ -223,33 +223,33 @@ constexpr uint8_t TITLE_HEIGHT = 30, // Title bar heig
|
|||||||
typedef struct { uint16_t left, top, right, bottom; } rect_t;
|
typedef struct { uint16_t left, top, right, bottom; } rect_t;
|
||||||
typedef struct { uint16_t x, y, w, h; } frame_rect_t;
|
typedef struct { uint16_t x, y, w, h; } frame_rect_t;
|
||||||
|
|
||||||
class TitleClass {
|
class Title {
|
||||||
public:
|
public:
|
||||||
char caption[32] = "";
|
char caption[32] = "";
|
||||||
uint8_t frameid = 0;
|
uint8_t frameid = 0;
|
||||||
rect_t frame = {0};
|
rect_t frame = {0};
|
||||||
void draw();
|
void draw();
|
||||||
void SetCaption(const char * const title);
|
void setCaption(const char * const titleStr);
|
||||||
inline void SetCaption(FSTR_P title) { SetCaption((char *)title); }
|
inline void setCaption(FSTR_P fTitle) { setCaption((char *)fTitle); }
|
||||||
void ShowCaption(const char * const title);
|
void showCaption(const char * const titleStr);
|
||||||
inline void ShowCaption(FSTR_P title) { ShowCaption((char *)title); }
|
inline void showCaption(FSTR_P fTitle) { showCaption((char *)fTitle); }
|
||||||
void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
|
void setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
|
||||||
void SetFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
void setFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
||||||
void FrameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
|
void frameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
|
||||||
void FrameCopy(uint16_t x, uint16_t y, uint16_t h, uint16_t v);
|
void frameCopy(uint16_t x, uint16_t y, uint16_t h, uint16_t v);
|
||||||
};
|
};
|
||||||
extern TitleClass Title;
|
extern Title title;
|
||||||
|
|
||||||
namespace DWINUI {
|
namespace DWINUI {
|
||||||
extern xy_int_t cursor;
|
extern xy_int_t cursor;
|
||||||
extern uint16_t pencolor;
|
extern uint16_t penColor;
|
||||||
extern uint16_t textcolor;
|
extern uint16_t textColor;
|
||||||
extern uint16_t backcolor;
|
extern uint16_t backColor;
|
||||||
extern uint16_t buttoncolor;
|
extern uint16_t buttonColor;
|
||||||
extern fontid_t fontid;
|
extern fontid_t fontID;
|
||||||
extern FSTR_P const Author;
|
extern FSTR_P const author;
|
||||||
|
|
||||||
extern void (*onTitleDraw)(TitleClass* title);
|
extern void (*onTitleDraw)(Title* t);
|
||||||
|
|
||||||
// DWIN LCD Initialization
|
// DWIN LCD Initialization
|
||||||
void init();
|
void init();
|
||||||
@@ -259,50 +259,50 @@ namespace DWINUI {
|
|||||||
|
|
||||||
// Get font character width
|
// Get font character width
|
||||||
uint8_t fontWidth(fontid_t cfont);
|
uint8_t fontWidth(fontid_t cfont);
|
||||||
inline uint8_t fontWidth() { return fontWidth(fontid); };
|
inline uint8_t fontWidth() { return fontWidth(fontID); };
|
||||||
|
|
||||||
// Get font character height
|
// Get font character height
|
||||||
uint8_t fontHeight(fontid_t cfont);
|
uint8_t fontHeight(fontid_t cfont);
|
||||||
inline uint8_t fontHeight() { return fontHeight(fontid); };
|
inline uint8_t fontHeight() { return fontHeight(fontID); };
|
||||||
|
|
||||||
// Get screen x coordinates from text column
|
// Get screen x coordinates from text column
|
||||||
uint16_t ColToX(uint8_t col);
|
uint16_t colToX(uint8_t col);
|
||||||
|
|
||||||
// Get screen y coordinates from text row
|
// Get screen y coordinates from text row
|
||||||
uint16_t RowToY(uint8_t row);
|
uint16_t rowToY(uint8_t row);
|
||||||
|
|
||||||
// Set text/number color
|
// Set text/number color
|
||||||
void SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor);
|
void setColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor);
|
||||||
void SetTextColor(uint16_t fgcolor);
|
void setTextColor(uint16_t fgcolor);
|
||||||
void SetBackgroundColor(uint16_t bgcolor);
|
void setBackgroundColor(uint16_t bgcolor);
|
||||||
|
|
||||||
// Moves cursor to point
|
// Moves cursor to point
|
||||||
// x: abscissa of the display
|
// x: abscissa of the display
|
||||||
// y: ordinate of the display
|
// y: ordinate of the display
|
||||||
// point: xy coordinate
|
// point: xy coordinate
|
||||||
void MoveTo(int16_t x, int16_t y);
|
void moveTo(int16_t x, int16_t y);
|
||||||
void MoveTo(xy_int_t point);
|
void moveTo(xy_int_t point);
|
||||||
|
|
||||||
// Moves cursor relative to the actual position
|
// Moves cursor relative to the actual position
|
||||||
// x: abscissa of the display
|
// x: abscissa of the display
|
||||||
// y: ordinate of the display
|
// y: ordinate of the display
|
||||||
// point: xy coordinate
|
// point: xy coordinate
|
||||||
void MoveBy(int16_t x, int16_t y);
|
void moveBy(int16_t x, int16_t y);
|
||||||
void MoveBy(xy_int_t point);
|
void moveBy(xy_int_t point);
|
||||||
|
|
||||||
// Draw a line from the cursor to xy position
|
// Draw a line from the cursor to xy position
|
||||||
// color: Line segment color
|
// color: Line segment color
|
||||||
// x/y: End point
|
// x/y: End point
|
||||||
inline void LineTo(uint16_t color, uint16_t x, uint16_t y) {
|
inline void lineTo(uint16_t color, uint16_t x, uint16_t y) {
|
||||||
dwinDrawLine(color, cursor.x, cursor.y, x, y);
|
dwinDrawLine(color, cursor.x, cursor.y, x, y);
|
||||||
}
|
}
|
||||||
inline void LineTo(uint16_t x, uint16_t y) {
|
inline void lineTo(uint16_t x, uint16_t y) {
|
||||||
dwinDrawLine(pencolor, cursor.x, cursor.y, x, y);
|
dwinDrawLine(penColor, cursor.x, cursor.y, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extend a frame box
|
// Extend a frame box
|
||||||
// v: value to extend
|
// v: value to extend
|
||||||
inline frame_rect_t ExtendFrame(frame_rect_t frame, uint8_t v) {
|
inline frame_rect_t extendFrame(frame_rect_t frame, uint8_t v) {
|
||||||
frame_rect_t t;
|
frame_rect_t t;
|
||||||
t.x = frame.x - v;
|
t.x = frame.x - v;
|
||||||
t.y = frame.y - v;
|
t.y = frame.y - v;
|
||||||
@@ -321,14 +321,14 @@ namespace DWINUI {
|
|||||||
// Draw an Icon with transparent background from the library ICON
|
// Draw an Icon with transparent background from the library ICON
|
||||||
// icon: Icon ID
|
// icon: Icon ID
|
||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
inline void Draw_Icon(uint8_t icon, uint16_t x, uint16_t y) {
|
inline void drawIcon(uint8_t icon, uint16_t x, uint16_t y) {
|
||||||
ICON_Show(false, icon, x, y);
|
ICON_Show(false, icon, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw an Icon from the library ICON with its background
|
// Draw an Icon from the library ICON with its background
|
||||||
// icon: Icon ID
|
// icon: Icon ID
|
||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
inline void Draw_IconWB(uint8_t icon, uint16_t x, uint16_t y) {
|
inline void drawIconWB(uint8_t icon, uint16_t x, uint16_t y) {
|
||||||
ICON_Show(true, icon, x, y);
|
ICON_Show(true, icon, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,48 +341,48 @@ namespace DWINUI {
|
|||||||
// iNum: Number of digits
|
// iNum: Number of digits
|
||||||
// x/y: Upper-left coordinate
|
// x/y: Upper-left coordinate
|
||||||
// value: Integer value
|
// value: Integer value
|
||||||
void Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value);
|
void drawInt(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value);
|
||||||
|
|
||||||
// Draw a positive integer
|
// Draw a positive integer
|
||||||
inline void Draw_Int(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void drawInt(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
Draw_Int(bShow, 0, fid, color, bColor, iNum, x, y, value);
|
drawInt(bShow, 0, fid, color, bColor, iNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Int(uint8_t iNum, long value) {
|
inline void drawInt(uint8_t iNum, long value) {
|
||||||
Draw_Int(false, 0, fontid, textcolor, backcolor, iNum, cursor.x, cursor.y, value);
|
drawInt(false, 0, fontID, textColor, backColor, iNum, cursor.x, cursor.y, value);
|
||||||
MoveBy(iNum * fontWidth(fontid), 0);
|
moveBy(iNum * fontWidth(fontID), 0);
|
||||||
}
|
}
|
||||||
inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void drawInt(uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
Draw_Int(false, 0, fontid, textcolor, backcolor, iNum, x, y, value);
|
drawInt(false, 0, fontID, textColor, backColor, iNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void drawInt(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
Draw_Int(false, 0, fontid, color, backcolor, iNum, x, y, value);
|
drawInt(false, 0, fontID, color, backColor, iNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void drawInt(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
Draw_Int(true, 0, fontid, color, bColor, iNum, x, y, value);
|
drawInt(true, 0, fontID, color, bColor, iNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Int(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void drawInt(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
Draw_Int(true, 0, fid, color, bColor, iNum, x, y, value);
|
drawInt(true, 0, fid, color, bColor, iNum, x, y, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a signed integer
|
// Draw a signed integer
|
||||||
inline void Draw_Signed_Int(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void drawSignedInt(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
Draw_Int(bShow, 1, fid, color, bColor, iNum, x, y, value);
|
drawInt(bShow, 1, fid, color, bColor, iNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Int(uint8_t iNum, long value) {
|
inline void drawSignedInt(uint8_t iNum, long value) {
|
||||||
Draw_Int(false, 1, fontid, textcolor, backcolor, iNum, cursor.x, cursor.y, value);
|
drawInt(false, 1, fontID, textColor, backColor, iNum, cursor.x, cursor.y, value);
|
||||||
MoveBy(iNum * fontWidth(fontid), 0);
|
moveBy(iNum * fontWidth(fontID), 0);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void drawSignedInt(uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
Draw_Int(false, 1, fontid, textcolor, backcolor, iNum, x, y, value);
|
drawInt(false, 1, fontID, textColor, backColor, iNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void drawSignedInt(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
Draw_Int(false, 1, fontid, color, backcolor, iNum, x, y, value);
|
drawInt(false, 1, fontID, color, backColor, iNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void drawSignedInt(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
Draw_Int(true, 1, fontid, color, bColor, iNum, x, y, value);
|
drawInt(true, 1, fontID, color, bColor, iNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Int(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void drawSignedInt(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
Draw_Int(true, 1, fid, color, bColor, iNum, x, y, value);
|
drawInt(true, 1, fid, color, bColor, iNum, x, y, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a numeric float value
|
// Draw a numeric float value
|
||||||
@@ -395,48 +395,48 @@ namespace DWINUI {
|
|||||||
// fNum: Number of decimal digits
|
// fNum: Number of decimal digits
|
||||||
// x/y: Upper-left coordinate
|
// x/y: Upper-left coordinate
|
||||||
// value: float value
|
// value: float value
|
||||||
void Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value);
|
void drawFloat(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value);
|
||||||
|
|
||||||
// Draw a positive floating point number
|
// Draw a positive floating point number
|
||||||
inline void Draw_Float(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void drawFloat(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Float(bShow, 0, fid, color, bColor, iNum, fNum, x, y, value);
|
drawFloat(bShow, 0, fid, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) {
|
inline void drawFloat(uint8_t iNum, uint8_t fNum, float value) {
|
||||||
Draw_Float(false, 0, fontid, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
|
drawFloat(false, 0, fontID, textColor, backColor, iNum, fNum, cursor.x, cursor.y, value);
|
||||||
MoveBy((iNum + fNum + 1) * fontWidth(fontid), 0);
|
moveBy((iNum + fNum + 1) * fontWidth(fontID), 0);
|
||||||
}
|
}
|
||||||
inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void drawFloat(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Float(false, 0, fontid, textcolor, backcolor, iNum, fNum, x, y, value);
|
drawFloat(false, 0, fontID, textColor, backColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Float(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void drawFloat(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Float(false, 0, fid, textcolor, backcolor, iNum, fNum, x, y, value);
|
drawFloat(false, 0, fid, textColor, backColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void drawFloat(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Float(true, 0, fontid, color, bColor, iNum, fNum, x, y, value);
|
drawFloat(true, 0, fontID, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Float(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void drawFloat(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Float(true, 0, fid, color, bColor, iNum, fNum, x, y, value);
|
drawFloat(true, 0, fid, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a signed floating point number
|
// Draw a signed floating point number
|
||||||
inline void Draw_Signed_Float(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void drawSignedFloat(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Float(bShow, 1, fid, color, bColor, iNum, fNum, x, y, value);
|
drawFloat(bShow, 1, fid, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) {
|
inline void drawSignedFloat(uint8_t iNum, uint8_t fNum, float value) {
|
||||||
Draw_Float(false, 1, fontid, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
|
drawFloat(false, 1, fontID, textColor, backColor, iNum, fNum, cursor.x, cursor.y, value);
|
||||||
MoveBy((iNum + fNum + 1) * fontWidth(fontid), 0);
|
moveBy((iNum + fNum + 1) * fontWidth(fontID), 0);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void drawSignedFloat(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Float(false, 1, fontid, textcolor, backcolor, iNum, fNum, x, y, value);
|
drawFloat(false, 1, fontID, textColor, backColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Float(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void drawSignedFloat(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Float(false, 1, fid, textcolor, backcolor, iNum, fNum, x, y, value);
|
drawFloat(false, 1, fid, textColor, backColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void drawSignedFloat(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Float(true, 1, fontid, color, bColor, iNum, fNum, x, y, value);
|
drawFloat(true, 1, fontID, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Float(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void drawSignedFloat(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Float(true, 1, fid, color, bColor, iNum, fNum, x, y, value);
|
drawFloat(true, 1, fid, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a char
|
// Draw a char
|
||||||
@@ -444,23 +444,23 @@ namespace DWINUI {
|
|||||||
// x: abscissa of the display
|
// x: abscissa of the display
|
||||||
// y: ordinate of the display
|
// y: ordinate of the display
|
||||||
// c: ASCII code of char
|
// c: ASCII code of char
|
||||||
void Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c);
|
void drawChar(uint16_t color, uint16_t x, uint16_t y, const char c);
|
||||||
inline void Draw_Char(uint16_t x, uint16_t y, const char c) { Draw_Char(textcolor, x, y, c); };
|
inline void drawChar(uint16_t x, uint16_t y, const char c) { drawChar(textColor, x, y, c); };
|
||||||
// Draw a char at cursor position and increment cursor
|
// Draw a char at cursor position and increment cursor
|
||||||
void Draw_Char(uint16_t color, const char c);
|
void drawChar(uint16_t color, const char c);
|
||||||
inline void Draw_Char(const char c) { Draw_Char(textcolor, c); }
|
inline void drawChar(const char c) { drawChar(textColor, c); }
|
||||||
|
|
||||||
// Draw a string at cursor position
|
// Draw a string at cursor position
|
||||||
// color: Character color
|
// color: Character color
|
||||||
// *string: The string
|
// *string: The string
|
||||||
// rlimit: For draw less chars than string length use rlimit
|
// rlimit: For draw less chars than string length use rlimit
|
||||||
void Draw_String(const char * const string, uint16_t rlimit = 0xFFFF);
|
void drawString(const char * const string, uint16_t rlimit = 0xFFFF);
|
||||||
void Draw_String(uint16_t color, const char * const string, uint16_t rlimit = 0xFFFF);
|
void drawString(uint16_t color, const char * const string, uint16_t rlimit = 0xFFFF);
|
||||||
inline void Draw_String(FSTR_P string, uint16_t rlimit = 0xFFFF) {
|
inline void drawString(FSTR_P string, uint16_t rlimit = 0xFFFF) {
|
||||||
Draw_String(FTOP(string), rlimit);
|
drawString(FTOP(string), rlimit);
|
||||||
}
|
}
|
||||||
inline void Draw_String(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) {
|
inline void drawString(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) {
|
||||||
Draw_String(color, FTOP(string), rlimit);
|
drawString(color, FTOP(string), rlimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a string
|
// Draw a string
|
||||||
@@ -469,29 +469,29 @@ namespace DWINUI {
|
|||||||
// bColor: Background color
|
// bColor: Background color
|
||||||
// x/y: Upper-left coordinate of the string
|
// x/y: Upper-left coordinate of the string
|
||||||
// *string: The string
|
// *string: The string
|
||||||
inline void Draw_String(uint16_t x, uint16_t y, const char * const string) {
|
inline void drawString(uint16_t x, uint16_t y, const char * const string) {
|
||||||
dwinDrawString(false, fontid, textcolor, backcolor, x, y, string);
|
dwinDrawString(false, fontID, textColor, backColor, x, y, string);
|
||||||
}
|
}
|
||||||
inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) {
|
inline void drawString(uint16_t x, uint16_t y, FSTR_P fTitle) {
|
||||||
dwinDrawString(false, fontid, textcolor, backcolor, x, y, FTOP(title));
|
dwinDrawString(false, fontID, textColor, backColor, x, y, FTOP(fTitle));
|
||||||
}
|
}
|
||||||
inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) {
|
inline void drawString(uint16_t color, uint16_t x, uint16_t y, const char * const string) {
|
||||||
dwinDrawString(false, fontid, color, backcolor, x, y, string);
|
dwinDrawString(false, fontID, color, backColor, x, y, string);
|
||||||
}
|
}
|
||||||
inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) {
|
inline void drawString(uint16_t color, uint16_t x, uint16_t y, FSTR_P fTitle) {
|
||||||
dwinDrawString(false, fontid, color, backcolor, x, y, title);
|
dwinDrawString(false, fontID, color, backColor, x, y, fTitle);
|
||||||
}
|
}
|
||||||
inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
|
inline void drawString(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
|
||||||
dwinDrawString(true, fontid, color, bgcolor, x, y, string);
|
dwinDrawString(true, fontID, color, bgcolor, x, y, string);
|
||||||
}
|
}
|
||||||
inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
|
inline void drawString(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P fTitle) {
|
||||||
dwinDrawString(true, fontid, color, bgcolor, x, y, title);
|
dwinDrawString(true, fontID, color, bgcolor, x, y, fTitle);
|
||||||
}
|
}
|
||||||
inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
|
inline void drawString(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
|
||||||
dwinDrawString(true, fid, color, bgcolor, x, y, string);
|
dwinDrawString(true, fid, color, bgcolor, x, y, string);
|
||||||
}
|
}
|
||||||
inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
|
inline void drawString(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P fTitle) {
|
||||||
dwinDrawString(true, fid, color, bgcolor, x, y, title);
|
dwinDrawString(true, fid, color, bgcolor, x, y, fTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a centered string using DWIN_WIDTH
|
// Draw a centered string using DWIN_WIDTH
|
||||||
@@ -501,40 +501,40 @@ namespace DWINUI {
|
|||||||
// bColor: Background color
|
// bColor: Background color
|
||||||
// y: Upper coordinate of the string
|
// y: Upper coordinate of the string
|
||||||
// *string: The string
|
// *string: The string
|
||||||
void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string);
|
void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string);
|
||||||
inline void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
|
inline void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
|
||||||
Draw_CenteredString(bShow, fid, color, bColor, 0, DWIN_WIDTH, y, string);
|
drawCenteredString(bShow, fid, color, bColor, 0, DWIN_WIDTH, y, string);
|
||||||
}
|
}
|
||||||
inline void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) {
|
inline void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) {
|
||||||
Draw_CenteredString(bShow, fid, color, bColor, y, FTOP(string));
|
drawCenteredString(bShow, fid, color, bColor, y, FTOP(string));
|
||||||
}
|
}
|
||||||
inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) {
|
inline void drawCenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) {
|
||||||
Draw_CenteredString(true, fontid, color, bcolor, y, string);
|
drawCenteredString(true, fontID, color, bcolor, y, string);
|
||||||
}
|
}
|
||||||
inline void Draw_CenteredString(fontid_t fid, uint16_t color, uint16_t y, const char * const string) {
|
inline void drawCenteredString(fontid_t fid, uint16_t color, uint16_t y, const char * const string) {
|
||||||
Draw_CenteredString(false, fid, color, backcolor, y, string);
|
drawCenteredString(false, fid, color, backColor, y, string);
|
||||||
}
|
}
|
||||||
inline void Draw_CenteredString(fontid_t fid, uint16_t color, uint16_t y, FSTR_P title) {
|
inline void drawCenteredString(fontid_t fid, uint16_t color, uint16_t y, FSTR_P fTitle) {
|
||||||
Draw_CenteredString(false, fid, color, backcolor, y, title);
|
drawCenteredString(false, fid, color, backColor, y, fTitle);
|
||||||
}
|
}
|
||||||
inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) {
|
inline void drawCenteredString(uint16_t color, uint16_t y, const char * const string) {
|
||||||
Draw_CenteredString(false, fontid, color, backcolor, y, string);
|
drawCenteredString(false, fontID, color, backColor, y, string);
|
||||||
}
|
}
|
||||||
inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) {
|
inline void drawCenteredString(uint16_t color, uint16_t y, FSTR_P fTitle) {
|
||||||
Draw_CenteredString(false, fontid, color, backcolor, y, title);
|
drawCenteredString(false, fontID, color, backColor, y, fTitle);
|
||||||
}
|
}
|
||||||
inline void Draw_CenteredString(uint16_t y, const char * const string) {
|
inline void drawCenteredString(uint16_t y, const char * const string) {
|
||||||
Draw_CenteredString(false, fontid, textcolor, backcolor, y, string);
|
drawCenteredString(false, fontID, textColor, backColor, y, string);
|
||||||
}
|
}
|
||||||
inline void Draw_CenteredString(uint16_t y, FSTR_P title) {
|
inline void drawCenteredString(uint16_t y, FSTR_P fTitle) {
|
||||||
Draw_CenteredString(false, fontid, textcolor, backcolor, y, title);
|
drawCenteredString(false, fontID, textColor, backColor, y, fTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a box
|
// Draw a box
|
||||||
// mode: 0=frame, 1=fill, 2=XOR fill
|
// mode: 0=frame, 1=fill, 2=XOR fill
|
||||||
// color: Rectangle color
|
// color: Rectangle color
|
||||||
// frame: Box coordinates and size
|
// frame: Box coordinates and size
|
||||||
inline void Draw_Box(uint8_t mode, uint16_t color, frame_rect_t frame) {
|
inline void drawBox(uint8_t mode, uint16_t color, frame_rect_t frame) {
|
||||||
dwinDrawBox(mode, color, frame.x, frame.y, frame.w, frame.h);
|
dwinDrawBox(mode, color, frame.x, frame.y, frame.w, frame.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,9 +543,9 @@ namespace DWINUI {
|
|||||||
// x: abscissa of the center of the circle
|
// x: abscissa of the center of the circle
|
||||||
// y: ordinate of the center of the circle
|
// y: ordinate of the center of the circle
|
||||||
// r: circle radius
|
// r: circle radius
|
||||||
void Draw_Circle(uint16_t color, uint16_t x,uint16_t y,uint8_t r);
|
void drawCircle(uint16_t color, uint16_t x,uint16_t y,uint8_t r);
|
||||||
inline void Draw_Circle(uint16_t color, uint8_t r) {
|
inline void drawCircle(uint16_t color, uint8_t r) {
|
||||||
Draw_Circle(color, cursor.x, cursor.y, r);
|
drawCircle(color, cursor.x, cursor.y, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a checkbox
|
// Draw a checkbox
|
||||||
@@ -553,9 +553,9 @@ namespace DWINUI {
|
|||||||
// bColor: Background color
|
// bColor: Background color
|
||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
// checked : 0 : unchecked, 1 : checked
|
// checked : 0 : unchecked, 1 : checked
|
||||||
void Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked);
|
void drawCheckbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked);
|
||||||
inline void Draw_Checkbox(uint16_t x, uint16_t y, bool checked=false) {
|
inline void drawCheckbox(uint16_t x, uint16_t y, bool checked=false) {
|
||||||
Draw_Checkbox(textcolor, backcolor, x, y, checked);
|
drawCheckbox(textColor, backColor, x, y, checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color Interpolator
|
// Color Interpolator
|
||||||
@@ -568,14 +568,14 @@ namespace DWINUI {
|
|||||||
|
|
||||||
// ------------------------- Buttons ------------------------------//
|
// ------------------------- Buttons ------------------------------//
|
||||||
|
|
||||||
void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption);
|
void drawButton(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption);
|
||||||
inline void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) {
|
inline void drawButton(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) {
|
||||||
Draw_Button(color, bcolor, x1, y1, x2, y2, FTOP(caption));
|
drawButton(color, bcolor, x1, y1, x2, y2, FTOP(caption));
|
||||||
}
|
}
|
||||||
inline void Draw_Button(FSTR_P caption, uint16_t x, uint16_t y) {
|
inline void drawButton(FSTR_P caption, uint16_t x, uint16_t y) {
|
||||||
Draw_Button(textcolor, buttoncolor, x, y, x + 99, y + 37, caption);
|
drawButton(textColor, buttonColor, x, y, x + 99, y + 37, caption);
|
||||||
}
|
}
|
||||||
void Draw_Button(uint8_t id, uint16_t x, uint16_t y);
|
void drawButton(uint8_t id, uint16_t x, uint16_t y);
|
||||||
|
|
||||||
// -------------------------- Extra -------------------------------//
|
// -------------------------- Extra -------------------------------//
|
||||||
|
|
||||||
@@ -584,9 +584,9 @@ namespace DWINUI {
|
|||||||
// x: abscissa of the center of the circle
|
// x: abscissa of the center of the circle
|
||||||
// y: ordinate of the center of the circle
|
// y: ordinate of the center of the circle
|
||||||
// r: circle radius
|
// r: circle radius
|
||||||
void Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r);
|
void drawFillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r);
|
||||||
inline void Draw_FillCircle(uint16_t bcolor, uint8_t r) {
|
inline void drawFillCircle(uint16_t bcolor, uint8_t r) {
|
||||||
Draw_FillCircle(bcolor, cursor.x, cursor.y, r);
|
drawFillCircle(bcolor, cursor.x, cursor.y, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color Interpolator through Red->Yellow->Green->Blue
|
// Color Interpolator through Red->Yellow->Green->Blue
|
||||||
@@ -600,7 +600,7 @@ namespace DWINUI {
|
|||||||
// length: Bytes to write
|
// length: Bytes to write
|
||||||
// data: address of the buffer with data
|
// data: address of the buffer with data
|
||||||
inline void WriteToSRAM(uint16_t addr, uint16_t length, uint8_t *data) {
|
inline void WriteToSRAM(uint16_t addr, uint16_t length, uint8_t *data) {
|
||||||
DWIN_WriteToMem(0x5A, addr, length, data);
|
dwinWriteToMem(0x5A, addr, length, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write buffer data to the Flash
|
// Write buffer data to the Flash
|
||||||
@@ -608,11 +608,11 @@ namespace DWINUI {
|
|||||||
// length: Bytes to write
|
// length: Bytes to write
|
||||||
// data: address of the buffer with data
|
// data: address of the buffer with data
|
||||||
inline void WriteToFlash(uint16_t addr, uint16_t length, uint8_t *data) {
|
inline void WriteToFlash(uint16_t addr, uint16_t length, uint8_t *data) {
|
||||||
DWIN_WriteToMem(0xA5, addr, length, data);
|
dwinWriteToMem(0xA5, addr, length, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear by filling the area with background color
|
// Clear by filling the area with background color
|
||||||
// Area (0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - 1)
|
// Area (0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - 1)
|
||||||
void ClearMainArea();
|
void clearMainArea();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -46,38 +46,38 @@
|
|||||||
#include "../../../module/probe.h"
|
#include "../../../module/probe.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESDiagClass ESDiag;
|
ESDiag esDiag;
|
||||||
|
|
||||||
void draw_es_label(FSTR_P const flabel=nullptr) {
|
void draw_es_label(FSTR_P const flabel=nullptr) {
|
||||||
DWINUI::cursor.x = 40;
|
DWINUI::cursor.x = 40;
|
||||||
if (flabel) DWINUI::Draw_String(F(flabel));
|
if (flabel) DWINUI::drawString(F(flabel));
|
||||||
DWINUI::Draw_String(F(": "));
|
DWINUI::drawString(F(": "));
|
||||||
DWINUI::MoveBy(0, 25);
|
DWINUI::moveBy(0, 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_es_state(const bool is_hit) {
|
void draw_es_state(const bool is_hit) {
|
||||||
const uint8_t LM = 130;
|
const uint8_t LM = 130;
|
||||||
DWINUI::cursor.x = LM;
|
DWINUI::cursor.x = LM;
|
||||||
dwinDrawRectangle(1, HMI_data.PopupBg_Color, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20);
|
dwinDrawRectangle(1, hmiData.colorPopupBg, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20);
|
||||||
is_hit ? DWINUI::Draw_String(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::Draw_String(RGB(16,63,16), F(STR_ENDSTOP_OPEN));
|
is_hit ? DWINUI::drawString(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::drawString(RGB(16,63,16), F(STR_ENDSTOP_OPEN));
|
||||||
DWINUI::MoveBy(0, 25);
|
DWINUI::moveBy(0, 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESDiagClass::Draw() {
|
void ESDiag::draw() {
|
||||||
Title.ShowCaption(GET_TEXT_F(MSG_ENDSTOP_TEST));
|
title.showCaption(GET_TEXT_F(MSG_ENDSTOP_TEST));
|
||||||
DWINUI::ClearMainArea();
|
DWINUI::clearMainArea();
|
||||||
Draw_Popup_Bkgd();
|
drawPopupBkgd();
|
||||||
DWINUI::Draw_Button(BTN_Continue, 86, 250);
|
DWINUI::drawButton(BTN_Continue, 86, 250);
|
||||||
DWINUI::cursor.y = 80;
|
DWINUI::cursor.y = 80;
|
||||||
#define ES_LABEL(S) draw_es_label(F(STR_##S))
|
#define ES_LABEL(S) draw_es_label(F(STR_##S))
|
||||||
TERN_(USE_X_MIN, ES_LABEL(X_MIN)); TERN_(USE_X_MAX, ES_LABEL(X_MAX));
|
TERN_(USE_X_MIN, ES_LABEL(X_MIN)); TERN_(USE_X_MAX, ES_LABEL(X_MAX));
|
||||||
TERN_(USE_Y_MIN, ES_LABEL(Y_MIN)); TERN_(USE_Y_MAX, ES_LABEL(Y_MAX));
|
TERN_(USE_Y_MIN, ES_LABEL(Y_MIN)); TERN_(USE_Y_MAX, ES_LABEL(Y_MAX));
|
||||||
TERN_(HAS_Z_MIN_PIN, ES_LABEL(Z_MIN)); TERN_(USE_Z_MAX, ES_LABEL(Z_MAX));
|
TERN_(HAS_Z_MIN_PIN, ES_LABEL(Z_MIN)); TERN_(USE_Z_MAX, ES_LABEL(Z_MAX));
|
||||||
TERN_(HAS_FILAMENT_SENSOR, draw_es_label(F(STR_FILAMENT)));
|
TERN_(HAS_FILAMENT_SENSOR, draw_es_label(F(STR_FILAMENT)));
|
||||||
Update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESDiagClass::Update() {
|
void ESDiag::update() {
|
||||||
DWINUI::cursor.y = 80;
|
DWINUI::cursor.y = 80;
|
||||||
#define ES_REPORT(S) draw_es_state(READ(S##_PIN) == S##_ENDSTOP_HIT_STATE)
|
#define ES_REPORT(S) draw_es_state(READ(S##_PIN) == S##_ENDSTOP_HIT_STATE)
|
||||||
TERN_(USE_X_MIN, ES_REPORT(X_MIN)); TERN_(USE_X_MAX, ES_REPORT(X_MAX));
|
TERN_(USE_X_MIN, ES_REPORT(X_MIN)); TERN_(USE_X_MAX, ES_REPORT(X_MAX));
|
||||||
|
@@ -28,10 +28,10 @@
|
|||||||
* Date: 2023/05/10
|
* Date: 2023/05/10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ESDiagClass {
|
class ESDiag {
|
||||||
public:
|
public:
|
||||||
static void Draw();
|
static void draw();
|
||||||
static void Update();
|
static void update();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ESDiagClass ESDiag;
|
extern ESDiag esDiag;
|
||||||
|
@@ -200,27 +200,27 @@ void Preview_DrawFromSD() {
|
|||||||
if (Has_Preview()) {
|
if (Has_Preview()) {
|
||||||
MString<45> buf;
|
MString<45> buf;
|
||||||
char str_1[6] = "", str_2[6] = "", str_3[6] = "";
|
char str_1[6] = "", str_2[6] = "", str_3[6] = "";
|
||||||
dwinDrawRectangle(1, HMI_data.Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1);
|
dwinDrawRectangle(1, hmiData.colorBackground, 0, 0, DWIN_WIDTH, STATUS_Y - 1);
|
||||||
if (fileprop.time) {
|
if (fileprop.time) {
|
||||||
buf.setf(F("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60);
|
buf.setf(F("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60);
|
||||||
DWINUI::Draw_String(20, 10, &buf);
|
DWINUI::drawString(20, 10, &buf);
|
||||||
}
|
}
|
||||||
if (fileprop.filament) {
|
if (fileprop.filament) {
|
||||||
buf.setf(F("Filament used: %s m"), dtostrf(fileprop.filament, 1, 2, str_1));
|
buf.setf(F("Filament used: %s m"), dtostrf(fileprop.filament, 1, 2, str_1));
|
||||||
DWINUI::Draw_String(20, 30, &buf);
|
DWINUI::drawString(20, 30, &buf);
|
||||||
}
|
}
|
||||||
if (fileprop.layer) {
|
if (fileprop.layer) {
|
||||||
buf.setf(F("Layer height: %s mm"), dtostrf(fileprop.layer, 1, 2, str_1));
|
buf.setf(F("Layer height: %s mm"), dtostrf(fileprop.layer, 1, 2, str_1));
|
||||||
DWINUI::Draw_String(20, 50, &buf);
|
DWINUI::drawString(20, 50, &buf);
|
||||||
}
|
}
|
||||||
if (fileprop.width) {
|
if (fileprop.width) {
|
||||||
buf.setf(F("Volume: %sx%sx%s mm"), dtostrf(fileprop.width, 1, 1, str_1), dtostrf(fileprop.length, 1, 1, str_2), dtostrf(fileprop.height, 1, 1, str_3));
|
buf.setf(F("Volume: %sx%sx%s mm"), dtostrf(fileprop.width, 1, 1, str_1), dtostrf(fileprop.length, 1, 1, str_2), dtostrf(fileprop.height, 1, 1, str_3));
|
||||||
DWINUI::Draw_String(20, 70, &buf);
|
DWINUI::drawString(20, 70, &buf);
|
||||||
}
|
}
|
||||||
DWINUI::Draw_Button(BTN_Print, 26, 290);
|
DWINUI::drawButton(BTN_Print, 26, 290);
|
||||||
DWINUI::Draw_Button(BTN_Cancel, 146, 290);
|
DWINUI::drawButton(BTN_Cancel, 146, 290);
|
||||||
Preview_Show();
|
Preview_Show();
|
||||||
Draw_Select_Highlight(true, 290);
|
drawSelectHighlight(true, 290);
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -36,39 +36,39 @@
|
|||||||
#include "dwin.h"
|
#include "dwin.h"
|
||||||
#include "lockscreen.h"
|
#include "lockscreen.h"
|
||||||
|
|
||||||
LockScreenClass lockScreen;
|
LockScreen lockScreen;
|
||||||
|
|
||||||
uint8_t LockScreenClass::lock_pos = 0;
|
uint8_t LockScreen::lock_pos = 0;
|
||||||
bool LockScreenClass::unlocked = false;
|
bool LockScreen::unlocked = false;
|
||||||
uint8_t LockScreenClass::rprocess = 0;
|
uint8_t LockScreen::rprocess = 0;
|
||||||
|
|
||||||
void LockScreenClass::init() {
|
void LockScreen::init() {
|
||||||
lock_pos = 0;
|
lock_pos = 0;
|
||||||
unlocked = false;
|
unlocked = false;
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LockScreenClass::draw() {
|
void LockScreen::draw() {
|
||||||
Title.SetCaption(GET_TEXT_F(MSG_LOCKSCREEN));
|
title.setCaption(GET_TEXT_F(MSG_LOCKSCREEN));
|
||||||
DWINUI::ClearMainArea();
|
DWINUI::clearMainArea();
|
||||||
DWINUI::Draw_Icon(ICON_LOGO, 71, 120); // CREALITY logo
|
DWINUI::drawIcon(ICON_LOGO, 71, 120); // CREALITY logo
|
||||||
DWINUI::Draw_CenteredString(Color_White, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED));
|
DWINUI::drawCenteredString(COLOR_WHITE, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED));
|
||||||
DWINUI::Draw_CenteredString(Color_White, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK));
|
DWINUI::drawCenteredString(COLOR_WHITE, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK));
|
||||||
DWINUI::Draw_CenteredString(Color_White, 240, F("-> | <-"));
|
DWINUI::drawCenteredString(COLOR_WHITE, 240, F("-> | <-"));
|
||||||
dwinDrawBox(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20);
|
dwinDrawBox(1, hmiData.colorBarfill, 0, 260, DWIN_WIDTH, 20);
|
||||||
dwinDrawVLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20);
|
dwinDrawVLine(COLOR_YELLOW, lock_pos * DWIN_WIDTH / 255, 260, 20);
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LockScreenClass::onEncoder(EncoderState encoder_diffState) {
|
void LockScreen::onEncoder(EncoderState encoder_diffState) {
|
||||||
switch (encoder_diffState) {
|
switch (encoder_diffState) {
|
||||||
case ENCODER_DIFF_CW: lock_pos += 8; break;
|
case ENCODER_DIFF_CW: lock_pos += 8; break;
|
||||||
case ENCODER_DIFF_CCW: lock_pos -= 8; break;
|
case ENCODER_DIFF_CCW: lock_pos -= 8; break;
|
||||||
case ENCODER_DIFF_ENTER: unlocked = (lock_pos == 128); break;
|
case ENCODER_DIFF_ENTER: unlocked = (lock_pos == 128); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
dwinDrawBox(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20);
|
dwinDrawBox(1, hmiData.colorBarfill, 0, 260, DWIN_WIDTH, 20);
|
||||||
dwinDrawVLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20);
|
dwinDrawVLine(COLOR_YELLOW, lock_pos * DWIN_WIDTH / 255, 260, 20);
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#include "../common/encoder.h"
|
#include "../common/encoder.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
class LockScreenClass {
|
class LockScreen {
|
||||||
private:
|
private:
|
||||||
static bool unlocked;
|
static bool unlocked;
|
||||||
static uint8_t lock_pos;
|
static uint8_t lock_pos;
|
||||||
@@ -43,4 +43,4 @@ public:
|
|||||||
static bool isUnlocked() { return unlocked; }
|
static bool isUnlocked() { return unlocked; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LockScreenClass lockScreen;
|
extern LockScreen lockScreen;
|
||||||
|
@@ -37,135 +37,135 @@
|
|||||||
|
|
||||||
int8_t MenuItemTotal = 0;
|
int8_t MenuItemTotal = 0;
|
||||||
int8_t MenuItemCount = 0;
|
int8_t MenuItemCount = 0;
|
||||||
CustomMenuItemClass** MenuItems = nullptr;
|
CustomMenuItem** menuItems = nullptr;
|
||||||
MenuClass *CurrentMenu = nullptr;
|
Menu *currentMenu = nullptr;
|
||||||
MenuClass *PreviousMenu = nullptr;
|
Menu *previousMenu = nullptr;
|
||||||
MenuData_t MenuData;
|
MenuData_t menuData;
|
||||||
|
|
||||||
// Menuitem Drawing functions =================================================
|
// Menuitem Drawing functions =================================================
|
||||||
|
|
||||||
void Draw_Title(TitleClass* title) {
|
void drawTitle(Title* aTitle) {
|
||||||
dwinDrawRectangle(1, HMI_data.TitleBg_Color, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1);
|
dwinDrawRectangle(1, hmiData.colorTitleBg, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1);
|
||||||
if (title->frameid)
|
if (aTitle->frameid)
|
||||||
DWIN_Frame_AreaCopy(title->frameid, title->frame.left, title->frame.top, title->frame.right, title->frame.bottom, 14, (TITLE_HEIGHT - (title->frame.bottom - title->frame.top)) / 2 - 1);
|
dwinFrameAreaCopy(aTitle->frameid, aTitle->frame.left, aTitle->frame.top, aTitle->frame.right, aTitle->frame.bottom, 14, (TITLE_HEIGHT - (aTitle->frame.bottom - aTitle->frame.top)) / 2 - 1);
|
||||||
else
|
else
|
||||||
#if ENABLED(TITLE_CENTERED)
|
#if ENABLED(TITLE_CENTERED)
|
||||||
DWINUI::Draw_CenteredString(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption);
|
DWINUI::drawCenteredString(false, DWIN_FONT_HEAD, hmiData.colorTitleTxt, hmiData.colorTitleBg, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, aTitle->caption);
|
||||||
#else
|
#else
|
||||||
dwinDrawString(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption);
|
dwinDrawString(false, DWIN_FONT_HEAD, hmiData.colorTitleTxt, hmiData.colorTitleBg, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, aTitle->caption);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw_Menu_Cursor(const int8_t line) {
|
void drawMenuCursor(const int8_t line) {
|
||||||
const uint16_t ypos = MYPOS(line);
|
const uint16_t ypos = MYPOS(line);
|
||||||
DWINUI::Draw_Box(1, HMI_data.Cursor_Color, {0, ypos, 15, MLINE - 1});
|
DWINUI::drawBox(1, hmiData.colorCursor, {0, ypos, 15, MLINE - 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Erase_Menu_Cursor(const int8_t line) {
|
void eraseMenuCursor(const int8_t line) {
|
||||||
const uint16_t ypos = MYPOS(line);
|
const uint16_t ypos = MYPOS(line);
|
||||||
DWINUI::Draw_Box(1, HMI_data.Background_Color, {0, ypos, 15, MLINE - 1});
|
DWINUI::drawBox(1, hmiData.colorBackground, {0, ypos, 15, MLINE - 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Erase_Menu_Text(const int8_t line) {
|
void eraseMenuText(const int8_t line) {
|
||||||
if (line < 0 || line >= TROWS) return;
|
if (line < 0 || line >= TROWS) return;
|
||||||
const uint16_t ypos = MYPOS(line) + 1;
|
const uint16_t ypos = MYPOS(line) + 1;
|
||||||
DWINUI::Draw_Box(1, HMI_data.Background_Color, {LBLX, ypos, DWIN_WIDTH - LBLX, MLINE - 2});
|
DWINUI::drawBox(1, hmiData.colorBackground, {LBLX, ypos, DWIN_WIDTH - LBLX, MLINE - 2});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw_Menu_Line(const uint8_t line, const uint8_t icon/*=0*/, const char * const label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) {
|
void drawMenuLine(const uint8_t line, const uint8_t icon/*=0*/, const char * const label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) {
|
||||||
if (icon) DWINUI::Draw_Icon(icon, ICOX, MBASE(line) - 3);
|
if (icon) DWINUI::drawIcon(icon, ICOX, MBASE(line) - 3);
|
||||||
if (label) DWINUI::Draw_String(LBLX, MBASE(line) - 1, (char*)label);
|
if (label) DWINUI::drawString(LBLX, MBASE(line) - 1, (char*)label);
|
||||||
if (more) DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3);
|
if (more) DWINUI::drawIcon(ICON_More, VALX + 16, MBASE(line) - 3);
|
||||||
if (selected) Draw_Menu_Cursor(line);
|
if (selected) drawMenuCursor(line);
|
||||||
dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
|
dwinDrawHLine(hmiData.colorSplitLine, 16, MYPOS(line + 1), 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw_Menu_Line(const uint8_t line, const uint8_t icon/*=0*/, FSTR_P label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) {
|
void drawMenuLine(const uint8_t line, const uint8_t icon/*=0*/, FSTR_P label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) {
|
||||||
Draw_Menu_Line(line, icon, FTOP(label), more, selected);
|
drawMenuLine(line, icon, FTOP(label), more, selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw_Chkb_Line(const uint8_t line, const bool checked) {
|
void drawCheckboxLine(const uint8_t line, const bool checked) {
|
||||||
DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked);
|
DWINUI::drawCheckbox(hmiData.colorText, hmiData.colorBackground, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Show_Chkb_Line(const bool checked) {
|
void showCheckboxLine(const bool checked) {
|
||||||
const uint8_t line = CurrentMenu->line();
|
const uint8_t line = currentMenu->line();
|
||||||
DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked);
|
DWINUI::drawCheckbox(hmiData.colorText, hmiData.colorBackground, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked);
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toggle_Chkb_Line(bool &checked) {
|
void toggleCheckboxLine(bool &checked) {
|
||||||
checked = !checked;
|
checked = !checked;
|
||||||
Show_Chkb_Line(checked);
|
showCheckboxLine(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value/*=0*/) {
|
void drawMenuIntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value/*=0*/) {
|
||||||
DWINUI::Draw_Signed_Int(HMI_data.Text_Color, bcolor, iNum , VALX, MBASE(line) - 1, value);
|
DWINUI::drawSignedInt(hmiData.colorText, bcolor, iNum , VALX, MBASE(line) - 1, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDrawMenuItem(MenuItemClass* menuitem, int8_t line) {
|
void onDrawMenuItem(MenuItem* menuitem, int8_t line) {
|
||||||
if (menuitem->icon) DWINUI::Draw_Icon(menuitem->icon, ICOX, MBASE(line) - 3);
|
if (menuitem->icon) DWINUI::drawIcon(menuitem->icon, ICOX, MBASE(line) - 3);
|
||||||
if (menuitem->frameid)
|
if (menuitem->frameid)
|
||||||
DWIN_Frame_AreaCopy(menuitem->frameid, menuitem->frame.left, menuitem->frame.top, menuitem->frame.right, menuitem->frame.bottom, LBLX, MBASE(line));
|
dwinFrameAreaCopy(menuitem->frameid, menuitem->frame.left, menuitem->frame.top, menuitem->frame.right, menuitem->frame.bottom, LBLX, MBASE(line));
|
||||||
else if (menuitem->caption)
|
else if (menuitem->caption)
|
||||||
DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption);
|
DWINUI::drawString(LBLX, MBASE(line) - 1, menuitem->caption);
|
||||||
dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
|
dwinDrawHLine(hmiData.colorSplitLine, 16, MYPOS(line + 1), 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDrawSubMenu(MenuItemClass* menuitem, int8_t line) {
|
void onDrawSubMenu(MenuItem* menuitem, int8_t line) {
|
||||||
onDrawMenuItem(menuitem, line);
|
onDrawMenuItem(menuitem, line);
|
||||||
DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3);
|
DWINUI::drawIcon(ICON_More, VALX + 16, MBASE(line) - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDrawIntMenu(MenuItemClass* menuitem, int8_t line, int32_t value) {
|
void onDrawIntMenu(MenuItem* menuitem, int8_t line, int32_t value) {
|
||||||
onDrawMenuItem(menuitem, line);
|
onDrawMenuItem(menuitem, line);
|
||||||
Draw_Menu_IntValue(HMI_data.Background_Color, line, 4, value);
|
drawMenuIntValue(hmiData.colorBackground, line, 4, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDrawPIntMenu(MenuItemClass* menuitem, int8_t line) {
|
void onDrawPIntMenu(MenuItem* menuitem, int8_t line) {
|
||||||
const int16_t value = *(int16_t*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
const int16_t value = *(int16_t*)static_cast<MenuItemPtr*>(menuitem)->value;
|
||||||
onDrawIntMenu(menuitem, line, value);
|
onDrawIntMenu(menuitem, line, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDrawPInt8Menu(MenuItemClass* menuitem, int8_t line) {
|
void onDrawPInt8Menu(MenuItem* menuitem, int8_t line) {
|
||||||
const uint8_t value = *(uint8_t*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
const uint8_t value = *(uint8_t*)static_cast<MenuItemPtr*>(menuitem)->value;
|
||||||
onDrawIntMenu(menuitem, line, value);
|
onDrawIntMenu(menuitem, line, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line) {
|
void onDrawPInt32Menu(MenuItem* menuitem, int8_t line) {
|
||||||
const uint32_t value = *(uint32_t*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
const uint32_t value = *(uint32_t*)static_cast<MenuItemPtr*>(menuitem)->value;
|
||||||
onDrawIntMenu(menuitem, line, value);
|
onDrawIntMenu(menuitem, line, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value) {
|
void onDrawFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp, const float value) {
|
||||||
onDrawMenuItem(menuitem, line);
|
onDrawMenuItem(menuitem, line);
|
||||||
DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), value);
|
DWINUI::drawSignedFloat(hmiData.colorText, hmiData.colorBackground, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp) {
|
void onDrawPFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp) {
|
||||||
const float value = *(float*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
const float value = *(float*)static_cast<MenuItemPtr*>(menuitem)->value;
|
||||||
onDrawFloatMenu(menuitem, line, dp, value);
|
onDrawFloatMenu(menuitem, line, dp, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked) {
|
void onDrawChkbMenu(MenuItem* menuitem, int8_t line, bool checked) {
|
||||||
onDrawMenuItem(menuitem, line);
|
onDrawMenuItem(menuitem, line);
|
||||||
Draw_Chkb_Line(line, checked);
|
drawCheckboxLine(line, checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line) {
|
void onDrawChkbMenu(MenuItem* menuitem, int8_t line) {
|
||||||
const bool val = *(bool*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
const bool val = *(bool*)static_cast<MenuItemPtr*>(menuitem)->value;
|
||||||
onDrawChkbMenu(menuitem, line, val);
|
onDrawChkbMenu(menuitem, line, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawItemEdit(const bool selected) {
|
void DrawItemEdit(const bool selected) {
|
||||||
const uint16_t bcolor = selected ? HMI_data.Selected_Color : HMI_data.Background_Color;
|
const uint16_t bcolor = selected ? hmiData.colorSelected : hmiData.colorBackground;
|
||||||
const uint8_t iNum = 4 - ((MenuData.dp > 0) ? (MenuData.dp - 1) : 0);
|
const uint8_t iNum = 4 - ((menuData.dp > 0) ? (menuData.dp - 1) : 0);
|
||||||
switch (checkkey) {
|
switch (checkkey) {
|
||||||
case SetIntNoDraw: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
case ID_SetIntNoDraw: if (menuData.liveUpdate) menuData.liveUpdate(); break;
|
||||||
case SetInt:
|
case ID_SetInt:
|
||||||
case SetPInt: DWINUI::Draw_Signed_Int(HMI_data.Text_Color, bcolor, iNum , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value); break;
|
case ID_SetPInt: DWINUI::drawSignedInt(hmiData.colorText, bcolor, iNum , VALX, MBASE(currentMenu->line()) - 1, menuData.value); break;
|
||||||
case SetFloat:
|
case ID_SetFloat:
|
||||||
case SetPFloat: DWINUI::Draw_Signed_Float(HMI_data.Text_Color, bcolor, iNum, MenuData.dp, VALX - 2 * DWINUI::fontWidth(), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, MenuData.dp)); break;
|
case ID_SetPFloat: DWINUI::drawSignedFloat(hmiData.colorText, bcolor, iNum, menuData.dp, VALX - 2 * DWINUI::fontWidth(), MBASE(currentMenu->line()), menuData.value / POW(10, menuData.dp)); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,16 +180,16 @@ void DrawItemEdit(const bool selected) {
|
|||||||
// hi: high limit
|
// hi: high limit
|
||||||
// dp: decimal places, 0 for integers
|
// dp: decimal places, 0 for integers
|
||||||
// val: value / scaled value
|
// val: value / scaled value
|
||||||
// LiveUpdate: live update function when the encoder changes
|
// liveUpdate: live update function when the encoder changes
|
||||||
// Apply: update function when the encoder is pressed
|
// apply: update function when the encoder is pressed
|
||||||
void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) {
|
void setOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) {
|
||||||
checkkey = process;
|
checkkey = process;
|
||||||
MenuData.MinValue = lo;
|
menuData.minValue = lo;
|
||||||
MenuData.MaxValue = hi;
|
menuData.maxValue = hi;
|
||||||
MenuData.dp = dp;
|
menuData.dp = dp;
|
||||||
MenuData.Apply = Apply;
|
menuData.apply = apply;
|
||||||
MenuData.LiveUpdate = LiveUpdate;
|
menuData.liveUpdate = liveUpdate;
|
||||||
MenuData.Value = constrain(val, lo, hi);
|
menuData.value = constrain(val, lo, hi);
|
||||||
encoderRate.enabled = true;
|
encoderRate.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,10 +198,10 @@ void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp,
|
|||||||
// lo: scaled low limit
|
// lo: scaled low limit
|
||||||
// hi: scaled high limit
|
// hi: scaled high limit
|
||||||
// val: value
|
// val: value
|
||||||
// LiveUpdate: live update function when the encoder changes
|
// liveUpdate: live update function when the encoder changes
|
||||||
// Apply: update function when the encoder is pressed
|
// apply: update function when the encoder is pressed
|
||||||
void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) {
|
void setValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) {
|
||||||
SetOnClick(process, lo, hi, 0, val, Apply, LiveUpdate);
|
setOnClick(process, lo, hi, 0, val, apply, liveUpdate);
|
||||||
DrawItemEdit(true);
|
DrawItemEdit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,11 +210,11 @@ void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const
|
|||||||
// lo: scaled low limit
|
// lo: scaled low limit
|
||||||
// hi: scaled high limit
|
// hi: scaled high limit
|
||||||
// val: value
|
// val: value
|
||||||
// LiveUpdate: live update function when the encoder changes
|
// liveUpdate: live update function when the encoder changes
|
||||||
// Apply: update function when the encoder is pressed
|
// apply: update function when the encoder is pressed
|
||||||
void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) {
|
void setValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) {
|
||||||
const int32_t value = round(val * POW(10, dp));
|
const int32_t value = round(val * POW(10, dp));
|
||||||
SetOnClick(process, lo * POW(10, dp), hi * POW(10, dp), dp, value, Apply, LiveUpdate);
|
setOnClick(process, lo * POW(10, dp), hi * POW(10, dp), dp, value, apply, liveUpdate);
|
||||||
DrawItemEdit(true);
|
DrawItemEdit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,21 +222,21 @@ void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp
|
|||||||
// lo: scaled low limit
|
// lo: scaled low limit
|
||||||
// hi: scaled high limit
|
// hi: scaled high limit
|
||||||
// val: value
|
// val: value
|
||||||
// LiveUpdate: live update function when the encoder changes
|
// liveUpdate: live update function when the encoder changes
|
||||||
// Apply: update function when the encoder is pressed
|
// apply: update function when the encoder is pressed
|
||||||
void SetIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) {
|
void setIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) {
|
||||||
SetValueOnClick(SetInt, lo, hi, val, Apply, LiveUpdate);
|
setValueOnClick(ID_SetInt, lo, hi, val, apply, liveUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic onclick event for set pointer to 16 bit uinteger values
|
// Generic onclick event for set pointer to 16 bit uinteger values
|
||||||
// lo: low limit
|
// lo: low limit
|
||||||
// hi: high limit
|
// hi: high limit
|
||||||
// LiveUpdate: live update function when the encoder changes
|
// liveUpdate: live update function when the encoder changes
|
||||||
// Apply: update function when the encoder is pressed
|
// apply: update function when the encoder is pressed
|
||||||
void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) {
|
void setPIntOnClick(const int32_t lo, const int32_t hi, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) {
|
||||||
MenuData.P_Int = (int16_t*)static_cast<MenuItemPtrClass*>(CurrentMenu->SelectedItem())->value;
|
menuData.intPtr = (int16_t*)static_cast<MenuItemPtr*>(currentMenu->selectedItem())->value;
|
||||||
const int32_t value = *MenuData.P_Int;
|
const int32_t value = *menuData.intPtr;
|
||||||
SetValueOnClick(SetPInt, lo, hi, value, Apply, LiveUpdate);
|
setValueOnClick(ID_SetPInt, lo, hi, value, apply, liveUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic onclick event for float values
|
// Generic onclick event for float values
|
||||||
@@ -245,31 +245,31 @@ void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)()/*=nullpt
|
|||||||
// hi: high limit
|
// hi: high limit
|
||||||
// dp: decimal places
|
// dp: decimal places
|
||||||
// val: value
|
// val: value
|
||||||
void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) {
|
void setFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) {
|
||||||
SetValueOnClick(SetFloat, lo, hi, dp, val, Apply, LiveUpdate);
|
setValueOnClick(ID_SetFloat, lo, hi, dp, val, apply, liveUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic onclick event for set pointer to float values
|
// Generic onclick event for set pointer to float values
|
||||||
// lo: low limit
|
// lo: low limit
|
||||||
// hi: high limit
|
// hi: high limit
|
||||||
// LiveUpdate: live update function when the encoder changes
|
// liveUpdate: live update function when the encoder changes
|
||||||
// Apply: update function when the encoder is pressed
|
// apply: update function when the encoder is pressed
|
||||||
void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) {
|
void setPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) {
|
||||||
MenuData.P_Float = (float*)static_cast<MenuItemPtrClass*>(CurrentMenu->SelectedItem())->value;
|
menuData.floatPtr = (float*)static_cast<MenuItemPtr*>(currentMenu->selectedItem())->value;
|
||||||
SetValueOnClick(SetPFloat, lo, hi, dp, *MenuData.P_Float, Apply, LiveUpdate);
|
setValueOnClick(ID_SetPFloat, lo, hi, dp, *menuData.floatPtr, apply, liveUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// HMI Control functions ======================================================
|
// HMI Control functions ======================================================
|
||||||
|
|
||||||
// Generic menu control using the encoder
|
// Generic menu control using the encoder
|
||||||
void HMI_Menu() {
|
void hmiMenu() {
|
||||||
EncoderState encoder_diffState = get_encoder_state();
|
EncoderState encoder_diffState = get_encoder_state();
|
||||||
if (CurrentMenu) {
|
if (currentMenu) {
|
||||||
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
||||||
if (encoder_diffState == ENCODER_DIFF_ENTER)
|
if (encoder_diffState == ENCODER_DIFF_ENTER)
|
||||||
CurrentMenu->onClick();
|
currentMenu->onClick();
|
||||||
else
|
else
|
||||||
CurrentMenu->onScroll(encoder_diffState == ENCODER_DIFF_CW);
|
currentMenu->onScroll(encoder_diffState == ENCODER_DIFF_CW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,283 +279,283 @@ void HMI_Menu() {
|
|||||||
// 0 : no change
|
// 0 : no change
|
||||||
// 1 : live change
|
// 1 : live change
|
||||||
// 2 : apply change
|
// 2 : apply change
|
||||||
int8_t HMI_Get(bool draw) {
|
int8_t hmiGet(bool draw) {
|
||||||
const int32_t lo = MenuData.MinValue;
|
const int32_t lo = menuData.minValue;
|
||||||
const int32_t hi = MenuData.MaxValue;
|
const int32_t hi = menuData.maxValue;
|
||||||
const int32_t cval = MenuData.Value;
|
const int32_t cval = menuData.value;
|
||||||
EncoderState encoder_diffState = TERN(SMOOTH_ENCODER_MENUITEMS, get_encoder_state(), encoderReceiveAnalyze());
|
EncoderState encoder_diffState = TERN(SMOOTH_ENCODER_MENUITEMS, get_encoder_state(), encoderReceiveAnalyze());
|
||||||
if (encoder_diffState != ENCODER_DIFF_NO) {
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
||||||
if (applyEncoder(encoder_diffState, MenuData.Value)) {
|
if (applyEncoder(encoder_diffState, menuData.value)) {
|
||||||
encoderRate.enabled = false;
|
encoderRate.enabled = false;
|
||||||
if (draw) DrawItemEdit(false);
|
if (draw) DrawItemEdit(false);
|
||||||
checkkey = Menu;
|
checkkey = ID_Menu;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
LIMIT(MenuData.Value, lo, hi);
|
LIMIT(menuData.value, lo, hi);
|
||||||
}
|
}
|
||||||
const bool change = cval != MenuData.Value;
|
const bool change = cval != menuData.value;
|
||||||
if (change) DrawItemEdit(true);
|
if (change) DrawItemEdit(true);
|
||||||
return int8_t(change);
|
return int8_t(change);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set and draw a value using the encoder
|
// Set and draw a value using the encoder
|
||||||
void HMI_SetDraw() {
|
void hmiSetDraw() {
|
||||||
int8_t val = HMI_Get(true);
|
int8_t val = hmiGet(true);
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 0: return;
|
case 0: return;
|
||||||
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break;
|
||||||
case 2: if (MenuData.Apply) MenuData.Apply(); break;
|
case 2: if (menuData.apply) menuData.apply(); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set an value without drawing
|
// Set an value without drawing
|
||||||
void HMI_SetNoDraw() {
|
void hmiSetNoDraw() {
|
||||||
int8_t val = HMI_Get(false);
|
int8_t val = hmiGet(false);
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 0: return;
|
case 0: return;
|
||||||
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break;
|
||||||
case 2: if (MenuData.Apply) MenuData.Apply(); break;
|
case 2: if (menuData.apply) menuData.apply(); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set an integer pointer variable using the encoder
|
// Set an integer pointer variable using the encoder
|
||||||
void HMI_SetPInt() {
|
void hmiSetPInt() {
|
||||||
int8_t val = HMI_Get(true);
|
int8_t val = hmiGet(true);
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 0: return;
|
case 0: return;
|
||||||
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break;
|
||||||
case 2: *MenuData.P_Int = MenuData.Value; if (MenuData.Apply) MenuData.Apply(); break;
|
case 2: *menuData.intPtr = menuData.value; if (menuData.apply) menuData.apply(); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a scaled float pointer variable using the encoder
|
// Set a scaled float pointer variable using the encoder
|
||||||
void HMI_SetPFloat() {
|
void hmiSetPFloat() {
|
||||||
const int8_t val = HMI_Get(true);
|
const int8_t val = hmiGet(true);
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 0: return;
|
case 0: return;
|
||||||
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break;
|
||||||
case 2: *MenuData.P_Float = MenuData.Value / POW(10, MenuData.dp); if (MenuData.Apply) MenuData.Apply(); break;
|
case 2: *menuData.floatPtr = menuData.value / POW(10, menuData.dp); if (menuData.apply) menuData.apply(); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Menu Class ===============================================================
|
// Menu Class ===============================================================
|
||||||
|
|
||||||
MenuClass::MenuClass() {
|
Menu::Menu() {
|
||||||
selected = 0;
|
selected = 0;
|
||||||
topline = 0;
|
topline = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuClass::draw() {
|
void Menu::draw() {
|
||||||
MenuTitle.draw();
|
menuTitle.draw();
|
||||||
DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color);
|
DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg);
|
||||||
dwinDrawRectangle(1, DWINUI::backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1);
|
dwinDrawRectangle(1, DWINUI::backColor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1);
|
||||||
for (int8_t i = 0; i < MenuItemCount; i++)
|
for (int8_t i = 0; i < MenuItemCount; i++)
|
||||||
MenuItems[i]->draw(i - topline);
|
menuItems[i]->draw(i - topline);
|
||||||
Draw_Menu_Cursor(line());
|
drawMenuCursor(line());
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuClass::onScroll(bool dir) {
|
void Menu::onScroll(bool dir) {
|
||||||
int8_t sel = selected;
|
int8_t sel = selected;
|
||||||
if (dir) sel++; else sel--;
|
if (dir) sel++; else sel--;
|
||||||
LIMIT(sel, 0, MenuItemCount - 1);
|
LIMIT(sel, 0, MenuItemCount - 1);
|
||||||
if (sel != selected) {
|
if (sel != selected) {
|
||||||
Erase_Menu_Cursor(line());
|
eraseMenuCursor(line());
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
if ((sel - topline) == TROWS) {
|
if ((sel - topline) == TROWS) {
|
||||||
dwinFrameAreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1);
|
dwinFrameAreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backColor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1);
|
||||||
topline++;
|
topline++;
|
||||||
MenuItems[sel]->draw(TROWS - 1);
|
menuItems[sel]->draw(TROWS - 1);
|
||||||
}
|
}
|
||||||
if ((sel < topline)) {
|
if ((sel < topline)) {
|
||||||
dwinFrameAreaMove(1, DWIN_SCROLL_DOWN, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1);
|
dwinFrameAreaMove(1, DWIN_SCROLL_DOWN, MLINE, DWINUI::backColor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1);
|
||||||
topline--;
|
topline--;
|
||||||
MenuItems[sel]->draw(0);
|
menuItems[sel]->draw(0);
|
||||||
}
|
}
|
||||||
selected = sel;
|
selected = sel;
|
||||||
Draw_Menu_Cursor(line());
|
drawMenuCursor(line());
|
||||||
dwinUpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuClass::onClick() {
|
void Menu::onClick() {
|
||||||
if (MenuItems[selected]->onClick != nullptr) (*MenuItems[selected]->onClick)();
|
if (menuItems[selected]->onClick != nullptr) (*menuItems[selected]->onClick)();
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomMenuItemClass *MenuClass::SelectedItem() {
|
CustomMenuItem *Menu::selectedItem() {
|
||||||
return MenuItems[selected];
|
return menuItems[selected];
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomMenuItemClass** MenuClass::Items() {
|
CustomMenuItem** Menu::items() {
|
||||||
return MenuItems;
|
return menuItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t MenuClass::count() {
|
int8_t Menu::count() {
|
||||||
return MenuItemCount;
|
return MenuItemCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* MenuItem Class ===========================================================*/
|
/* MenuItem Class ===========================================================*/
|
||||||
|
|
||||||
void CustomMenuItemClass::draw(int8_t line) {
|
void CustomMenuItem::draw(int8_t line) {
|
||||||
if (line < 0 || line >= TROWS) return;
|
if (line < 0 || line >= TROWS) return;
|
||||||
if (onDraw != nullptr) (*onDraw)(static_cast<MenuItemClass*>(this), line);
|
if (onDraw != nullptr) (*onDraw)(static_cast<MenuItem*>(this), line);
|
||||||
};
|
};
|
||||||
|
|
||||||
void CustomMenuItemClass::redraw(bool erase/*=false*/) {
|
void CustomMenuItem::redraw(bool erase/*=false*/) {
|
||||||
const int8_t line = CurrentMenu->line(this->pos);
|
const int8_t line = currentMenu->line(this->pos);
|
||||||
if (erase) Erase_Menu_Text(line);
|
if (erase) eraseMenuText(line);
|
||||||
draw(line);
|
draw(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomMenuItemClass::CustomMenuItemClass(OnDrawItem ondraw, OnClickItem onclick) {
|
CustomMenuItem::CustomMenuItem(OnDrawItem ondraw, OnClickItem onclick) {
|
||||||
onClick = onclick;
|
onClick = onclick;
|
||||||
onDraw = ondraw;
|
onDraw = ondraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItemClass::MenuItemClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItemClass(ondraw, onclick) {
|
MenuItem::MenuItem(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItem(ondraw, onclick) {
|
||||||
icon = cicon;
|
icon = cicon;
|
||||||
SetCaption(text);
|
setCaption(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItemClass::MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItemClass(ondraw, onclick) {
|
MenuItem::MenuItem(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItem(ondraw, onclick) {
|
||||||
icon = cicon;
|
icon = cicon;
|
||||||
caption[0] = '\0';
|
caption[0] = '\0';
|
||||||
frameid = id;
|
frameid = id;
|
||||||
frame = { x1, y1, x2, y2 };
|
frame = { x1, y1, x2, y2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuItemClass::SetCaption(const char * const text) {
|
void MenuItem::setCaption(const char * const text) {
|
||||||
const uint8_t len = _MIN(sizeof(caption) - 1, strlen(text));
|
const uint8_t len = _MIN(sizeof(caption) - 1, strlen(text));
|
||||||
memcpy(&caption[0], text, len);
|
memcpy(&caption[0], text, len);
|
||||||
caption[len] = '\0';
|
caption[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuItemClass::SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
|
void MenuItem::setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
|
||||||
caption[0] = '\0';
|
caption[0] = '\0';
|
||||||
frameid = id;
|
frameid = id;
|
||||||
frame = { x1, y1, x2, y2 };
|
frame = { x1, y1, x2, y2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItemPtrClass::MenuItemPtrClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemClass(cicon, text, ondraw, onclick) {
|
MenuItemPtr::MenuItemPtr(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItem(cicon, text, ondraw, onclick) {
|
||||||
value = val;
|
value = val;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Menu auxiliary functions ===================================================
|
// Menu auxiliary functions ===================================================
|
||||||
|
|
||||||
void MenuItemsClear() {
|
void menuItemsClear() {
|
||||||
if (MenuItems == nullptr) return;
|
if (menuItems == nullptr) return;
|
||||||
for (int8_t i = 0; i < MenuItemCount; i++) delete MenuItems[i];
|
for (int8_t i = 0; i < MenuItemCount; i++) delete menuItems[i];
|
||||||
delete[] MenuItems;
|
delete[] menuItems;
|
||||||
MenuItems = nullptr;
|
menuItems = nullptr;
|
||||||
MenuItemCount = 0;
|
MenuItemCount = 0;
|
||||||
MenuItemTotal = 0;
|
MenuItemTotal = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuItemsPrepare(int8_t totalitems) {
|
void menuItemsPrepare(int8_t totalitems) {
|
||||||
MenuItemsClear();
|
menuItemsClear();
|
||||||
MenuItemTotal = _MIN(totalitems, MENU_MAX_ITEMS);
|
MenuItemTotal = _MIN(totalitems, MENU_MAX_ITEMS);
|
||||||
MenuItems = new CustomMenuItemClass*[totalitems];
|
menuItems = new CustomMenuItem*[totalitems];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsMenu(MenuClass* _menu) {
|
bool isMenu(Menu* _menu) {
|
||||||
return ((checkkey == Menu) && !!CurrentMenu && (CurrentMenu == _menu));
|
return ((checkkey == ID_Menu) && !!currentMenu && (currentMenu == _menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T* MenuItemAdd(T* menuitem) {
|
T* menuItemAdd(T* menuitem) {
|
||||||
MenuItems[MenuItemCount] = menuitem;
|
menuItems[MenuItemCount] = menuitem;
|
||||||
menuitem->pos = MenuItemCount++;
|
menuitem->pos = MenuItemCount++;
|
||||||
return menuitem;
|
return menuitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomMenuItemClass* MenuItemAdd(OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) {
|
CustomMenuItem* menuItemAdd(OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) {
|
||||||
if (MenuItemCount < MenuItemTotal) {
|
if (MenuItemCount < MenuItemTotal) {
|
||||||
CustomMenuItemClass* menuitem = new CustomMenuItemClass(ondraw, onclick);
|
CustomMenuItem* menuitem = new CustomMenuItem(ondraw, onclick);
|
||||||
return MenuItemAdd(menuitem);
|
return menuItemAdd(menuitem);
|
||||||
}
|
}
|
||||||
else return nullptr;
|
else return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItemClass* MenuItemAdd(uint8_t cicon, const char * const text/*=nullptr*/, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) {
|
MenuItem* menuItemAdd(uint8_t cicon, const char * const text/*=nullptr*/, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) {
|
||||||
if (MenuItemCount < MenuItemTotal) {
|
if (MenuItemCount < MenuItemTotal) {
|
||||||
MenuItemClass* menuitem = new MenuItemClass(cicon, text, ondraw, onclick);
|
MenuItem* menuitem = new MenuItem(cicon, text, ondraw, onclick);
|
||||||
return MenuItemAdd(menuitem);
|
return menuItemAdd(menuitem);
|
||||||
}
|
}
|
||||||
else return nullptr;
|
else return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItemClass* MenuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) {
|
MenuItem* menuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) {
|
||||||
if (MenuItemCount < MenuItemTotal) {
|
if (MenuItemCount < MenuItemTotal) {
|
||||||
MenuItemClass* menuitem = new MenuItemClass(cicon, id, x1, y1, x2, y2, ondraw, onclick);
|
MenuItem* menuitem = new MenuItem(cicon, id, x1, y1, x2, y2, ondraw, onclick);
|
||||||
return MenuItemAdd(menuitem);
|
return menuItemAdd(menuitem);
|
||||||
}
|
}
|
||||||
else return nullptr;
|
else return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItemClass* EditItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) {
|
MenuItem* editItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) {
|
||||||
if (MenuItemCount < MenuItemTotal) {
|
if (MenuItemCount < MenuItemTotal) {
|
||||||
MenuItemClass* menuitem = new MenuItemPtrClass(cicon, text, ondraw, onclick, val);
|
MenuItem* menuitem = new MenuItemPtr(cicon, text, ondraw, onclick, val);
|
||||||
return MenuItemAdd(menuitem);
|
return menuItemAdd(menuitem);
|
||||||
}
|
}
|
||||||
else return nullptr;
|
else return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitMenu() {
|
void initMenu() {
|
||||||
CurrentMenu = nullptr;
|
currentMenu = nullptr;
|
||||||
PreviousMenu = nullptr;
|
previousMenu = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems) {
|
bool setMenu(Menu* &menu, FSTR_P fTitle, int8_t totalitems) {
|
||||||
if (!menu) menu = new MenuClass();
|
if (!menu) menu = new Menu();
|
||||||
const bool NotCurrent = (CurrentMenu != menu);
|
const bool NotCurrent = (currentMenu != menu);
|
||||||
if (NotCurrent) {
|
if (NotCurrent) {
|
||||||
menu->MenuTitle.SetCaption(title);
|
menu->menuTitle.setCaption(fTitle);
|
||||||
MenuItemsPrepare(totalitems);
|
menuItemsPrepare(totalitems);
|
||||||
}
|
}
|
||||||
return NotCurrent;
|
return NotCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetMenu(MenuClass* &menu, frame_rect_t cn, FSTR_P title, int8_t totalitems) {
|
bool setMenu(Menu* &menu, frame_rect_t cn, FSTR_P fTitle, int8_t totalitems) {
|
||||||
if (!menu) menu = new MenuClass();
|
if (!menu) menu = new Menu();
|
||||||
const bool NotCurrent = (CurrentMenu != menu);
|
const bool NotCurrent = (currentMenu != menu);
|
||||||
if (NotCurrent) {
|
if (NotCurrent) {
|
||||||
if (cn.w != 0)
|
if (cn.w != 0)
|
||||||
menu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h);
|
menu->menuTitle.setFrame(cn.x, cn.y, cn.w, cn.h);
|
||||||
else
|
else
|
||||||
menu->MenuTitle.SetCaption(title);
|
menu->menuTitle.setCaption(fTitle);
|
||||||
MenuItemsPrepare(totalitems);
|
menuItemsPrepare(totalitems);
|
||||||
}
|
}
|
||||||
return NotCurrent;
|
return NotCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetMenu(MenuClass* &menu) {
|
void resetMenu(Menu* &menu) {
|
||||||
if (menu) {
|
if (menu) {
|
||||||
menu->topline = 0;
|
menu->topline = 0;
|
||||||
menu->selected = 0;
|
menu->selected = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InvalidateMenu() {
|
void invalidateMenu() {
|
||||||
ResetMenu(CurrentMenu);
|
resetMenu(currentMenu);
|
||||||
CurrentMenu = nullptr;
|
currentMenu = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateMenu(MenuClass* &menu) {
|
void updateMenu(Menu* &menu) {
|
||||||
if (!menu) return;
|
if (!menu) return;
|
||||||
if (CurrentMenu != menu) {
|
if (currentMenu != menu) {
|
||||||
PreviousMenu = CurrentMenu;
|
previousMenu = currentMenu;
|
||||||
CurrentMenu = menu;
|
currentMenu = menu;
|
||||||
}
|
}
|
||||||
menu->draw();
|
menu->draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReDrawMenu(bool force/*=false*/) {
|
void ReDrawMenu(bool force/*=false*/) {
|
||||||
if (CurrentMenu && (force || checkkey == Menu)) CurrentMenu->draw();
|
if (currentMenu && (force || checkkey == ID_Menu)) currentMenu->draw();
|
||||||
if (force) DrawItemEdit(true);
|
if (force) DrawItemEdit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReDrawItem() {
|
void ReDrawItem() {
|
||||||
static_cast<MenuItemClass*>(CurrentMenu->SelectedItem())->redraw(false);
|
static_cast<MenuItem*>(currentMenu->selectedItem())->redraw(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DWIN_LCD_PROUI
|
#endif // DWIN_LCD_PROUI
|
||||||
|
@@ -37,154 +37,154 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t MaxValue = 0; // Auxiliar max integer/scaled float value
|
int32_t maxValue = 0; // Auxiliar max integer/scaled float value
|
||||||
int32_t MinValue = 0; // Auxiliar min integer/scaled float value
|
int32_t minValue = 0; // Auxiliar min integer/scaled float value
|
||||||
int8_t dp = 0; // Auxiliar decimal places
|
int8_t dp = 0; // Auxiliar decimal places
|
||||||
int32_t Value = 0; // Auxiliar integer / scaled float value
|
int32_t value = 0; // Auxiliar integer / scaled float value
|
||||||
int16_t *P_Int = nullptr; // Auxiliar pointer to 16 bit integer variable
|
int16_t *intPtr = nullptr; // Auxiliar pointer to 16 bit integer variable
|
||||||
float *P_Float = nullptr; // Auxiliar pointer to float variable
|
float *floatPtr = nullptr; // Auxiliar pointer to float variable
|
||||||
void (*Apply)() = nullptr; // Auxiliar apply function
|
void (*apply)() = nullptr; // Auxiliar apply function
|
||||||
void (*LiveUpdate)() = nullptr; // Auxiliar live update function
|
void (*liveUpdate)() = nullptr; // Auxiliar live update function
|
||||||
} MenuData_t;
|
} MenuData_t;
|
||||||
|
|
||||||
extern MenuData_t MenuData;
|
extern MenuData_t menuData;
|
||||||
|
|
||||||
// Auxiliary Macros ===========================================================
|
// Auxiliary Macros ===========================================================
|
||||||
|
|
||||||
// Create and add a MenuItem object to the menu array
|
// Create and add a MenuItem object to the menu array
|
||||||
#define SET_MENU(I,L,V) SetMenu(I, GET_TEXT_F(L), V)
|
#define SET_MENU(I,L,V) setMenu(I, GET_TEXT_F(L), V)
|
||||||
#define SET_MENU_F(I,L,V) SetMenu(I, F(L), V)
|
#define SET_MENU_F(I,L,V) setMenu(I, F(L), V)
|
||||||
#define SET_MENU_R(I,R,L,V) SetMenu(I, R, GET_TEXT_F(L), V)
|
#define SET_MENU_R(I,R,L,V) setMenu(I, R, GET_TEXT_F(L), V)
|
||||||
|
|
||||||
#define BACK_ITEM(H) MenuItemAdd(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, H)
|
#define BACK_ITEM(H) menuItemAdd(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, H)
|
||||||
#define MENU_ITEM(I,L,V...) MenuItemAdd(I, GET_TEXT_F(L), V)
|
#define MENU_ITEM(I,L,V...) menuItemAdd(I, GET_TEXT_F(L), V)
|
||||||
#define EDIT_ITEM(I,L,V...) EditItemAdd(I, GET_TEXT_F(L), V)
|
#define EDIT_ITEM(I,L,V...) editItemAdd(I, GET_TEXT_F(L), V)
|
||||||
#define MENU_ITEM_F(I,L,V...) MenuItemAdd(I, F(L), V)
|
#define MENU_ITEM_F(I,L,V...) menuItemAdd(I, F(L), V)
|
||||||
#define EDIT_ITEM_F(I,L,V...) EditItemAdd(I, F(L), V)
|
#define EDIT_ITEM_F(I,L,V...) editItemAdd(I, F(L), V)
|
||||||
|
|
||||||
// Menu Classes ===============================================================
|
// Menu Classes ===============================================================
|
||||||
|
|
||||||
class CustomMenuItemClass;
|
class CustomMenuItem;
|
||||||
class MenuItemClass;
|
class MenuItem;
|
||||||
|
|
||||||
typedef void (*OnDrawCustomItem)(CustomMenuItemClass* menuitem, int8_t line);
|
typedef void (*OnDrawCustomItem)(CustomMenuItem* menuitem, int8_t line);
|
||||||
typedef void (*OnDrawItem)(MenuItemClass* menuitem, int8_t line);
|
typedef void (*OnDrawItem)(MenuItem* menuitem, int8_t line);
|
||||||
typedef void (*OnClickItem)();
|
typedef void (*OnClickItem)();
|
||||||
|
|
||||||
class CustomMenuItemClass {
|
class CustomMenuItem {
|
||||||
public:
|
public:
|
||||||
int8_t pos = 0;
|
int8_t pos = 0;
|
||||||
OnDrawItem onDraw = nullptr;
|
OnDrawItem onDraw = nullptr;
|
||||||
void (*onClick)() = nullptr;
|
void (*onClick)() = nullptr;
|
||||||
CustomMenuItemClass() {};
|
CustomMenuItem() {};
|
||||||
CustomMenuItemClass(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
CustomMenuItem(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||||
virtual ~CustomMenuItemClass(){};
|
virtual ~CustomMenuItem(){};
|
||||||
virtual void draw(int8_t line);
|
virtual void draw(int8_t line);
|
||||||
void redraw(bool erase=false);
|
void redraw(bool erase=false);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MenuItemClass: public CustomMenuItemClass {
|
class MenuItem: public CustomMenuItem {
|
||||||
public:
|
public:
|
||||||
uint8_t icon = 0;
|
uint8_t icon = 0;
|
||||||
char caption[MENU_CHAR_LIMIT] = "";
|
char caption[MENU_CHAR_LIMIT] = "";
|
||||||
uint8_t frameid = 0;
|
uint8_t frameid = 0;
|
||||||
rect_t frame = {0};
|
rect_t frame = {0};
|
||||||
using CustomMenuItemClass::CustomMenuItemClass;
|
using CustomMenuItem::CustomMenuItem;
|
||||||
MenuItemClass(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
MenuItem(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||||
MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
MenuItem(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||||
void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
|
void setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
|
||||||
void SetCaption(const char * const text = nullptr);
|
void setCaption(const char * const text = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MenuItemPtrClass: public MenuItemClass {
|
class MenuItemPtr: public MenuItem {
|
||||||
public:
|
public:
|
||||||
void *value = nullptr;
|
void *value = nullptr;
|
||||||
using MenuItemClass::MenuItemClass;
|
using MenuItem::MenuItem;
|
||||||
MenuItemPtrClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val);
|
MenuItemPtr(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val);
|
||||||
MenuItemPtrClass(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemPtrClass(cicon, FTOP(text), ondraw, onclick, val){}
|
MenuItemPtr(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemPtr(cicon, FTOP(text), ondraw, onclick, val){}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MenuClass {
|
class Menu {
|
||||||
public:
|
public:
|
||||||
int8_t topline = 0;
|
int8_t topline = 0;
|
||||||
int8_t selected = 0;
|
int8_t selected = 0;
|
||||||
TitleClass MenuTitle;
|
Title menuTitle;
|
||||||
MenuClass();
|
Menu();
|
||||||
virtual ~MenuClass(){};
|
virtual ~Menu(){};
|
||||||
inline int8_t line() { return selected - topline; };
|
inline int8_t line() { return selected - topline; };
|
||||||
inline int8_t line(uint8_t pos) {return pos - topline; };
|
inline int8_t line(uint8_t pos) {return pos - topline; };
|
||||||
int8_t count();
|
int8_t count();
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
virtual void onScroll(bool dir);
|
virtual void onScroll(bool dir);
|
||||||
void onClick();
|
void onClick();
|
||||||
CustomMenuItemClass* SelectedItem();
|
CustomMenuItem* selectedItem();
|
||||||
static CustomMenuItemClass** Items();
|
static CustomMenuItem** items();
|
||||||
};
|
};
|
||||||
extern MenuClass *CurrentMenu;
|
extern Menu *currentMenu;
|
||||||
extern MenuClass *PreviousMenu;
|
extern Menu *previousMenu;
|
||||||
|
|
||||||
// Menuitem Drawing functions =================================================
|
// Menuitem Drawing functions =================================================
|
||||||
|
|
||||||
void Draw_Title(TitleClass* title);
|
void drawTitle(Title* aTitle);
|
||||||
void Draw_Menu_Cursor(const int8_t line);
|
void drawMenuCursor(const int8_t line);
|
||||||
void Erase_Menu_Cursor(const int8_t line);
|
void eraseMenuCursor(const int8_t line);
|
||||||
void Erase_Menu_Text(const int8_t line);
|
void eraseMenuText(const int8_t line);
|
||||||
void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false, bool selected=false);
|
void drawMenuLine(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false, bool selected=false);
|
||||||
void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false, bool selected=false);
|
void drawMenuLine(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false, bool selected=false);
|
||||||
void Draw_Chkb_Line(const uint8_t line, const bool checked);
|
void drawCheckboxLine(const uint8_t line, const bool checked);
|
||||||
void Show_Chkb_Line(const bool checked);
|
void showCheckboxLine(const bool checked);
|
||||||
void Toggle_Chkb_Line(bool &checked);
|
void toggleCheckboxLine(bool &checked);
|
||||||
void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value=0);
|
void drawMenuIntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value=0);
|
||||||
void onDrawMenuItem(MenuItemClass* menuitem, int8_t line);
|
void onDrawMenuItem(MenuItem* menuitem, int8_t line);
|
||||||
void onDrawSubMenu(MenuItemClass* menuitem, int8_t line);
|
void onDrawSubMenu(MenuItem* menuitem, int8_t line);
|
||||||
void onDrawIntMenu(MenuItemClass* menuitem, int8_t line, int32_t value);
|
void onDrawIntMenu(MenuItem* menuitem, int8_t line, int32_t value);
|
||||||
void onDrawPIntMenu(MenuItemClass* menuitem, int8_t line);
|
void onDrawPIntMenu(MenuItem* menuitem, int8_t line);
|
||||||
void onDrawPInt8Menu(MenuItemClass* menuitem, int8_t line);
|
void onDrawPInt8Menu(MenuItem* menuitem, int8_t line);
|
||||||
void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line);
|
void onDrawPInt32Menu(MenuItem* menuitem, int8_t line);
|
||||||
void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value);
|
void onDrawFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp, const float value);
|
||||||
void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp);
|
void onDrawPFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp);
|
||||||
inline void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, UNITFDIGITS); };
|
inline void onDrawPFloatMenu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, UNITFDIGITS); };
|
||||||
inline void onDrawPFloat2Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 2); };
|
inline void onDrawPFloat2Menu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 2); };
|
||||||
inline void onDrawPFloat3Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 3); };
|
inline void onDrawPFloat3Menu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 3); };
|
||||||
inline void onDrawPFloat4Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 4); };
|
inline void onDrawPFloat4Menu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 4); };
|
||||||
void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked);
|
void onDrawChkbMenu(MenuItem* menuitem, int8_t line, bool checked);
|
||||||
void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line);
|
void onDrawChkbMenu(MenuItem* menuitem, int8_t line);
|
||||||
|
|
||||||
// On click functions =========================================================
|
// On click functions =========================================================
|
||||||
|
|
||||||
void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr);
|
void setOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr);
|
||||||
void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr);
|
void setValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr);
|
||||||
void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr);
|
void setValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr);
|
||||||
void SetIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr);
|
void setIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr);
|
||||||
void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr);
|
void setPIntOnClick(const int32_t lo, const int32_t hi, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr);
|
||||||
void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr);
|
void setFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr);
|
||||||
void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr);
|
void setPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr);
|
||||||
|
|
||||||
// HMI user control functions =================================================
|
// HMI user control functions =================================================
|
||||||
|
|
||||||
void HMI_Menu();
|
void hmiMenu();
|
||||||
void HMI_SetDraw();
|
void hmiSetDraw();
|
||||||
void HMI_SetNoDraw();
|
void hmiSetNoDraw();
|
||||||
void HMI_SetPInt();
|
void hmiSetPInt();
|
||||||
void HMI_SetPFloat();
|
void hmiSetPFloat();
|
||||||
|
|
||||||
// Menu auxiliary functions ===================================================
|
// Menu auxiliary functions ===================================================
|
||||||
|
|
||||||
// Initialize menu
|
// Initialize menu
|
||||||
void InitMenu();
|
void initMenu();
|
||||||
|
|
||||||
// Create a new menu
|
// Create a new menu
|
||||||
bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems);
|
bool setMenu(Menu* &menu, FSTR_P fTitle, int8_t totalitems);
|
||||||
bool SetMenu(MenuClass* &menu, frame_rect_t cn, FSTR_P title, int8_t totalitems);
|
bool setMenu(Menu* &menu, frame_rect_t cn, FSTR_P fTitle, int8_t totalitems);
|
||||||
|
|
||||||
// Reset top line and selected item
|
// Reset top line and selected item
|
||||||
void ResetMenu(MenuClass* &menu);
|
void resetMenu(Menu* &menu);
|
||||||
|
|
||||||
// Invalidate CurrentMenu to prepare for full menu drawing
|
// Invalidate currentMenu to prepare for full menu drawing
|
||||||
void InvalidateMenu();
|
void invalidateMenu();
|
||||||
|
|
||||||
//Update the Menu and Draw if it is valid
|
//Update the Menu and Draw if it is valid
|
||||||
void UpdateMenu(MenuClass* &menu);
|
void updateMenu(Menu* &menu);
|
||||||
|
|
||||||
//Redraw the current Menu if it is valid
|
//Redraw the current Menu if it is valid
|
||||||
void ReDrawMenu(bool force=false);
|
void ReDrawMenu(bool force=false);
|
||||||
@@ -192,23 +192,23 @@ void ReDrawMenu(bool force=false);
|
|||||||
//Redraw selected menu item
|
//Redraw selected menu item
|
||||||
void ReDrawItem();
|
void ReDrawItem();
|
||||||
|
|
||||||
// Clear MenuItems array and free MenuItems elements
|
// Clear menuItems array and free menuItems elements
|
||||||
void MenuItemsClear();
|
void menuItemsClear();
|
||||||
|
|
||||||
// Prepare MenuItems array
|
// Prepare menuItems array
|
||||||
void MenuItemsPrepare(int8_t totalitems);
|
void menuItemsPrepare(int8_t totalitems);
|
||||||
|
|
||||||
// Is the current menu = menu?
|
// Is the current menu = menu?
|
||||||
bool IsMenu(MenuClass* menu);
|
bool isMenu(Menu* menu);
|
||||||
|
|
||||||
// Add elements to the MenuItems array
|
// Add elements to the menuItems array
|
||||||
CustomMenuItemClass* MenuItemAdd(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
CustomMenuItem* menuItemAdd(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||||
MenuItemClass* MenuItemAdd(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
MenuItem* menuItemAdd(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||||
inline MenuItemClass* MenuItemAdd(uint8_t cicon, FSTR_P text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr) {
|
inline MenuItem* menuItemAdd(uint8_t cicon, FSTR_P text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr) {
|
||||||
return MenuItemAdd(cicon, FTOP(text), ondraw, onclick);
|
return menuItemAdd(cicon, FTOP(text), ondraw, onclick);
|
||||||
}
|
}
|
||||||
MenuItemClass* MenuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
MenuItem* menuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||||
MenuItemClass* EditItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val);
|
MenuItem* editItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val);
|
||||||
inline MenuItemClass* EditItemAdd(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) {
|
inline MenuItem* editItemAdd(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) {
|
||||||
return EditItemAdd(cicon, FTOP(text), ondraw, onclick, val);
|
return editItemAdd(cicon, FTOP(text), ondraw, onclick, val);
|
||||||
}
|
}
|
||||||
|
@@ -56,101 +56,101 @@ uint8_t rmax; // Maximum radius
|
|||||||
|
|
||||||
constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12);
|
constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12);
|
||||||
|
|
||||||
MeshViewerClass MeshViewer;
|
MeshViewer meshViewer;
|
||||||
|
|
||||||
float MeshViewerClass::max, MeshViewerClass::min;
|
float MeshViewer::max, MeshViewer::min;
|
||||||
|
|
||||||
void MeshViewerClass::DrawMeshGrid(const uint8_t csizex, const uint8_t csizey) {
|
void MeshViewer::drawMeshGrid(const uint8_t csizex, const uint8_t csizey) {
|
||||||
sizex = csizex;
|
sizex = csizex;
|
||||||
sizey = csizey;
|
sizey = csizey;
|
||||||
rmax = _MIN(margin - 2, 0.5 * (width) / (sizex - 1));
|
rmax = _MIN(margin - 2, 0.5 * (width) / (sizex - 1));
|
||||||
min = 100;
|
min = 100;
|
||||||
max = -100;
|
max = -100;
|
||||||
DWINUI::ClearMainArea();
|
DWINUI::clearMainArea();
|
||||||
dwinDrawRectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(sizex - 1), py(sizey - 1));
|
dwinDrawRectangle(0, hmiData.colorSplitLine, px(0), py(0), px(sizex - 1), py(sizey - 1));
|
||||||
for (uint8_t x = 1; x < sizex - 1; ++x) dwinDrawVLine(HMI_data.SplitLine_Color, px(x), py(sizey - 1), width);
|
for (uint8_t x = 1; x < sizex - 1; ++x) dwinDrawVLine(hmiData.colorSplitLine, px(x), py(sizey - 1), width);
|
||||||
for (uint8_t y = 1; y < sizey - 1; ++y) dwinDrawHLine(HMI_data.SplitLine_Color, px(0), py(y), width);
|
for (uint8_t y = 1; y < sizey - 1; ++y) dwinDrawHLine(hmiData.colorSplitLine, px(0), py(y), width);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshViewerClass::DrawMeshPoint(const uint8_t x, const uint8_t y, const float z) {
|
void MeshViewer::drawMeshPoint(const uint8_t x, const uint8_t y, const float z) {
|
||||||
const uint8_t fs = DWINUI::fontWidth(meshfont);
|
const uint8_t fs = DWINUI::fontWidth(meshfont);
|
||||||
const int16_t v = isnan(z) ? 0 : round(z * 100);
|
const int16_t v = isnan(z) ? 0 : round(z * 100);
|
||||||
NOLESS(max, z);
|
NOLESS(max, z);
|
||||||
NOMORE(min, z);
|
NOMORE(min, z);
|
||||||
const uint16_t color = DWINUI::RainbowInt(v, zmin, zmax);
|
const uint16_t color = DWINUI::RainbowInt(v, zmin, zmax);
|
||||||
DWINUI::Draw_FillCircle(color, px(x), py(y), r(_MAX(_MIN(v,zmax),zmin)));
|
DWINUI::drawFillCircle(color, px(x), py(y), r(_MAX(_MIN(v,zmax),zmin)));
|
||||||
TERN_(TJC_DISPLAY, delay(100));
|
TERN_(TJC_DISPLAY, delay(100));
|
||||||
if (sizex < (ENABLED(TJC_DISPLAY) ? 8 : 9)) {
|
if (sizex < (ENABLED(TJC_DISPLAY) ? 8 : 9)) {
|
||||||
if (v == 0) DWINUI::Draw_Float(meshfont, 1, 2, px(x) - 2*fs, py(y) - fs, 0);
|
if (v == 0) DWINUI::drawFloat(meshfont, 1, 2, px(x) - 2*fs, py(y) - fs, 0);
|
||||||
else DWINUI::Draw_Signed_Float(meshfont, 1, 2, px(x) - 3*fs, py(y) - fs, z);
|
else DWINUI::drawSignedFloat(meshfont, 1, 2, px(x) - 3*fs, py(y) - fs, z);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char str_1[9];
|
char str_1[9];
|
||||||
str_1[0] = '\0';
|
str_1[0] = '\0';
|
||||||
switch (v) {
|
switch (v) {
|
||||||
case -999 ... -100:
|
case -999 ... -100:
|
||||||
DWINUI::Draw_Signed_Float(meshfont, 1, 1, px(x) - 3*fs, py(y) - fs, z);
|
DWINUI::drawSignedFloat(meshfont, 1, 1, px(x) - 3*fs, py(y) - fs, z);
|
||||||
break;
|
break;
|
||||||
case -99 ... -1:
|
case -99 ... -1:
|
||||||
sprintf_P(str_1, PSTR("-.%02i"), -v);
|
sprintf_P(str_1, PSTR("-.%02i"), -v);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
dwinDrawString(false, meshfont, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - fs, "0");
|
dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 4, py(y) - fs, "0");
|
||||||
break;
|
break;
|
||||||
case 1 ... 99:
|
case 1 ... 99:
|
||||||
sprintf_P(str_1, PSTR(".%02i"), v);
|
sprintf_P(str_1, PSTR(".%02i"), v);
|
||||||
break;
|
break;
|
||||||
case 100 ... 999:
|
case 100 ... 999:
|
||||||
DWINUI::Draw_Signed_Float(meshfont, 1, 1, px(x) - 3 * fs, py(y) - fs, z);
|
DWINUI::drawSignedFloat(meshfont, 1, 1, px(x) - 3 * fs, py(y) - fs, z);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (str_1[0])
|
if (str_1[0])
|
||||||
dwinDrawString(false, meshfont, DWINUI::textcolor, DWINUI::backcolor, px(x) - 2 * fs, py(y) - fs, str_1);
|
dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 2 * fs, py(y) - fs, str_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshViewerClass::DrawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey) {
|
void MeshViewer::drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey) {
|
||||||
DrawMeshGrid(csizex, csizey);
|
drawMeshGrid(csizex, csizey);
|
||||||
for (uint8_t y = 0; y < csizey; ++y) {
|
for (uint8_t y = 0; y < csizey; ++y) {
|
||||||
hal.watchdog_refresh();
|
hal.watchdog_refresh();
|
||||||
for (uint8_t x = 0; x < csizex; ++x) DrawMeshPoint(x, y, zval[x][y]);
|
for (uint8_t x = 0; x < csizex; ++x) drawMeshPoint(x, y, zval[x][y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshViewerClass::Draw(const bool withsave/*=false*/, const bool redraw/*=true*/) {
|
void MeshViewer::draw(const bool withsave/*=false*/, const bool redraw/*=true*/) {
|
||||||
Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER));
|
title.showCaption(GET_TEXT_F(MSG_MESH_VIEWER));
|
||||||
#if ENABLED(USE_GRID_MESHVIEWER)
|
#if ENABLED(USE_GRID_MESHVIEWER)
|
||||||
DWINUI::ClearMainArea();
|
DWINUI::clearMainArea();
|
||||||
bedLevelTools.viewer_print_value = true;
|
bedLevelTools.viewer_print_value = true;
|
||||||
bedLevelTools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT);
|
bedLevelTools.drawBedMesh(-1, 1, 8, 10 + TITLE_HEIGHT);
|
||||||
#else
|
#else
|
||||||
if (redraw) DrawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
|
if (redraw) drawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
|
||||||
else DWINUI::Draw_Box(1, HMI_data.Background_Color, { 89, 305, 99, 38 });
|
else DWINUI::drawBox(1, hmiData.colorBackground, { 89, 305, 99, 38 });
|
||||||
#endif
|
#endif
|
||||||
if (withsave) {
|
if (withsave) {
|
||||||
DWINUI::Draw_Button(BTN_Save, 26, 305);
|
DWINUI::drawButton(BTN_Save, 26, 305);
|
||||||
DWINUI::Draw_Button(BTN_Continue, 146, 305);
|
DWINUI::drawButton(BTN_Continue, 146, 305);
|
||||||
Draw_Select_Highlight(hmiFlag.select_flag, 305);
|
drawSelectHighlight(hmiFlag.select_flag, 305);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DWINUI::Draw_Button(BTN_Continue, 86, 305);
|
DWINUI::drawButton(BTN_Continue, 86, 305);
|
||||||
|
|
||||||
#if ENABLED(USE_GRID_MESHVIEWER)
|
#if ENABLED(USE_GRID_MESHVIEWER)
|
||||||
bedLevelTools.Set_Mesh_Viewer_Status();
|
bedLevelTools.setMeshViewerStatus();
|
||||||
#else
|
#else
|
||||||
char str_1[6], str_2[6] = "";
|
char str_1[6], str_2[6] = "";
|
||||||
ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"), dtostrf(min, 1, 2, str_1), dtostrf(max, 1, 2, str_2));
|
ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"), dtostrf(min, 1, 2, str_1), dtostrf(max, 1, 2, str_2));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw_MeshViewer() { MeshViewer.Draw(true, meshredraw); }
|
void drawMeshViewer() { meshViewer.draw(true, meshredraw); }
|
||||||
|
|
||||||
void onClick_MeshViewer() { if (hmiFlag.select_flag) SaveMesh(); HMI_ReturnScreen(); }
|
void onClick_MeshViewer() { if (hmiFlag.select_flag) saveMesh(); hmiReturnScreen(); }
|
||||||
|
|
||||||
void Goto_MeshViewer(const bool redraw) {
|
void gotoMeshViewer(const bool redraw) {
|
||||||
meshredraw = redraw;
|
meshredraw = redraw;
|
||||||
if (leveling_is_valid()) Goto_Popup(Draw_MeshViewer, onClick_MeshViewer);
|
if (leveling_is_valid()) gotoPopup(drawMeshViewer, onClick_MeshViewer);
|
||||||
else HMI_ReturnScreen();
|
else hmiReturnScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DWIN_LCD_PROUI && HAS_MESH
|
#endif // DWIN_LCD_PROUI && HAS_MESH
|
||||||
|
@@ -28,15 +28,15 @@
|
|||||||
* Date: 2023/05/05
|
* Date: 2023/05/05
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class MeshViewerClass {
|
class MeshViewer {
|
||||||
public:
|
public:
|
||||||
static float max, min;
|
static float max, min;
|
||||||
static void DrawMeshGrid(const uint8_t csizex, const uint8_t csizey);
|
static void drawMeshGrid(const uint8_t csizex, const uint8_t csizey);
|
||||||
static void DrawMeshPoint(const uint8_t x, const uint8_t y, const float z);
|
static void drawMeshPoint(const uint8_t x, const uint8_t y, const float z);
|
||||||
static void Draw(const bool withsave=false, const bool redraw=true);
|
static void draw(const bool withsave=false, const bool redraw=true);
|
||||||
static void DrawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey);
|
static void drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MeshViewerClass MeshViewer;
|
extern MeshViewer meshViewer;
|
||||||
|
|
||||||
void Goto_MeshViewer(const bool redraw);
|
void gotoMeshViewer(const bool redraw);
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "../../../inc/MarlinConfig.h"
|
#include "../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if ALL(DWIN_LCD_PROUI, SHOW_TUNING_GRAPH)
|
#if ALL(DWIN_LCD_PROUI, PROUI_TUNING_GRAPH)
|
||||||
|
|
||||||
#include "dwin.h"
|
#include "dwin.h"
|
||||||
#include "../../../core/types.h"
|
#include "../../../core/types.h"
|
||||||
@@ -44,32 +44,32 @@ uint16_t grphpoints, r, x2, y2 = 0;
|
|||||||
frame_rect_t grphframe = {0};
|
frame_rect_t grphframe = {0};
|
||||||
float scale = 0;
|
float scale = 0;
|
||||||
|
|
||||||
void PlotClass::Draw(const frame_rect_t &frame, const_float_t max, const_float_t ref/*=0*/) {
|
void PlotClass::draw(const frame_rect_t &frame, const_float_t max, const_float_t ref/*=0*/) {
|
||||||
grphframe = frame;
|
grphframe = frame;
|
||||||
grphpoints = 0;
|
grphpoints = 0;
|
||||||
scale = frame.h / max;
|
scale = frame.h / max;
|
||||||
x2 = frame.x + frame.w - 1;
|
x2 = frame.x + frame.w - 1;
|
||||||
y2 = frame.y + frame.h - 1;
|
y2 = frame.y + frame.h - 1;
|
||||||
r = round((y2) - ref * scale);
|
r = round((y2) - ref * scale);
|
||||||
DWINUI::Draw_Box(1, Plot_Bg_Color, frame);
|
DWINUI::drawBox(1, Plot_Bg_Color, frame);
|
||||||
for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) dwinDrawVLine(Line_Color, i * 50 + frame.x, frame.y, frame.h);
|
for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) dwinDrawVLine(COLOR_LINE, i * 50 + frame.x, frame.y, frame.h);
|
||||||
DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1));
|
DWINUI::drawBox(0, COLOR_WHITE, DWINUI::extendFrame(frame, 1));
|
||||||
dwinDrawHLine(Color_Red, frame.x, r, frame.w);
|
dwinDrawHLine(COLOR_RED, frame.x, r, frame.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlotClass::Update(const_float_t value) {
|
void PlotClass::update(const_float_t value) {
|
||||||
if (!scale) return;
|
if (!scale) return;
|
||||||
const uint16_t y = round((y2) - value * scale);
|
const uint16_t y = round((y2) - value * scale);
|
||||||
if (grphpoints < grphframe.w) {
|
if (grphpoints < grphframe.w) {
|
||||||
dwinDrawPoint(Color_Yellow, 1, 1, grphpoints + grphframe.x, y);
|
dwinDrawPoint(COLOR_YELLOW, 1, 1, grphpoints + grphframe.x, y);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dwinFrameAreaMove(1, 0, 1, Plot_Bg_Color, grphframe.x, grphframe.y, x2, y2);
|
dwinFrameAreaMove(1, 0, 1, Plot_Bg_Color, grphframe.x, grphframe.y, x2, y2);
|
||||||
if ((grphpoints % 50) == 0) dwinDrawVLine(Line_Color, x2 - 1, grphframe.y + 1, grphframe.h - 2);
|
if ((grphpoints % 50) == 0) dwinDrawVLine(COLOR_LINE, x2 - 1, grphframe.y + 1, grphframe.h - 2);
|
||||||
dwinDrawPoint(Color_Red, 1, 1, x2 - 1, r);
|
dwinDrawPoint(COLOR_RED, 1, 1, x2 - 1, r);
|
||||||
dwinDrawPoint(Color_Yellow, 1, 1, x2 - 1, y);
|
dwinDrawPoint(COLOR_YELLOW, 1, 1, x2 - 1, y);
|
||||||
}
|
}
|
||||||
grphpoints++;
|
grphpoints++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DWIN_LCD_PROUI && SHOW_TUNING_GRAPH
|
#endif // DWIN_LCD_PROUI && PROUI_TUNING_GRAPH
|
||||||
|
@@ -32,8 +32,8 @@
|
|||||||
|
|
||||||
class PlotClass {
|
class PlotClass {
|
||||||
public:
|
public:
|
||||||
static void Draw(const frame_rect_t &frame, const_float_t max, const_float_t ref=0);
|
static void draw(const frame_rect_t &frame, const_float_t max, const_float_t ref=0);
|
||||||
static void Update(const_float_t value);
|
static void update(const_float_t value);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PlotClass plot;
|
extern PlotClass plot;
|
||||||
|
@@ -40,43 +40,43 @@
|
|||||||
#include "dwin.h"
|
#include "dwin.h"
|
||||||
#include "dwin_popup.h"
|
#include "dwin_popup.h"
|
||||||
|
|
||||||
PrintStatsClass PrintStats;
|
PrintStats printStats;
|
||||||
|
|
||||||
void PrintStatsClass::Draw() {
|
void PrintStats::draw() {
|
||||||
char str[30] = "";
|
char str[30] = "";
|
||||||
constexpr int8_t MRG = 30;
|
constexpr int8_t MRG = 30;
|
||||||
|
|
||||||
Title.ShowCaption(GET_TEXT_F(MSG_INFO_STATS_MENU));
|
title.showCaption(GET_TEXT_F(MSG_INFO_STATS_MENU));
|
||||||
DWINUI::ClearMainArea();
|
DWINUI::clearMainArea();
|
||||||
Draw_Popup_Bkgd();
|
drawPopupBkgd();
|
||||||
DWINUI::Draw_Button(BTN_Continue, 86, 250);
|
DWINUI::drawButton(BTN_Continue, 86, 250);
|
||||||
printStatistics ps = print_job_timer.getStats();
|
printStatistics ps = print_job_timer.getStats();
|
||||||
|
|
||||||
DWINUI::Draw_String(MRG, 80, TS(GET_TEXT_F(MSG_INFO_PRINT_COUNT), F(": "), ps.totalPrints));
|
DWINUI::drawString(MRG, 80, TS(GET_TEXT_F(MSG_INFO_PRINT_COUNT), F(": "), ps.totalPrints));
|
||||||
DWINUI::Draw_String(MRG, 100, TS(GET_TEXT_F(MSG_INFO_COMPLETED_PRINTS), F(": "), ps.finishedPrints));
|
DWINUI::drawString(MRG, 100, TS(GET_TEXT_F(MSG_INFO_COMPLETED_PRINTS), F(": "), ps.finishedPrints));
|
||||||
duration_t(print_job_timer.getStats().printTime).toDigital(str, true);
|
duration_t(print_job_timer.getStats().printTime).toDigital(str, true);
|
||||||
DWINUI::Draw_String(MRG, 120, MString<50>(GET_TEXT_F(MSG_INFO_PRINT_TIME), F(": "), str));
|
DWINUI::drawString(MRG, 120, MString<50>(GET_TEXT_F(MSG_INFO_PRINT_TIME), F(": "), str));
|
||||||
duration_t(print_job_timer.getStats().longestPrint).toDigital(str, true);
|
duration_t(print_job_timer.getStats().longestPrint).toDigital(str, true);
|
||||||
DWINUI::Draw_String(MRG, 140, MString<50>(GET_TEXT(MSG_INFO_PRINT_LONGEST), F(": "), str));
|
DWINUI::drawString(MRG, 140, MString<50>(GET_TEXT(MSG_INFO_PRINT_LONGEST), F(": "), str));
|
||||||
DWINUI::Draw_String(MRG, 160, TS(GET_TEXT_F(MSG_INFO_PRINT_FILAMENT), F(": "), p_float_t(ps.filamentUsed / 1000, 2), F(" m")));
|
DWINUI::drawString(MRG, 160, TS(GET_TEXT_F(MSG_INFO_PRINT_FILAMENT), F(": "), p_float_t(ps.filamentUsed / 1000, 2), F(" m")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintStatsClass::Reset() {
|
void PrintStats::reset() {
|
||||||
print_job_timer.initStats();
|
print_job_timer.initStats();
|
||||||
DONE_BUZZ(true);
|
DONE_BUZZ(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Goto_PrintStats() {
|
void gotoPrintStats() {
|
||||||
PrintStats.Draw();
|
printStats.draw();
|
||||||
HMI_SaveProcessID(WaitResponse);
|
hmiSaveProcessID(ID_WaitResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print Stats Reset popup
|
// Print Stats Reset popup
|
||||||
void Popup_ResetStats() { DWIN_Popup_ConfirmCancel(ICON_Info_0, GET_TEXT_F(MSG_RESET_STATS)); }
|
void popupResetStats() { dwinPopupConfirmCancel(ICON_Info_0, GET_TEXT_F(MSG_RESET_STATS)); }
|
||||||
void OnClick_ResetStats() {
|
void onClickResetStats() {
|
||||||
if (hmiFlag.select_flag) PrintStatsClass::Reset();
|
if (hmiFlag.select_flag) printStats.reset();
|
||||||
HMI_ReturnScreen();
|
hmiReturnScreen();
|
||||||
}
|
}
|
||||||
void PrintStatsReset() { Goto_Popup(Popup_ResetStats, OnClick_ResetStats); }
|
void printStatsReset() { gotoPopup(popupResetStats, onClickResetStats); }
|
||||||
|
|
||||||
#endif // DWIN_LCD_PROUI && PRINTCOUNTER
|
#endif // DWIN_LCD_PROUI && PRINTCOUNTER
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
* Date: 2022/12/03
|
* Date: 2022/12/03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class PrintStatsClass {
|
class PrintStats {
|
||||||
public:
|
public:
|
||||||
static void Draw();
|
static void draw();
|
||||||
static void Reset();
|
static void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PrintStatsClass PrintStats;
|
extern PrintStats printStats;
|
||||||
|
|
||||||
void Goto_PrintStats();
|
void gotoPrintStats();
|
||||||
void PrintStatsReset();
|
void printStatsReset();
|
||||||
|
@@ -1600,7 +1600,7 @@ void MarlinUI::host_status() {
|
|||||||
|
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message));
|
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message));
|
||||||
TERN_(DWIN_CREALITY_LCD, dwinStatusChanged(status_message));
|
TERN_(DWIN_CREALITY_LCD, dwinStatusChanged(status_message));
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_CheckStatusMessage());
|
TERN_(DWIN_LCD_PROUI, dwinCheckStatusMessage());
|
||||||
TERN_(DWIN_CREALITY_LCD_JYERSUI, jyersDWIN.updateStatus(status_message));
|
TERN_(DWIN_CREALITY_LCD_JYERSUI, jyersDWIN.updateStatus(status_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -413,7 +413,7 @@ void restore_feedrate_and_scaling();
|
|||||||
|
|
||||||
#if HAS_Z_AXIS
|
#if HAS_Z_AXIS
|
||||||
#if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING)
|
#if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING)
|
||||||
#define Z_POST_CLEARANCE HMI_data.z_after_homing
|
#define Z_POST_CLEARANCE hmiData.z_after_homing
|
||||||
#elif defined(Z_AFTER_HOMING)
|
#elif defined(Z_AFTER_HOMING)
|
||||||
#define Z_POST_CLEARANCE Z_AFTER_HOMING
|
#define Z_POST_CLEARANCE Z_AFTER_HOMING
|
||||||
#else
|
#else
|
||||||
|
@@ -377,7 +377,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
|
|||||||
|
|
||||||
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(ds_str));
|
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(ds_str));
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(ds_str));
|
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(ds_str));
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_Popup_Confirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR)));
|
TERN_(DWIN_LCD_PROUI, dwinPopupConfirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR)));
|
||||||
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
|
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
|
||||||
|
|
||||||
ui.reset_status();
|
ui.reset_status();
|
||||||
|
@@ -1610,7 +1610,7 @@ void MarlinSettings::postprocess() {
|
|||||||
{
|
{
|
||||||
_FIELD_TEST(dwin_data);
|
_FIELD_TEST(dwin_data);
|
||||||
char dwin_data[eeprom_data_size] = { 0 };
|
char dwin_data[eeprom_data_size] = { 0 };
|
||||||
DWIN_CopySettingsTo(dwin_data);
|
dwinCopySettingsTo(dwin_data);
|
||||||
EEPROM_WRITE(dwin_data);
|
EEPROM_WRITE(dwin_data);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2675,7 +2675,7 @@ void MarlinSettings::postprocess() {
|
|||||||
const char dwin_data[eeprom_data_size] = { 0 };
|
const char dwin_data[eeprom_data_size] = { 0 };
|
||||||
_FIELD_TEST(dwin_data);
|
_FIELD_TEST(dwin_data);
|
||||||
EEPROM_READ(dwin_data);
|
EEPROM_READ(dwin_data);
|
||||||
if (!validating) DWIN_CopySettingsFrom(dwin_data);
|
if (!validating) dwinCopySettingsFrom(dwin_data);
|
||||||
}
|
}
|
||||||
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
||||||
{
|
{
|
||||||
@@ -3022,7 +3022,7 @@ void MarlinSettings::postprocess() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DWIN_LCD_PROUI)
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
status = !bedLevelTools.meshvalidate();
|
status = !bedLevelTools.meshValidate();
|
||||||
if (status) {
|
if (status) {
|
||||||
bedlevel.invalidate();
|
bedlevel.invalidate();
|
||||||
LCD_MESSAGE(MSG_UBL_MESH_INVALID);
|
LCD_MESSAGE(MSG_UBL_MESH_INVALID);
|
||||||
@@ -3559,7 +3559,7 @@ void MarlinSettings::reset() {
|
|||||||
//
|
//
|
||||||
// Ender-3 V2 with ProUI
|
// Ender-3 V2 with ProUI
|
||||||
//
|
//
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_SetDataDefaults());
|
TERN_(DWIN_LCD_PROUI, dwinSetDataDefaults());
|
||||||
|
|
||||||
//
|
//
|
||||||
// Model predictive control
|
// Model predictive control
|
||||||
|
@@ -2639,7 +2639,7 @@ hal_timer_t Stepper::block_phase_isr() {
|
|||||||
oversampling_factor = 0; // Assume no axis smoothing (via oversampling)
|
oversampling_factor = 0; // Assume no axis smoothing (via oversampling)
|
||||||
// Decide if axis smoothing is possible
|
// Decide if axis smoothing is possible
|
||||||
uint32_t max_rate = current_block->nominal_rate; // Get the step event rate
|
uint32_t max_rate = current_block->nominal_rate; // Get the step event rate
|
||||||
if (TERN1(DWIN_LCD_PROUI, HMI_data.AdaptiveStepSmoothing)) {
|
if (TERN1(DWIN_LCD_PROUI, hmiData.adaptiveStepSmoothing)) {
|
||||||
while (max_rate < MIN_STEP_ISR_FREQUENCY) { // As long as more ISRs are possible...
|
while (max_rate < MIN_STEP_ISR_FREQUENCY) { // As long as more ISRs are possible...
|
||||||
max_rate <<= 1; // Try to double the rate
|
max_rate <<= 1; // Try to double the rate
|
||||||
if (max_rate < MIN_STEP_ISR_FREQUENCY) // Don't exceed the estimated ISR limit
|
if (max_rate < MIN_STEP_ISR_FREQUENCY) // Don't exceed the estimated ISR limit
|
||||||
|
@@ -723,12 +723,12 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
TERN_(HAS_FAN_LOGIC, fan_update_ms = next_temp_ms + fan_update_interval_ms);
|
TERN_(HAS_FAN_LOGIC, fan_update_ms = next_temp_ms + fan_update_interval_ms);
|
||||||
|
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_STARTED));
|
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_STARTED));
|
||||||
TERN_(DWIN_PID_TUNE, DWIN_PidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START));
|
TERN_(PROUI_PID_TUNE, dwinPidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START));
|
||||||
|
|
||||||
if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, temp_range[heater_id].maxtemp - (HOTEND_OVERSHOOT))) {
|
if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, temp_range[heater_id].maxtemp - (HOTEND_OVERSHOOT))) {
|
||||||
SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
|
SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
|
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
|
||||||
TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TEMP_TOO_HIGH));
|
TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TEMP_TOO_HIGH));
|
||||||
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)));
|
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -820,7 +820,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
|
if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
|
||||||
SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
|
SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
|
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
|
||||||
TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TEMP_TOO_HIGH));
|
TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TEMP_TOO_HIGH));
|
||||||
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)));
|
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -857,7 +857,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
#endif
|
#endif
|
||||||
if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
|
if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
|
||||||
TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0));
|
TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0));
|
||||||
TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TUNING_TIMEOUT));
|
TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TUNING_TIMEOUT));
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
|
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
|
||||||
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT)));
|
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT)));
|
||||||
SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
|
SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
|
||||||
@@ -910,7 +910,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color));
|
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color));
|
||||||
|
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE));
|
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE));
|
||||||
TERN_(DWIN_PID_TUNE, DWIN_PidTuning(AUTOTUNE_DONE));
|
TERN_(PROUI_PID_TUNE, dwinPidTuning(AUTOTUNE_DONE));
|
||||||
|
|
||||||
goto EXIT_M303;
|
goto EXIT_M303;
|
||||||
}
|
}
|
||||||
@@ -928,7 +928,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color));
|
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color));
|
||||||
|
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE));
|
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE));
|
||||||
TERN_(DWIN_PID_TUNE, DWIN_PidTuning(AUTOTUNE_DONE));
|
TERN_(PROUI_PID_TUNE, dwinPidTuning(AUTOTUNE_DONE));
|
||||||
|
|
||||||
EXIT_M303:
|
EXIT_M303:
|
||||||
TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true);
|
TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true);
|
||||||
@@ -1147,7 +1147,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
// Ensure we don't drift too far from the window between the last sampled temp and the target temperature
|
// Ensure we don't drift too far from the window between the last sampled temp and the target temperature
|
||||||
if (!WITHIN(current_temp, get_sample_3_temp() - 15.0f, hotend.target + 15.0f)) {
|
if (!WITHIN(current_temp, get_sample_3_temp() - 15.0f, hotend.target + 15.0f)) {
|
||||||
SERIAL_ECHOLNPGM(STR_MPC_TEMPERATURE_ERROR);
|
SERIAL_ECHOLNPGM(STR_MPC_TEMPERATURE_ERROR);
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_TEMP_ERROR));
|
TERN_(DWIN_LCD_PROUI, dwinMPCTuning(MPC_TEMP_ERROR));
|
||||||
wait_for_heatup = false;
|
wait_for_heatup = false;
|
||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
@@ -1187,7 +1187,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
|
|
||||||
if (!wait_for_heatup) {
|
if (!wait_for_heatup) {
|
||||||
SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED);
|
SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED);
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_INTERRUPTED));
|
TERN_(DWIN_LCD_PROUI, dwinMPCTuning(MPC_INTERRUPTED));
|
||||||
return MeasurementState::CANCELLED;
|
return MeasurementState::CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1215,7 +1215,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
// Determine ambient temperature.
|
// Determine ambient temperature.
|
||||||
SERIAL_ECHOLNPGM(STR_MPC_COOLING_TO_AMBIENT);
|
SERIAL_ECHOLNPGM(STR_MPC_COOLING_TO_AMBIENT);
|
||||||
#if ENABLED(DWIN_LCD_PROUI)
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
DWIN_MPCTuning(MPCTEMP_START);
|
dwinMPCTuning(MPCTEMP_START);
|
||||||
LCD_ALERTMESSAGE(MSG_MPC_COOLING_TO_AMBIENT);
|
LCD_ALERTMESSAGE(MSG_MPC_COOLING_TO_AMBIENT);
|
||||||
#else
|
#else
|
||||||
LCD_MESSAGE(MSG_COOLING);
|
LCD_MESSAGE(MSG_COOLING);
|
||||||
@@ -1305,7 +1305,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_FINISHED);
|
SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_FINISHED);
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(AUTOTUNE_DONE));
|
TERN_(DWIN_LCD_PROUI, dwinMPCTuning(AUTOTUNE_DONE));
|
||||||
|
|
||||||
SERIAL_ECHOLNPGM("MPC_BLOCK_HEAT_CAPACITY ", mpc.block_heat_capacity);
|
SERIAL_ECHOLNPGM("MPC_BLOCK_HEAT_CAPACITY ", mpc.block_heat_capacity);
|
||||||
SERIAL_ECHOLNPGM("MPC_SENSOR_RESPONSIVENESS ", p_float_t(mpc.sensor_responsiveness, 4));
|
SERIAL_ECHOLNPGM("MPC_SENSOR_RESPONSIVENESS ", p_float_t(mpc.sensor_responsiveness, 4));
|
||||||
|
Reference in New Issue
Block a user