Skip to content

Commit

Permalink
vyper firmware v2.4.5 for hardware v0.0.6 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ANYCUBIC-3D committed Sep 18, 2021
1 parent c87dc15 commit 2b56d0e
Show file tree
Hide file tree
Showing 23 changed files with 658 additions and 63 deletions.
4 changes: 2 additions & 2 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1486,8 +1486,8 @@

// Manually set the home position. Leave these undefined for automatic settings.
// For DELTA this is the top-center of the Cartesian print volume.
#define MANUAL_X_HOME_POS -0.2
#define MANUAL_Y_HOME_POS -5.7
#define MANUAL_X_HOME_POS +0.5
#define MANUAL_Y_HOME_POS -4.2
#define MANUAL_Z_HOME_POS -4

// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area.
Expand Down
11 changes: 9 additions & 2 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ PGMSTR(SP_A_STR, " A"); PGMSTR(SP_B_STR, " B"); PGMSTR(SP_C_STR, " C");
PGMSTR(SP_X_STR, " X"); PGMSTR(SP_Y_STR, " Y"); PGMSTR(SP_Z_STR, " Z"); PGMSTR(SP_E_STR, " E");
PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMSTR(SP_E_LBL, " E:");

MarlinState marlin_state = MF_INITIALIZING;
volatile MarlinState marlin_state = MF_INITIALIZING;
volatile HomingState homing_state = NOT_HOMING;

// For M109 and M190, this flag may be cleared (by M108) to exit the wait loop
bool wait_for_heatup = true;
Expand Down Expand Up @@ -477,7 +478,9 @@ void startOrResumeJob() {
wait_for_heatup = false;
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
#ifdef EVENT_GCODE_SD_ABORT
queue.inject_P(PSTR(EVENT_GCODE_SD_ABORT));
if(MF_KILLED != marlin_state) {
queue.inject_P(PSTR(EVENT_GCODE_SD_ABORT));
}
#endif

TERN_(PASSWORD_AFTER_SD_PRINT_ABORT, password.lock_machine());
Expand Down Expand Up @@ -813,8 +816,11 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
* After this the machine will need to be reset.
*/
void kill(PGM_P const lcd_error/*=nullptr*/, PGM_P const lcd_component/*=nullptr*/, const bool steppers_off/*=false*/) {

thermalManager.disable_all_heaters();

caselight.off();

TERN_(HAS_CUTTER, cutter.kill()); // Full cutter shutdown including ISR control

SERIAL_ERROR_MSG(STR_ERR_KILLED);
Expand All @@ -834,6 +840,7 @@ void kill(PGM_P const lcd_error/*=nullptr*/, PGM_P const lcd_component/*=nullptr
host_action_kill();
#endif

// no freeze the machine
minkill(steppers_off);
}

Expand Down
15 changes: 14 additions & 1 deletion Marlin/src/MarlinCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,20 @@ enum MarlinState : uint8_t {
MF_KILLED = _BV(7)
};

extern MarlinState marlin_state;
// Global State of homing
enum HomingState : uint8_t {
NOT_HOMING = _BV(0),
HOMING_X = _BV(1),
HOMING_Y = _BV(2),
HOMING_Z = _BV(3),
HOMING_FAILED_X = _BV(4),
HOMING_FAILED_Y = _BV(5),
HOMING_FAILED_Z = _BV(6),
};

extern volatile MarlinState marlin_state;
extern volatile HomingState homing_state;

inline bool IsRunning() { return marlin_state == MF_RUNNING; }
inline bool IsStopped() { return marlin_state != MF_RUNNING; }

Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/feature/caselight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,9 @@ void CaseLight::update(const bool sflag) {
#endif // !CASE_LIGHT_USE_NEOPIXEL
}

void CaseLight::off() {
WRITE(CASE_LIGHT_PIN, LOW);
}


#endif // CASE_LIGHT_ENABLE
1 change: 1 addition & 0 deletions Marlin/src/feature/caselight.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class CaseLight {
#endif
static bool on;

static void off();
static void update(const bool sflag);
static inline void update_brightness() { update(false); }
static inline void update_enabled() { update(true); }
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=0*/
return ;
}

if(AD_DMA[2] < 2600) {
if(AD_DMA[2] < 2300) {

// SERIAL_ECHOLNPAIR("v:", AD_DMA[2]);

Expand Down
23 changes: 21 additions & 2 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#include "../../../module/probe.h"
#include "../../../module/temperature.h"

#include "../../queue.h"

#if ENABLED(PROBE_TEMP_COMPENSATION)
Expand Down Expand Up @@ -163,6 +165,8 @@
*/
G29_TYPE GcodeSuite::G29() {

probe.status = 0;

reset_stepper_timeout();

const bool seenQ = EITHER(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) && parser.seen('Q');
Expand Down Expand Up @@ -885,8 +889,23 @@ G29_TYPE GcodeSuite::G29() {

#ifdef Z_PROBE_END_SCRIPT
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Z Probe End Script: ", Z_PROBE_END_SCRIPT);
planner.synchronize();
process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT));

if(probe.status != -1) {
planner.synchronize();
process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT));
} else {
thermalManager.setTargetHotend(0, 0);
thermalManager.setTargetBed(0);

thermalManager.set_fan_speed(0, 0);
thermalManager.set_fan_speed(1, 0);

wait_for_heatup = wait_for_user = false;

planner.clear_block_buffer();
queue.clear();
}

#endif

#if ENABLED(DWIN_CREALITY_LCD)
Expand Down
35 changes: 32 additions & 3 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@
* Z Home to the Z endstop
*/
void GcodeSuite::G28() {

homing_state = NOT_HOMING;

DEBUG_SECTION(log_G28, "G28", DEBUGGING(LEVELING));
if (DEBUGGING(LEVELING)) log_machine_info();

Expand Down Expand Up @@ -367,14 +370,27 @@ void GcodeSuite::G28() {

#else

homing_state = HOMING_X;
homeaxis(X_AXIS);
if(HOMING_FAILED_X == homing_state) {
return ;
}

#endif
}

// Home Y (after X)
if (DISABLED(HOME_Y_BEFORE_X) && doY)
homeaxis(Y_AXIS);
if (DISABLED(HOME_Y_BEFORE_X) && doY) {
if(HOMING_FAILED_X != homing_state) {
homing_state = HOMING_Y;
homeaxis(Y_AXIS);
if(HOMING_FAILED_Y == homing_state) {
return ;
}
} else {
return ;
}
}

TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));

Expand All @@ -387,7 +403,20 @@ void GcodeSuite::G28() {
#endif

TERN_(BLTOUCH, bltouch.init());
TERN(Z_SAFE_HOMING, home_z_safely(), homeaxis(Z_AXIS));
// TERN(Z_SAFE_HOMING, home_z_safely(), homeaxis(Z_AXIS));
#if ENABLED(Z_SAFE_HOMING)
home_z_safely();
#else
if(HOMING_FAILED_X != homing_state && HOMING_FAILED_Y != homing_state) {
homing_state = HOMING_Z;
homeaxis(Z_AXIS);
if(HOMING_FAILED_Z == homing_state) {
return ;
}
} else {
return ;
}
#endif
probe.move_z_after_homing();
}
#endif
Expand Down
1 change: 0 additions & 1 deletion Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ void GcodeSuite::dwell(millis_t time) {
*/
void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
KEEPALIVE_STATE(IN_HANDLER);

/**
* Block all Gcodes except M511 Unlock Printer, if printer is locked
* Will still block Gcodes if M511 is disabled, in which case the printer should be unlocked via LCD Menu
Expand Down
27 changes: 22 additions & 5 deletions Marlin/src/gcode/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ void GCodeQueue::clear() {
index_r = index_w = length = 0;
}

void GCodeQueue::clear_buf() {
index_r = index_w = length = 0;
memset(command_buffer, 0, BUFSIZE * MAX_CMD_SIZE);
memset(injected_commands, 0, 64);
injected_commands_P = nullptr;
}


/**
* Once a new command is in the ring buffer, call this to commit it
*/
Expand Down Expand Up @@ -197,7 +205,10 @@ bool GCodeQueue::process_injected_command_P() {
// Execute command if non-blank
if (i) {
parser.parse(cmd);
SERIAL_ECHOLNPAIR("line: ", __LINE__, " func: ", __FUNCTION__);
gcode.process_parsed_command();
} else {
SERIAL_ECHOLNPAIR("line: ", __LINE__, " func: ", __FUNCTION__);
}
return true;
}
Expand Down Expand Up @@ -658,23 +669,29 @@ void GCodeQueue::advance() {
else {
// Write the string from the read buffer to SD
card.write_command(command);
if (card.flag.logging)
if (card.flag.logging) {
gcode.process_next_command(); // The card is saving because it's logging
else
} else {
ok_to_send();
}
}
}
else
gcode.process_next_command();

#else

gcode.process_next_command();

#endif // SDSUPPORT

// The queue may be reset by a command handler or by code invoked by idle() within a handler
--length;
if (++index_r >= BUFSIZE) index_r = 0;

// When kill called, length = index_r = index_w = 0;
if(length) {
--length;
if (++index_r >= BUFSIZE) index_r = 0;
} else { // be sure to keep index_r <= BUFSIZE
if (index_r >= BUFSIZE) index_r = 0;
}

}
1 change: 1 addition & 0 deletions Marlin/src/gcode/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class GCodeQueue {
* Clear the Marlin command queue
*/
static void clear();
static void clear_buf();

/**
* Next Injected Command (PROGMEM) pointer. (nullptr == empty)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/anycubic_dgus_lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ namespace ExtUI {
void onUserConfirmRequired(const char * const msg) { Dgus.ConfirmationRequest(msg); }
void onStatusChanged(const char * const msg) { Dgus.StatusChange(msg); }

void onHomingStart() {}
void onHomingComplete() {}
void onHomingStart() { Dgus.HomingStart(); }
void onHomingComplete() { Dgus.HomingComplete(); }
void onPrintFinished() {}

void onFactoryReset() {
Expand Down
Loading

0 comments on commit 2b56d0e

Please sign in to comment.