Merge pull request #190 from PavelSindler/MK2

farm mode: fixed serial communication on PORT1, reduced "enqueing command" messa…
This commit is contained in:
PavelSindler 2017-09-01 14:58:06 +02:00 committed by GitHub
commit 2d55cc3e22
3 changed files with 28 additions and 16 deletions

View File

@ -5,7 +5,7 @@
#include "Configuration_prusa.h"
// Firmware version
#define FW_version "3.0.12-3"
#define FW_version "3.0.12-4"
#define FW_PRUSA3D_MAGIC "PRUSA3DFW"
#define FW_PRUSA3D_MAGIC_LEN 10

View File

@ -101,14 +101,22 @@ class MarlinSerial //: public Stream
{
return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE;
}
FORCE_INLINE void write(uint8_t c)
{
while (!((M_UCSRxA) & (1 << M_UDREx)))
;
M_UDRx = c;
}
void write(uint8_t c)
{
if (selectedSerialPort == 0) {
while (!((M_UCSRxA) & (1 << M_UDREx)))
;
M_UDRx = c;
}
else if (selectedSerialPort == 1) {
while (!((UCSR2A) & (1 << UDRE2)))
;
UDR2 = c;
}
}
void checkRx(void)

View File

@ -761,10 +761,12 @@ void enquecommand(const char *cmd, bool from_progmem)
strcpy_P(cmdbuffer + bufindw + 1, cmd);
else
strcpy(cmdbuffer + bufindw + 1, cmd);
SERIAL_ECHO_START;
SERIAL_ECHORPGM(MSG_Enqueing);
SERIAL_ECHO(cmdbuffer + bufindw + 1);
SERIAL_ECHOLNPGM("\"");
if (!farm_mode) {
SERIAL_ECHO_START;
SERIAL_ECHORPGM(MSG_Enqueing);
SERIAL_ECHO(cmdbuffer + bufindw + 1);
SERIAL_ECHOLNPGM("\"");
}
bufindw += len + 2;
if (bufindw == sizeof(cmdbuffer))
bufindw = 0;
@ -797,10 +799,12 @@ void enquecommand_front(const char *cmd, bool from_progmem)
else
strcpy(cmdbuffer + bufindr + 1, cmd);
++ buflen;
SERIAL_ECHO_START;
SERIAL_ECHOPGM("Enqueing to the front: \"");
SERIAL_ECHO(cmdbuffer + bufindr + 1);
SERIAL_ECHOLNPGM("\"");
if (!farm_mode) {
SERIAL_ECHO_START;
SERIAL_ECHOPGM("Enqueing to the front: \"");
SERIAL_ECHO(cmdbuffer + bufindr + 1);
SERIAL_ECHOLNPGM("\"");
}
#ifdef CMDBUFFER_DEBUG
cmdqueue_dump_to_serial();
#endif /* CMDBUFFER_DEBUG */