Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into X5SA-2E-Bug…
Browse files Browse the repository at this point in the history
…fix-ColorUI
  • Loading branch information
effgarces committed Aug 19, 2020
2 parents 58a9945 + d3c5161 commit 813838c
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 78 deletions.
5 changes: 2 additions & 3 deletions Marlin/src/feature/power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ bool Power::is_power_needed() {

// If any of the drivers or the bed are enabled...
if (X_ENABLE_READ() == X_ENABLE_ON || Y_ENABLE_READ() == Y_ENABLE_ON || Z_ENABLE_READ() == Z_ENABLE_ON
|| TERN0(HAS_HEATED_BED, thermalManager.temp_bed.soft_pwm_amount > 0)
#if HAS_X2_ENABLE
|| X2_ENABLE_READ() == X_ENABLE_ON
#endif
Expand All @@ -75,8 +74,8 @@ bool Power::is_power_needed() {
#endif
) return true;

HOTEND_LOOP() if (thermalManager.degTargetHotend(e) > 0) return true;
if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0)) return true;
HOTEND_LOOP() if (thermalManager.degTargetHotend(e) > 0 || thermalManager.temp_hotend[e].soft_pwm_amount > 0) return true;
if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0 || thermalManager.temp_bed.soft_pwm_amount > 0)) return true;

#if HAS_HOTEND && AUTO_POWER_E_TEMP
HOTEND_LOOP() if (thermalManager.degHotend(e) >= AUTO_POWER_E_TEMP) return true;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2020-08-18"
#define STRING_DISTRIBUTION_DATE "2020-08-19"
#endif

/**
Expand Down
137 changes: 68 additions & 69 deletions Marlin/src/lcd/dwin/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@
#include "../../module/probe.h"
#endif

#include "../../libs/buzzer.h"

#ifndef MACHINE_SIZE
#define MACHINE_SIZE "220x220x250"
#endif
Expand Down Expand Up @@ -1065,36 +1063,40 @@ void HMI_Move_Z(void) {
}
}

void HMI_Move_E(void) {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.Move_E_scale += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.Move_E_scale -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
checkkey = AxisMove;
EncoderRate.encoderRateEnabled = 0;
last_E_scale = HMI_ValueStruct.Move_E_scale;
show_plus_or_minus(font8x16, Background_black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
if (!planner.is_full()) {
planner.synchronize(); // Wait for planner moves to finish!
planner.buffer_line(current_position, MMM_TO_MMS(FEEDRATE_E), active_extruder);
#if EXTRUDERS

void HMI_Move_E(void) {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.Move_E_scale += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.Move_E_scale -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
checkkey = AxisMove;
EncoderRate.encoderRateEnabled = 0;
last_E_scale = HMI_ValueStruct.Move_E_scale;
show_plus_or_minus(font8x16, Background_black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
if (!planner.is_full()) {
planner.synchronize(); // Wait for planner moves to finish!
planner.buffer_line(current_position, MMM_TO_MMS(FEEDRATE_E), active_extruder);
}
DWIN_UpdateLCD();
return;
}
if ((HMI_ValueStruct.Move_E_scale - last_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
HMI_ValueStruct.Move_E_scale = last_E_scale + (EXTRUDE_MAXLENGTH) * MINUNITMULT;
else if ((last_E_scale - HMI_ValueStruct.Move_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
HMI_ValueStruct.Move_E_scale = last_E_scale - (EXTRUDE_MAXLENGTH) * MINUNITMULT;
current_position.e = HMI_ValueStruct.Move_E_scale / 10;
show_plus_or_minus(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
DWIN_UpdateLCD();
return;
}
if ((HMI_ValueStruct.Move_E_scale - last_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
HMI_ValueStruct.Move_E_scale = last_E_scale + (EXTRUDE_MAXLENGTH) * MINUNITMULT;
else if ((last_E_scale - HMI_ValueStruct.Move_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
HMI_ValueStruct.Move_E_scale = last_E_scale - (EXTRUDE_MAXLENGTH) * MINUNITMULT;
current_position.e = HMI_ValueStruct.Move_E_scale / 10;
show_plus_or_minus(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
DWIN_UpdateLCD();
}
}

#endif

void HMI_Zoffset(void) {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
Expand Down Expand Up @@ -2096,7 +2098,9 @@ inline void Draw_Move_Menu() {
DWIN_Frame_AreaCopy(1, 58, 118, 271 - 165, 479 - 347, LBLX, MBASE(1));
DWIN_Frame_AreaCopy(1, 109, 118, 271 - 114, 479 - 347, LBLX, MBASE(2));
DWIN_Frame_AreaCopy(1, 160, 118, 271 - 62, 479 - 347, LBLX, MBASE(3));
DWIN_Frame_AreaCopy(1, 212, 118, 271 - 18, 479 - 348, LBLX, MBASE(4));
#if HAS_HOTEND
DWIN_Frame_AreaCopy(1, 212, 118, 271 - 18, 479 - 348, LBLX, MBASE(4));
#endif
}
else {
#ifdef USE_STRING_HEADINGS
Expand All @@ -2107,7 +2111,9 @@ inline void Draw_Move_Menu() {
draw_move_en(MBASE(1)); say_x(33 + 3, MBASE(1)); // "Move X"
draw_move_en(MBASE(2)); say_y(33 + 3, MBASE(2)); // "Move Y"
draw_move_en(MBASE(3)); say_z(33 + 3, MBASE(3)); // "Move Z"
DWIN_Frame_AreaCopy(1, 123, 192, 271 - 95, 479 - 277, LBLX, MBASE(4)); // "Extruder"
#if HAS_HOTEND
DWIN_Frame_AreaCopy(1, 123, 192, 271 - 95, 479 - 277, LBLX, MBASE(4)); // "Extruder"
#endif
}

Draw_Back_First(select_axis.now == 0);
Expand All @@ -2116,6 +2122,18 @@ inline void Draw_Move_Menu() {
LOOP_L_N(i, MROWS) Draw_Menu_Line(i + 1, ICON_MoveX + i);
}

#include "../../libs/buzzer.h"

void HMI_AudioFeedback(const bool success=true) {
if (success) {
buzzer.tone(100, 659);
buzzer.tone(10, 0);
buzzer.tone(100, 698);
}
else
buzzer.tone(40, 440);
}

/* Prepare */
void HMI_Prepare(void) {
ENCODER_DiffState encoder_diffState = get_encoder_state();
Expand Down Expand Up @@ -2202,8 +2220,7 @@ void HMI_Prepare(void) {
#else
// Apply workspace offset, making the current position 0,0,0
queue.inject_P(PSTR("G92 X0 Y0 Z0"));
buzzer.tone(100, 659);
buzzer.tone(100, 698);
HMI_AudioFeedback();
#endif
break;
case 5: // PLA preheat
Expand Down Expand Up @@ -2347,27 +2364,17 @@ void HMI_Control(void) {
select_motion.reset();
Draw_Motion_Menu();
break;
case 3: // write EEPROM
if (settings.save()) {
buzzer.tone(100, 659);
buzzer.tone(100, 698);
}
else
buzzer.tone(20, 440);
break;
case 4: // read EEPROM
if (settings.load()) {
buzzer.tone(100, 659);
buzzer.tone(100, 698);
}
else {buzzer.tone(20, 440);}
break;
case 3: { // write EEPROM
const bool success = settings.save();
HMI_AudioFeedback(success);
} break;
case 4: { // read EEPROM
const bool success = settings.load();
HMI_AudioFeedback(success);
} break;
case 5: // resume EEPROM
settings.reset();
#if HAS_BUZZER
buzzer.tone(100, 659);
buzzer.tone(100, 698);
#endif
HMI_AudioFeedback();
break;
case 6: // info
checkkey = Info;
Expand Down Expand Up @@ -3006,14 +3013,10 @@ void HMI_PLAPreheatSetting(void) {
EncoderRate.encoderRateEnabled = 1;
break;
#endif
case 4: // save PLA configuration
if (settings.save()) {
buzzer.tone(100, 659);
buzzer.tone(100, 698);
}
else
buzzer.tone(20, 440);
break;
case 4: { // save PLA configuration
const bool success = settings.save();
HMI_AudioFeedback(success);
} break;
default: break;
}
}
Expand Down Expand Up @@ -3064,14 +3067,10 @@ void HMI_ABSPreheatSetting(void) {
EncoderRate.encoderRateEnabled = 1;
break;
#endif
case 4: // save PLA configuration
if (settings.save()) {
buzzer.tone(100, 659);
buzzer.tone(100, 698);
}
else
buzzer.tone(20, 440);
break;
case 4: { // save ABS configuration
const bool success = settings.save();
HMI_AudioFeedback(success);
} break;
default:
break;
}
Expand Down Expand Up @@ -3496,11 +3495,11 @@ void DWIN_HandleScreen(void) {
case Move_X: HMI_Move_X(); break;
case Move_Y: HMI_Move_Y(); break;
case Move_Z: HMI_Move_Z(); break;
case Extruder: HMI_Move_E(); break;
case Homeoffset: HMI_Zoffset(); break;
#if HAS_HOTEND
case Extruder: HMI_Move_E(); break;
case ETemp: HMI_ETemp(); break;
#endif
case Homeoffset: HMI_Zoffset(); break;
#if HAS_HEATED_BED
case BedTemp: HMI_BedTemp(); break;
#endif
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/dwin/dwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ enum processID {
Move_X,
Move_Y,
Move_Z,
Extruder,
Homeoffset,
#if HAS_HOTEND
Extruder,
ETemp,
#endif
Homeoffset,
#if HAS_HEATED_BED
BedTemp,
#endif
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/lcd/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace Language_en {
PROGMEM Language_Str MSG_MEDIA_INSERTED = _UxGT("Media Inserted");
PROGMEM Language_Str MSG_MEDIA_REMOVED = _UxGT("Media Removed");
PROGMEM Language_Str MSG_MEDIA_WAITING = _UxGT("Waiting for media");
PROGMEM Language_Str MSG_SD_INIT_FAIL = _UxGT("SD Init Fail");
PROGMEM Language_Str MSG_MEDIA_READ_ERROR = _UxGT("Media read error");
PROGMEM Language_Str MSG_MEDIA_USB_REMOVED = _UxGT("USB device removed");
PROGMEM Language_Str MSG_MEDIA_USB_FAILED = _UxGT("USB start failed");
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ void Stepper::set_directions() {
}

FORCE_INLINE int32_t Stepper::_eval_bezier_curve(const uint32_t curr_step) {
#if defined(__ARM__) || defined(__thumb__)
#if defined(__arm__) || defined(__thumb__)

// For ARM Cortex M3/M4 CPUs, we have the optimized assembler version, that takes 43 cycles to execute
uint32_t flo = 0;
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ volatile bool Temperature::raw_temps_ready = false;
LEDColor color = ONHEATINGSTART();
#endif

TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = false);

// PID Tuning loop
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/pins/stm32f1/pins_CREALITY_V4.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@
#define BTN_EN2 PB12

//#define LCD_LED_PIN PB2
#define BEEPER_PIN PB13
#ifndef BEEPER_PIN
#define BEEPER_PIN PB13
#undef SPEAKER
#endif

#elif ENABLED(DWIN_VET6_CREALITY_LCD)

Expand Down
7 changes: 6 additions & 1 deletion Marlin/src/sd/cardreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,13 @@ void CardReader::mount() {
flag.mounted = true;
SERIAL_ECHO_MSG(STR_SD_CARD_OK);
}
cdroot();

if (flag.mounted)
cdroot();
else {
spiInit(SPI_SPEED); // Return to base SPI speed
ui.set_status_P(GET_TEXT(MSG_SD_INIT_FAIL), -1);
}
ui.refresh();
}

Expand Down

0 comments on commit 813838c

Please sign in to comment.