0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-31 14:12:52 +00:00

MYSERIAL => MYSERIAL0

For cleaner diffing with Marlin 2.0.x.
This commit is contained in:
Scott Lahteine 2018-02-14 02:53:55 -06:00
parent d89a61bd51
commit c93dab2307
10 changed files with 50 additions and 65 deletions

View file

@ -274,8 +274,7 @@
// action to give the user a more responsive 'Stop'.
set_destination_from_current();
idle();
MYSERIAL.flush(); // G26 takes a long time to complete. PronterFace may
// overwhelm the serial buffer with M105's without this fix.
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
}
wait_for_release();
@ -502,9 +501,7 @@
SERIAL_EOL();
}
idle();
MYSERIAL.flush(); // G26 takes a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
}
#if ENABLED(ULTRA_LCD)
}
@ -528,9 +525,7 @@
}
idle();
MYSERIAL.flush(); // G26 takes a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
}
#if ENABLED(ULTRA_LCD)
lcd_reset_status();
@ -828,16 +823,12 @@
//}
print_line_from_here_to_there(rx, ry, g26_layer_height, xe, ye, g26_layer_height);
MYSERIAL.flush(); // G26 takes a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
}
if (look_for_lines_to_connect())
goto LEAVE;
}
MYSERIAL.flush(); // G26 takes a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
} while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
LEAVE:

View file

@ -1030,7 +1030,7 @@ inline void get_serial_commands() {
#if NO_TIMEOUTS > 0
static millis_t last_command_time = 0;
const millis_t ms = millis();
if (commands_in_queue == 0 && !MYSERIAL.available() && ELAPSED(ms, last_command_time + NO_TIMEOUTS)) {
if (commands_in_queue == 0 && !MYSERIAL0.available() && ELAPSED(ms, last_command_time + NO_TIMEOUTS)) {
SERIAL_ECHOLNPGM(MSG_WAIT);
last_command_time = ms;
}
@ -1040,7 +1040,7 @@ inline void get_serial_commands() {
* Loop while serial characters are incoming and the queue is not full
*/
int c;
while (commands_in_queue < BUFSIZE && (c = MYSERIAL.read()) >= 0) {
while (commands_in_queue < BUFSIZE && (c = MYSERIAL0.read()) >= 0) {
char serial_char = c;
@ -1136,7 +1136,7 @@ inline void get_serial_commands() {
// The command will be injected when EOL is reached
}
else if (serial_char == '\\') { // Handle escapes
if ((c = MYSERIAL.read()) >= 0 && !serial_comment_mode) // if we have one more character, copy it over
if ((c = MYSERIAL0.read()) >= 0 && !serial_comment_mode) // if we have one more character, copy it over
serial_line_buffer[serial_count++] = (char)c;
// otherwise do nothing
}
@ -11981,7 +11981,7 @@ void process_next_command() {
*/
void FlushSerialRequestResend() {
//char command_queue[cmd_queue_index_r][100]="Resend:";
MYSERIAL.flush();
MYSERIAL0.flush();
SERIAL_PROTOCOLPGM(MSG_RESEND);
SERIAL_PROTOCOLLN(gcode_LastN + 1);
ok_to_send();
@ -13636,7 +13636,7 @@ void setup() {
disableStepperDrivers();
#endif
MYSERIAL.begin(BAUDRATE);
MYSERIAL0.begin(BAUDRATE);
SERIAL_PROTOCOLLNPGM("start");
SERIAL_ECHO_START();

View file

@ -339,38 +339,38 @@ int8_t SdBaseFile::lsPrintNext(uint8_t flags, uint8_t indent) {
&& DIR_IS_FILE_OR_SUBDIR(&dir)) break;
}
// indent for dir level
for (uint8_t i = 0; i < indent; i++) MYSERIAL.write(' ');
for (uint8_t i = 0; i < indent; i++) MYSERIAL0.write(' ');
// print name
for (uint8_t i = 0; i < 11; i++) {
if (dir.name[i] == ' ')continue;
if (i == 8) {
MYSERIAL.write('.');
MYSERIAL0.write('.');
w++;
}
MYSERIAL.write(dir.name[i]);
MYSERIAL0.write(dir.name[i]);
w++;
}
if (DIR_IS_SUBDIR(&dir)) {
MYSERIAL.write('/');
MYSERIAL0.write('/');
w++;
}
if (flags & (LS_DATE | LS_SIZE)) {
while (w++ < 14) MYSERIAL.write(' ');
while (w++ < 14) MYSERIAL0.write(' ');
}
// print modify date/time if requested
if (flags & LS_DATE) {
MYSERIAL.write(' ');
MYSERIAL0.write(' ');
printFatDate(dir.lastWriteDate);
MYSERIAL.write(' ');
MYSERIAL0.write(' ');
printFatTime(dir.lastWriteTime);
}
// print size if requested
if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
MYSERIAL.write(' ');
MYSERIAL.print(dir.fileSize);
MYSERIAL0.write(' ');
MYSERIAL0.print(dir.fileSize);
}
MYSERIAL.println();
MYSERIAL0.println();
return DIR_IS_FILE(&dir) ? 1 : 2;
}
@ -905,8 +905,8 @@ int SdBaseFile::peek() {
// print uint8_t with width 2
static void print2u(uint8_t v) {
if (v < 10) MYSERIAL.write('0');
MYSERIAL.print(v, DEC);
if (v < 10) MYSERIAL0.write('0');
MYSERIAL0.print(v, DEC);
}
/**
@ -927,10 +927,10 @@ static void print2u(uint8_t v) {
* \param[in] fatDate The date field from a directory entry.
*/
void SdBaseFile::printFatDate(uint16_t fatDate) {
MYSERIAL.print(FAT_YEAR(fatDate));
MYSERIAL.write('-');
MYSERIAL0.print(FAT_YEAR(fatDate));
MYSERIAL0.write('-');
print2u(FAT_MONTH(fatDate));
MYSERIAL.write('-');
MYSERIAL0.write('-');
print2u(FAT_DAY(fatDate));
}
@ -945,9 +945,9 @@ void SdBaseFile::printFatDate(uint16_t fatDate) {
*/
void SdBaseFile::printFatTime(uint16_t fatTime) {
print2u(FAT_HOUR(fatTime));
MYSERIAL.write(':');
MYSERIAL0.write(':');
print2u(FAT_MINUTE(fatTime));
MYSERIAL.write(':');
MYSERIAL0.write(':');
print2u(FAT_SECOND(fatTime));
}
@ -959,7 +959,7 @@ void SdBaseFile::printFatTime(uint16_t fatTime) {
bool SdBaseFile::printName() {
char name[FILENAME_LENGTH];
if (!getFilename(name)) return false;
MYSERIAL.print(name);
MYSERIAL0.print(name);
return true;
}

View file

@ -63,7 +63,7 @@ int SdFatUtil::FreeRam() {
* \param[in] str Pointer to string stored in flash memory.
*/
void SdFatUtil::print_P(PGM_P str) {
for (uint8_t c; (c = pgm_read_byte(str)); str++) MYSERIAL.write(c);
for (uint8_t c; (c = pgm_read_byte(str)); str++) MYSERIAL0.write(c);
}
/**
@ -72,7 +72,7 @@ void SdFatUtil::print_P(PGM_P str) {
* \param[in] pr Print object for output.
* \param[in] str Pointer to string stored in flash memory.
*/
void SdFatUtil::println_P(PGM_P str) { print_P(str); MYSERIAL.println(); }
void SdFatUtil::println_P(PGM_P str) { print_P(str); MYSERIAL0.println(); }
/**
* %Print a string in flash memory to Serial.

View file

@ -474,9 +474,9 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = f
for (uint8_t y = 0; y < 28; y++) { // always print pin name
temp_char = pgm_read_byte(name_mem_pointer + y);
if (temp_char != 0)
MYSERIAL.write(temp_char);
MYSERIAL0.write(temp_char);
else {
for (uint8_t i = 0; i < 28 - y; i++) MYSERIAL.write(' ');
for (uint8_t i = 0; i < 28 - y; i++) MYSERIAL0.write(' ');
break;
}
}

View file

@ -33,4 +33,4 @@ void serial_echopair_P(const char* s_P, float v) { serialprintPGM(s_P);
void serial_echopair_P(const char* s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) MYSERIAL.write(' '); }
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) MYSERIAL0.write(' '); }

View file

@ -29,30 +29,30 @@
#include <HardwareSerial.h>
#if ENABLED(BLUETOOTH)
extern HardwareSerial bluetoothSerial;
#define MYSERIAL bluetoothSerial
#define MYSERIAL0 bluetoothSerial
#else
#define MYSERIAL Serial
#define MYSERIAL0 Serial
#endif // BLUETOOTH
#else
#include "MarlinSerial.h"
#define MYSERIAL customizedSerial
#define MYSERIAL0 customizedSerial
#endif
extern const char echomagic[] PROGMEM;
extern const char errormagic[] PROGMEM;
#define SERIAL_CHAR(x) ((void)MYSERIAL.write(x))
#define SERIAL_CHAR(x) ((void)MYSERIAL0.write(x))
#define SERIAL_EOL() SERIAL_CHAR('\n')
#define SERIAL_PRINT(x,b) MYSERIAL.print(x,b)
#define SERIAL_PRINTLN(x,b) MYSERIAL.println(x,b)
#define SERIAL_PRINTF(args...) MYSERIAL.printf(args)
#define SERIAL_PRINT(x,b) MYSERIAL0.print(x,b)
#define SERIAL_PRINTLN(x,b) MYSERIAL0.println(x,b)
#define SERIAL_PRINTF(args...) MYSERIAL0.printf(args)
#define SERIAL_PROTOCOLCHAR(x) SERIAL_CHAR(x)
#define SERIAL_PROTOCOL(x) MYSERIAL.print(x)
#define SERIAL_PROTOCOL_F(x,y) MYSERIAL.print(x,y)
#define SERIAL_PROTOCOL(x) MYSERIAL0.print(x)
#define SERIAL_PROTOCOL_F(x,y) MYSERIAL0.print(x,y)
#define SERIAL_PROTOCOLPGM(x) serialprintPGM(PSTR(x))
#define SERIAL_PROTOCOLLN(x) do{ MYSERIAL.print(x); SERIAL_EOL(); }while(0)
#define SERIAL_PROTOCOLLN(x) do{ MYSERIAL0.print(x); SERIAL_EOL(); }while(0)
#define SERIAL_PROTOCOLLNPGM(x) serialprintPGM(PSTR(x "\n"))
#define SERIAL_PROTOCOLPAIR(name, value) serial_echopair_P(PSTR(name),(value))
#define SERIAL_PROTOCOLLNPAIR(name, value) do{ SERIAL_PROTOCOLPAIR(name, value); SERIAL_EOL(); }while(0)
@ -100,7 +100,7 @@ void serial_spaces(uint8_t count);
// Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
//
FORCE_INLINE void serialprintPGM(const char* str) {
while (char ch = pgm_read_byte(str++)) MYSERIAL.write(ch);
while (char ch = pgm_read_byte(str++)) MYSERIAL0.write(ch);
}
#endif // __SERIAL_H__

View file

@ -336,8 +336,8 @@ class Stepper {
}
if (timer < 100) { // (20kHz - this should never happen)
timer = 100;
MYSERIAL.print(MSG_STEPPER_TOO_HIGH);
MYSERIAL.println(step_rate);
MYSERIAL0.print(MSG_STEPPER_TOO_HIGH);
MYSERIAL0.println(step_rate);
}
return timer;
}

View file

@ -199,7 +199,7 @@
if (map_type == 1 && i < GRID_MAX_POINTS_X - 1) SERIAL_CHAR(',');
#if TX_BUFFER_SIZE > 0
MYSERIAL.flushTX();
MYSERIAL0.flushTX();
#endif
safe_delay(15);
if (map_type == 0) {

View file

@ -763,9 +763,7 @@
const float measured_z = probe_pt(rawx, rawy, stow_probe, g29_verbose_level); // TODO: Needs error handling
z_values[location.x_index][location.y_index] = measured_z;
}
MYSERIAL.flush(); // G29 P2's take a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
} while (location.x_index >= 0 && --max_iterations);
@ -904,9 +902,7 @@
SERIAL_PROTOCOL_F(z_values[location.x_index][location.y_index], 6);
SERIAL_EOL();
}
MYSERIAL.flush(); // G29 P2's take a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
} while (location.x_index >= 0 && location.y_index >= 0);
if (do_ubl_mesh_map) display_map(g29_map_type); // show user where we're probing
@ -1418,9 +1414,7 @@
do_blocking_move_to_z(h_offset + new_z); // Move the nozzle as the point is edited
#endif
idle();
MYSERIAL.flush(); // G29 P2's take a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
} while (!is_lcd_clicked());
if (!lcd_map_control) lcd_return_to_status();