Skip to content

Commit

Permalink
Merge nightly patches
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Feb 24, 2020
2 parents 2b759b9 + a254354 commit 089cc68
Show file tree
Hide file tree
Showing 53 changed files with 173 additions and 130 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/core/drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
|| AXIS_DRIVER_TYPE(A,TMC5160) )

#define _OR_EAH(N,T) || AXIS_HAS_##T(E##N)
#define E_AXIS_HAS(T) (0 RREPEAT2(E_STEPPERS, _OR_EAH, T))
#define E_AXIS_HAS(T) (0 _OR_EAH(0,T) _OR_EAH(1,T) _OR_EAH(2,T) _OR_EAH(3,T) _OR_EAH(4,T) _OR_EAH(5,T) _OR_EAH(6,T) _OR_EAH(7,T))

#define ANY_AXIS_HAS(T) ( AXIS_HAS_##T(X) || AXIS_HAS_##T(X2) \
|| AXIS_HAS_##T(Y) || AXIS_HAS_##T(Y2) \
Expand Down
12 changes: 6 additions & 6 deletions Marlin/src/feature/babystep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@

Babystep babystep;

volatile int16_t Babystep::steps[BS_TODO_AXIS(Z_AXIS) + 1];
volatile int16_t Babystep::steps[BS_AXIS_IND(Z_AXIS) + 1];
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];
int16_t Babystep::axis_total[BS_TOTAL_IND(Z_AXIS) + 1];
#endif
int16_t Babystep::accum;

void Babystep::step_axis(const AxisEnum axis) {
const int16_t curTodo = steps[BS_TODO_AXIS(axis)]; // get rid of volatile for performance
const int16_t curTodo = steps[BS_AXIS_IND(axis)]; // get rid of volatile for performance
if (curTodo) {
stepper.do_babystep((AxisEnum)axis, curTodo > 0);
if (curTodo > 0) steps[BS_TODO_AXIS(axis)]--; else steps[BS_TODO_AXIS(axis)]++;
if (curTodo > 0) steps[BS_AXIS_IND(axis)]--; else steps[BS_AXIS_IND(axis)]++;
}
}

Expand All @@ -66,7 +66,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {

accum += distance; // Count up babysteps for the UI
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
axis_total[BS_TOTAL_AXIS(axis)] += distance;
axis_total[BS_TOTAL_IND(axis)] += distance;
#endif

#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
Expand Down Expand Up @@ -112,7 +112,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
#else
BSA_ENABLE(Z_AXIS);
#endif
steps[BS_TODO_AXIS(axis)] += distance;
steps[BS_AXIS_IND(axis)] += distance;
#endif
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
gcode.reset_stepper_timeout();
Expand Down
20 changes: 11 additions & 9 deletions Marlin/src/feature/babystep.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,48 +32,50 @@
#endif

#if IS_CORE || EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
#define BS_TODO_AXIS(A) A
#define BS_AXIS_IND(A) A
#define BS_AXIS(I) AxisEnum(I)
#else
#define BS_TODO_AXIS(A) 0
#define BS_AXIS_IND(A) 0
#define BS_AXIS(I) Z_AXIS
#endif

#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
#if ENABLED(BABYSTEP_XY)
#define BS_TOTAL_AXIS(A) A
#define BS_TOTAL_IND(A) A
#else
#define BS_TOTAL_AXIS(A) 0
#define BS_TOTAL_IND(A) 0
#endif
#endif

class Babystep {
public:
static volatile int16_t steps[BS_TODO_AXIS(Z_AXIS) + 1];
static volatile int16_t steps[BS_AXIS_IND(Z_AXIS) + 1];
static int16_t accum; // Total babysteps in current edit

#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; // Total babysteps since G28
static int16_t axis_total[BS_TOTAL_IND(Z_AXIS) + 1]; // Total babysteps since G28
static inline void reset_total(const AxisEnum axis) {
if (true
#if ENABLED(BABYSTEP_XY)
&& axis == Z_AXIS
#endif
) axis_total[BS_TOTAL_AXIS(axis)] = 0;
) axis_total[BS_TOTAL_IND(axis)] = 0;
}
#endif

static void add_steps(const AxisEnum axis, const int16_t distance);
static void add_mm(const AxisEnum axis, const float &mm);

static inline bool has_steps() {
return steps[BS_TODO_AXIS(X_AXIS)] || steps[BS_TODO_AXIS(Y_AXIS)] || steps[BS_TODO_AXIS(Z_AXIS)];
return steps[BS_AXIS_IND(X_AXIS)] || steps[BS_AXIS_IND(Y_AXIS)] || steps[BS_AXIS_IND(Z_AXIS)];
}

//
// Called by the Temperature or Stepper ISR to
// apply accumulated babysteps to the axes.
//
static inline void task() {
LOOP_LE_N(axis, BS_TODO_AXIS(Z_AXIS)) step_axis((AxisEnum)axis);
LOOP_LE_N(i, BS_AXIS_IND(Z_AXIS)) step_axis(BS_AXIS(i));
}

private:
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/tmc_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@

bool tmc_enable_stallguard(TMC2209Stepper &st) {
const bool stealthchop_was_enabled = !st.en_spreadCycle();

st.TCOOLTHRS(0xFFFFF);
st.en_spreadCycle(false);
return stealthchop_was_enabled;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/geometry/G92.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void GcodeSuite::G92() {

bool sync_E = false, sync_XYZ = false;

#if USE_GCODE_SUBCODES
#if ENABLED(USE_GCODE_SUBCODES)
const uint8_t subcode_G92 = parser.subcode;
#else
constexpr uint8_t subcode_G92 = 0;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/motion/M290.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void GcodeSuite::M290() {
#else
PSTR("Babystep Z")
#endif
, babystep.axis_total[BS_TODO_AXIS(Z_AXIS)]
, babystep.axis_total[BS_AXIS_IND(Z_AXIS)]
);
}
#endif
Expand Down
22 changes: 11 additions & 11 deletions Marlin/src/gcode/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ char *GCodeParser::command_ptr,
char GCodeParser::command_letter;
int GCodeParser::codenum;

#if USE_GCODE_SUBCODES
#if ENABLED(USE_GCODE_SUBCODES)
uint8_t GCodeParser::subcode;
#endif

#if ENABLED(GCODE_MOTION_MODES)
int16_t GCodeParser::motion_mode_codenum = -1;
#if USE_GCODE_SUBCODES
#if ENABLED(USE_GCODE_SUBCODES)
uint8_t GCodeParser::motion_mode_subcode;
#endif
#endif
Expand All @@ -83,7 +83,7 @@ void GCodeParser::reset() {
string_arg = nullptr; // No whole line argument
command_letter = '?'; // No command letter
codenum = 0; // No command code
#if USE_GCODE_SUBCODES
#if ENABLED(USE_GCODE_SUBCODES)
subcode = 0; // No command sub-code
#endif
#if ENABLED(FASTER_GCODE_PARSER)
Expand Down Expand Up @@ -187,12 +187,12 @@ void GCodeParser::parse(char *p) {
do { codenum *= 10, codenum += *p++ - '0'; } while (NUMERIC(*p));

// Allow for decimal point in command
#if USE_GCODE_SUBCODES
if (*p == '.') {
p++;
while (NUMERIC(*p))
subcode *= 10, subcode += *p++ - '0';
}
#if ENABLED(USE_GCODE_SUBCODES)
if (*p == '.') {
p++;
while (NUMERIC(*p))
subcode *= 10, subcode += *p++ - '0';
}
#endif

// Skip all spaces to get to the first argument, or nul
Expand All @@ -206,7 +206,7 @@ void GCodeParser::parse(char *p) {
)
) {
motion_mode_codenum = codenum;
#if USE_GCODE_SUBCODES
#if ENABLED(USE_GCODE_SUBCODES)
motion_mode_subcode = subcode;
#endif
}
Expand All @@ -225,7 +225,7 @@ void GCodeParser::parse(char *p) {
if (motion_mode_codenum < 0) return;
command_letter = 'G';
codenum = motion_mode_codenum;
#if USE_GCODE_SUBCODES
#if ENABLED(USE_GCODE_SUBCODES)
subcode = motion_mode_subcode;
#endif
p--; // Back up one character to use the current parameter
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ class GCodeParser {
*string_arg, // string of command line
command_letter; // G, M, or T
static int codenum; // 123
#if USE_GCODE_SUBCODES
#if ENABLED(USE_GCODE_SUBCODES)
static uint8_t subcode; // .1
#endif

#if ENABLED(GCODE_MOTION_MODES)
static int16_t motion_mode_codenum;
#if USE_GCODE_SUBCODES
#if ENABLED(USE_GCODE_SUBCODES)
static uint8_t motion_mode_subcode;
#endif
FORCE_INLINE static void cancel_motion_mode() { motion_mode_codenum = -1; }
Expand Down
40 changes: 18 additions & 22 deletions Marlin/src/gcode/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,42 +526,38 @@ void GCodeQueue::get_serial_commands() {
while (length < BUFSIZE && !card_eof) {
const int16_t n = card.get();
card_eof = card.eof();
if (n < 0) { SERIAL_ERROR_MSG(MSG_SD_ERR_READ); continue; }
const char sd_char = (char)n;
if (card_eof || n < 0 || sd_char == '\n' || sd_char == '\r') {
if (sd_char == '\n' || sd_char == '\r' || card_eof) {

// Reset stream state, terminate the buffer, and commit a non-empty command
if (!process_line_done(sd_input_state, command_buffer[index_w], sd_count)) {
_commit_command(false); // Can handle last line missing a newline terminator
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.cmd_sdpos = card.getIndex(); // Prime for the next _commit_command
#endif
}

if (card_eof) {

card.printingHasFinished();
card.fileHasFinished(); // Handle end of file reached

if (IS_SD_PRINTING())
sd_count = 0; // If a sub-file was printing, continue from call point
else {
SERIAL_ECHOLNPGM(MSG_FILE_PRINTED);
if (!IS_SD_PRINTING()) { // Was it the main job file?
SERIAL_ECHOLNPGM(MSG_FILE_PRINTED); // Tell the host the file is printed.
#if ENABLED(PRINTER_EVENT_LEDS)
printerEventLEDs.onPrintCompleted();
printerEventLEDs.onPrintCompleted(); // Change LED color for Print Completed
#if HAS_RESUME_CONTINUE
enqueue_now_P(PSTR("M0 S"
enqueue_now_P(PSTR("M0 S" // Display "Click to Continue..."
#if HAS_LCD_MENU
"1800"
"1800" // ...for 30 minutes with LCD
#else
"60"
"60" // ...for 1 minute with no LCD
#endif
));
#endif
#endif
}
}
else if (n < 0)
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);

// Terminate the buffer, reset the input state, continue for empty line
if (process_line_done(sd_input_state, command_buffer[index_w], sd_count))
continue;

_commit_command(false);

#if ENABLED(POWER_LOSS_RECOVERY)
recovery.cmd_sdpos = card.getIndex(); // Prime for the next _commit_command
#endif
}
else
process_stream_char(sd_char, sd_input_state, command_buffer[index_w], sd_count);
Expand Down
9 changes: 9 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,15 @@
#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD)
#define HAS_DGUS_LCD ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)

#if HAS_GRAPHICAL_LCD
#ifndef LCD_PIXEL_WIDTH
#define LCD_PIXEL_WIDTH 128
#endif
#ifndef LCD_PIXEL_HEIGHT
#define LCD_PIXEL_HEIGHT 64
#endif
#endif

/**
* Extruders have some combination of stepper motors and hotends
* so we separate these concepts into the defines:
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,9 @@
#endif

// Add commands that need sub-codes to this list
#define USE_GCODE_SUBCODES ANY(G38_PROBE_TARGET, CNC_COORDINATE_SYSTEMS, POWER_LOSS_RECOVERY)
#if ANY(G38_PROBE_TARGET, CNC_COORDINATE_SYSTEMS, POWER_LOSS_RECOVERY)
#define USE_GCODE_SUBCODES
#endif

// Parking Extruder
#if ENABLED(PARKING_EXTRUDER)
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-02-23"
#define STRING_DISTRIBUTION_DATE "2020-02-24"
#endif

/**
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/lcd/dogm/HAL_LCD_com_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include <U8glib.h>

#ifndef U8G_HAL_LINKS
#ifndef U8G_HAL_LINKS // Defined by LPC1768/9 environments in platform.ini

#ifdef __SAM3X8E__

Expand Down Expand Up @@ -75,6 +75,7 @@
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
#endif

// This can't be invoked from the current platformio.ini
#ifdef TARGET_LPC1768
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#endif
Expand Down
2 changes: 0 additions & 2 deletions Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@

#include "HAL_LCD_com_defines.h"

#define LCD_PIXEL_WIDTH 128
#define LCD_PIXEL_HEIGHT 64
#define PAGE_HEIGHT 8

/* init sequence from https://github.com/adafruit/ST7565-LCD/blob/master/ST7565/ST7565.cpp */
Expand Down
7 changes: 0 additions & 7 deletions Marlin/src/lcd/dogm/ultralcd_DOGM.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,6 @@
#endif
#endif

#ifndef LCD_PIXEL_WIDTH
#define LCD_PIXEL_WIDTH 128
#endif
#ifndef LCD_PIXEL_HEIGHT
#define LCD_PIXEL_HEIGHT 64
#endif

// LCD_FULL_PIXEL_WIDTH =
// LCD_PIXEL_OFFSET_X + (LCD_PIXEL_WIDTH * 2) + LCD_PIXEL_OFFSET_X
#if ENABLED(FSMC_GRAPHICAL_TFT)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_rrd_st7920_128x64_fn, &u8
#endif

#endif // U8GLIB_ST7920
#endif // __AVR__ && !U8G_HAL_LINKS
#endif // !U8G_HAL_LINKS && (__AVR__ || ARDUINO_ARCH_STM32 || ARDUINO_ARCH_ESP32)
9 changes: 3 additions & 6 deletions Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,9 @@
#define ST7920_DAT_PIN LCD_PINS_ENABLE
#define ST7920_CS_PIN LCD_PINS_RS

//#define PAGE_HEIGHT 8 //128 byte framebuffer
#define PAGE_HEIGHT 16 //256 byte framebuffer
//#define PAGE_HEIGHT 32 //512 byte framebuffer

#define LCD_PIXEL_WIDTH 128
#define LCD_PIXEL_HEIGHT 64
//#define PAGE_HEIGHT 8 // 128 byte framebuffer
#define PAGE_HEIGHT 16 // 256 byte framebuffer
//#define PAGE_HEIGHT 32 // 512 byte framebuffer

#include <U8glib.h>

Expand Down
Loading

0 comments on commit 089cc68

Please sign in to comment.