1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 07:17:59 +00:00

🚸 Fixes for ProUI, JyersUI, backlight, etc. (#26086)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Andrew 2023-08-25 19:33:49 -04:00 committed by GitHub
parent 4613f85bb7
commit 8fa6a4da2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 177 additions and 177 deletions

View File

@ -772,6 +772,7 @@ void unified_bed_leveling::shift_mesh_height() {
const grid_count_t point_num = (GRID_MAX_POINTS - count) + 1; const grid_count_t point_num = (GRID_MAX_POINTS - count) + 1;
SERIAL_ECHOLNPGM("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, "."); SERIAL_ECHOLNPGM("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, ".");
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS))); TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS)));
TERN_(LCD_BACKLIGHT_TIMEOUT_MINS, ui.refresh_backlight_timeout());
#if HAS_MARLINUI_MENU #if HAS_MARLINUI_MENU
if (ui.button_pressed()) { if (ui.button_pressed()) {

View File

@ -2722,7 +2722,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
#endif #endif
#if LCD_BACKLIGHT_TIMEOUT_MINS #if LCD_BACKLIGHT_TIMEOUT_MINS
#if !HAS_ENCODER_ACTION #if !HAS_ENCODER_ACTION && DISABLED(HAS_DWIN_E3V2)
#error "LCD_BACKLIGHT_TIMEOUT_MINS requires an LCD with encoder or keypad." #error "LCD_BACKLIGHT_TIMEOUT_MINS requires an LCD with encoder or keypad."
#elif ENABLED(NEOPIXEL_BKGD_INDEX_FIRST) #elif ENABLED(NEOPIXEL_BKGD_INDEX_FIRST)
#if PIN_EXISTS(LCD_BACKLIGHT) #if PIN_EXISTS(LCD_BACKLIGHT)
@ -2730,8 +2730,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
#elif ENABLED(NEOPIXEL_BKGD_ALWAYS_ON) #elif ENABLED(NEOPIXEL_BKGD_ALWAYS_ON)
#error "LCD_BACKLIGHT_TIMEOUT is not compatible with NEOPIXEL_BKGD_ALWAYS_ON." #error "LCD_BACKLIGHT_TIMEOUT is not compatible with NEOPIXEL_BKGD_ALWAYS_ON."
#endif #endif
#elif !PIN_EXISTS(LCD_BACKLIGHT) #elif !PIN_EXISTS(LCD_BACKLIGHT) && DISABLED(HAS_DWIN_E3V2)
#error "LCD_BACKLIGHT_TIMEOUT_MINS requires either LCD_BACKLIGHT_PIN or NEOPIXEL_BKGD_INDEX_FIRST." #error "LCD_BACKLIGHT_TIMEOUT_MINS requires LCD_BACKLIGHT_PIN, NEOPIXEL_BKGD_INDEX_FIRST, or an Ender-3 V2 DWIN LCD."
#endif #endif
#endif #endif

View File

@ -87,7 +87,13 @@ EncoderState encoderReceiveAnalyze() {
#if PIN_EXISTS(LCD_LED) #if PIN_EXISTS(LCD_LED)
//LED_Action(); //LED_Action();
#endif #endif
if (!ui.backlight) ui.refresh_brightness(); #if LCD_BACKLIGHT_TIMEOUT_MINS
ui.refresh_backlight_timeout();
#endif
if (!ui.backlight) {
ui.refresh_brightness();
return ENCODER_DIFF_NO;
}
const bool was_waiting = wait_for_user; const bool was_waiting = wait_for_user;
wait_for_user = false; wait_for_user = false;
return was_waiting ? ENCODER_DIFF_NO : ENCODER_DIFF_ENTER; return was_waiting ? ENCODER_DIFF_NO : ENCODER_DIFF_ENTER;
@ -154,6 +160,12 @@ EncoderState encoderReceiveAnalyze() {
temp_diff = 0; temp_diff = 0;
} }
if (temp_diffState != ENCODER_DIFF_NO) {
#if LCD_BACKLIGHT_TIMEOUT_MINS
ui.refresh_backlight_timeout();
#endif
if (!ui.backlight) ui.refresh_brightness();
}
return temp_diffState; return temp_diffState;
} }
@ -164,9 +176,9 @@ EncoderState encoderReceiveAnalyze() {
// LED light operation // LED light operation
void LED_Action() { void LED_Action() {
LED_Control(RGB_SCALE_WARM_WHITE,0x0F); LED_Control(RGB_SCALE_WARM_WHITE, 0x0F);
delay(30); delay(30);
LED_Control(RGB_SCALE_WARM_WHITE,0x00); LED_Control(RGB_SCALE_WARM_WHITE, 0x00);
} }
// LED initialization // LED initialization

View File

@ -341,20 +341,14 @@ private:
} }
float getMaxValue() { float getMaxValue() {
float max = __FLT_MIN__; float max = -(__FLT_MAX__);
GRID_LOOP(x, y) { GRID_LOOP(x, y) { const float z = bedlevel.z_values[x][y]; if (!isnan(z)) NOLESS(max, z); }
if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max)
max = bedlevel.z_values[x][y];
}
return max; return max;
} }
float getMinValue() { float getMinValue() {
float min = __FLT_MAX__; float min = __FLT_MAX__;
GRID_LOOP(x, y) { GRID_LOOP(x, y) { const float z = bedlevel.z_values[x][y]; if (!isnan(z)) NOMORE(min, z); }
if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min)
min = bedlevel.z_values[x][y];
}
return min; return min;
} }
@ -363,7 +357,7 @@ private:
const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x, const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x,
cell_width_px = total_width_px / (GRID_MAX_POINTS_X), cell_width_px = total_width_px / (GRID_MAX_POINTS_X),
cell_height_px = total_width_px / (GRID_MAX_POINTS_Y); cell_height_px = total_width_px / (GRID_MAX_POINTS_Y);
const float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max); const float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), rmax = _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);
@ -381,11 +375,11 @@ private:
const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width; const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width;
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 ? rmax : 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 ? rmax : v_max)) << 5) | // green if mesh point value is positive
_MIN(0x1F, (((uint8_t)abs(bedlevel.z_values[x][y]) / 10) * 4))), // + blue stepping for every mm _MIN(0x1F, (((uint8_t)abs(bedlevel.z_values[x][y]) / 10) * 4))), // + blue stepping for every mm
start_x_px, start_y_px, end_x_px, end_y_px start_x_px, start_y_px, end_x_px, end_y_px
); );
@ -421,16 +415,17 @@ private:
v_min = abs(getMinValue()), v_min = abs(getMinValue()),
v_max = abs(getMaxValue()); v_max = abs(getMaxValue());
if (viewer_asymmetric_range) { if (viewer_asymmetric_range) {
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;
v1 = -v_min; v1 = -v_min;
v2 = v_max; v2 = v_max;
} }
else { else {
float range = _MAX(v_min, v_max); float rmax = _MAX(v_min, v_max), rmin = _MIN(v_min, v_max);
if (range > 3e+10F) range = 0.0000001; if (rmax > 3e+10f) rmax = 0.0000001;
v1 = -range; if (rmin > 3e+10f) rmin = 0.0000001;
v2 = range; v1 = -rmax;
v2 = rmin;
} }
jyersDWIN.updateStatus(TS(F("Red "), p_float_t(v1, 3) , F("..0.."), p_float_t(v2, 3), F(" Green"))); jyersDWIN.updateStatus(TS(F("Red "), p_float_t(v1, 3) , F("..0.."), p_float_t(v2, 3), F(" Green")));
drawing_mesh = false; drawing_mesh = false;

View File

@ -8,9 +8,7 @@
* Changed unsigned int to uint16_t for use in the professional Ender-3V2/S1 firmware * Changed unsigned int to uint16_t for use in the professional Ender-3V2/S1 firmware
* Url: https://www.arduino.cc/reference/en/libraries/base64/ * Url: https://www.arduino.cc/reference/en/libraries/base64/
*/ */
#pragma once
#ifndef BASE64_H_INCLUDED
#define BASE64_H_INCLUDED
/* binary_to_base64: /* binary_to_base64:
* Description: * Description:
@ -135,11 +133,11 @@ uint16_t decode_base64_length(unsigned char input[], uint16_t input_length) {
} }
input_length = input - start; input_length = input - start;
return input_length/4*3 + (input_length % 4 ? input_length % 4 - 1 : 0); return input_length / 4 * 3 + (input_length % 4 ? input_length % 4 - 1 : 0);
} }
uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]) { uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]) {
uint16_t full_sets = input_length/3; uint16_t full_sets = input_length / 3;
// While there are still full sets of 24 bits... // While there are still full sets of 24 bits...
for (uint16_t i = 0; i < full_sets; ++i) { for (uint16_t i = 0; i < full_sets; ++i) {
@ -152,7 +150,7 @@ uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned ch
output += 4; output += 4;
} }
switch(input_length % 3) { switch (input_length % 3) {
case 0: case 0:
output[0] = '\0'; output[0] = '\0';
break; break;
@ -192,7 +190,7 @@ uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned ch
output += 3; output += 3;
} }
switch(output_length % 3) { switch (output_length % 3) {
case 1: case 1:
output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4;
break; break;
@ -204,5 +202,3 @@ uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned ch
return output_length; return output_length;
} }
#endif // ifndef

View File

@ -66,7 +66,6 @@
BedLevelTools bedLevelTools; BedLevelTools bedLevelTools;
#if ENABLED(USE_GRID_MESHVIEWER) #if ENABLED(USE_GRID_MESHVIEWER)
bool BedLevelTools::viewer_asymmetric_range = false;
bool BedLevelTools::viewer_print_value = false; bool BedLevelTools::viewer_print_value = false;
#endif #endif
bool BedLevelTools::goto_mesh_value = false; bool BedLevelTools::goto_mesh_value = false;
@ -186,20 +185,14 @@ void BedLevelTools::meshReset() {
// Accessors // Accessors
float BedLevelTools::getMaxValue() { float BedLevelTools::getMaxValue() {
float max = __FLT_MAX__ * -1; float max = -(__FLT_MAX__);
GRID_LOOP(x, y) { GRID_LOOP(x, y) { const float z = bedlevel.z_values[x][y]; if (!isnan(z)) NOLESS(max, z); }
if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max)
max = bedlevel.z_values[x][y];
}
return max; return max;
} }
float BedLevelTools::getMinValue() { float BedLevelTools::getMinValue() {
float min = __FLT_MAX__; float min = __FLT_MAX__;
GRID_LOOP(x, y) { GRID_LOOP(x, y) { const float z = bedlevel.z_values[x][y]; if (!isnan(z)) NOMORE(min, z); }
if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min)
min = bedlevel.z_values[x][y];
}
return min; return min;
} }
@ -221,7 +214,7 @@ bool BedLevelTools::meshValidate() {
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(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max); const float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), rmax = _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);
@ -242,8 +235,8 @@ bool BedLevelTools::meshValidate() {
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] / rmax) << 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] / rmax) << 5) | // green if mesh point value is positive
_MIN(0x1F, (((uint8_t)abs(bedlevel.z_values[x][y]) / 10) * 4))), // + blue stepping for every mm _MIN(0x1F, (((uint8_t)abs(bedlevel.z_values[x][y]) / 10) * 4))), // + blue stepping for every mm
start_x_px, start_y_px, end_x_px, end_y_px start_x_px, start_y_px, end_x_px, end_y_px
); );
@ -252,7 +245,6 @@ bool BedLevelTools::meshValidate() {
LCD_SERIAL.flushTX(); LCD_SERIAL.flushTX();
// Draw value text on // Draw value text on
char buf[8];
const uint8_t fs = DWINUI::fontWidth(meshfont); const uint8_t fs = DWINUI::fontWidth(meshfont);
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;
@ -260,14 +252,15 @@ bool BedLevelTools::meshValidate() {
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)) MString<12> msg;
sprintf_P(buf, PSTR("%s"), dtostrf(abs(bedlevel.z_values[x][y]), 1, 2, str_1)); if ((GRID_MAX_POINTS_X) < TERN(TJC_DISPLAY, 8, 10))
msg.set(p_float_t(abs(bedlevel.z_values[x][y]), 2));
else else
sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100)); msg.setf(F("%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) * msg.length() - 2;
if (!(GRID_MAX_POINTS_X < (ENABLED(TJC_DISPLAY) ? 8 : 10))) if ((GRID_MAX_POINTS_X) >= TERN(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, msg);
} }
safe_delay(10); safe_delay(10);
LCD_SERIAL.flushTX(); LCD_SERIAL.flushTX();
@ -276,17 +269,10 @@ bool BedLevelTools::meshValidate() {
} }
void BedLevelTools::setMeshViewerStatus() { // 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(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max); float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), rmax = _MAX(v_min, v_max), rmin = _MIN(v_min, v_max);
if (v_min > 3e+10f) v_min = 0.0000001; if (rmax > 3e+10f) rmax = 0.0000001;
if (v_max > 3e+10f) v_max = 0.0000001; if (rmin > 3e+10f) rmin = 0.0000001;
if (range > 3e+10f) range = 0.0000001; ui.set_status(&MString<47>(F("Red "), p_float_t(-rmax, 3), F("..0.."), p_float_t(rmin, 3), F(" Green")));
ui.set_status(
&MString<45>(
F("Red "), p_float_t(viewer_asymmetric_range ? -v_min : -range, 3),
F("..0.."), p_float_t(viewer_asymmetric_range ? v_max : range, 3),
F(" Green")
)
);
drawing_mesh = false; drawing_mesh = false;
} }

View File

@ -161,8 +161,8 @@
#define MIN_BEDTEMP 0 #define MIN_BEDTEMP 0
#define MAX_BEDTEMP BED_MAX_TARGET #define MAX_BEDTEMP BED_MAX_TARGET
#define DWIN_VAR_UPDATE_INTERVAL 1024 #define DWIN_VAR_UPDATE_INTERVAL 500
#define DWIN_UPDATE_INTERVAL 1024 #define DWIN_UPDATE_INTERVAL 1000
#if HAS_MESH && HAS_BED_PROBE #if HAS_MESH && HAS_BED_PROBE
#define BABY_Z_VAR probe.offset.z #define BABY_Z_VAR probe.offset.z
@ -1253,6 +1253,13 @@ void eachMomentUpdate() {
static millis_t next_var_update_ms = 0, next_rts_update_ms = 0, next_status_update_ms = 0; static millis_t next_var_update_ms = 0, next_rts_update_ms = 0, next_status_update_ms = 0;
const millis_t ms = millis(); const millis_t ms = millis();
#if LCD_BACKLIGHT_TIMEOUT_MINS
if (ui.backlight_off_ms && ELAPSED(ms, ui.backlight_off_ms)) {
turnOffBacklight(); // Backlight off
ui.backlight_off_ms = 0;
}
#endif
if (ELAPSED(ms, next_var_update_ms)) { if (ELAPSED(ms, next_var_update_ms)) {
next_var_update_ms = ms + DWIN_VAR_UPDATE_INTERVAL; next_var_update_ms = ms + DWIN_VAR_UPDATE_INTERVAL;
blink = !blink; blink = !blink;
@ -1276,7 +1283,7 @@ void eachMomentUpdate() {
#endif #endif
if (ELAPSED(ms, next_status_update_ms)) { if (ELAPSED(ms, next_status_update_ms)) {
next_status_update_ms = ms + 500; next_status_update_ms = ms + DWIN_VAR_UPDATE_INTERVAL;
dwinDrawStatusMessage(); dwinDrawStatusMessage();
#if ENABLED(SCROLL_LONG_FILENAMES) #if ENABLED(SCROLL_LONG_FILENAMES)
if (isMenu(fileMenu)) fileMenuIdle(); if (isMenu(fileMenu)) fileMenuIdle();
@ -2220,6 +2227,10 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS,
#endif #endif
#if LCD_BACKLIGHT_TIMEOUT_MINS
void setTimer() { setPIntOnClick(ui.backlight_timeout_min, ui.backlight_timeout_max); }
#endif
#if HAS_FILAMENT_SENSOR #if HAS_FILAMENT_SENSOR
void setRunoutEnable() { void setRunoutEnable() {
runout.reset(); runout.reset();
@ -2258,6 +2269,13 @@ void setSpeed() { setPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); }
void setFanSpeed() { setIntOnClick(0, 255, thermalManager.fan_speed[0], applyFanSpeed); } void setFanSpeed() { setIntOnClick(0, 255, thermalManager.fan_speed[0], applyFanSpeed); }
#endif #endif
#if ENABLED(NOZZLE_PARK_FEATURE)
void parkHead() {
LCD_MESSAGE(MSG_FILAMENT_PARK_ENABLED);
queue.inject(F("G28O\nG27"));
}
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
void changeFilament() { void changeFilament() {
@ -2265,13 +2283,6 @@ void setSpeed() { setPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); }
queue.inject(F("M600 B2")); queue.inject(F("M600 B2"));
} }
#if ENABLED(NOZZLE_PARK_FEATURE)
void parkHead() {
LCD_MESSAGE(MSG_FILAMENT_PARK_ENABLED);
queue.inject(F("G28O\nG27"));
}
#endif
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
void unloadFilament() { void unloadFilament() {
LCD_MESSAGE(MSG_FILAMENTUNLOAD); LCD_MESSAGE(MSG_FILAMENTUNLOAD);
@ -2979,9 +2990,7 @@ void drawPrepareMenu() {
checkkey = ID_Menu; checkkey = ID_Menu;
if (SET_MENU_R(prepareMenu, selrect({133, 1, 28, 13}), MSG_PREPARE, 10 + PREHEAT_COUNT)) { if (SET_MENU_R(prepareMenu, selrect({133, 1, 28, 13}), MSG_PREPARE, 10 + PREHEAT_COUNT)) {
BACK_ITEM(gotoMainMenu); BACK_ITEM(gotoMainMenu);
#if ENABLED(ADVANCED_PAUSE_FEATURE) MENU_ITEM(ICON_FilMan, MSG_FILAMENT_MAN, onDrawSubMenu, drawFilamentManMenu);
MENU_ITEM(ICON_FilMan, MSG_FILAMENT_MAN, onDrawSubMenu, drawFilamentManMenu);
#endif
MENU_ITEM(ICON_Axis, MSG_MOVE_AXIS, onDrawMoveSubMenu, drawMoveMenu); MENU_ITEM(ICON_Axis, MSG_MOVE_AXIS, onDrawMoveSubMenu, drawMoveMenu);
#if ENABLED(LCD_BED_TRAMMING) #if ENABLED(LCD_BED_TRAMMING)
MENU_ITEM(ICON_Tram, MSG_BED_TRAMMING, onDrawSubMenu, drawTrammingMenu); MENU_ITEM(ICON_Tram, MSG_BED_TRAMMING, onDrawSubMenu, drawTrammingMenu);
@ -3072,7 +3081,7 @@ void drawControlMenu() {
void drawAdvancedSettingsMenu() { void drawAdvancedSettingsMenu() {
checkkey = ID_Menu; checkkey = ID_Menu;
if (SET_MENU(advancedSettingsMenu, MSG_ADVANCED_SETTINGS, 23)) { if (SET_MENU(advancedSettingsMenu, MSG_ADVANCED_SETTINGS, 24)) {
BACK_ITEM(gotoMainMenu); BACK_ITEM(gotoMainMenu);
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM);
@ -3109,6 +3118,9 @@ void drawAdvancedSettingsMenu() {
#if HAS_LOCKSCREEN #if HAS_LOCKSCREEN
MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, dwinLockScreen); MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, dwinLockScreen);
#endif #endif
#if LCD_BACKLIGHT_TIMEOUT_MINS
EDIT_ITEM(ICON_Brightness, MSG_SCREEN_TIMEOUT, onDrawPIntMenu, setTimer, &ui.backlight_timeout_minutes);
#endif
#if ENABLED(SOUND_MENU_ITEM) #if ENABLED(SOUND_MENU_ITEM)
EDIT_ITEM(ICON_Sound, MSG_SOUND_ENABLE, onDrawChkbMenu, setEnableSound, &ui.sound_on); EDIT_ITEM(ICON_Sound, MSG_SOUND_ENABLE, onDrawChkbMenu, setEnableSound, &ui.sound_on);
#endif #endif
@ -3330,6 +3342,9 @@ void drawTuneMenu() {
EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, setBrightness, &ui.brightness); EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, setBrightness, &ui.brightness);
MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, turnOffBacklight); MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, turnOffBacklight);
#endif #endif
#if LCD_BACKLIGHT_TIMEOUT_MINS
EDIT_ITEM(ICON_Brightness, MSG_SCREEN_TIMEOUT, onDrawPIntMenu, setTimer, &ui.backlight_timeout_minutes);
#endif
#if ENABLED(CASE_LIGHT_MENU) #if ENABLED(CASE_LIGHT_MENU)
EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on);
#if CASELIGHT_USES_BRIGHTNESS #if CASELIGHT_USES_BRIGHTNESS
@ -3452,9 +3467,7 @@ void drawMotionMenu() {
updateMenu(motionMenu); updateMenu(motionMenu);
} }
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ALL(ADVANCED_PAUSE_FEATURE, HAS_PREHEAT)
#if HAS_PREHEAT
void drawPreheatHotendMenu() { void drawPreheatHotendMenu() {
checkkey = ID_Menu; checkkey = ID_Menu;
@ -3466,28 +3479,28 @@ void drawMotionMenu() {
updateMenu(preheatHotendMenu); updateMenu(preheatHotendMenu);
} }
#endif #endif
void drawFilamentManMenu() { void drawFilamentManMenu() {
checkkey = ID_Menu; checkkey = ID_Menu;
if (SET_MENU(filamentMenu, MSG_FILAMENT_MAN, 6)) { if (SET_MENU(filamentMenu, MSG_FILAMENT_MAN, 6)) {
BACK_ITEM(drawPrepareMenu); BACK_ITEM(drawPrepareMenu);
#if ENABLED(NOZZLE_PARK_FEATURE) #if ENABLED(NOZZLE_PARK_FEATURE)
MENU_ITEM(ICON_Park, MSG_FILAMENT_PARK_ENABLED, onDrawMenuItem, parkHead); MENU_ITEM(ICON_Park, MSG_FILAMENT_PARK_ENABLED, onDrawMenuItem, parkHead);
#endif #endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#if HAS_PREHEAT #if HAS_PREHEAT
MENU_ITEM(ICON_SetEndTemp, MSG_PREHEAT_HOTEND, onDrawSubMenu, drawPreheatHotendMenu); MENU_ITEM(ICON_SetEndTemp, MSG_PREHEAT_HOTEND, onDrawSubMenu, drawPreheatHotendMenu);
#endif #endif
MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, changeFilament); MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, changeFilament);
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) #endif
MENU_ITEM(ICON_FilUnload, MSG_FILAMENTUNLOAD, onDrawMenuItem, unloadFilament); #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
MENU_ITEM(ICON_FilLoad, MSG_FILAMENTLOAD, onDrawMenuItem, loadFilament); MENU_ITEM(ICON_FilUnload, MSG_FILAMENTUNLOAD, onDrawMenuItem, unloadFilament);
#endif MENU_ITEM(ICON_FilLoad, MSG_FILAMENTLOAD, onDrawMenuItem, loadFilament);
} #endif
updateMenu(filamentMenu);
} }
updateMenu(filamentMenu);
#endif }
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)

View File

@ -321,9 +321,7 @@ void drawFilSetMenu();
#endif #endif
void drawTuneMenu(); void drawTuneMenu();
void drawMotionMenu(); void drawMotionMenu();
#if ENABLED(ADVANCED_PAUSE_FEATURE) void drawFilamentManMenu();
void drawFilamentManMenu();
#endif
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
void drawManualMeshMenu(); void drawManualMeshMenu();
#endif #endif

View File

@ -263,7 +263,7 @@ void DWINUI::drawCircle(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::drawFillCircle(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) {
@ -280,12 +280,12 @@ void DWINUI::drawFillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) {
// maxv : Maximum value // maxv : Maximum value
// color1 : Start color // color1 : Start color
// color2 : End color // color2 : End color
uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2) { uint16_t DWINUI::colorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2) {
uint8_t B, G, R; uint8_t B, G, R;
const float n = float(val - minv) / (maxv - minv); const float n = float(val - minv) / (maxv - minv + 1);
R = (1 - n) * GetRColor(color1) + n * GetRColor(color2); R = (1.0f - n) * GetRColor(color1) + n * GetRColor(color2);
G = (1 - n) * GetGColor(color1) + n * GetGColor(color2); G = (1.0f - n) * GetGColor(color1) + n * GetGColor(color2);
B = (1 - n) * GetBColor(color1) + n * GetBColor(color2); B = (1.0f - n) * GetBColor(color1) + n * GetBColor(color2);
return RGB(R, G, B); return RGB(R, G, B);
} }
@ -293,27 +293,17 @@ uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t colo
// val : Interpolator minv..maxv // val : Interpolator minv..maxv
// minv : Minimum value // minv : Minimum value
// maxv : Maximum value // maxv : Maximum value
uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) { uint16_t DWINUI::rainbowInt(int16_t val, int16_t minv, int16_t maxv) {
uint8_t B, G, R;
const uint8_t maxB = 28, maxR = 28, maxG = 38;
const int16_t limv = _MAX(abs(minv), abs(maxv)); const int16_t limv = _MAX(abs(minv), abs(maxv));
float n = minv >= 0 ? float(val - minv) / (maxv - minv) : (float)val / limv; float n = (minv >= 0) ? float(val - minv) / (maxv - minv + 1) : (float)val / limv;
LIMIT(n, -1, 1); LIMIT(n, -1, 1);
if (n < 0) {
R = 0; constexpr uint8_t maxB = 28, maxR = 28, maxG = 38;
G = (1 + n) * maxG; uint8_t R, G, B;
B = (-n) * maxB; if (n <= -0.5f) { R = 0; G = maxG * (1.0f + n); B = maxB; }
} else if (n <= 0.0f) { R = 0; G = maxG; B = maxB * (-n) * 2; }
else if (n < 0.5) { else if (n < 0.5f) { R = maxR * n * 2; G = maxG; B = 0; }
R = maxR * n * 2; else { R = maxR; G = maxG * (1.0f - n); B = 0; }
G = maxG;
B = 0;
}
else {
R = maxR;
G = maxG * (1 - n);
B = 0;
}
return RGB(R, G, B); return RGB(R, G, B);
} }

View File

@ -564,7 +564,7 @@ namespace DWINUI {
// maxv : Maximum value // maxv : Maximum value
// color1 : Start color // color1 : Start color
// color2 : End color // color2 : End color
uint16_t ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2); uint16_t colorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2);
// ------------------------- Buttons ------------------------------// // ------------------------- Buttons ------------------------------//
@ -593,13 +593,13 @@ namespace DWINUI {
// val : Interpolator minv..maxv // val : Interpolator minv..maxv
// minv : Minimum value // minv : Minimum value
// maxv : Maximum value // maxv : Maximum value
uint16_t RainbowInt(int16_t val, int16_t minv, int16_t maxv); uint16_t rainbowInt(int16_t val, int16_t minv, int16_t maxv);
// Write buffer data to the SRAM // Write buffer data to the SRAM
// addr: SRAM start address 0x0000-0x7FFF // addr: SRAM start address 0x0000-0x7FFF
// 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) {
dwinWriteToMem(0x5A, addr, length, data); dwinWriteToMem(0x5A, addr, length, data);
} }
@ -607,7 +607,7 @@ namespace DWINUI {
// addr: Flash start address 0x0000-0x3FFF // addr: Flash start address 0x0000-0x3FFF
// 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) {
dwinWriteToMem(0xA5, addr, length, data); dwinWriteToMem(0xA5, addr, length, data);
} }

View File

@ -39,7 +39,7 @@
#include "../../../MarlinCore.h" // for wait_for_user #include "../../../MarlinCore.h" // for wait_for_user
#include "dwin.h" #include "dwin.h"
#include "dwin_popup.h" #include "dwin_popup.h"
#include "base64.hpp" #include "base64.h"
#define THUMBWIDTH 230 #define THUMBWIDTH 230
#define THUMBHEIGHT 180 #define THUMBHEIGHT 180
@ -160,7 +160,7 @@ bool Preview::hasPreview() {
return false; return false;
} }
uint8_t buf64[fileprop.thumbsize]; uint8_t buf64[fileprop.thumbsize + 1];
uint16_t nread = 0; uint16_t nread = 0;
while (nread < fileprop.thumbsize) { while (nread < fileprop.thumbsize) {
const uint8_t c = card.get(); const uint8_t c = card.get();

View File

@ -75,37 +75,29 @@ void MeshViewer::drawMeshGrid(const uint8_t csizex, const uint8_t csizey) {
void MeshViewer::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::drawFillCircle(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 (v == 0) DWINUI::drawFloat(meshfont, 1, 2, px(x) - 2*fs, py(y) - fs, 0); const uint16_t fy = py(y) - fs;
else DWINUI::drawSignedFloat(meshfont, 1, 2, px(x) - 3*fs, py(y) - fs, z); if (sizex < TERN(TJC_DISPLAY, 8, 9)) {
if (v == 0) DWINUI::drawFloat(meshfont, 1, 2, px(x) - 2 * fs, fy, 0);
else DWINUI::drawSignedFloat(meshfont, 1, 2, px(x) - 3 * fs, fy, z);
} }
else { else {
char str_1[9]; char msg[9]; msg[0] = '\0';
str_1[0] = '\0';
switch (v) { switch (v) {
case -999 ... -100: case -999 ... -100:
DWINUI::drawSignedFloat(meshfont, 1, 1, px(x) - 3*fs, py(y) - fs, z); case 100 ... 999: DWINUI::drawSignedFloat(meshfont, 1, 1, px(x) - 3 * fs, fy, z); break;
break; case -99 ... -1: sprintf_P(msg, PSTR("-.%2i"), -v); break;
case -99 ... -1: case 1 ... 99: sprintf_P(msg, PSTR( ".%2i"), v); break;
sprintf_P(str_1, PSTR("-.%02i"), -v); default:
break; dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 4, fy, "0");
case 0: return;
dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 4, py(y) - fs, "0");
break;
case 1 ... 99:
sprintf_P(str_1, PSTR(".%02i"), v);
break;
case 100 ... 999:
DWINUI::drawSignedFloat(meshfont, 1, 1, px(x) - 3 * fs, py(y) - fs, z);
break;
} }
if (str_1[0]) dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 2 * fs, fy, msg);
dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 2 * fs, py(y) - fs, str_1);
} }
} }

View File

@ -38,38 +38,41 @@
#define Plot_Bg_Color RGB( 1, 12, 8) #define Plot_Bg_Color RGB( 1, 12, 8)
PlotClass plot; Plot plot;
uint16_t grphpoints, r, x2, y2 = 0; uint16_t graphpoints, r, x2, y2 = 0;
frame_rect_t grphframe = {0}; frame_rect_t graphframe = {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 Plot::draw(const frame_rect_t &frame, const_celsius_float_t max, const_float_t ref/*=0*/) {
grphframe = frame; graphframe = frame;
grphpoints = 0; graphpoints = 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::drawBox(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(COLOR_LINE, i * 50 + frame.x, frame.y, frame.h); for (uint8_t i = 1; i < 4; i++) if (i * 60 < frame.w) dwinDrawVLine(COLOR_LINE, i * 60 + frame.x, frame.y, frame.h);
DWINUI::drawBox(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 Plot::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 (graphpoints < graphframe.w) {
dwinDrawPoint(COLOR_YELLOW, 1, 1, grphpoints + grphframe.x, y); dwinDrawPoint(COLOR_YELLOW, 1, 1, graphpoints + graphframe.x, y);
} }
else { else {
dwinFrameAreaMove(1, 0, 1, Plot_Bg_Color, grphframe.x, grphframe.y, x2, y2); dwinFrameAreaMove(1, 0, 1, Plot_Bg_Color, graphframe.x, graphframe.y, x2, y2);
if ((grphpoints % 50) == 0) dwinDrawVLine(COLOR_LINE, x2 - 1, grphframe.y + 1, grphframe.h - 2); if ((graphpoints % 60) == 0) dwinDrawVLine(COLOR_LINE, x2 - 1, graphframe.y + 1, graphframe.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++; graphpoints++;
#if LCD_BACKLIGHT_TIMEOUT_MINS
ui.refresh_backlight_timeout();
#endif
} }
#endif // DWIN_LCD_PROUI && PROUI_TUNING_GRAPH #endif // DWIN_LCD_PROUI && PROUI_TUNING_GRAPH

View File

@ -30,10 +30,10 @@
#include "dwinui.h" #include "dwinui.h"
class PlotClass { class Plot {
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_celsius_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 Plot plot;

View File

@ -190,7 +190,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
millis_t MarlinUI::backlight_off_ms = 0; millis_t MarlinUI::backlight_off_ms = 0;
void MarlinUI::refresh_backlight_timeout() { void MarlinUI::refresh_backlight_timeout() {
backlight_off_ms = backlight_timeout_minutes ? millis() + backlight_timeout_minutes * 60UL * 1000UL : 0; backlight_off_ms = backlight_timeout_minutes ? millis() + MIN_TO_MS(backlight_timeout_minutes) : 0;
#ifdef NEOPIXEL_BKGD_INDEX_FIRST #ifdef NEOPIXEL_BKGD_INDEX_FIRST
neo.reset_background_color(); neo.reset_background_color();
neo.show(); neo.show();

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 3.5)
#====================================================================# #====================================================================#
# Usage under Linux: # # Usage under Linux: #
# # # #
@ -82,7 +82,7 @@ message("-- Running CMake version: " ${CMAKE_VERSION})
# Replace the CMake Ver. in the Arduino.cmake # Replace the CMake Ver. in the Arduino.cmake
file(READ "${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/Platform/Arduino.cmake" ORIGINAL_FILE_CONTENTS) file(READ "${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/Platform/Arduino.cmake" ORIGINAL_FILE_CONTENTS)
string(REPLACE "cmake_minimum_required(VERSION 2.8.5)" "cmake_minimum_required(VERSION 2.8.12)" NEW_FILE_CONTENTS "${ORIGINAL_FILE_CONTENTS}") string(REPLACE "cmake_minimum_required(VERSION 2.8.5)" "cmake_minimum_required(VERSION 3.5)" NEW_FILE_CONTENTS "${ORIGINAL_FILE_CONTENTS}")
file(WRITE "${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/Platform/Arduino.cmake" "${NEW_FILE_CONTENTS}") file(WRITE "${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/Platform/Arduino.cmake" "${NEW_FILE_CONTENTS}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/modules) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/modules)
@ -95,6 +95,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/marlin-cma
set(ARDUINO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR}/arduino-1.8.19) set(ARDUINO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR}/arduino-1.8.19)
#set(ARDUINO_SDK_PATH /Applications/Arduino.app/Contents/Java) #set(ARDUINO_SDK_PATH /Applications/Arduino.app/Contents/Java)
#set(ARDUINO_SDK_PATH $HOME/ArduinoAddons/Arduino_1.6.x) #set(ARDUINO_SDK_PATH $HOME/ArduinoAddons/Arduino_1.6.x)
#====================================================================# #====================================================================#
# Set included cmake files # # Set included cmake files #
#====================================================================# #====================================================================#
@ -108,6 +109,19 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/toolchain/Arduin
#====================================================================# #====================================================================#
# Setup Project # # Setup Project #
# #
# If you receive this error: #
# 'Unknown CMake command "_cmake_record_install_prefix".' #
# #
# Go to the file in your CMake directory. #
# #
# For Windows: cmake\Modules\Platform\WindowsPaths.cmake #
# For Linux: cmake/Modules/Platform/UnixPaths.cmake #
# #
# Comment out "_cmake_record_install_prefix()" #
# - OR - #
# Add "include(CMakeSystemSpecificInformation)" above the line. #
# #
#====================================================================# #====================================================================#
project(Marlin C CXX) project(Marlin C CXX)