Skip to content

Commit

Permalink
⛙ Merge w/Marlin
Browse files Browse the repository at this point in the history
  • Loading branch information
classicrocker883 committed Dec 9, 2024
2 parents 0f7ba8b + 906dcc7 commit 42d5864
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 93 deletions.
16 changes: 8 additions & 8 deletions Marlin/src/inc/Conditionals-4-adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,39 +51,39 @@
#define NUM_SERVOS 0
#if HAS_Z_SERVO_PROBE && NUM_SERVOS <= Z_PROBE_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (Z_PROBE_SERVO_NR + 1)
#define NUM_SERVOS INCREMENT(Z_PROBE_SERVO_NR)
#endif
#if ENABLED(CHAMBER_VENT) && NUM_SERVOS <= CHAMBER_VENT_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (CHAMBER_VENT_SERVO_NR + 1)
#define NUM_SERVOS INCREMENT(CHAMBER_VENT_SERVO_NR)
#endif
#if ENABLED(SWITCHING_TOOLHEAD) && NUM_SERVOS <= SWITCHING_TOOLHEAD_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SWITCHING_TOOLHEAD_SERVO_NR + 1)
#define NUM_SERVOS INCREMENT(SWITCHING_TOOLHEAD_SERVO_NR)
#endif
#if ENABLED(SWITCHING_NOZZLE)
#if NUM_SERVOS <= SWITCHING_NOZZLE_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SWITCHING_NOZZLE_SERVO_NR + 1)
#define NUM_SERVOS INCREMENT(SWITCHING_NOZZLE_SERVO_NR)
#endif
#if NUM_SERVOS <= SWITCHING_NOZZLE_E1_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SWITCHING_NOZZLE_E1_SERVO_NR + 1)
#define NUM_SERVOS INCREMENT(SWITCHING_NOZZLE_E1_SERVO_NR)
#endif
#endif
#if ENABLED(SWITCHING_EXTRUDER)
#if NUM_SERVOS <= SWITCHING_EXTRUDER_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SWITCHING_EXTRUDER_SERVO_NR + 1)
#define NUM_SERVOS INCREMENT(SWITCHING_EXTRUDER_SERVO_NR)
#endif
#if NUM_SERVOS <= SWITCHING_EXTRUDER_E23_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SWITCHING_EXTRUDER_E23_SERVO_NR + 1)
#define NUM_SERVOS INCREMENT(SWITCHING_EXTRUDER_E23_SERVO_NR)
#endif
#endif
#if ENABLED(SPINDLE_SERVO) && NUM_SERVOS <= SPINDLE_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SPINDLE_SERVO_NR + 1)
#define NUM_SERVOS INCREMENT(SPINDLE_SERVO_NR)
#endif
#endif // !defined(NUM_SERVOS)

Expand Down
49 changes: 48 additions & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,54 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#if 1 < 0 \
+ (DISABLED(BLTOUCH) && HAS_Z_SERVO_PROBE) \
+ COUNT_ENABLED(PROBE_MANUALLY, BLTOUCH, BD_SENSOR, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, RACK_AND_PINION_PROBE, SENSORLESS_PROBING, MAGLEV4, MAG_MOUNTED_PROBE, BIQU_MICROPROBE_V1, BIQU_MICROPROBE_V2)
#error "Please enable only one probe option: PROBE_MANUALLY, SENSORLESS_PROBING, BLTOUCH, BD_SENSOR, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, MAGLEV4, MAG_MOUNTED_PROBE, BIQU_MICROPROBE_V1, BIQU_MICROPROBE_V2, or Z Servo."
#error "Please enable only one probe option. See the following errors:"
#if ENABLED(BLTOUCH)
#error "(BLTOUCH is enabled.)"
#elif HAS_Z_SERVO_PROBE
#error "(Z_SERVO_PROBE is enabled.)"
#endif
#if ENABLED(PROBE_MANUALLY)
#error "(PROBE_MANUALLY is enabled.)"
#endif
#if ENABLED(BD_SENSOR)
#error "(BD_SENSOR is enabled.)"
#endif
#if ENABLED(FIX_MOUNTED_PROBE)
#error "(FIX_MOUNTED_PROBE is enabled.)"
#endif
#if ENABLED(NOZZLE_AS_PROBE)
#error "(NOZZLE_AS_PROBE is enabled.)"
#endif
#if ENABLED(TOUCH_MI_PROBE)
#error "(TOUCH_MI_PROBE is enabled.)"
#endif
#if ENABLED(SOLENOID_PROBE)
#error "(SOLENOID_PROBE is enabled.)"
#endif
#if ENABLED(Z_PROBE_ALLEN_KEY)
#error "(Z_PROBE_ALLEN_KEY is enabled.)"
#endif
#if ENABLED(Z_PROBE_SLED)
#error "(Z_PROBE_SLED is enabled.)"
#endif
#if ENABLED(RACK_AND_PINION_PROBE)
#error "(RACK_AND_PINION_PROBE is enabled.)"
#endif
#if ENABLED(SENSORLESS_PROBING)
#error "(SENSORLESS_PROBING is enabled.)"
#endif
#if ENABLED(MAGLEV4)
#error "(MAGLEV4 is enabled.)"
#endif
#if ENABLED(MAG_MOUNTED_PROBE)
#error "(MAG_MOUNTED_PROBE is enabled.)"
#endif
#if ENABLED(BIQU_MICROPROBE_V1)
#error "(BIQU_MICROPROBE_V1 is enabled.)"
#endif
#if ENABLED(BIQU_MICROPROBE_V2)
#error "(BIQU_MICROPROBE_V2 is enabled.)"
#endif
#endif

#if HAS_BED_PROBE
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/common/dwin_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
#define ICON_Info_0 90
#define ICON_Info_1 91

// Additional Icons
// Extra Icons
#define ICON_Printer_0 93
#define ICON_Box 200
#define ICON_Checkbox 201
Expand Down
26 changes: 18 additions & 8 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2478,6 +2478,13 @@ void ApplyMove() {
void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS, UNITFDIGITS, ApplyMove, LiveMove); }
#endif

#if ENABLED(Z_STEPPER_AUTO_ALIGN)
void autoZAlign() {
LCD_MESSAGE(MSG_AUTO_Z_ALIGN);
queue.inject(F("G34"));
}
#endif

#if HAS_HOTEND
void SetMoveE() {
#define E_MIN_POS (current_position.e - (EXTRUDE_MAXLENGTH))
Expand Down Expand Up @@ -3548,7 +3555,7 @@ void Draw_Tune_Menu() {
EDIT_ITEM_F(ICON_File, "Auto Abort GCodes", onDrawChkbMenu, SetAutoAbort, &HMI_data.auto_abort);
#endif
#if ENABLED(FWRETRACT)
MENU_ITEM(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu);
MENU_ITEM(ICON_FWRetLength, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu);
#endif
#if ALL(PROUI_ITEM_JD, HAS_JUNCTION_DEVIATION)
EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, SetJDmm, &planner.junction_deviation_mm);
Expand Down Expand Up @@ -3735,7 +3742,7 @@ void Draw_FilamentMan_Menu() {
BACK_ITEM(Draw_Prepare_Menu);
MENU_ITEM(ICON_FilSet, MSG_FILAMENT_SET, onDrawSubMenu, Draw_FilSet_Menu);
#if ENABLED(FWRETRACT)
MENU_ITEM(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu);
MENU_ITEM(ICON_FWRetLength, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu);
#endif
#if HAS_FEEDRATE_EDIT
EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawPIntMenu, SetSpeed, &feedrate_percentage);
Expand Down Expand Up @@ -4268,7 +4275,7 @@ void Draw_MaxAccel_Menu() {
#if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
void Draw_Homing_Menu() {
checkkey = Menu;
if (SET_MENU(HomingMenu, MSG_HOMING, 8)) {
if (SET_MENU(HomingMenu, MSG_HOMING, 9)) {
BACK_ITEM(Draw_Prepare_Menu);
MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, AutoHome);
#if HAS_X_AXIS
Expand All @@ -4287,6 +4294,9 @@ void Draw_MaxAccel_Menu() {
#if ENABLED(MESH_BED_LEVELING)
EDIT_ITEM(ICON_ZAfterHome, MSG_Z_AFTER_HOME, onDrawPInt8Menu, SetZAfterHoming, &HMI_data.z_after_homing);
#endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
MENU_ITEM(ICON_HomeZ, MSG_AUTO_Z_ALIGN, onDrawMenuItem, autoZAlign);
#endif
}
UpdateMenu(HomingMenu);
}
Expand All @@ -4297,11 +4307,11 @@ void Draw_MaxAccel_Menu() {
checkkey = Menu;
if (SET_MENU(FWRetractMenu, MSG_FWRETRACT, 6)) {
BACK_ITEM(ReturnToPreviousMenu);
EDIT_ITEM(ICON_FWRetract, MSG_CONTROL_RETRACT, onDrawPFloatMenu, SetRetractLength, &fwretract.settings.retract_length);
EDIT_ITEM(ICON_FWSpeed, MSG_SINGLENOZZLE_RETRACT_SPEED, onDrawPFloatMenu, SetRetractSpeed, &fwretract.settings.retract_feedrate_mm_s);
EDIT_ITEM(ICON_FWZRaise, MSG_CONTROL_RETRACT_ZHOP, onDrawPFloat2Menu, SetZRaise, &fwretract.settings.retract_zraise);
EDIT_ITEM(ICON_FWSpeed, MSG_SINGLENOZZLE_UNRETRACT_SPEED, onDrawPFloatMenu, SetRetractSpeed, &fwretract.settings.retract_recover_feedrate_mm_s);
EDIT_ITEM(ICON_FWRetract, MSG_CONTROL_RETRACT_RECOVER, onDrawPFloatMenu, SetAddRecover, &fwretract.settings.retract_recover_extra);
EDIT_ITEM(ICON_FWRetLength, MSG_CONTROL_RETRACT, onDrawPFloatMenu, SetRetractLength, &fwretract.settings.retract_length);
EDIT_ITEM(ICON_FWRetSpeed, MSG_SINGLENOZZLE_RETRACT_SPEED, onDrawPFloatMenu, SetRetractSpeed, &fwretract.settings.retract_feedrate_mm_s);
EDIT_ITEM(ICON_FWRetZRaise, MSG_CONTROL_RETRACT_ZHOP, onDrawPFloat2Menu, SetZRaise, &fwretract.settings.retract_zraise);
EDIT_ITEM(ICON_FWRecSpeed, MSG_SINGLENOZZLE_UNRETRACT_SPEED, onDrawPFloatMenu, SetRetractSpeed, &fwretract.settings.retract_recover_feedrate_mm_s);
EDIT_ITEM(ICON_FWRecExtra, MSG_CONTROL_RETRACT_RECOVER, onDrawPFloatMenu, SetAddRecover, &fwretract.settings.retract_recover_extra);
}
UpdateMenu(FWRetractMenu);
}
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/lcd/e3v2/proui/dwinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@
#define ICON_FilUnload ICON_ReadEEPROM
#define ICON_Flow ICON_StepE
#define ICON_Folder ICON_More
#define ICON_FWRetract ICON_StepE
#define ICON_FWZRaise ICON_MoveZ
#define ICON_FWSpeed ICON_Setspeed
#define ICON_FWRetLength ICON_StepE
#define ICON_FWRetSpeed ICON_Setspeed
#define ICON_FWRetZRaise ICON_MoveZ
#define ICON_FWRecSpeed ICON_Setspeed
#define ICON_FWRecExtra ICON_StepE
#define ICON_HomeX ICON_MoveX
#define ICON_HomeY ICON_MoveY
#define ICON_HomeZ ICON_MoveZ
Expand Down
14 changes: 7 additions & 7 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ MarlinUI ui;
#endif

#if ENABLED(LCD_PROGRESS_BAR) && !IS_TFTGLCD_PANEL
#define BASIC_PROGRESS_BAR 1
#define HAS_BASIC_PROGRESS_BAR 1
#endif

#if ANY(HAS_DISPLAY, HAS_STATUS_MESSAGE, BASIC_PROGRESS_BAR)
#if ANY(HAS_DISPLAY, HAS_STATUS_MESSAGE, HAS_BASIC_PROGRESS_BAR)
#include "../module/printcounter.h"
#endif

Expand Down Expand Up @@ -613,7 +613,7 @@ void MarlinUI::init() {
* This is very display-dependent, so the lcd implementation draws this.
*/

#if BASIC_PROGRESS_BAR
#if HAS_BASIC_PROGRESS_BAR
millis_t MarlinUI::progress_bar_ms; // = 0
#if PROGRESS_MSG_EXPIRE > 0
millis_t MarlinUI::expire_status_ms; // = 0
Expand All @@ -622,7 +622,7 @@ void MarlinUI::init() {

void MarlinUI::status_screen() {

#if BASIC_PROGRESS_BAR
#if HAS_BASIC_PROGRESS_BAR

//
// HD44780 implements the following message blinking and
Expand Down Expand Up @@ -662,7 +662,7 @@ void MarlinUI::init() {

#endif // PROGRESS_MSG_EXPIRE

#endif // BASIC_PROGRESS_BAR
#endif // HAS_BASIC_PROGRESS_BAR

bool did_expire = status_reset_callback && (*status_reset_callback)();

Expand Down Expand Up @@ -1616,11 +1616,11 @@ void MarlinUI::host_notify(const char * const cstr) {

#if HAS_WIRED_LCD

#if BASIC_PROGRESS_BAR || ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA)
#if HAS_BASIC_PROGRESS_BAR || ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA)
const millis_t ms = millis();
#endif

#if BASIC_PROGRESS_BAR
#if HAS_BASIC_PROGRESS_BAR
progress_bar_ms = ms;
#if PROGRESS_MSG_EXPIRE > 0
expire_status_ms = persist ? 0 : ms + PROGRESS_MSG_EXPIRE;
Expand Down
38 changes: 19 additions & 19 deletions Marlin/src/libs/buzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,29 @@ void Buzzer::tone(const uint16_t duration, const uint16_t frequency/*=0*/) {
}

void Buzzer::tick() {
const millis_t now = millis();
if (state.endtime) {
if (ELAPSED(millis(), state.endtime)) reset();
return;
}

if (!state.endtime) {
if (buffer.isEmpty()) return;
if (buffer.isEmpty()) return;

state.tone = buffer.dequeue();
state.endtime = now + state.tone.duration;
state.tone = buffer.dequeue();
state.endtime = millis() + state.tone.duration;

if (state.tone.frequency > 0) {
#if ENABLED(EXTENSIBLE_UI) && DISABLED(EXTUI_LOCAL_BEEPER)
CRITICAL_SECTION_START();
ExtUI::onPlayTone(state.tone.frequency, state.tone.duration);
CRITICAL_SECTION_END();
#elif ENABLED(SPEAKER)
CRITICAL_SECTION_START();
::tone(BEEPER_PIN, state.tone.frequency, state.tone.duration);
CRITICAL_SECTION_END();
#else
on();
#endif
}
if (state.tone.frequency > 0) {
#if ENABLED(EXTENSIBLE_UI) && DISABLED(EXTUI_LOCAL_BEEPER)
CRITICAL_SECTION_START();
ExtUI::onPlayTone(state.tone.frequency, state.tone.duration);
CRITICAL_SECTION_END();
#elif ENABLED(SPEAKER)
CRITICAL_SECTION_START();
::tone(BEEPER_PIN, state.tone.frequency, state.tone.duration);
CRITICAL_SECTION_END();
#else
on();
#endif
}
else if (ELAPSED(now, state.endtime)) reset();
}

#endif // HAS_BEEPER
13 changes: 10 additions & 3 deletions Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
#include "endstops.h"
#include "stepper.h"

#include "../sd/cardreader.h"
#include "temperature.h"
#include "../lcd/marlinui.h"
#if HAS_STATUS_MESSAGE
#include "../lcd/marlinui.h"
#endif

#if ENABLED(SOVOL_SV06_RTS)
#include "../lcd/sovol_rts/sovol_rts.h"
#endif
Expand All @@ -44,6 +45,8 @@

#if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
#include "printcounter.h" // for print_job_timer
#include "temperature.h"
#include "../sd/cardreader.h"
#endif

#if ENABLED(BLTOUCH)
Expand All @@ -54,6 +57,10 @@
#include "../feature/joystick.h"
#endif

#if HAS_FILAMENT_SENSOR
#include "../feature/runout.h"
#endif

#if HAS_BED_PROBE
#include "probe.h"
#endif
Expand Down
37 changes: 12 additions & 25 deletions Marlin/src/module/servo.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
constexpr uint16_t sasn[2] = { 0 };
#endif
#ifdef Z_PROBE_SERVO_NR
#if HAS_Z_SERVO_PROBE
#if ENABLED(BLTOUCH)
#include "../feature/bltouch.h"
#undef Z_SERVO_ANGLES
Expand All @@ -76,19 +76,22 @@
#ifndef SWITCHING_NOZZLE_SERVO_NR
#define SWITCHING_NOZZLE_SERVO_NR -1
#endif
#ifndef SWITCHING_NOZZLE_E1_SERVO_NR
#define SWITCHING_NOZZLE_E1_SERVO_NR -1
#endif
#ifndef Z_PROBE_SERVO_NR
#define Z_PROBE_SERVO_NR -1
#endif
#define SASN(J,I) TERN(SWITCHING_NOZZLE_TWO_SERVOS, sasn[J][I], sasn[I])
#define ASRC(N,I) ( \
N == SWITCHING_EXTRUDER_SERVO_NR ? sase[I] \
: N == SWITCHING_EXTRUDER_E23_SERVO_NR ? sase[I+2] \
: N == SWITCHING_NOZZLE_SERVO_NR ? SASN(0,I) \
TERN_(SWITCHING_NOZZLE_TWO_SERVOS, : N == SWITCHING_NOZZLE_E1_SERVO_NR ? SASN(1,I)) \
: N == Z_PROBE_SERVO_NR ? sazp[I] \
: 0 )
N == SWITCHING_EXTRUDER_SERVO_NR ? sase[I] \
: N == SWITCHING_EXTRUDER_E23_SERVO_NR ? sase[I+2] \
: N == SWITCHING_NOZZLE_SERVO_NR ? SASN(0,I) \
: N == SWITCHING_NOZZLE_E1_SERVO_NR ? SASN(1,I) \
: N == Z_PROBE_SERVO_NR ? sazp[I] \
: 0 )
#if ENABLED(EDITABLE_SERVO_ANGLES)
extern uint16_t servo_angles[NUM_SERVOS][2];
Expand All @@ -97,24 +100,8 @@
#define CONST_SERVO_ANGLES servo_angles
#endif
constexpr uint16_t CONST_SERVO_ANGLES [NUM_SERVOS][2] = {
{ ASRC(0,0), ASRC(0,1) }
#if NUM_SERVOS > 1
, { ASRC(1,0), ASRC(1,1) }
#if NUM_SERVOS > 2
, { ASRC(2,0), ASRC(2,1) }
#if NUM_SERVOS > 3
, { ASRC(3,0), ASRC(3,1) }
#if NUM_SERVOS > 4
, { ASRC(4,0), ASRC(4,1) }
#if NUM_SERVOS > 5
, { ASRC(5,0), ASRC(5,1) }
#endif
#endif
#endif
#endif
#endif
};
#define _ASRC_PAIR(N) { ASRC(N,0), ASRC(N,1) },
constexpr uint16_t CONST_SERVO_ANGLES [NUM_SERVOS][2] = { REPEAT(NUM_SERVOS, _ASRC_PAIR) };
#if HAS_Z_SERVO_PROBE
#define DEPLOY_Z_SERVO() servo[Z_PROBE_SERVO_NR].move(servo_angles[Z_PROBE_SERVO_NR][0])
Expand Down
Loading

0 comments on commit 42d5864

Please sign in to comment.