Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 11, 2022
1 parent 7630229 commit 33f53bf
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 53 deletions.
39 changes: 22 additions & 17 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1563,11 +1563,10 @@ void DWIN_CompletedLeveling() {
}

#if HAS_MESH
void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
char msg[33] = "";
char str_1[6] = "";
sprintf_P(msg, PSTR(S_FMT " %i/%i Z=%s"), GET_TEXT(MSG_PROBING_POINT), xpos, ypos,
dtostrf(zval, 1, 2, str_1));
sprintf_P(msg, PSTR(S_FMT " %i/%i Z=%s"), GET_TEXT(MSG_PROBING_POINT), xpos, ypos, dtostrf(zval, 1, 2, str_1));
ui.set_status(msg);
}
#endif
Expand Down Expand Up @@ -2287,8 +2286,10 @@ TERN(HAS_ONESTEP_LEVELING, float, void) Tram(uint8_t point) {
break;
}

planner.synchronize();

#if HAS_ONESTEP_LEVELING
planner.synchronize();

if (HMI_data.FullManualTramming) {
planner.synchronize();
sprintf_P(cmd, PSTR("M420S0\nG28O\nG90\nG0Z5F300\nG0X%sY%sF5000\nG0Z0F300"),
Expand All @@ -2300,28 +2301,30 @@ TERN(HAS_ONESTEP_LEVELING, float, void) Tram(uint8_t point) {
else {
LIMIT(xpos, X_MIN_POS, (X_MAX_POS + probe.offset.x));
LIMIT(ypos, Y_MIN_POS, (Y_MAX_POS + probe.offset.y));
probe.stow();
gcode.process_subcommands_now(F("M420S0\nG28O"));
planner.synchronize();
inLev = true;
zval = probe.probe_at_point(xpos, ypos, PROBE_PT_STOW);
probe.stow();
gcode.process_subcommands_now(F("M420S0\nG28O"));
planner.synchronize();
inLev = true;
zval = probe.probe_at_point(xpos, ypos, PROBE_PT_STOW);
if (isnan(zval))
ui.set_status(F("Position Not Reachable, check offsets"));
else {
sprintf_P(cmd, PSTR("X:%s, Y:%s, Z:%s"),
dtostrf(xpos, 1, 1, str_1),
dtostrf(ypos, 1, 1, str_2),
dtostrf(zval, 1, 2, str_3)
);
ui.set_status(cmd);
dtostrf(xpos, 1, 1, str_1),
dtostrf(ypos, 1, 1, str_2),
dtostrf(zval, 1, 2, str_3)
);
ui.set_status(cmd);
}
inLev = false;
inLev = false;
}
return zval;

#else
planner.synchronize();

sprintf_P(cmd, PSTR("M420S0\nG28O\nG90\nG0Z5F300\nG0X%iY%iF5000\nG0Z0F300"), xpos, ypos);
queue.inject(cmd);

#endif
}

Expand All @@ -2332,6 +2335,7 @@ void TramBL() { Tram(3); }
void TramC () { Tram(4); }

#if HAS_ONESTEP_LEVELING

void Trammingwizard() {
bed_mesh_t zval = {0};
if (HMI_data.FullManualTramming) {
Expand Down Expand Up @@ -2388,7 +2392,8 @@ void TramC () { Tram(4); }
Draw_Chkb_Line(CurrentMenu->line(), HMI_data.FullManualTramming);
DWIN_UpdateLCD();
}
#endif

#endif // HAS_ONESTEP_LEVELING

#if ENABLED(MESH_BED_LEVELING)

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/e3v2/proui/dwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ void DWIN_CheckStatusMessage();
void DWIN_StartHoming();
void DWIN_CompletedHoming();
#if HAS_MESH
void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const float zval);
void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval);
#endif
void DWIN_MeshLevelingStart();
void DWIN_CompletedLeveling();
void DWIN_PidTuning(pidresult_t result);
void DWIN_Print_Started(const bool sd = false);
void DWIN_Print_Started(const bool sd=false);
void DWIN_Print_Pause();
void DWIN_Print_Resume();
void DWIN_Print_Finished();
Expand All @@ -182,7 +182,7 @@ void DWIN_SetDataDefaults();
void DWIN_RebootScreen();

#if ENABLED(ADVANCED_PAUSE_FEATURE)
void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button = 0);
void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button=0);
void Draw_Popup_FilamentPurge();
void Goto_FilamentPurge();
void HMI_FilamentPurge();
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/e3v2/proui/dwin_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
#endif

typedef struct {
// Color settings
// Color settings
uint16_t Background_Color = Def_Background_Color;
uint16_t Cursor_color = Def_Cursor_color;
uint16_t TitleBg_color = Def_TitleBg_color;
Expand All @@ -116,7 +116,7 @@ typedef struct {
#if HAS_HOTEND && defined(PREHEAT_1_TEMP_HOTEND)
int16_t HotendPidT = PREHEAT_1_TEMP_HOTEND;
#endif
#if defined(PREHEAT_1_TEMP_BED)
#if HAS_HEATED_BED && defined(PREHEAT_1_TEMP_BED)
int16_t BedPidT = PREHEAT_1_TEMP_BED;
#endif
#if HAS_HOTEND || HAS_HEATED_BED
Expand Down
46 changes: 20 additions & 26 deletions Marlin/src/lcd/e3v2/proui/dwinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) {
default: break;
}
}

// -------------------------- Extra -------------------------------//

// Draw a circle
Expand Down Expand Up @@ -258,47 +259,40 @@ void DWINUI::Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) {
// color1 : Start color
// color2 : End color
uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2) {
uint8_t B,G,R;
float n;
n = (float)(val-minv)/(maxv-minv);
R = (1-n)*GetRColor(color1) + n*GetRColor(color2);
G = (1-n)*GetGColor(color1) + n*GetGColor(color2);
B = (1-n)*GetBColor(color1) + n*GetBColor(color2);
return RGB(R,G,B);
uint8_t B, G, R;
const float n = (float)(val - minv) / (maxv - minv);
R = (1-n) * GetRColor(color1) + n * GetRColor(color2);
G = (1-n) * GetGColor(color1) + n * GetGColor(color2);
B = (1-n) * GetBColor(color1) + n * GetBColor(color2);
return RGB(R, G, B);
}

// Color Interpolator through Red->Yellow->Green->Blue
// val : Interpolator minv..maxv
// minv : Minimum value
// maxv : Maximum value
uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) {
uint8_t B,G,R;
const uint8_t maxB = 28;
const uint8_t maxR = 28;
const uint8_t maxG = 38;
uint8_t B, G, R;
const uint8_t maxB = 28, maxR = 28, maxG = 38;
const int16_t limv = _MAX(abs(minv), abs(maxv));
float n;
if (minv>=0) {
n = (float)(val-minv)/(maxv-minv);
} else {
n = (float)val/limv;
}
n = _MIN(1, n);
n = _MAX(-1, n);
float n = minv >= 0 ? (float)(val - minv) / (maxv - minv) : (float)val / limv;
LIMIT(n, -1, 1);
if (n < 0) {
R = 0;
G = (1+n)*maxG;
B = (-n)*maxB;
} else if (n < 0.5) {
R = maxR*n*2;
G = (1 + n) * maxG;
B = (-n) * maxB;
}
else if (n < 0.5) {
R = maxR * n * 2;
G = maxG;
B = 0;
} else {
}
else {
R = maxR;
G = maxG*(1-n);
G = maxG * (1 - n);
B = 0;
}
return RGB(R,G,B);
return RGB(R, G, B);
}

// Draw a checkbox
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,4 @@ void HMI_SetPFloat() {
}
}

#endif
#endif // DWIN_LCD_PROUI
8 changes: 5 additions & 3 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1440,10 +1440,12 @@ void MarlinUI::init() {
else if (print_job_timer.needsService(3)) msg = FPSTR(service3);
#endif

else if (!no_welcome)
msg = GET_TEXT_F(WELCOME_MSG);
else if (!no_welcome) msg = GET_TEXT_F(WELCOME_MSG);

else if (ENABLED(DWIN_LCD_PROUI))
msg = F("")
else
TERN(DWIN_LCD_PROUI, msg = F(""), return);
return;

set_status(msg, -1);
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
#if HAS_HOTEND && (PROBING_NOZZLE_TEMP || LEVELING_NOZZLE_TEMP)
#define WAIT_FOR_NOZZLE_HEAT
#endif
#if HAS_HEATED_BED && (PROBING_BED_TEMP || defined(LEVELING_BED_TEMP))
#if HAS_HEATED_BED && (PROBING_BED_TEMP || LEVELING_BED_TEMP)
#define WAIT_FOR_BED_HEAT
#endif

Expand Down

0 comments on commit 33f53bf

Please sign in to comment.