Messages: more newlines needed.

The recent switch to send 'ok' postponed requires also sending a
newline in a few places, because this 'ok' is no longer at the
start of the line. Now it appears in its own line.

Some whitespace at line end was removed in heater.c.

Costs 14 bytes binary size on AVR.
This commit is contained in:
Markus Hitter 2015-08-07 14:52:34 +02:00
parent 9075459659
commit 9c194b42f6
5 changed files with 28 additions and 25 deletions

View File

@ -89,7 +89,6 @@ void queue_step() {
} }
else { else {
temp_print(TEMP_SENSOR_none); temp_print(TEMP_SENSOR_none);
serial_writechar('\n');
} }
} }
else { else {
@ -180,7 +179,7 @@ void next_move() {
/// DEBUG - print queue. /// DEBUG - print queue.
/// Qt/hs format, t is tail, h is head, s is F/full, E/empty or neither /// Qt/hs format, t is tail, h is head, s is F/full, E/empty or neither
void print_queue() { void print_queue() {
sersendf_P(PSTR("Q%d/%d%c"), mb_tail, mb_head, (queue_full()?'F':(queue_empty()?'E':' '))); sersendf_P(PSTR("Queue: %d/%d%c\n"), mb_tail, mb_head, (queue_full()?'F':(queue_empty()?'E':' ')));
} }
/// dump queue for emergency stop. /// dump queue for emergency stop.

View File

@ -335,7 +335,7 @@ void process_gcode_command() {
// unknown gcode: spit an error // unknown gcode: spit an error
default: default:
sersendf_P(PSTR("E: Bad G-code %d"), next_target.G); sersendf_P(PSTR("E: Bad G-code %d\n"), next_target.G);
// newline is sent from gcode_parse after we return // newline is sent from gcode_parse after we return
return; return;
} }
@ -614,21 +614,23 @@ void process_gcode_command() {
queue_wait(); queue_wait();
#endif #endif
update_current_position(); update_current_position();
sersendf_P(PSTR("X:%lq,Y:%lq,Z:%lq,E:%lq,F:%lu"), sersendf_P(PSTR("X:%lq,Y:%lq,Z:%lq,E:%lq,F:%lu\n"),
current_position.axis[X], current_position.axis[Y], current_position.axis[X], current_position.axis[Y],
current_position.axis[Z], current_position.axis[E], current_position.axis[Z], current_position.axis[E],
current_position.F); current_position.F);
if (DEBUG_POSITION && (debug_flags & DEBUG_POSITION)) { if (DEBUG_POSITION && (debug_flags & DEBUG_POSITION)) {
sersendf_P(PSTR(",c:%lu}\nEndpoint: X:%ld,Y:%ld,Z:%ld,E:%ld,F:%lu,c:%lu}"), sersendf_P(PSTR("Endpoint: X:%ld,Y:%ld,Z:%ld,E:%ld,F:%lu,c:%lu}\n"),
movebuffer[mb_tail].c, movebuffer[mb_tail].endpoint.axis[X], movebuffer[mb_tail].endpoint.axis[X],
movebuffer[mb_tail].endpoint.axis[Y], movebuffer[mb_tail].endpoint.axis[Z], movebuffer[mb_tail].endpoint.axis[Y],
movebuffer[mb_tail].endpoint.axis[E], movebuffer[mb_tail].endpoint.F, movebuffer[mb_tail].endpoint.axis[Z],
#ifdef ACCELERATION_REPRAP movebuffer[mb_tail].endpoint.axis[E],
movebuffer[mb_tail].end_c movebuffer[mb_tail].endpoint.F,
#else #ifdef ACCELERATION_REPRAP
movebuffer[mb_tail].c movebuffer[mb_tail].end_c
#endif #else
movebuffer[mb_tail].c
#endif
); );
print_queue(); print_queue();
} }
@ -648,7 +650,7 @@ void process_gcode_command() {
//? FIRMWARE_NAME:Teacup FIRMWARE_URL:http://github.com/traumflug/Teacup_Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1 TEMP_SENSOR_COUNT:1 HEATER_COUNT:1 //? FIRMWARE_NAME:Teacup FIRMWARE_URL:http://github.com/traumflug/Teacup_Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1 TEMP_SENSOR_COUNT:1 HEATER_COUNT:1
//? //?
sersendf_P(PSTR("FIRMWARE_NAME:Teacup FIRMWARE_URL:http://github.com/traumflug/Teacup_Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:%d TEMP_SENSOR_COUNT:%d HEATER_COUNT:%d"), 1, NUM_TEMP_SENSORS, NUM_HEATERS); sersendf_P(PSTR("FIRMWARE_NAME:Teacup FIRMWARE_URL:http://github.com/traumflug/Teacup_Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:%d TEMP_SENSOR_COUNT:%d HEATER_COUNT:%d\n"), 1, NUM_TEMP_SENSORS, NUM_HEATERS);
// newline is sent from gcode_parse after we return // newline is sent from gcode_parse after we return
break; break;
@ -700,10 +702,11 @@ void process_gcode_command() {
#if ! (defined(X_MIN_PIN) || defined(X_MAX_PIN) || \ #if ! (defined(X_MIN_PIN) || defined(X_MAX_PIN) || \
defined(Y_MIN_PIN) || defined(Y_MAX_PIN) || \ defined(Y_MIN_PIN) || defined(Y_MAX_PIN) || \
defined(Z_MIN_PIN) || defined(Z_MAX_PIN)) defined(Z_MIN_PIN) || defined(Z_MAX_PIN))
sersendf_P(PSTR("no endstops defined")); sersendf_P(PSTR("No endstops defined."));
#endif #endif
} }
endstops_off(); endstops_off();
serial_writechar('\n');
break; break;
#ifdef EECONFIG #ifdef EECONFIG

View File

@ -145,8 +145,8 @@ void heater_init() {
TCCR4D = MASK(WGM40); // Phase correct TCCR4D = MASK(WGM40); // Phase correct
TCCR4B = MASK(CS40); // no prescaler TCCR4B = MASK(CS40); // no prescaler
#ifndef FAST_PWM #ifndef FAST_PWM
TCCR4B = MASK(CS40) | MASK(CS42) | MASK(CS43); // 16 MHz / 1024 / 256 TCCR4B = MASK(CS40) | MASK(CS42) | MASK(CS43); // 16 MHz / 1024 / 256
//TCCR4B = MASK(CS40) | MASK(CS41) | MASK(CS43); // 16 MHz / 4096 / 256 //TCCR4B = MASK(CS40) | MASK(CS41) | MASK(CS43); // 16 MHz / 4096 / 256
#endif #endif
TC4H = 0; // clear high bits TC4H = 0; // clear high bits
OCR4C = 0xff; // 8 bit max count at top before reset OCR4C = 0xff; // 8 bit max count at top before reset
@ -157,7 +157,7 @@ void heater_init() {
TIMSK4 = 0; TIMSK4 = 0;
OCR4A = 0; OCR4A = 0;
OCR4B = 0; OCR4B = 0;
#ifdef OCR4D #ifdef OCR4D
OCR4D = 0; OCR4D = 0;
#endif #endif
#endif #endif
@ -222,7 +222,7 @@ void heater_init() {
case (uint16_t) &OCR4B: case (uint16_t) &OCR4B:
TCCR4A |= MASK(COM4B1); TCCR4A |= MASK(COM4B1);
break; break;
#ifdef OCR4D #ifdef OCR4D
case (uint16_t) &OCR4D: case (uint16_t) &OCR4D:
TCCR4C |= MASK(COM4D1); TCCR4C |= MASK(COM4D1);
break; break;
@ -544,6 +544,6 @@ void heater_save_settings() {
\param i index of heater to send info for \param i index of heater to send info for
*/ */
void heater_print(uint16_t i) { void heater_print(uint16_t i) {
sersendf_P(PSTR("P:%ld I:%ld D:%ld Ilim:%u crc:%u "), heaters_pid[i].p_factor, heaters_pid[i].i_factor, heaters_pid[i].d_factor, heaters_pid[i].i_limit, crc_block(&heaters_pid[i].p_factor, 14)); sersendf_P(PSTR("P:%ld I:%ld D:%ld Ilim:%u crc:%u\n"), heaters_pid[i].p_factor, heaters_pid[i].i_factor, heaters_pid[i].d_factor, heaters_pid[i].i_limit, crc_block(&heaters_pid[i].p_factor, 14));
} }
#endif #endif

9
sd.c
View File

@ -27,7 +27,7 @@ void sd_init(void) {
void sd_mount(void) { void sd_mount(void) {
result = pf_mount(&sdfile); result = pf_mount(&sdfile);
if (result != FR_OK) if (result != FR_OK)
sersendf_P(PSTR("E: SD init failed. (%su)"), result); sersendf_P(PSTR("E: SD init failed. (%su)\n"), result);
} }
/** Unmount the SD card. /** Unmount the SD card.
@ -51,7 +51,6 @@ void sd_list(const char* path) {
FILINFO fno; FILINFO fno;
DIR dir; DIR dir;
serial_writechar('\n');
result = pf_opendir(&dir, path); result = pf_opendir(&dir, path);
if (result == FR_OK) { if (result == FR_OK) {
for (;;) { for (;;) {
@ -66,7 +65,7 @@ void sd_list(const char* path) {
} }
} }
else { else {
sersendf_P(PSTR("E: failed to open dir. (%su)"), result); sersendf_P(PSTR("E: failed to open dir. (%su)\n"), result);
} }
} }
@ -80,7 +79,7 @@ void sd_list(const char* path) {
void sd_open(const char* filename) { void sd_open(const char* filename) {
result = pf_open(filename); result = pf_open(filename);
if (result != FR_OK) { if (result != FR_OK) {
sersendf_P(PSTR("E: failed to open file. (%su)"), result); sersendf_P(PSTR("E: failed to open file. (%su)\n"), result);
} }
} }
@ -108,7 +107,7 @@ uint8_t sd_read_gcode_line(void) {
return 1; return 1;
} }
else if (result != FR_OK) { else if (result != FR_OK) {
sersendf_P(PSTR("E: failed to parse from file. (%su)"), result); sersendf_P(PSTR("E: failed to parse from file. (%su)\n"), result);
return 1; return 1;
} }

2
temp.c
View File

@ -17,6 +17,7 @@
#include "simulator.h" #include "simulator.h"
#include "arduino.h" #include "arduino.h"
#include "serial.h"
#include "debug.h" #include "debug.h"
#ifndef EXTRUDER #ifndef EXTRUDER
#include "sersendf.h" #include "sersendf.h"
@ -387,5 +388,6 @@ void temp_print(temp_sensor_t index) {
sersendf_P(PSTR("T[%su]:"), index); sersendf_P(PSTR("T[%su]:"), index);
single_temp_print(index); single_temp_print(index);
} }
serial_writechar('\n');
} }
#endif #endif