Merge pull request #482 from bubnikv/M221_fix

M221 fix
This commit is contained in:
XPila 2018-02-20 19:10:07 +01:00 committed by GitHub
commit 74e6ff67d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 46 deletions

View File

@ -99,13 +99,6 @@ ISR(USART1_RX_vect)
#endif #endif
#endif #endif
// Constructors ////////////////////////////////////////////////////////////////
MarlinSerial::MarlinSerial()
{
}
// Public Methods ////////////////////////////////////////////////////////////// // Public Methods //////////////////////////////////////////////////////////////
void MarlinSerial::begin(long baud) void MarlinSerial::begin(long baud)

View File

@ -90,14 +90,13 @@ class MarlinSerial //: public Stream
{ {
public: public:
MarlinSerial(); static void begin(long);
void begin(long); static void end();
void end(); static int peek(void);
int peek(void); static int read(void);
int read(void); static void flush(void);
void flush(void);
FORCE_INLINE int available(void) static FORCE_INLINE int available(void)
{ {
return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE; return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE;
} }
@ -110,7 +109,7 @@ class MarlinSerial //: public Stream
M_UDRx = c; M_UDRx = c;
} }
*/ */
void write(uint8_t c) static void write(uint8_t c)
{ {
if (selectedSerialPort == 0) if (selectedSerialPort == 0)
{ {
@ -124,7 +123,7 @@ class MarlinSerial //: public Stream
} }
} }
void checkRx(void) static void checkRx(void)
{ {
if (selectedSerialPort == 0) { if (selectedSerialPort == 0) {
if((M_UCSRxA & (1<<M_RXCx)) != 0) { if((M_UCSRxA & (1<<M_RXCx)) != 0) {
@ -150,7 +149,7 @@ class MarlinSerial //: public Stream
#endif //DEBUG_DUMP_TO_2ND_SERIAL #endif //DEBUG_DUMP_TO_2ND_SERIAL
} }
} }
} else if(selectedSerialPort == 1) { } else { // if(selectedSerialPort == 1) {
if((UCSR1A & (1<<RXC1)) != 0) { if((UCSR1A & (1<<RXC1)) != 0) {
// Test for a framing error. // Test for a framing error.
if (UCSR1A & (1<<FE1)) { if (UCSR1A & (1<<FE1)) {
@ -179,54 +178,54 @@ class MarlinSerial //: public Stream
private: private:
void printNumber(unsigned long, uint8_t); static void printNumber(unsigned long, uint8_t);
void printFloat(double, uint8_t); static void printFloat(double, uint8_t);
public: public:
FORCE_INLINE void write(const char *str) static FORCE_INLINE void write(const char *str)
{ {
while (*str) while (*str)
write(*str++); write(*str++);
} }
FORCE_INLINE void write(const uint8_t *buffer, size_t size) static FORCE_INLINE void write(const uint8_t *buffer, size_t size)
{ {
while (size--) while (size--)
write(*buffer++); write(*buffer++);
} }
FORCE_INLINE void print(const String &s) static FORCE_INLINE void print(const String &s)
{ {
for (int i = 0; i < (int)s.length(); i++) { for (int i = 0; i < (int)s.length(); i++) {
write(s[i]); write(s[i]);
} }
} }
FORCE_INLINE void print(const char *str) static FORCE_INLINE void print(const char *str)
{ {
write(str); write(str);
} }
void print(char, int = BYTE); static void print(char, int = BYTE);
void print(unsigned char, int = BYTE); static void print(unsigned char, int = BYTE);
void print(int, int = DEC); static void print(int, int = DEC);
void print(unsigned int, int = DEC); static void print(unsigned int, int = DEC);
void print(long, int = DEC); static void print(long, int = DEC);
void print(unsigned long, int = DEC); static void print(unsigned long, int = DEC);
void print(double, int = 2); static void print(double, int = 2);
void println(const String &s); static void println(const String &s);
void println(const char[]); static void println(const char[]);
void println(char, int = BYTE); static void println(char, int = BYTE);
void println(unsigned char, int = BYTE); static void println(unsigned char, int = BYTE);
void println(int, int = DEC); static void println(int, int = DEC);
void println(unsigned int, int = DEC); static void println(unsigned int, int = DEC);
void println(long, int = DEC); static void println(long, int = DEC);
void println(unsigned long, int = DEC); static void println(unsigned long, int = DEC);
void println(double, int = 2); static void println(double, int = 2);
void println(void); static void println(void);
}; };
extern MarlinSerial MSerial; extern MarlinSerial MSerial;

View File

@ -6561,7 +6561,11 @@ void get_coordinates()
for(int8_t i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) if(code_seen(axis_codes[i]))
{ {
destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i]; destination[i] = (float)code_value();
if (i == E_AXIS && extrudemultiply != 100)
destination[i] *= (extrudemultiply * 0.01f);
if (axis_relative_modes[i] || relative_mode)
destination[i] += current_position[i];
seen[i]=true; seen[i]=true;
} }
else destination[i] = current_position[i]; //Are these else lines really needed? else destination[i] = current_position[i]; //Are these else lines really needed?

View File

@ -784,10 +784,6 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
block->steps_e = labs(target[E_AXIS]-position[E_AXIS]); block->steps_e = labs(target[E_AXIS]-position[E_AXIS]);
if (volumetric_multiplier[active_extruder] != 1.f) if (volumetric_multiplier[active_extruder] != 1.f)
block->steps_e *= volumetric_multiplier[active_extruder]; block->steps_e *= volumetric_multiplier[active_extruder];
if (extrudemultiply != 100) {
block->steps_e *= extrudemultiply;
block->steps_e /= 100;
}
block->step_event_count = max(block->steps_x, max(block->steps_y, max(block->steps_z, block->steps_e))); block->step_event_count = max(block->steps_x, max(block->steps_y, max(block->steps_z, block->steps_e)));
// Bail if this is a zero-length block // Bail if this is a zero-length block
@ -919,7 +915,7 @@ Having the real displacement of the head, we can calculate the total movement le
delta_mm[Y_AXIS] = ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[Y_AXIS]; delta_mm[Y_AXIS] = ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[Y_AXIS];
#endif #endif
delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS]; delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS];
delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*volumetric_multiplier[active_extruder]*extrudemultiply/100.0; delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*volumetric_multiplier[active_extruder];
if ( block->steps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments ) if ( block->steps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments )
{ {
block->millimeters = fabs(delta_mm[E_AXIS]); block->millimeters = fabs(delta_mm[E_AXIS]);