Skip to content

Commit

Permalink
Replace with thinkyhead's branch
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jul 24, 2021
1 parent 76f6570 commit d25f48c
Show file tree
Hide file tree
Showing 19 changed files with 192 additions and 189 deletions.
5 changes: 3 additions & 2 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#include "lcd/dwin/creality_dwin.h"
#include "lcd/dwin/rotary_encoder.h"
#include "lcd/dwin/e3v2/dwin.h"
#include "lcd/dwin/e3v2/rotary_encoder.h"
#endif

#if ENABLED(EXTENSIBLE_UI)
Expand Down Expand Up @@ -868,6 +868,7 @@ void idle(bool no_stepper_sleep/*=false*/) {
TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_reporter.tick());
TERN_(AUTO_REPORT_SD_STATUS, card.auto_reporter.tick());
TERN_(AUTO_REPORT_POSITION, position_auto_reporter.tick());
TERN_(BUFFER_MONITORING, queue.auto_report_buffer_statistics());
}
#endif

Expand Down
5 changes: 2 additions & 3 deletions Marlin/src/gcode/feature/powerloss/M1000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
#include "../../../lcd/marlinui.h"
#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extui/ui_api.h"
#endif
#if ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/dwin/creality_dwin.h" // Temporary fix until it can be better implemented
#elif ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/dwin/e3v2/dwin.h" // Temporary fix until it can be better implemented
#endif

#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
* M553 - Get or set IP netmask. (Requires enabled Ethernet port)
* M554 - Get or set IP gateway. (Requires enabled Ethernet port)
* M569 - Enable stealthChop on an axis. (Requires at least one _DRIVER_TYPE to be TMC2130/2160/2208/2209/5130/5160)
* M575 - Change the serial baud rate. (Requires BAUD_RATE_GCODE)
* M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
* M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
* M605 - Set Dual X-Carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
Expand Down Expand Up @@ -298,6 +299,7 @@
* M997 - Perform in-application firmware update
* M999 - Restart after being stopped by error
* D... - Custom Development G-code. Add hooks to 'gcode_D.cpp' for developers to test features. (Requires MARLIN_DEV_MODE)
* D576 - Set buffer monitoring options. (Requires BUFFER_MONITORING)
*
* "T" Codes
*
Expand Down
24 changes: 23 additions & 1 deletion Marlin/src/gcode/lcd/M251.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"

#if HAS_LCD_BRIGHTNESS
Expand All @@ -9,7 +30,8 @@
* M251: Set the LCD brightness
*/
void GcodeSuite::M251() {
if (parser.seen('B')) ui.set_brightness(parser.value_int());
if (parser.seenval('B')) ui.set_brightness(parser.value_int());
SERIAL_ECHOLNPAIR("LCD Brightness: ", ui.brightness);
}

#endif // HAS_LCD_BRIGHTNESS
4 changes: 2 additions & 2 deletions Marlin/src/gcode/lcd/M73.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
* M73 P25 ; Set progress to 25%
*/
void GcodeSuite::M73() {
if (parser.seen('P'))
if (parser.seenval('P'))
ui.set_progress((PROGRESS_SCALE) > 1
? parser.value_float() * (PROGRESS_SCALE)
: parser.value_byte()
);
#if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
if (parser.seen('R')) ui.set_remaining_time(60 * parser.value_ulong());
if (parser.seenval('R')) ui.set_remaining_time(60 * parser.value_ulong());
#endif
}

Expand Down
9 changes: 6 additions & 3 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,12 @@

#if ENABLED(DWIN_CREALITY_LCD)
#define HAS_LCD_BRIGHTNESS 1
#define MAX_LCD_BRIGHTNESS 255
#define MIN_LCD_BRIGHTNESS 1
#define DEFAULT_LCD_BRIGHTNESS 255
#endif

#if HAS_LCD_BRIGHTNESS
#define MIN_LCD_BRIGHTNESS 1
#define MAX_LCD_BRIGHTNESS 255
#define DEFAULT_LCD_BRIGHTNESS MAX_LCD_BRIGHTNESS
#endif

/**
Expand Down
19 changes: 2 additions & 17 deletions Marlin/src/lcd/dwin/creality_marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,9 @@
#include "../../feature/pause.h"
#endif

#include "creality_dwin.h"
#include "e3v2/dwin.h"
#include "../marlinui.h"

uint8_t MarlinUI::brightness = DEFAULT_LCD_BRIGHTNESS;
bool MarlinUI::backlight = true;

void MarlinUI::set_brightness(const uint8_t value) {
if (value == 0) {
backlight = false;
DWIN_Backlight_SetLuminance(0);
}
else {
backlight = true;
brightness = constrain(value, MIN_LCD_BRIGHTNESS, MAX_LCD_BRIGHTNESS);
DWIN_Backlight_SetLuminance(brightness);
}
}

#if ENABLED(ADVANCED_PAUSE_FEATURE)
void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) {
switch(message) {
Expand Down Expand Up @@ -108,4 +93,4 @@ void MarlinUI::kill_screen(PGM_P const error, PGM_P const component) {
CrealityDWIN.Draw_Popup((char*)"Printer Kill Reason:", error, (char*)"Restart Required", Wait, ICON_BLTouch);
}

#endif
#endif // DWIN_CREALITY_LCD
21 changes: 10 additions & 11 deletions Marlin/src/lcd/dwin/dwin.cpp → Marlin/src/lcd/dwin/dwin_lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ bool DWIN_Handshake(void) {
#endif
LCD_SERIAL.begin(LCD_BAUDRATE);
const millis_t serial_connect_timeout = millis() + 1000UL;
while (!LCD_SERIAL.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
while (!LCD_SERIAL && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }

size_t i = 0;
DWIN_Byte(i, 0x00);
Expand Down Expand Up @@ -211,18 +211,17 @@ void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color,

//Color: color
//x/y: Upper-left coordinate of the first pixel
void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) {
DWIN_Draw_Point(Color, 1, 1, x + 1, y);
DWIN_Draw_Point(Color, 1, 1, x + 2, y);
DWIN_Draw_Point(Color, 1, 1, x, y + 1);
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 1);
DWIN_Draw_Point(Color, 1, 1, x, y + 2);
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 2);
DWIN_Draw_Point(Color, 1, 1, x + 1, y + 3);
DWIN_Draw_Point(Color, 1, 1, x + 2, y + 3);
void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) {
DWIN_Draw_Point(Color, 1, 1, x + 1, y);
DWIN_Draw_Point(Color, 1, 1, x + 2, y);
DWIN_Draw_Point(Color, 1, 1, x, y + 1);
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 1);
DWIN_Draw_Point(Color, 1, 1, x, y + 2);
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 2);
DWIN_Draw_Point(Color, 1, 1, x + 1, y + 3);
DWIN_Draw_Point(Color, 1, 1, x + 2, y + 3);
}


// Move a screen area
// mode: 0, circle shift; 1, translation
// dir: 0=left, 1=right, 2=up, 3=down
Expand Down
File renamed without changes.
Loading

0 comments on commit d25f48c

Please sign in to comment.