Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix 2.0.x #2

Merged
merged 26 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2f3077f
Tests (LPC176x): Emergency Parser (#17967)
thisiskeithb May 12, 2020
174e41c
[cron] Bump distribution date (2020-05-12)
thinkyhead May 12, 2020
8a22ef0
G6 Direct Stepping (#17853)
colinrgodsey May 12, 2020
aecfc05
Align slightly in M114 detail
thinkyhead May 11, 2020
e6079bd
Correct endstop noise comment
thinkyhead May 12, 2020
d35dd2a
Fix babystep / double-click check (#17962)
Knifa May 12, 2020
df9cad6
Correct DEFAULT_MINSEGMENTTIME units
thinkyhead May 12, 2020
0fbedf5
Fix LPC host actions, add tests
thinkyhead May 12, 2020
7664e55
Finish DOGM progress bar
thinkyhead May 12, 2020
c2d66a5
Tweak JD + Jerk limit
thinkyhead May 12, 2020
798dc68
Combine some conditions
thinkyhead May 12, 2020
98fdc67
Fixes for FYSETC Cheetah (#17935)
RudolphRiedel May 12, 2020
a06a0c5
Fix SKR/GTR PeripheralPins.c (#17937)
thinkyhead May 12, 2020
181739d
Move inline laser state to fix EEPROM error
thinkyhead May 12, 2020
ab19a27
Prevent some macro pitfalls (#17956)
espr14 May 12, 2020
d4aa197
Add MAP macro
thinkyhead May 12, 2020
d853a70
Remove strcpy compile warning
thinkyhead May 12, 2020
73e0937
Fix HAS_MICROSTEPS if only Z
thinkyhead May 12, 2020
ac6a580
Reorder RAMBo tests
thinkyhead May 12, 2020
219812e
Squish microstep_readings
thinkyhead May 12, 2020
2e03c79
Simplification
thinkyhead May 12, 2020
b88cf2e
Remove version appendage
thinkyhead May 12, 2020
18a01f2
Add user's build (_date_ _time_) to M115 output (#17957)
chestwood96 May 12, 2020
69d4bc9
Fix Hungarian language (#17936)
AntoszHUN May 12, 2020
27beade
Update EP comment
thinkyhead May 12, 2020
104d020
[cron] Bump distribution date (2020-05-13)
thinkyhead May 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@
* Enable if your probe or endstops falsely trigger due to noise.
*
* - Higher values may affect repeatability or accuracy of some bed probes.
* - To fix noise install a 100nF ceramic capacitor inline with the switch.
* - To fix noise install a 100nF ceramic capacitor in parallel with the switch.
* - This feature is not required for common micro-switches mounted on PCBs
* based on the Makerbot design, which already have the 100nF capacitor.
*
Expand Down
39 changes: 27 additions & 12 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@
//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated

// Minimum time that a segment needs to take if the buffer is emptied
#define DEFAULT_MINSEGMENTTIME 20000 // (ms)
#define DEFAULT_MINSEGMENTTIME 20000 // (µs)

// Slow down the machine if the look ahead buffer is (by default) half full.
// Increase the slowdown divisor for larger buffer sizes.
Expand Down Expand Up @@ -1381,7 +1381,6 @@
//#define AO_EXP2_PINMAP // AlephObjects CLCD UI EXP2 mapping
//#define CR10_TFT_PINMAP // Rudolph Riedel's CR10 pin mapping
//#define S6_TFT_PINMAP // FYSETC S6 pin mapping
//#define CHEETAH_TFT_PINMAP // FYSETC Cheetah pin mapping
//#define E3_EXP1_PINMAP // E3 type boards (SKR E3/DIP, and Stock boards) EXP1 pin mapping
//#define GENERIC_EXP2_PINMAP // GENERIC EXP2 pin mapping

Expand Down Expand Up @@ -1663,6 +1662,16 @@
// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
//#define BEZIER_CURVE_SUPPORT

/**
* Direct Stepping
*
* Comparable to the method used by Klipper, G6 direct stepping significantly
* reduces motion calculations, increases top printing speeds, and results in
* less step aliasing by calculating all motions in advance.
* Preparing your G-code: https://github.com/colinrgodsey/step-daemon
*/
//#define DIRECT_STEPPING

/**
* G38 Probe Target
*
Expand Down Expand Up @@ -1731,14 +1740,16 @@
//================================= Buffers =================================
//===========================================================================

// @section hidden
// @section motion

// The number of linear motions that can be in the plan at any give time.
// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2 (e.g. 8, 16, 32) because shifts and ors are used to do the ring-buffering.
#if ENABLED(SDSUPPORT)
#define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller
// The number of lineear moves that can be in the planner at once.
// The value of BLOCK_BUFFER_SIZE must be a power of 2 (e.g. 8, 16, 32)
#if BOTH(SDSUPPORT, DIRECT_STEPPING)
#define BLOCK_BUFFER_SIZE 8
#elif ENABLED(SDSUPPORT)
#define BLOCK_BUFFER_SIZE 16
#else
#define BLOCK_BUFFER_SIZE 16 // maximize block buffer
#define BLOCK_BUFFER_SIZE 16
#endif

// @section serial
Expand Down Expand Up @@ -1781,10 +1792,14 @@
//#define SERIAL_STATS_DROPPED_RX
#endif

// Enable an emergency-command parser to intercept certain commands as they
// enter the serial receive buffer, so they cannot be blocked.
// Currently handles M108, M112, M410
// Does not work on boards using AT90USB (USBCON) processors!
/**
* Emergency Command Parser
*
* Add a low-level parser to intercept certain commands as they
* enter the serial receive buffer, so they cannot be blocked.
* Currently handles M108, M112, M410, M876
* NOTE: Not yet implemented for all platforms.
*/
//#define EMERGENCY_PARSER

// Bad Serial-connections can miss a received command by sending an 'ok'
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* Verbose version identifier which should contain a reference to the location
* from where the binary was downloaded or the source code was compiled.
*/
//#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " (Github)"
//#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION

/**
* The STRING_DISTRIBUTION_DATE represents when the binary file was built,
Expand Down
24 changes: 16 additions & 8 deletions Marlin/src/HAL/AVR/MarlinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
#include "MarlinSerial.h"
#include "../../MarlinCore.h"

#if ENABLED(DIRECT_STEPPING)
#include "../../feature/direct_stepping.h"
#endif

template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_r MarlinSerial<Cfg>::rx_buffer = { 0, 0, { 0 } };
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_t MarlinSerial<Cfg>::tx_buffer = { 0 };
template<typename Cfg> bool MarlinSerial<Cfg>::_written = false;
Expand Down Expand Up @@ -131,6 +135,18 @@

static EmergencyParser::State emergency_state; // = EP_RESET

// This must read the R_UCSRA register before reading the received byte to detect error causes
if (Cfg::DROPPED_RX && B_DOR && !++rx_dropped_bytes) --rx_dropped_bytes;
if (Cfg::RX_OVERRUNS && B_DOR && !++rx_buffer_overruns) --rx_buffer_overruns;
if (Cfg::RX_FRAMING_ERRORS && B_FE && !++rx_framing_errors) --rx_framing_errors;

// Read the character from the USART
uint8_t c = R_UDR;

#if ENABLED(DIRECT_STEPPING)
if (page_manager.maybe_store_rxd_char(c)) return;
#endif

// Get the tail - Nothing can alter its value while this ISR is executing, but there's
// a chance that this ISR interrupted the main process while it was updating the index.
// The backup mechanism ensures the correct value is always returned.
Expand All @@ -142,14 +158,6 @@
// Get the next element
ring_buffer_pos_t i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1);

// This must read the R_UCSRA register before reading the received byte to detect error causes
if (Cfg::DROPPED_RX && B_DOR && !++rx_dropped_bytes) --rx_dropped_bytes;
if (Cfg::RX_OVERRUNS && B_DOR && !++rx_buffer_overruns) --rx_buffer_overruns;
if (Cfg::RX_FRAMING_ERRORS && B_FE && !++rx_framing_errors) --rx_framing_errors;

// Read the character from the USART
uint8_t c = R_UDR;

if (Cfg::EMERGENCYPARSER) emergency_parser.update(emergency_state, c);

// If the character is to be stored at the index just before the tail
Expand Down
11 changes: 11 additions & 0 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
#include "gcode/parser.h"
#include "gcode/queue.h"

#if ENABLED(DIRECT_STEPPING)
#include "feature/direct_stepping.h"
#endif

#if ENABLED(TOUCH_BUTTONS)
#include "feature/touch/xpt2046.h"
#endif
Expand Down Expand Up @@ -713,6 +717,9 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {

// Handle Joystick jogging
TERN_(POLL_JOG, joystick.inject_jog_moves());

// Direct Stepping
TERN_(DIRECT_STEPPING, page_manager.write_responses());
}

/**
Expand Down Expand Up @@ -1124,6 +1131,10 @@ void setup() {
SETUP_RUN(max7219.init());
#endif

#if ENABLED(DIRECT_STEPPING)
SETUP_RUN(page_manager.init());
#endif

marlin_state = MF_RUNNING;

SETUP_LOG("setup() completed.");
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/core/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
#define STR_INVALID_E_STEPPER "Invalid E stepper"
#define STR_E_STEPPER_NOT_SPECIFIED "E stepper not specified"
#define STR_INVALID_SOLENOID "Invalid solenoid"
#define STR_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID
#define STR_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " (" __DATE__ " " __TIME__ ") SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID
#define STR_COUNT_X " Count X:"
#define STR_COUNT_A " Count A:"
#define STR_WATCHDOG_FIRED "Watchdog timeout. Reset required."
Expand Down
19 changes: 14 additions & 5 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@
#define SBI32(n,b) (n |= _BV32(b))
#define CBI32(n,b) (n &= ~_BV32(b))

#define cu(x) ((x)*(x)*(x))
#define cu(x) ({__typeof__(x) _x = (x); (_x)*(_x)*(_x);})
#define RADIANS(d) ((d)*float(M_PI)/180.0f)
#define DEGREES(r) ((r)*180.0f/float(M_PI))
#define HYPOT2(x,y) (sq(x)+sq(y))

#define CIRCLE_AREA(R) (float(M_PI) * sq(float(R)))
#define CIRCLE_CIRC(R) (2 * float(M_PI) * float(R))

#define SIGN(a) ((a>0)-(a<0))
#define SIGN(a) ({__typeof__(a) _a = (a); (_a>0)-(_a<0);})
#define IS_POWER_OF_2(x) ((x) && !((x) & ((x) - 1)))

// Macros to constrain values
Expand All @@ -130,8 +130,6 @@

#else

// Using GCC extensions, but Travis GCC version does not like it and gives
// "error: statement-expressions are not allowed outside functions nor in template-argument lists"
#define NOLESS(v, n) \
do{ \
__typeof__(n) _n = (n); \
Expand Down Expand Up @@ -269,7 +267,7 @@
#define NEAR(x,y) NEAR_ZERO((x)-(y))

#define RECIPROCAL(x) (NEAR_ZERO(x) ? 0 : (1 / float(x)))
#define FIXFLOAT(f) (f + (f < 0 ? -0.00005f : 0.00005f))
#define FIXFLOAT(f) ({__typeof__(f) _f = (f); _f + (_f < 0 ? -0.00005f : 0.00005f);})

//
// Maths macros that can be overridden by HAL
Expand Down Expand Up @@ -482,3 +480,14 @@
#define RREPEAT(N,OP) RREPEAT_S(0,N,OP)
#define RREPEAT2_S(S,N,OP,V...) EVAL1024(_RREPEAT2(S,SUB##S(N),OP,V))
#define RREPEAT2(N,OP,V...) RREPEAT2_S(0,N,OP,V)

// See https://github.com/swansontec/map-macro
#define MAP_OUT
#define MAP_END(...)
#define MAP_GET_END() 0, MAP_END
#define MAP_NEXT0(test, next, ...) next MAP_OUT
#define MAP_NEXT1(test, next) MAP_NEXT0 (test, next, 0)
#define MAP_NEXT(test, next) MAP_NEXT1 (MAP_GET_END test, next)
#define MAP0(f, x, peek, ...) f(x) MAP_NEXT (peek, MAP1) (f, peek, __VA_ARGS__)
#define MAP1(f, x, peek, ...) f(x) MAP_NEXT (peek, MAP0) (f, peek, __VA_ARGS__)
#define MAP(f, ...) EVAL512 (MAP1 (f, __VA_ARGS__, (), 0))
Loading