Commit a062586b authored by MagoKimbra's avatar MagoKimbra

Update 4.2.5

parent b5dc91e1
#ifndef CONFIGURATION_VERSION_H
#define CONFIGURATION_VERSION_H
#define BUILD_VERSION "MK 4.2.5 dev"
#define SHORT_BUILD_VERSION "4.2.5_dev"
#define BUILD_VERSION "MK_" SHORT_BUILD_VERSION
#define STRING_DISTRIBUTION_DATE __DATE__ " " __TIME__ // build date and time
// It might also be appropriate to define a location where additional information can be found
#define FIRMWARE_URL "https://github.com/MagoKimbra/MarlinKimbra"
......
......@@ -8,9 +8,6 @@
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "module/HAL.h"
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
......@@ -37,12 +34,15 @@
#include "Configuration_Feature.h"
#endif
#include "module/HAL/HAL.h"
#include "module/communication/communication.h"
#include "Configuration_Store.h"
#include "module/language/language.h"
#include "module/conditionals.h"
#include "module/sanitycheck.h"
#include "module/communication/communication.h"
#include "module/MK_Main.h"
#include "module/motion/stepper.h"
#include "module/motion/stepper_indirection.h"
......@@ -88,4 +88,8 @@
#include "module/fwtest/firmware_test.h"
#endif
#if ENABLED(RFID_MODULE)
#include "module/mfrc522/MFRC522_serial.h"
#endif
#endif
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// **************************************************************************
//
// Description: *** HAL for Arduino ***
//
// **************************************************************************
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "../base.h"
#include "HAL.h"
HAL::HAL() {
// ctor
}
HAL::~HAL() {
// dtor
}
// Print apparent cause of start/restart
void HAL::showStartReason() {
byte mcu = MCUSR;
if (mcu & 1) ECHO_EM(SERIAL_POWERUP);
if (mcu & 2) ECHO_EM(SERIAL_EXTERNAL_RESET);
if (mcu & 4) ECHO_EM(SERIAL_BROWNOUT_RESET);
if (mcu & 8) ECHO_EM(SERIAL_WATCHDOG_RESET);
if (mcu & 32) ECHO_EM(SERIAL_SOFTWARE_RESET);
MCUSR = 0;
}
// Return available memory
int HAL::getFreeRam() {
int freeram = 0;
InterruptProtectedBlock noInts;
uint8_t * heapptr, * stackptr;
heapptr = (uint8_t *)malloc(4); // get heap pointer
free(heapptr); // free up the memory again (sets heapptr to 0)
stackptr = (uint8_t *)(SP); // save value of stack pointer
freeram = (int)stackptr-(int)heapptr;
return freeram;
}
// Reset peripherals and cpu
void HAL::resetHardware() {}
#ifndef EXTERNALSERIAL
// Implement serial communication for one stream only!
/*
HardwareSerial.h - Hardware serial library for Wiring
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified 28 September 2010 by Mark Sproul
Modified to use only 1 queue with fixed length by Repetier
*/
ring_buffer rx_buffer = { { 0 }, 0, 0};
ring_buffer_tx tx_buffer = { { 0 }, 0, 0};
inline void rf_store_char(unsigned char c, ring_buffer *buffer) {
uint8_t i = (buffer->head + 1) & SERIAL_BUFFER_MASK;
// if we should be storing the received character into the location
// just before the tail (meaning that the head would advance to the
// current location of the tail), we're about to overflow the buffer
// and so we don't write the character or advance the head.
if (i != buffer->tail) {
buffer->buffer[buffer->head] = c;
buffer->head = i;
}
}
#if !defined(USART0_RX_vect) && defined(USART1_RX_vect)
// do nothing - on the 32u4 the first USART is USART1
#else
void rfSerialEvent() __attribute__((weak));
void rfSerialEvent() {}
#define serialEvent_implemented
#if defined(USART_RX_vect)
SIGNAL(USART_RX_vect)
#elif defined(USART0_RX_vect)
SIGNAL(USART0_RX_vect)
#else
#if defined(SIG_USART0_RECV)
SIGNAL(SIG_USART0_RECV)
#elif defined(SIG_UART0_RECV)
SIGNAL(SIG_UART0_RECV)
#elif defined(SIG_UART_RECV)
SIGNAL(SIG_UART_RECV)
#else
#error "Don't know what the Data Received vector is called for the first UART"
#endif
#endif
{
#if defined(UDR0)
uint8_t c = UDR0;
#elif defined(UDR)
uint8_t c = UDR;
#else
#error UDR not defined
#endif
rf_store_char(c, &rx_buffer);
}
#endif
#if !defined(USART0_UDRE_vect) && defined(USART1_UDRE_vect)
// do nothing - on the 32u4 the first USART is USART1
#else
#if !defined(UART0_UDRE_vect) && !defined(UART_UDRE_vect) && !defined(USART0_UDRE_vect) && !defined(USART_UDRE_vect)
#error "Don't know what the Data Register Empty vector is called for the first UART"
#else
#if defined(UART0_UDRE_vect)
ISR(UART0_UDRE_vect)
#elif defined(UART_UDRE_vect)
ISR(UART_UDRE_vect)
#elif defined(USART0_UDRE_vect)
ISR(USART0_UDRE_vect)
#elif defined(USART_UDRE_vect)
ISR(USART_UDRE_vect)
#endif
{
if (tx_buffer.head == tx_buffer.tail) {
// Buffer empty, so disable interrupts
#if defined(UCSR0B)
bit_clear(UCSR0B, UDRIE0);
#else
bit_clear(UCSRB, UDRIE);
#endif
}
else {
// There is more data in the output buffer. Send the next byte
uint8_t c = tx_buffer.buffer[tx_buffer.tail];
#if defined(UDR0)
UDR0 = c;
#elif defined(UDR)
UDR = c;
#else
#error UDR not defined
#endif
tx_buffer.tail = (tx_buffer.tail + 1) & SERIAL_TX_BUFFER_MASK;
}
}
#endif
#endif
#if defined(BLUETOOTH) && BLUETOOTH_SERIAL > 0
#if !(defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega2561__) || defined(__AVR_ATmega1281__) || defined (__AVR_ATmega644__) || defined (__AVR_ATmega644P__))
#error BlueTooth option cannot be used with your mainboard
#endif
#if BLUETOOTH_SERIAL > 1 && !(defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__))
#error BlueTooth serial 2 or 3 can be used only with boards based on ATMega2560 or ATMega1280
#endif
#if (BLUETOOTH_SERIAL == 1)
#if defined(USART1_RX_vect)
#define SIG_USARTx_RECV USART1_RX_vect
#define USARTx_UDRE_vect USART1_UDRE_vect
#else
#define SIG_USARTx_RECV SIG_USART1_RECV
#define USARTx_UDRE_vect SIG_USART1_DATA
#endif
#define UDRx UDR1
#define UCSRxA UCSR1A
#define UCSRxB UCSR1B
#define UBRRxH UBRR1H
#define UBRRxL UBRR1L
#define U2Xx U2X1
#define UARTxENABLE ((1<<RXEN1)|(1<<TXEN1)|(1<<RXCIE1)|(1<<UDRIE1))
#define UDRIEx UDRIE1
#define RXxPIN 19
#elif (BLUETOOTH_SERIAL == 2)
#if defined(USART2_RX_vect)
#define SIG_USARTx_RECV USART2_RX_vect
#define USARTx_UDRE_vect USART2_UDRE_vect
#else
#define SIG_USARTx_RECV SIG_USART2_RECV
#define USARTx_UDRE_vect SIG_USART2_DATA
#endif
#define UDRx UDR2
#define UCSRxA UCSR2A
#define UCSRxB UCSR2B
#define UBRRxH UBRR2H
#define UBRRxL UBRR2L
#define U2Xx U2X2
#define UARTxENABLE ((1<<RXEN2)|(1<<TXEN2)|(1<<RXCIE2)|(1<<UDRIE2))
#define UDRIEx UDRIE2
#define RXxPIN 17
#elif (BLUETOOTH_SERIAL == 3)
#if defined(USART3_RX_vect)
#define SIG_USARTx_RECV USART3_RX_vect
#define USARTx_UDRE_vect USART3_UDRE_vect
#else
#define SIG_USARTx_RECV SIG_USART3_RECV
#define USARTx_UDRE_vect SIG_USART3_DATA
#endif
#define UDRx UDR3
#define UCSRxA UCSR3A
#define UCSRxB UCSR3B
#define UBRRxH UBRR3H
#define UBRRxL UBRR3L
#define U2Xx U2X3
#define UARTxENABLE ((1<<RXEN3)|(1<<TXEN3)|(1<<RXCIE3)|(1<<UDRIE3))
#define UDRIEx UDRIE3
#define RXxPIN 15
#else
#error Wrong serial port number for BlueTooth
#endif
SIGNAL(SIG_USARTx_RECV) {
uint8_t c = UDRx;
rf_store_char(c, &rx_buffer);
}
volatile uint8_t txx_buffer_tail = 0;
ISR(USARTx_UDRE_vect) {
if (tx_buffer.head == txx_buffer_tail) {
// Buffer empty, so disable interrupts
bit_clear(UCSRxB, UDRIEx);
}
else {
// There is more data in the output buffer. Send the next byte
uint8_t c = tx_buffer.buffer[txx_buffer_tail];
txx_buffer_tail = (txx_buffer_tail + 1) & SERIAL_TX_BUFFER_MASK;
UDRx = c;
}
}
#endif
// Constructors
MKHardwareSerial::MKHardwareSerial(ring_buffer *rx_buffer, ring_buffer_tx *tx_buffer,
volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
volatile uint8_t *udr,
uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x) {
_rx_buffer = rx_buffer;
_tx_buffer = tx_buffer;
_ubrrh = ubrrh;
_ubrrl = ubrrl;
_ucsra = ucsra;
_ucsrb = ucsrb;
_udr = udr;
_rxen = rxen;
_txen = txen;
_rxcie = rxcie;
_udrie = udrie;
_u2x = u2x;
}
// Public Methods
void MKHardwareSerial::begin(unsigned long baud) {
uint16_t baud_setting;
bool use_u2x = true;
#if F_CPU == 16000000UL
// hardcoded exception for compatibility with the bootloader shipped
// with the Duemilanove and previous boards and the firmware on the 8U2
// on the Uno and Mega 2560.
if (baud == 57600) {
use_u2x = false;
}
#endif
try_again:
if (use_u2x) {
*_ucsra = 1 << _u2x;
baud_setting = (F_CPU / 4 / baud - 1) / 2;
}
else {
*_ucsra = 0;
baud_setting = (F_CPU / 8 / baud - 1) / 2;
}
if ((baud_setting > 4095) && use_u2x) {
use_u2x = false;
goto try_again;
}
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
*_ubrrh = baud_setting >> 8;
*_ubrrl = baud_setting;
bit_set(*_ucsrb, _rxen);
bit_set(*_ucsrb, _txen);
bit_set(*_ucsrb, _rxcie);
bit_clear(*_ucsrb, _udrie);
#if defined(BLUETOOTH) && BLUETOOTH_SERIAL > 0
WRITE(RXxPIN,1); // Pullup on RXDx
UCSRxA = (1<<U2Xx);
UBRRxH = (uint8_t)(((F_CPU / 4 / BLUETOOTH_BAUD -1) / 2) >> 8);
UBRRxL = (uint8_t)(((F_CPU / 4 / BLUETOOTH_BAUD -1) / 2) & 0xFF);
UCSRxB |= UARTxENABLE;
#endif
}
void MKHardwareSerial::end() {
// wait for transmission of outgoing data
while (_tx_buffer->head != _tx_buffer->tail)
;
bit_clear(*_ucsrb, _rxen);
bit_clear(*_ucsrb, _txen);
bit_clear(*_ucsrb, _rxcie);
bit_clear(*_ucsrb, _udrie);
#if defined(BLUETOOTH_SERIAL) && BLUETOOTH_SERIAL > 0
UCSRxB = 0;
#endif
// clear a ny received data
_rx_buffer->head = _rx_buffer->tail;
}
int MKHardwareSerial::available(void) {
return (unsigned int)(SERIAL_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) & SERIAL_BUFFER_MASK;
}
int MKHardwareSerial::outputUnused(void) {
return SERIAL_TX_BUFFER_SIZE - (unsigned int)((SERIAL_TX_BUFFER_SIZE + _tx_buffer->head - _tx_buffer->tail) & SERIAL_TX_BUFFER_MASK);
}
int MKHardwareSerial::peek(void) {
if (_rx_buffer->head == _rx_buffer->tail)
return -1;
return _rx_buffer->buffer[_rx_buffer->tail];
}
int MKHardwareSerial::read(void) {
// if the head isn't ahead of the tail, we don't have any characters
if (_rx_buffer->head == _rx_buffer->tail) {
return -1;
}
unsigned char c = _rx_buffer->buffer[_rx_buffer->tail];
_rx_buffer->tail = (_rx_buffer->tail + 1) & SERIAL_BUFFER_MASK;
return c;
}
void MKHardwareSerial::flush() {
while (_tx_buffer->head != _tx_buffer->tail);
#if defined(BLUETOOTH) && BLUETOOTH_SERIAL > 0
while (_tx_buffer->head != txx_buffer_tail);
#endif
}
#ifdef COMPAT_PRE1
void
#else
size_t
#endif
MKHardwareSerial::write(uint8_t c) {
uint8_t i = (_tx_buffer->head + 1) & SERIAL_TX_BUFFER_MASK;
// If the output buffer is full, there's nothing for it other than to
// wait for the interrupt handler to empty it a bit
while (i == _tx_buffer->tail) {}
#if defined(BLUETOOTH) && BLUETOOTH_SERIAL > 0
while (i == txx_buffer_tail) {}
#endif
_tx_buffer->buffer[_tx_buffer->head] = c;
_tx_buffer->head = i;
bit_set(*_ucsrb, _udrie);
#if defined(BLUETOOTH) && BLUETOOTH_SERIAL > 0
bit_set(UCSRxB, UDRIEx);
#endif
#ifndef COMPAT_PRE1
return 1;
#endif
}
// Preinstantiate Object
#if defined(UBRRH) && defined(UBRRL)
MKHardwareSerial MKSerial(&rx_buffer, &tx_buffer, &UBRRH, &UBRRL, &UCSRA, &UCSRB, &UDR, RXEN, TXEN, RXCIE, UDRIE, U2X);
#elif defined(UBRR0H) && defined(UBRR0L)
MKHardwareSerial MKSerial(&rx_buffer, &tx_buffer, &UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UDR0, RXEN0, TXEN0, RXCIE0, UDRIE0, U2X0);
#elif defined(USBCON)
// do nothing - Serial object and buffers are initialized in CDC code
#else
#error no serial port defined (port 0)
#endif
#endif
\ No newline at end of file
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// **************************************************************************
//
// Description: *** HAL for Arduino ***
//
// **************************************************************************
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "../../base.h"
#include "HAL.h"
HAL::HAL() {
// ctor
}
HAL::~HAL() {
// dtor
}
// Print apparent cause of start/restart
void HAL::showStartReason() {
byte mcu = MCUSR;
if (mcu & 1) ECHO_EM(SERIAL_POWERUP);
if (mcu & 2) ECHO_EM(SERIAL_EXTERNAL_RESET);
if (mcu & 4) ECHO_EM(SERIAL_BROWNOUT_RESET);
if (mcu & 8) ECHO_EM(SERIAL_WATCHDOG_RESET);
if (mcu & 32) ECHO_EM(SERIAL_SOFTWARE_RESET);
MCUSR = 0;
}
// Return available memory
int HAL::getFreeRam() {
int freeram = 0;
InterruptProtectedBlock noInts;
uint8_t * heapptr, * stackptr;
heapptr = (uint8_t *)malloc(4); // get heap pointer
free(heapptr); // free up the memory again (sets heapptr to 0)
stackptr = (uint8_t *)(SP); // save value of stack pointer
freeram = (int)stackptr-(int)heapptr;
return freeram;
}
// Reset peripherals and cpu
void HAL::resetHardware() {}
......@@ -17,16 +17,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* Description: *** HAL for Arduino Due ***
* Description: *** HAL for Arduino ***
*
* ARDUINO_ARCH_SAM
* ARDUINO_ARCH_ARM
*/
#ifndef HAL_H
#define HAL_H
#include <avr/pgmspace.h>
//#include <avr/io.h>
#include <avr/io.h>
#include "fastio.h"
// Arduino < 1.0.0 does not define this, so we need to do it ourselves
#ifndef analogInputToDigitalPin
......@@ -43,8 +43,6 @@
#define BIT(b) (1<<(b))
#define TEST(n, b) (((n)&BIT(b))!=0)
#define SET_BIT(n, b, value) (n) ^= ((-value)^(n)) & (BIT(b))
#define bit_clear(x, y) x&= ~(1<<y)
#define bit_set(x, y) x|= (1<<y)
// Macros for maths shortcuts
#ifndef M_PI
......@@ -73,42 +71,18 @@
#define CRITICAL_SECTION_END SREG = _sreg;
#endif
#if CPU_ARCH == ARCH_AVR
#include <avr/io.h>
#else
#define PROGMEM
#define PGM_P const char *
#define PSTR(s) s
#define pgm_read_byte_near(x) (*(uint8_t*)x)
#define pgm_read_byte(x) (*(uint8_t*)x)
#endif
#define PACK
#define FSTRINGVALUE(var,value) const char var[] PROGMEM = value;
#define FSTRINGVAR(var) static const char var[] PROGMEM;
#define FSTRINGPARAM(var) PGM_P var
#include <avr/eeprom.h>
#include <avr/wdt.h>
//#define EXTERNALSERIAL // Force using arduino serial
#ifndef EXTERNALSERIAL
#define HardwareSerial_h // Don't use standard serial console
#include "HardwareSerial.h"
#define MKSERIAL MKSerial
#else
#define MKSERIAL Serial
#endif
#include <inttypes.h>
#include "Print.h"
#ifdef EXTERNALSERIAL
#define SERIAL_RX_BUFFER_SIZE 128
#endif
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#define COMPAT_PRE1
#endif
/**
......@@ -116,15 +90,6 @@
*/
typedef uint32_t millis_t;
#if CPU_ARCH == ARCH_AVR
#include "fastio.h"
#else
#define READ(IO) digitalRead(IO)
#define WRITE(IO, v) digitalWrite(IO, v)
#define SET_INPUT(IO) pinMode(IO, INPUT)
#define SET_OUTPUT(IO) pinMode(IO, OUTPUT)
#endif
class InterruptProtectedBlock {
uint8_t sreg;
public:
......@@ -146,103 +111,6 @@
}
};
#ifndef EXTERNALSERIAL
// Implement serial communication for one stream only!
/*
* HardwareSerial.h - Hardware serial library for Wiring
* Copyright (c) 2006 Nicholas Zambetti. All right reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Modified 28 September 2010 by Mark Sproul
*
* Modified to use only 1 queue with fixed length by Repetier
*/
#define SERIAL_BUFFER_SIZE 128
#define SERIAL_BUFFER_MASK 127
#undef SERIAL_TX_BUFFER_SIZE
#undef SERIAL_TX_BUFFER_MASK
#ifdef BIG_OUTPUT_BUFFER
#define SERIAL_TX_BUFFER_SIZE 128
#define SERIAL_TX_BUFFER_MASK 127
#else
#define SERIAL_TX_BUFFER_SIZE 64
#define SERIAL_TX_BUFFER_MASK 63
#endif
struct ring_buffer {
uint8_t buffer[SERIAL_BUFFER_SIZE];
volatile uint8_t head;
volatile uint8_t tail;
};
struct ring_buffer_tx {
uint8_t buffer[SERIAL_TX_BUFFER_SIZE];
volatile uint8_t head;
volatile uint8_t tail;
};
class MKHardwareSerial : public Print {
public:
ring_buffer *_rx_buffer;
ring_buffer_tx *_tx_buffer;
volatile uint8_t *_ubrrh;
volatile uint8_t *_ubrrl;
volatile uint8_t *_ucsra;
volatile uint8_t *_ucsrb;
volatile uint8_t *_udr;
uint8_t _rxen;
uint8_t _txen;
uint8_t _rxcie;
uint8_t _udrie;
uint8_t _u2x;
public:
MKHardwareSerial(ring_buffer *rx_buffer, ring_buffer_tx *tx_buffer,
volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
volatile uint8_t *udr,
uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x);
void begin(unsigned long);
void end();
virtual int available(void);
virtual int peek(void);
virtual int read(void);
virtual void flush(void);
#ifdef COMPAT_PRE1
virtual void write(uint8_t);
#else
virtual size_t write(uint8_t);
#endif
using Print::write; // pull in write(str) and write(buf, size) from Print
operator bool();
int outputUnused(void); // Used for output in interrupts
};
extern MKHardwareSerial MKSerial;
#define MKSERIAL MKSerial
//extern ring_buffer x_buffer;
#define WAIT_OUT_EMPTY while(tx_buffer.head != tx_buffer.tail) {}
#else
#define MKSERIAL Serial
#endif
class HAL {
public:
......@@ -250,12 +118,6 @@
virtual ~HAL();
static inline char readFlashByte(PGM_P ptr) { return pgm_read_byte(ptr); }
static inline void serialSetBaudrate(long baud) { MKSERIAL.begin(baud); }
static inline bool serialByteAvailable() { return MKSERIAL.available() > 0; }
static inline uint8_t serialReadByte() { return MKSERIAL.read(); }
static inline void serialWriteByte(char b) { MKSERIAL.write(b); }
static inline void serialFlush() { MKSERIAL.flush(); }
static void showStartReason();
static int getFreeRam();
static void resetHardware();
......
/*
HardwareSerial.cpp - Hardware serial library for Wiring
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified 23 November 2006 by David A. Mellis
Modified 28 September 2010 by Mark Sproul
*/
#include "../../base.h"
#include "HardwareSerial.h"
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
#if UART_PRESENT(SERIAL_PORT)
ring_buffer rx_buffer = { { 0 }, 0, 0 };
#endif
FORCE_INLINE void store_char(unsigned char c) {
int i = (unsigned int)(rx_buffer.head + 1) % RX_BUFFER_SIZE;
if (i != rx_buffer.tail) {
rx_buffer.buffer[rx_buffer.head] = c;
rx_buffer.head = i;
}
}
#if defined(M_USARTx_RX_vect)
SIGNAL(M_USARTx_RX_vect) {
unsigned char c = M_UDRx;
store_char(c);
}
#endif
// Constructors
MKHardwareSerial::MKHardwareSerial() { }
// Public Methods
void MKHardwareSerial::begin(long baud) {
uint16_t baud_setting;
bool useU2X = true;
#if F_CPU == 16000000UL && SERIAL_PORT == 0
if (baud == 57600) {
useU2X = false;
}
#endif
if (useU2X) {
M_UCSRxA = BIT(M_U2Xx);
baud_setting = (F_CPU / 4 / baud - 1) / 2;
}
else {
M_UCSRxA = 0;
baud_setting = (F_CPU / 8 / baud - 1) / 2;
}
M_UBRRxH = baud_setting >> 8;
M_UBRRxL = baud_setting;
set_bit(M_UCSRxB, M_RXENx);
set_bit(M_UCSRxB, M_TXENx);
set_bit(M_UCSRxB, M_RXCIEx);
}
void MKHardwareSerial::end() {
clear_bit(M_UCSRxB, M_RXENx);
clear_bit(M_UCSRxB, M_TXENx);
clear_bit(M_UCSRxB, M_RXCIEx);
}
int MKHardwareSerial::peek(void) {
if (rx_buffer.head == rx_buffer.tail) {
return -1;
}
else {
return rx_buffer.buffer[rx_buffer.tail];
}
}
int MKHardwareSerial::read(void) {
if (rx_buffer.head == rx_buffer.tail) {
return -1;
}
else {
unsigned char c = rx_buffer.buffer[rx_buffer.tail];
rx_buffer.tail = (unsigned int)(rx_buffer.tail + 1) % RX_BUFFER_SIZE;
return c;
}
}
void MKHardwareSerial::flush() {
rx_buffer.head = rx_buffer.tail;
}
void MKHardwareSerial::print(char c, int base) {
print((long) c, base);
}
void MKHardwareSerial::print(unsigned char b, int base) {
print((unsigned long) b, base);
}
void MKHardwareSerial::print(int n, int base) {
print((long) n, base);
}
void MKHardwareSerial::print(unsigned int n, int base) {
print((unsigned long) n, base);
}
void MKHardwareSerial::print(long n, int base) {
if (base == 0) {
write(n);
}
else if (base == 10) {
if (n < 0) {
print('-');
n = -n;
}
printNumber(n, 10);
}
else {
printNumber(n, base);
}
}
void MKHardwareSerial::print(unsigned long n, int base) {
if (base == 0)
write(n);
else
printNumber(n, base);
}
void MKHardwareSerial::print(double n, int digits) {
printFloat(n, digits);
}
void MKHardwareSerial::println(void) {
print('\r');
print('\n');
}
void MKHardwareSerial::println(const String &s) {
print(s);
println();
}
void MKHardwareSerial::println(const char c[]) {
print(c);
println();
}
void MKHardwareSerial::println(char c, int base) {
print(c, base);
println();
}
void MKHardwareSerial::println(unsigned char b, int base) {
print(b, base);
println();
}
void MKHardwareSerial::println(int n, int base) {
print(n, base);
println();
}
void MKHardwareSerial::println(unsigned int n, int base) {
print(n, base);
println();
}
void MKHardwareSerial::println(long n, int base) {
print(n, base);
println();
}
void MKHardwareSerial::println(unsigned long n, int base) {
print(n, base);
println();
}
void MKHardwareSerial::println(double n, int digits) {
print(n, digits);
println();
}
// Private Methods
void MKHardwareSerial::printNumber(unsigned long n, uint8_t base) {
unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
unsigned long i = 0;
if (n == 0) {
print('0');
return;
}
while (n > 0) {
buf[i++] = n % base;
n /= base;
}
for (; i > 0; i--)
print((char) (buf[i - 1] < 10 ?
'0' + buf[i - 1] :
'A' + buf[i - 1] - 10));
}
void MKHardwareSerial::printFloat(double number, uint8_t digits) {
// Handle negative numbers
if (number < 0.0) {
print('-');
number = -number;
}
// Round correctly so that print(1.999, 2) prints as "2.00"
double rounding = 0.5;
for (uint8_t i = 0; i < digits; ++i)
rounding /= 10.0;
number += rounding;
// Extract the integer part of the number and print it
unsigned long int_part = (unsigned long)number;
double remainder = number - (double)int_part;
print(int_part);
// Print the decimal point, but only if there are digits beyond
if (digits > 0) print('.');
// Extract digits from the remainder one at a time
while (digits-- > 0) {
remainder *= 10.0;
int toPrint = int(remainder);
print(toPrint);
remainder -= toPrint;
}
}
// Preinstantiate Objects
MKHardwareSerial MKSerial;
#endif
/*
HardwareSerial.h - Hardware serial library for Wiring
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified 28 September 2010 by Mark Sproul
*/
#ifndef HardwareSerial_H
#define HardwareSerial_H
#define clear_bit(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#define set_bit(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
// The presence of the UBRRH register is used to detect a UART.
#define UART_PRESENT(port) ((port == 0 && (defined(UBRRH) || defined(UBRR0H))) || \
(port == 1 && defined(UBRR1H)) || (port == 2 && defined(UBRR2H)) || \
(port == 3 && defined(UBRR3H)))
// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
// requires two levels of indirection to expand macro values properly)
#define SERIAL_REGNAME(registerbase,number,suffix) SERIAL_REGNAME_INTERNAL(registerbase,number,suffix)
#if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##suffix
#else
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
#endif
// Registers used by MarlinSerial class (these are expanded
// depending on selected serial port
#define M_UCSRxA SERIAL_REGNAME(UCSR,SERIAL_PORT,A) // defines M_UCSRxA to be UCSRnA where n is the serial port number
#define M_UCSRxB SERIAL_REGNAME(UCSR,SERIAL_PORT,B)
#define M_RXENx SERIAL_REGNAME(RXEN,SERIAL_PORT,)
#define M_TXENx SERIAL_REGNAME(TXEN,SERIAL_PORT,)
#define M_RXCIEx SERIAL_REGNAME(RXCIE,SERIAL_PORT,)
#define M_UDREx SERIAL_REGNAME(UDRE,SERIAL_PORT,)
#define M_UDRx SERIAL_REGNAME(UDR,SERIAL_PORT,)
#define M_UBRRxH SERIAL_REGNAME(UBRR,SERIAL_PORT,H)
#define M_UBRRxL SERIAL_REGNAME(UBRR,SERIAL_PORT,L)
#define M_RXCx SERIAL_REGNAME(RXC,SERIAL_PORT,)
#define M_USARTx_RX_vect SERIAL_REGNAME(USART,SERIAL_PORT,_RX_vect)
#define M_U2Xx SERIAL_REGNAME(U2X,SERIAL_PORT,)
#define DEC 10
#define HEX 16
#define OCT 8
#define BIN 2
#define BYTE 0
#define RX_BUFFER_SIZE 128
struct ring_buffer {
unsigned char buffer[RX_BUFFER_SIZE];
int head;
int tail;
};
#if UART_PRESENT(SERIAL_PORT)
extern ring_buffer rx_buffer;
#endif
class MKHardwareSerial {
public:
MKHardwareSerial();
void begin(long);
void end();
int peek(void);
int read(void);
void flush(void);
FORCE_INLINE int available(void) {
return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE;
}
FORCE_INLINE void write(uint8_t c) {
while (!TEST(M_UCSRxA, M_UDREx));
M_UDRx = c;
}
FORCE_INLINE void checkRx(void) {
if (TEST(M_UCSRxA, M_RXCx)) {
unsigned char c = M_UDRx;
int i = (unsigned int)(rx_buffer.head + 1) % RX_BUFFER_SIZE;
if (i != rx_buffer.tail) {
rx_buffer.buffer[rx_buffer.head] = c;
rx_buffer.head = i;
}
}
}
private:
void printNumber(unsigned long, uint8_t);
void printFloat(double, uint8_t);
public:
FORCE_INLINE void write(const char *str) { while (*str) write(*str++); }
FORCE_INLINE void write(const uint8_t *buffer, size_t size) { while (size--) write(*buffer++); }
FORCE_INLINE void print(const String &s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); }
FORCE_INLINE void print(const char *str) { write(str); }
void print(char, int = BYTE);
void print(unsigned char, int = BYTE);
void print(int, int = DEC);
void print(unsigned int, int = DEC);
void print(long, int = DEC);
void print(unsigned long, int = DEC);
void print(double, int = 2);
void println(const String &s);
void println(const char[]);
void println(char, int = BYTE);
void println(unsigned char, int = BYTE);
void println(int, int = DEC);
void println(unsigned int, int = DEC);
void println(long, int = DEC);
void println(unsigned long, int = DEC);
void println(double, int = 2);
void println(void);
};
extern MKHardwareSerial MKSerial;
#endif // HardwareSerial_H
/**
* MK Firmware
*
* Based on Sprinter and grbl.
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2013 MagoKimbra
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
......@@ -587,7 +588,7 @@ void setup() {
disableStepperDrivers();
#endif
HAL::serialSetBaudrate(BAUDRATE);
SERIAL_INIT(BAUDRATE);
ECHO_EM(START);
HAL::showStartReason();
ECHO_EM(BUILD_VERSION);
......@@ -732,7 +733,7 @@ void get_command() {
static millis_t last_command_time = 0;
millis_t ms = millis();
if (!HAL::serialByteAvailable() && commands_in_queue == 0 && ms - last_command_time > 1000UL) {
if (!MKSERIAL.available() && commands_in_queue == 0 && ms - last_command_time > 1000UL) {
ECHO_L(WT);
last_command_time = ms;
}
......@@ -741,13 +742,13 @@ void get_command() {
//
// Loop while serial characters are incoming and the queue is not full
//
while (HAL::serialByteAvailable() > 0 && commands_in_queue < BUFSIZE) {
while (MKSERIAL.available() > 0 && commands_in_queue < BUFSIZE) {
#if ENABLED(NO_TIMEOUTS)
last_command_time = ms;
#endif
serial_char = HAL::serialReadByte();
serial_char = MKSERIAL.read();
//
// If the character ends the line, or the line is full...
......@@ -826,9 +827,9 @@ void get_command() {
serial_count = 0; //clear buffer
} else if (serial_char == '\\') { // Handle escapes
if (HAL::serialByteAvailable() > 0 && commands_in_queue < BUFSIZE) {
if (MKSERIAL.available() > 0 && commands_in_queue < BUFSIZE) {
// if we have one more character, copy it over
serial_char = HAL::serialReadByte();
serial_char = MKSERIAL.read();
command_queue[cmd_queue_index_w][serial_count++] = serial_char;
}
// otherwise do nothing
......@@ -7384,7 +7385,7 @@ ExitUnknownCommand:
void FlushSerialRequestResend() {
//char command_queue[cmd_queue_index_r][100]="Resend:";
HAL::serialFlush();
MKSERIAL.flush();
ECHO_LV(RESEND, (long)(gcode_LastN + 1));
ECHO_S(OK);
}
......
/**
* This file is part of MarlinKimbra Firmware.
*
* MarlinKimbra Firmware is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MarlinKimbra Firmware is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MarlinKimbra Firmware. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../base.h"
void Com::printF(FSTRINGPARAM(ptr)) {
char c;
while ((c = HAL::readFlashByte(ptr++)) != 0)
HAL::serialWriteByte(c);
}
void Com::printVal(int value) {
print(value);
}
void Com::printVal(int8_t value) {
print(value);
}
void Com::printVal(uint8_t value) {
print(value);
}
void Com::printVal(int32_t value) {
print(value);
}
void Com::printVal(uint32_t value) {
printNumber(value);
}
void Com::printVal(float value, uint8_t digits) {
printFloat(value, digits);
}
void Com::printVal(double value, uint8_t digits) {
printFloat(value, digits);
}
void Com::print(const char* text) {
while(*text) {
HAL::serialWriteByte(*text++);
}
}
void Com::print(char c) {
HAL::serialWriteByte(c);
}
void Com::print(float number) {
printFloat(number, 6);
}
void Com::print(int value) {
print((int32_t)value);
}
void Com::print(long value) {
if(value < 0) {
HAL::serialWriteByte('-');
value = -value;
}
printNumber(value);
}
void Com::print(uint16_t value) {
printNumber(value);
}
void Com::print(uint32_t value) {
printNumber(value);
}
void Com::printNumber(uint32_t n) {
char buf[11]; // Assumes 8-bit chars plus zero byte.
char *str = &buf[10];
*str = '\0';
do {
unsigned long m = n;
n /= 10;
*--str = '0'+(m - 10 * n);
} while(n);
print(str);
}
void Com::printArray(float *arr, uint8_t n, uint8_t digits) {
for (uint8_t i = 0; i < n; i++) {
print(" ");
printFloat(arr[i], digits);
}
}
void Com::printArray(int32_t *arr, uint8_t n) {
for (uint8_t i = 0; i < n; i++) {
print(" ");
printVal(arr[i]);
}
}
void Com::printFloat(float number, uint8_t digits) {
if (isnan(number)) {
print(TNAN);
return;
}
if (isinf(number)) {
print(TINF);
return;
}
// Handle negative numbers
if (number < 0.0) {
print('-');
number = -number;
}
// Round correctly so that print(1.999, 2) prints as "2.00"
float rounding = 0.5;
for (uint8_t i = 0; i < digits; ++i)
rounding /= 10.0;
number += rounding;
// Extract the integer part of the number and print it
unsigned long int_part = (unsigned long)number;
float remainder = number - (float)int_part;
printNumber(int_part);
// Print the decimal point, but only if there are digits beyond
if (digits > 0)
print('.');
// Extract digits from the remainder one at a time
while (digits-- > 0) {
remainder *= 10.0;
int toPrint = int(remainder);
print(toPrint);
remainder -= toPrint;
}
}
#ifndef COMMUNICATION_H
#define COMMUNICATION_H
class Com {
public:
#define START "start" // start for host
#define OK "ok " // ok answer for host
#define ER "Error: " // error for host
#define WT "Wait" // wait for host
#define DB "Echo: " // message for user
#define CFG "Config: " // config for host
#define INFO "Info: " // info for host
#define RESEND "Resend: " // resend for host
#define WARNING "Warning: " // warning for host
#define TNAN "NAN" // NAN for host
#define TINF "INF" // INF for host
#define PAUSE "//action:pause" // command for host that support action
#define RESUME "//action:resume" // command for host that support action
#define DISCONNECT "//action:disconnect" // command for host that support action
#define START "start" // start for host
#define OK "ok " // ok answer for host
#define ER "Error: " // error for host
#define WT "Wait" // wait for host
#define DB "Echo: " // message for user
#define CFG "Config: " // config for host
#define INFO "Info: " // info for host
#define RESEND "Resend: " // resend for host
#define WARNING "Warning: " // warning for host
#define TNAN "NAN" // NAN for host
#define TINF "INF" // INF for host
#define PAUSE "//action:pause" // command for host that support action
#define RESUME "//action:resume" // command for host that support action
#define DISCONNECT "//action:disconnect" // command for host that support action
static void printFloat(float number, uint8_t digits);
static void printVal(int value);
static void printVal(int8_t value);
static void printVal(uint8_t value);
static void printVal(int32_t value);
static void printVal(uint32_t value);
static void printVal(float value, uint8_t digits = 2);
static void printVal(double value, uint8_t digits = 2);
static void printArray(float *arr, uint8_t n = 4, uint8_t digits = 2);
static void printArray(long *arr, uint8_t n = 4);
static void printNumber(uint32_t n);
static void print(long value);
static void print(uint16_t value);
static void print(uint32_t value);
static void print(int value);
static void print(float number);
static void print(const char *text);
static void print(char c);
static void println() { HAL::serialWriteByte('\r'); HAL::serialWriteByte('\n'); }
static void printF(FSTRINGPARAM(ptr));
protected:
private:
};
#define SERIAL_INIT(baud) MKSERIAL.begin(baud), delay(1)
#define SERIAL_WRITE(x) MKSERIAL.write(x)
#define SERIAL_PRINT(msg, args...) MKSERIAL.print(msg, ##args)
#define SERIAL_ENDL MKSERIAL.println()
#define SERIAL_WRITE(x) HAL::serialWriteByte(x)
FORCE_INLINE void PS_PGM(const char *str) {
char c;
while (c = pgm_read_byte(str)) {
SERIAL_WRITE(c);
str++;
}
}
#define ECHO_S(srt) Com::printF(PSTR(srt))
#define ECHO_M(msg) Com::printF(PSTR(msg))
#define ECHO_T(txt) Com::print(txt)
#define ECHO_V(val, args...) Com::printVal(val, ##args)
#define ECHO_C(x) Com::print(x)
#define ECHO_E Com::println()
#define ECHO_ENDL SERIAL_ENDL
#define ECHO_PGM(message) PS_PGM(PSTR(message))
#define ECHO_S(srt) ECHO_PGM(srt)
#define ECHO_M(msg) ECHO_PGM(msg)
#define ECHO_T SERIAL_PRINT
#define ECHO_V SERIAL_PRINT
#define ECHO_C SERIAL_WRITE
#define ECHO_E SERIAL_ENDL
#define ECHO_MV(msg, val, args...) ECHO_M(msg),ECHO_V(val, ##args)
#define ECHO_VM(val, msg, args...) ECHO_V(val, ##args),ECHO_M(msg)
......
......@@ -61,15 +61,15 @@
// Serial Console Messages (do not translate those!)
#if MECH(CARTESIAN)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:MK_" SHORT_BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Mendel EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Mendel EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#elif MECH(COREXY)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:MK_" SHORT_BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Core_XY EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Core_XY EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#elif MECH(COREXZ)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:MK_" SHORT_BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Core_XZ EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Core_XZ EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#elif MECH(DELTA)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:MK_" SHORT_BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Delta EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Delta EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#elif MECH(SCARA)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:MK_" SHORT_BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Scara EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Scara EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#endif
#define SERIAL_ENQUEUEING "enqueueing \""
......
......@@ -686,7 +686,7 @@ ISR(TIMER1_COMPA_vect) {
// Take multiple steps per interrupt (For high speed moves)
for (int8_t i = 0; i < step_loops; i++) {
#ifndef USBCON
HAL::serialByteAvailable(); // Check for serial chars.
MKSERIAL.checkRx(); // Check for serial chars.
#endif
#if ENABLED(ADVANCE)
......
......@@ -468,8 +468,7 @@ void checkExtruderAutoFans() {
inline void _temp_error(int h, const char* serial_msg, const char* lcd_msg) {
static bool killed = false;
if (IsRunning()) {
ECHO_S(ER);
Com::printF(serial_msg);
ECHO_ST(ER, serial_msg);
ECHO_M(SERIAL_STOPPED_HEATER);
if (h >= 0) ECHO_EV((int)h); else ECHO_EM(SERIAL_HEATER_BED);
#if ENABLED(ULTRA_LCD)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment