Anycubic followup

This commit is contained in:
Scott Lahteine 2020-07-21 14:43:43 -05:00
parent 2119e19bff
commit 1e5d73579c
2 changed files with 23 additions and 25 deletions

View File

@ -29,10 +29,10 @@
#if ENABLED(ANYCUBIC_TFT_MODEL)
#include "Arduino.h"
#include <Arduino.h>
// this next line disables the entire HardwareSerial.cpp,
// so I can support AtTiny series and other chips without a UART
// This next line disables the entire anycubic_serial.cpp,
// to support AtTiny series and other chips without a UART
#ifdef UBRR3H
#include "anycubic_serial.h"
@ -59,10 +59,8 @@ struct ring_buffer {
volatile unsigned int tail;
};
#ifdef UBRR3H
ring_buffer rx_buffer_ajg = { { 0 }, 0, 0 };
ring_buffer tx_buffer_ajg = { { 0 }, 0, 0 };
#endif
inline void store_char(unsigned char c, ring_buffer *buffer) {
int i = (unsigned int)(buffer->head + 1) % SERIAL_BUFFER_SIZE;
@ -286,9 +284,7 @@ AnycubicSerialClass::operator bool() {
// Preinstantiate Objects //////////////////////////////////////////////////////
#ifdef UBRR3H
AnycubicSerialClass AnycubicSerial(&rx_buffer_ajg, &tx_buffer_ajg, &UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UCSR3C, &UDR3, RXEN3, TXEN3, RXCIE3, UDRIE3, U2X3);
#endif
#endif // UBRR3H
#endif // ANYCUBIC_TFT_MODEL

View File

@ -130,14 +130,16 @@ const char newSucc[] PROGMEM = "OK";
#define ANYCUBIC_SERIAL_ECHOPGM(x) ANYCUBIC_SERIAL_PROTOCOLPGM(x)
#define ANYCUBIC_SERIAL_ECHO(x) ANYCUBIC_SERIAL_PROTOCOL(x)
#ifdef UBRR3H
extern AnycubicSerialClass AnycubicSerial;
FORCE_INLINE void AnycubicSerialprintPGM(const char *str) {
char ch = pgm_read_byte(str);
while (ch) {
AnycubicSerialClass::write(ch);
AnycubicSerial.write(ch);
ch = pgm_read_byte(++str);
}
}
#ifdef UBRR3H
extern AnycubicSerialClass AnycubicSerial;
#endif