Rename enquecommandf() into enquecommandf_P()

This commit is contained in:
Guðni Már Gilbert 2023-02-28 21:44:34 +00:00 committed by DRracer
parent 7e119f733f
commit b9ce7637df
6 changed files with 37 additions and 37 deletions

View File

@ -3594,7 +3594,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
// Recover feed rate // Recover feed rate
feedmultiply = feedmultiplyBckp; feedmultiply = feedmultiplyBckp;
enquecommandf(MSG_M220, feedmultiplyBckp); enquecommandf_P(MSG_M220, feedmultiplyBckp);
} }
lcd_setstatuspgm(MSG_WELCOME); lcd_setstatuspgm(MSG_WELCOME);
@ -10776,16 +10776,16 @@ void recover_print(uint8_t automatic) {
// and second also so one may remove the excess priming material. // and second also so one may remove the excess priming material.
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 1) if(eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 1)
{ {
enquecommandf(PSTR("G1 Z%.3f F800"), current_position[Z_AXIS] + 25); enquecommandf_P(PSTR("G1 Z%.3f F800"), current_position[Z_AXIS] + 25);
} }
// Home X and Y axes. Homing just X and Y shall not touch the babystep and the world2machine // Home X and Y axes. Homing just X and Y shall not touch the babystep and the world2machine
// transformation status. G28 will not touch Z when MBL is off. // transformation status. G28 will not touch Z when MBL is off.
enquecommand_P(PSTR("G28 X Y")); enquecommand_P(PSTR("G28 X Y"));
// Set the target bed and nozzle temperatures and wait. // Set the target bed and nozzle temperatures and wait.
enquecommandf(PSTR("M104 S%d"), target_temperature[active_extruder]); enquecommandf_P(PSTR("M104 S%d"), target_temperature[active_extruder]);
enquecommandf(PSTR("M140 S%d"), target_temperature_bed); enquecommandf_P(PSTR("M140 S%d"), target_temperature_bed);
enquecommandf(PSTR("M109 S%d"), target_temperature[active_extruder]); enquecommandf_P(PSTR("M109 S%d"), target_temperature[active_extruder]);
enquecommand_P(MSG_M83); //E axis relative mode enquecommand_P(MSG_M83); //E axis relative mode
// If not automatically recoreverd (long power loss) // If not automatically recoreverd (long power loss)
@ -10793,7 +10793,7 @@ void recover_print(uint8_t automatic) {
//Extrude some filament to stabilize the pressure //Extrude some filament to stabilize the pressure
enquecommand_P(PSTR("G1 E5 F120")); enquecommand_P(PSTR("G1 E5 F120"));
// Retract to be consistent with a short pause // Retract to be consistent with a short pause
enquecommandf(G1_E_F2700, default_retraction); enquecommandf_P(G1_E_F2700, default_retraction);
} }
printf_P(_N("After waiting for temp:\nCurrent pos X_AXIS:%.3f\nCurrent pos Y_AXIS:%.3f\n"), current_position[X_AXIS], current_position[Y_AXIS]); printf_P(_N("After waiting for temp:\nCurrent pos X_AXIS:%.3f\nCurrent pos Y_AXIS:%.3f\n"), current_position[X_AXIS], current_position[Y_AXIS]);
@ -10916,7 +10916,7 @@ void restore_print_from_eeprom(bool mbl_was_active) {
MYSERIAL.print(filename); MYSERIAL.print(filename);
strcat_P(filename, PSTR(".gco")); strcat_P(filename, PSTR(".gco"));
enquecommandf(MSG_M23, filename); enquecommandf_P(MSG_M23, filename);
uint32_t position = eeprom_read_dword((uint32_t*)(EEPROM_FILE_POSITION)); uint32_t position = eeprom_read_dword((uint32_t*)(EEPROM_FILE_POSITION));
SERIAL_ECHOPGM("Position read from eeprom:"); SERIAL_ECHOPGM("Position read from eeprom:");
MYSERIAL.println(position); MYSERIAL.println(position);
@ -10927,7 +10927,7 @@ void restore_print_from_eeprom(bool mbl_was_active) {
float pos_y = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4)); float pos_y = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4));
if (pos_x != X_COORD_INVALID) if (pos_x != X_COORD_INVALID)
{ {
enquecommandf(PSTR("G1 X%f Y%f F3000"), pos_x, pos_y); enquecommandf_P(PSTR("G1 X%f Y%f F3000"), pos_x, pos_y);
} }
// Enable MBL and switch to logical positioning // Enable MBL and switch to logical positioning
@ -10935,29 +10935,29 @@ void restore_print_from_eeprom(bool mbl_was_active) {
enquecommand_P(PSTR("PRUSA MBL V1")); enquecommand_P(PSTR("PRUSA MBL V1"));
// Move the Z axis down to the print, in logical coordinates. // Move the Z axis down to the print, in logical coordinates.
enquecommandf(PSTR("G1 Z%f"), eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z))); enquecommandf_P(PSTR("G1 Z%f"), eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)));
// Restore acceleration settings // Restore acceleration settings
float acceleration = eeprom_read_float((float*)(EEPROM_UVLO_ACCELL)); float acceleration = eeprom_read_float((float*)(EEPROM_UVLO_ACCELL));
float retract_acceleration = eeprom_read_float((float*)(EEPROM_UVLO_RETRACT_ACCELL)); float retract_acceleration = eeprom_read_float((float*)(EEPROM_UVLO_RETRACT_ACCELL));
float travel_acceleration = eeprom_read_float((float*)(EEPROM_UVLO_TRAVEL_ACCELL)); float travel_acceleration = eeprom_read_float((float*)(EEPROM_UVLO_TRAVEL_ACCELL));
enquecommandf(PSTR("M204 P%f R%f T%f"), acceleration, retract_acceleration, travel_acceleration); enquecommandf_P(PSTR("M204 P%f R%f T%f"), acceleration, retract_acceleration, travel_acceleration);
// Unretract. // Unretract.
enquecommandf(G1_E_F2700, default_retraction); enquecommandf_P(G1_E_F2700, default_retraction);
// Recover final E axis position and mode // Recover final E axis position and mode
float pos_e = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E)); float pos_e = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E));
enquecommandf(PSTR("G92 E%6.3f"), pos_e); enquecommandf_P(PSTR("G92 E%6.3f"), pos_e);
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS)) if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS))
enquecommand_P(PSTR("M82")); //E axis abslute mode enquecommand_P(PSTR("M82")); //E axis abslute mode
// Set the feedrates saved at the power panic. // Set the feedrates saved at the power panic.
enquecommandf(PSTR("G1 F%d"), feedrate_rec); enquecommandf_P(PSTR("G1 F%d"), feedrate_rec);
enquecommandf(MSG_M220, feedmultiply_rec); enquecommandf_P(MSG_M220, feedmultiply_rec);
// Set the fan speed saved at the power panic. // Set the fan speed saved at the power panic.
enquecommandf(PSTR("M106 S%u"), fan_speed_rec); enquecommandf_P(PSTR("M106 S%u"), fan_speed_rec);
// Set a position in the file. // Set a position in the file.
enquecommandf(PSTR("M26 S%lu"), position); enquecommandf_P(PSTR("M26 S%lu"), position);
enquecommand_P(PSTR("G4 S0")); enquecommand_P(PSTR("G4 S0"));
enquecommand_P(PSTR("PRUSA uvlo")); enquecommand_P(PSTR("PRUSA uvlo"));
} }
@ -11141,13 +11141,13 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
// A snprintf would have been a safer call, but since it is not used // A snprintf would have been a safer call, but since it is not used
// in the whole program, its implementation would bring more bytes to the total size // in the whole program, its implementation would bring more bytes to the total size
// The behavior of dtostrf 8,3 should be roughly the same as %-0.3 // The behavior of dtostrf 8,3 should be roughly the same as %-0.3
enquecommandf(G1_E_F2700, e_move); enquecommandf_P(G1_E_F2700, e_move);
} }
if(z_move) if(z_move)
{ {
// Then lift Z axis // Then lift Z axis
enquecommandf(PSTR("G1 Z%-0.3f F%-0.3f"), saved_pos[Z_AXIS] + z_move, homing_feedrate[Z_AXIS]); enquecommandf_P(PSTR("G1 Z%-0.3f F%-0.3f"), saved_pos[Z_AXIS] + z_move, homing_feedrate[Z_AXIS]);
} }
// If this call is invoked from the main Arduino loop() function, let the caller know that the command // If this call is invoked from the main Arduino loop() function, let the caller know that the command

View File

@ -650,7 +650,7 @@ void CardReader::checkautostart(bool force)
if(strncmp((char*)p.name,autoname,5)==0) if(strncmp((char*)p.name,autoname,5)==0)
{ {
// M23: Select SD file // M23: Select SD file
enquecommandf(MSG_M23, autoname); enquecommandf_P(MSG_M23, autoname);
// M24: Start/resume SD print // M24: Start/resume SD print
enquecommand_P(MSG_M24); enquecommand_P(MSG_M24);
found=true; found=true;

View File

@ -253,7 +253,7 @@ static const char bufferFull[] PROGMEM = "\" failed: Buffer full!";
static const char enqueingFront[] PROGMEM = "Enqueing to the front: \""; static const char enqueingFront[] PROGMEM = "Enqueing to the front: \"";
void enquecommandf(const char *fmt, ...) void enquecommandf_P(const char *fmt, ...)
{ {
// MAX_CMD_SIZE is 96, but for formatting // MAX_CMD_SIZE is 96, but for formatting
// string we usually don't need more than 30 bytes // string we usually don't need more than 30 bytes

View File

@ -64,7 +64,7 @@ extern bool cmd_buffer_empty();
/// @brief Variant of enquecommand which accepts a format string /// @brief Variant of enquecommand which accepts a format string
/// @param fmt a format string residing in PROGMEM /// @param fmt a format string residing in PROGMEM
void enquecommandf(const char *fmt, ...); void enquecommandf_P(const char *fmt, ...);
extern void enquecommand(const char *cmd, bool from_progmem = false); extern void enquecommand(const char *cmd, bool from_progmem = false);
extern void enquecommand_front(const char *cmd, bool from_progmem = false); extern void enquecommand_front(const char *cmd, bool from_progmem = false);
extern void repeatcommand_front(); extern void repeatcommand_front();

View File

@ -75,7 +75,7 @@ bool lay1cal_load_filament(uint8_t filament)
enquecommand_P(MSG_M702_NO_LIFT); enquecommand_P(MSG_M702_NO_LIFT);
} }
// perform a toolchange // perform a toolchange
enquecommandf(PSTR("T%d"), filament); enquecommandf_P(PSTR("T%d"), filament);
return true; return true;
} }
return false; return false;
@ -123,8 +123,8 @@ void lay1cal_intro_line(bool extraPurgeNeeded, float layer_height, float extrusi
else else
{ {
static const char fmt1[] PROGMEM = "G1 X%d E%-.3f F1000"; static const char fmt1[] PROGMEM = "G1 X%d E%-.3f F1000";
enquecommandf(fmt1, 60, count_e(layer_height, extrusion_width * 4.f, 60)); enquecommandf_P(fmt1, 60, count_e(layer_height, extrusion_width * 4.f, 60));
enquecommandf(fmt1, 100, count_e(layer_height, extrusion_width * 8.f, 40)); enquecommandf_P(fmt1, 100, count_e(layer_height, extrusion_width * 8.f, 40));
} }
} }
@ -160,14 +160,14 @@ void lay1cal_meander_start(float layer_height, float extrusion_width)
enquecommand_P(PSTR("G1 X50 Y155")); enquecommand_P(PSTR("G1 X50 Y155"));
static const char fmt1[] PROGMEM = "G1 Z%-.3f F7200"; static const char fmt1[] PROGMEM = "G1 Z%-.3f F7200";
enquecommandf(fmt1, layer_height); enquecommandf_P(fmt1, layer_height);
enquecommand_P(PSTR("G1 F1080")); enquecommand_P(PSTR("G1 F1080"));
enquecommandf(extrude_fmt, 75, 155, count_e(layer_height, extrusion_width * 4.f, 25)); enquecommandf_P(extrude_fmt, 75, 155, count_e(layer_height, extrusion_width * 4.f, 25));
enquecommandf(extrude_fmt, 100, 155, count_e(layer_height, extrusion_width * 2.f, 25)); enquecommandf_P(extrude_fmt, 100, 155, count_e(layer_height, extrusion_width * 2.f, 25));
enquecommandf(extrude_fmt, 200, 155, count_e(layer_height, extrusion_width, 100)); enquecommandf_P(extrude_fmt, 200, 155, count_e(layer_height, extrusion_width, 100));
enquecommandf(extrude_fmt, 200, 135, count_e(layer_height, extrusion_width, 20)); enquecommandf_P(extrude_fmt, 200, 135, count_e(layer_height, extrusion_width, 20));
} }
//! @brief Print meander //! @brief Print meander
@ -183,11 +183,11 @@ void lay1cal_meander(float layer_height, float extrusion_width)
uint8_t x_pos = 50; uint8_t x_pos = 50;
for(uint8_t i = 0; i <= 4; ++i) for(uint8_t i = 0; i <= 4; ++i)
{ {
enquecommandf(extrude_fmt, x_pos, y_pos, long_extrusion); enquecommandf_P(extrude_fmt, x_pos, y_pos, long_extrusion);
y_pos -= short_length; y_pos -= short_length;
enquecommandf(extrude_fmt, x_pos, y_pos, short_extrusion); enquecommandf_P(extrude_fmt, x_pos, y_pos, short_extrusion);
x_pos += long_length; x_pos += long_length;
@ -212,10 +212,10 @@ void lay1cal_square(uint8_t step, float layer_height, float extrusion_width)
for (uint8_t i = step; i < step+4; ++i) for (uint8_t i = step; i < step+4; ++i)
{ {
enquecommandf(fmt1, 70, (35 - i*short_length * 2), long_extrusion); enquecommandf_P(fmt1, 70, (35 - i*short_length * 2), long_extrusion);
enquecommandf(fmt1, 70, (35 - (2 * i + 1)*short_length), short_extrusion); enquecommandf_P(fmt1, 70, (35 - (2 * i + 1)*short_length), short_extrusion);
enquecommandf(fmt1, 50, (35 - (2 * i + 1)*short_length), long_extrusion); enquecommandf_P(fmt1, 50, (35 - (2 * i + 1)*short_length), long_extrusion);
enquecommandf(fmt1, 50, (35 - (i + 1)*short_length * 2), short_extrusion); enquecommandf_P(fmt1, 50, (35 - (i + 1)*short_length * 2), short_extrusion);
} }
} }

View File

@ -900,7 +900,7 @@ void lcd_commands()
if (lcd_commands_step == 3 && !blocks_queued()) { //PID calibration if (lcd_commands_step == 3 && !blocks_queued()) { //PID calibration
preparePidTuning(); // ensure we don't move to the next step early preparePidTuning(); // ensure we don't move to the next step early
// setting the correct target temperature (for visualization) is done in PID_autotune // setting the correct target temperature (for visualization) is done in PID_autotune
enquecommandf(PSTR("M303 E0 S%3u"), pid_temp); enquecommandf_P(PSTR("M303 E0 S%3u"), pid_temp);
lcd_setstatuspgm(_i("PID cal."));////MSG_PID_RUNNING c=20 lcd_setstatuspgm(_i("PID cal."));////MSG_PID_RUNNING c=20
lcd_commands_step = 2; lcd_commands_step = 2;
} }
@ -909,7 +909,7 @@ void lcd_commands()
lcd_setstatuspgm(_i("PID cal. finished"));////MSG_PID_FINISHED c=20 lcd_setstatuspgm(_i("PID cal. finished"));////MSG_PID_FINISHED c=20
setTargetHotend(0); setTargetHotend(0);
if (_Kp != 0 || _Ki != 0 || _Kd != 0) { if (_Kp != 0 || _Ki != 0 || _Kd != 0) {
enquecommandf(PSTR("M301 P%.2f I%.2f D%.2f"), _Kp, _Ki, _Kd); enquecommandf_P(PSTR("M301 P%.2f I%.2f D%.2f"), _Kp, _Ki, _Kd);
enquecommand_P(MSG_M500); enquecommand_P(MSG_M500);
} }
else { else {