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