Merge pull request #190 from PavelSindler/MK2
farm mode: fixed serial communication on PORT1, reduced "enqueing command" messa…
This commit is contained in:
commit
2d55cc3e22
|
|
@ -5,7 +5,7 @@
|
||||||
#include "Configuration_prusa.h"
|
#include "Configuration_prusa.h"
|
||||||
|
|
||||||
// Firmware version
|
// 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 "PRUSA3DFW"
|
||||||
#define FW_PRUSA3D_MAGIC_LEN 10
|
#define FW_PRUSA3D_MAGIC_LEN 10
|
||||||
|
|
|
||||||
|
|
@ -101,14 +101,22 @@ class MarlinSerial //: public Stream
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
void checkRx(void)
|
||||||
|
|
|
||||||
|
|
@ -761,10 +761,12 @@ void enquecommand(const char *cmd, bool from_progmem)
|
||||||
strcpy_P(cmdbuffer + bufindw + 1, cmd);
|
strcpy_P(cmdbuffer + bufindw + 1, cmd);
|
||||||
else
|
else
|
||||||
strcpy(cmdbuffer + bufindw + 1, cmd);
|
strcpy(cmdbuffer + bufindw + 1, cmd);
|
||||||
SERIAL_ECHO_START;
|
if (!farm_mode) {
|
||||||
SERIAL_ECHORPGM(MSG_Enqueing);
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHO(cmdbuffer + bufindw + 1);
|
SERIAL_ECHORPGM(MSG_Enqueing);
|
||||||
SERIAL_ECHOLNPGM("\"");
|
SERIAL_ECHO(cmdbuffer + bufindw + 1);
|
||||||
|
SERIAL_ECHOLNPGM("\"");
|
||||||
|
}
|
||||||
bufindw += len + 2;
|
bufindw += len + 2;
|
||||||
if (bufindw == sizeof(cmdbuffer))
|
if (bufindw == sizeof(cmdbuffer))
|
||||||
bufindw = 0;
|
bufindw = 0;
|
||||||
|
|
@ -797,10 +799,12 @@ void enquecommand_front(const char *cmd, bool from_progmem)
|
||||||
else
|
else
|
||||||
strcpy(cmdbuffer + bufindr + 1, cmd);
|
strcpy(cmdbuffer + bufindr + 1, cmd);
|
||||||
++ buflen;
|
++ buflen;
|
||||||
SERIAL_ECHO_START;
|
if (!farm_mode) {
|
||||||
SERIAL_ECHOPGM("Enqueing to the front: \"");
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHO(cmdbuffer + bufindr + 1);
|
SERIAL_ECHOPGM("Enqueing to the front: \"");
|
||||||
SERIAL_ECHOLNPGM("\"");
|
SERIAL_ECHO(cmdbuffer + bufindr + 1);
|
||||||
|
SERIAL_ECHOLNPGM("\"");
|
||||||
|
}
|
||||||
#ifdef CMDBUFFER_DEBUG
|
#ifdef CMDBUFFER_DEBUG
|
||||||
cmdqueue_dump_to_serial();
|
cmdqueue_dump_to_serial();
|
||||||
#endif /* CMDBUFFER_DEBUG */
|
#endif /* CMDBUFFER_DEBUG */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue