@@ -467,22 +467,16 @@ void serial_echopair_P(const char *s_P, double v)
467
467
void serial_echopair_P(const char *s_P, unsigned long v)
468
468
{ serialprintPGM(s_P); SERIAL_ECHO(v); }
469
469
470
- /*FORCE_INLINE*/ void serialprintPGM(const char *str)
471
- {
472
- #if 0
473
- char ch=pgm_read_byte(str);
474
- while(ch)
475
- {
476
- MYSERIAL.write(ch);
477
- ch=pgm_read_byte(++str);
478
- }
479
- #else
480
- // hmm, same size as the above version, the compiler did a good job optimizing the above
481
- while( uint8_t ch = pgm_read_byte(str) ){
482
- MYSERIAL.write((char)ch);
483
- ++str;
484
- }
485
- #endif
470
+ void serialprintPGM(const char *str) {
471
+ while(uint8_t ch = pgm_read_byte(str)) {
472
+ MYSERIAL.write((char)ch);
473
+ ++str;
474
+ }
475
+ }
476
+
477
+ void serialprintlnPGM(const char *str) {
478
+ serialprintPGM(str);
479
+ MYSERIAL.println();
486
480
}
487
481
488
482
#ifdef SDSUPPORT
@@ -3676,9 +3670,7 @@ void gcode_M114()
3676
3670
SERIAL_PROTOCOLPGM(" Z:");
3677
3671
SERIAL_PROTOCOL(float(st_get_position(Z_AXIS)) / cs.axis_steps_per_unit[Z_AXIS]);
3678
3672
SERIAL_PROTOCOLPGM(" E:");
3679
- SERIAL_PROTOCOL(float(st_get_position(E_AXIS)) / cs.axis_steps_per_unit[E_AXIS]);
3680
-
3681
- SERIAL_PROTOCOLLN();
3673
+ SERIAL_PROTOCOLLN(float(st_get_position(E_AXIS)) / cs.axis_steps_per_unit[E_AXIS]);
3682
3674
}
3683
3675
3684
3676
#if (defined(FANCHECK) && (((defined(TACH_0) && (TACH_0 >-1)) || (defined(TACH_1) && (TACH_1 > -1)))))
@@ -6158,8 +6150,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
6158
6150
SERIAL_PROTOCOL('.');
6159
6151
SERIAL_PROTOCOL(uint8_t(ip[2]));
6160
6152
SERIAL_PROTOCOL('.');
6161
- SERIAL_PROTOCOL(uint8_t(ip[3]));
6162
- SERIAL_PROTOCOLLN();
6153
+ SERIAL_PROTOCOLLN(uint8_t(ip[3]));
6163
6154
} else {
6164
6155
SERIAL_PROTOCOLPGM("?Toshiba FlashAir GetIP failed\n");
6165
6156
}
@@ -7730,8 +7721,7 @@ SERIAL_PROTOCOLPGM("\n\n");
7730
7721
SERIAL_PROTOCOL(" Servo ");
7731
7722
SERIAL_PROTOCOL(servo_index);
7732
7723
SERIAL_PROTOCOL(": ");
7733
- SERIAL_PROTOCOL(servos[servo_index].read());
7734
- SERIAL_PROTOCOLLN();
7724
+ SERIAL_PROTOCOLLN(servos[servo_index].read());
7735
7725
}
7736
7726
}
7737
7727
break;
@@ -7796,14 +7786,14 @@ SERIAL_PROTOCOLPGM("\n\n");
7796
7786
7797
7787
updatePID();
7798
7788
SERIAL_PROTOCOLRPGM(MSG_OK);
7799
- SERIAL_PROTOCOL (" p:");
7789
+ SERIAL_PROTOCOLPGM (" p:");
7800
7790
SERIAL_PROTOCOL(cs.Kp);
7801
- SERIAL_PROTOCOL (" i:");
7791
+ SERIAL_PROTOCOLPGM (" i:");
7802
7792
SERIAL_PROTOCOL(unscalePID_i(cs.Ki));
7803
- SERIAL_PROTOCOL (" d:");
7793
+ SERIAL_PROTOCOLPGM (" d:");
7804
7794
SERIAL_PROTOCOL(unscalePID_d(cs.Kd));
7805
7795
#ifdef PID_ADD_EXTRUSION_RATE
7806
- SERIAL_PROTOCOL (" c:");
7796
+ SERIAL_PROTOCOLPGM (" c:");
7807
7797
//Kc does not have scaling applied above, or in resetting defaults
7808
7798
SERIAL_PROTOCOL(Kc);
7809
7799
#endif
@@ -7834,13 +7824,12 @@ SERIAL_PROTOCOLPGM("\n\n");
7834
7824
7835
7825
updatePID();
7836
7826
SERIAL_PROTOCOLRPGM(MSG_OK);
7837
- SERIAL_PROTOCOL (" p:");
7827
+ SERIAL_PROTOCOLPGM (" p:");
7838
7828
SERIAL_PROTOCOL(cs.bedKp);
7839
- SERIAL_PROTOCOL (" i:");
7829
+ SERIAL_PROTOCOLPGM (" i:");
7840
7830
SERIAL_PROTOCOL(unscalePID_i(cs.bedKi));
7841
- SERIAL_PROTOCOL(" d:");
7842
- SERIAL_PROTOCOL(unscalePID_d(cs.bedKd));
7843
- SERIAL_PROTOCOLLN();
7831
+ SERIAL_PROTOCOLPGM(" d:");
7832
+ SERIAL_PROTOCOLLN(unscalePID_d(cs.bedKd));
7844
7833
}
7845
7834
break;
7846
7835
#endif //PIDTEMP
@@ -8272,8 +8261,7 @@ SERIAL_PROTOCOLPGM("\n\n");
8272
8261
LCD_MESSAGERPGM(_T(MSG_PLEASE_WAIT));
8273
8262
8274
8263
SERIAL_PROTOCOLPGM("Wait for PINDA target temperature:");
8275
- SERIAL_PROTOCOL(set_target_pinda);
8276
- SERIAL_PROTOCOLLN();
8264
+ SERIAL_PROTOCOLLN(set_target_pinda);
8277
8265
8278
8266
codenum = _millis();
8279
8267
cancel_heatup = false;
@@ -8315,12 +8303,13 @@ SERIAL_PROTOCOLPGM("\n\n");
8315
8303
- `S` - Microsteps
8316
8304
- `I` - Table index
8317
8305
*/
8318
- case 861:
8306
+ case 861: {
8307
+ const char * const _header = PSTR("index, temp, ustep, um");
8319
8308
if (code_seen('?')) { // ? - Print out current EEPROM offset values
8320
- uint8_t cal_status = calibration_status_pinda();
8321
8309
int16_t usteps = 0;
8322
- cal_status ? SERIAL_PROTOCOLLN("PINDA cal status: 1") : SERIAL_PROTOCOLLN("PINDA cal status: 0");
8323
- SERIAL_PROTOCOLLN("index, temp, ustep, um");
8310
+ SERIAL_PROTOCOLPGM("PINDA cal status: ");
8311
+ SERIAL_PROTOCOLLN(calibration_status_pinda());
8312
+ SERIAL_PROTOCOLLNRPGM(_header);
8324
8313
for (uint8_t i = 0; i < 6; i++)
8325
8314
{
8326
8315
if(i > 0) {
@@ -8333,8 +8322,7 @@ SERIAL_PROTOCOLPGM("\n\n");
8333
8322
SERIAL_PROTOCOLPGM(", ");
8334
8323
SERIAL_PROTOCOL(usteps);
8335
8324
SERIAL_PROTOCOLPGM(", ");
8336
- SERIAL_PROTOCOL(mm * 1000);
8337
- SERIAL_PROTOCOLLN();
8325
+ SERIAL_PROTOCOLLN(mm * 1000);
8338
8326
}
8339
8327
}
8340
8328
else if (code_seen('!')) { // ! - Set factory default values
@@ -8349,24 +8337,24 @@ SERIAL_PROTOCOLPGM("\n\n");
8349
8337
eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + 3, z_shift);
8350
8338
z_shift = 120; //60C - 300um - 120usteps
8351
8339
eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + 4, z_shift);
8352
- SERIAL_PROTOCOLLN ("factory restored");
8340
+ SERIAL_PROTOCOLLNPGM ("factory restored");
8353
8341
}
8354
8342
else if (code_seen('Z')) { // Z - Set all values to 0 (effectively disabling PINDA temperature compensation)
8355
8343
eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1);
8356
8344
int16_t z_shift = 0;
8357
8345
for (uint8_t i = 0; i < 5; i++) {
8358
8346
eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + i, z_shift);
8359
8347
}
8360
- SERIAL_PROTOCOLLN ("zerorized");
8348
+ SERIAL_PROTOCOLLNPGM ("zerorized");
8361
8349
}
8362
8350
else if (code_seen('S')) { // Sxxx Iyyy - Set compensation ustep value S for compensation table index I
8363
8351
int16_t usteps = code_value_short();
8364
8352
if (code_seen('I')) {
8365
8353
uint8_t index = code_value_uint8();
8366
8354
if (index < 5) {
8367
8355
eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + index, usteps);
8368
- SERIAL_PROTOCOLLN("OK" );
8369
- SERIAL_PROTOCOLLN("index, temp, ustep, um" );
8356
+ SERIAL_PROTOCOLLNRPGM(MSG_OK );
8357
+ SERIAL_PROTOCOLLNRPGM(_header );
8370
8358
for (uint8_t i = 0; i < 6; i++)
8371
8359
{
8372
8360
usteps = 0;
@@ -8380,16 +8368,15 @@ SERIAL_PROTOCOLPGM("\n\n");
8380
8368
SERIAL_PROTOCOLPGM(", ");
8381
8369
SERIAL_PROTOCOL(usteps);
8382
8370
SERIAL_PROTOCOLPGM(", ");
8383
- SERIAL_PROTOCOL(mm * 1000);
8384
- SERIAL_PROTOCOLLN();
8371
+ SERIAL_PROTOCOLLN(mm * 1000);
8385
8372
}
8386
8373
}
8387
8374
}
8388
8375
}
8389
8376
else {
8390
- SERIAL_PROTOCOLPGM ("no valid command");
8377
+ SERIAL_PROTOCOLLNPGM ("no valid command");
8391
8378
}
8392
- break;
8379
+ } break;
8393
8380
8394
8381
#endif //PINDA_THERMISTOR
8395
8382
@@ -11462,8 +11449,7 @@ void restore_print_from_eeprom(bool mbl_was_active) {
11462
11449
enquecommand(cmd);
11463
11450
// Recover final E axis position and mode
11464
11451
float pos_e = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E));
11465
- sprintf_P(cmd, PSTR("G92 E"));
11466
- dtostrf(pos_e, 6, 3, cmd + strlen(cmd));
11452
+ sprintf_P(cmd, PSTR("G92 E%6.3f"), pos_e);
11467
11453
enquecommand(cmd);
11468
11454
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS))
11469
11455
enquecommand_P(PSTR("M82")); //E axis abslute mode
@@ -11957,7 +11943,7 @@ void M600_wait_for_user(float HotendTempBckp) {
11957
11943
else {
11958
11944
counterBeep = 20; //beeper will be inactive during waiting for nozzle preheat
11959
11945
lcd_set_cursor(1, 4);
11960
- lcd_print(ftostr3( degHotend(active_extruder) ));
11946
+ lcd_printf_P(PSTR("%3d"), (int16_t) degHotend(active_extruder));
11961
11947
}
11962
11948
break;
11963
11949
0 commit comments