🎨 Apply F() to G-code suite and queue

This commit is contained in:
Scott Lahteine 2021-09-25 21:11:31 -05:00 committed by Scott Lahteine
parent 2b9ae0cc33
commit 46c53f6730
39 changed files with 136 additions and 134 deletions

View File

@ -357,15 +357,15 @@ void startOrResumeJob() {
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
#ifdef EVENT_GCODE_SD_ABORT
queue.inject_P(PSTR(EVENT_GCODE_SD_ABORT));
queue.inject(F(EVENT_GCODE_SD_ABORT));
#endif
TERN_(PASSWORD_AFTER_SD_PRINT_ABORT, password.lock_machine());
}
inline void finishSDPrinting() {
if (queue.enqueue_one_P(PSTR("M1001"))) { // Keep trying until it gets queued
marlin_state = MF_RUNNING; // Signal to stop trying
if (queue.enqueue_one(F("M1001"))) { // Keep trying until it gets queued
marlin_state = MF_RUNNING; // Signal to stop trying
TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished());
}
@ -493,7 +493,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
if (ELAPSED(ms, next_cub_ms_##N)) { \
next_cub_ms_##N = ms + CUB_DEBOUNCE_DELAY_##N; \
CODE; \
queue.inject_P(PSTR(BUTTON##N##_GCODE)); \
queue.inject(F(BUTTON##N##_GCODE)); \
TERN_(HAS_LCD_MENU, ui.quick_feedback()); \
} \
} \
@ -1521,7 +1521,7 @@ void setup() {
#ifdef STARTUP_COMMANDS
SETUP_LOG("STARTUP_COMMANDS");
queue.inject_P(PSTR(STARTUP_COMMANDS));
queue.inject(F(STARTUP_COMMANDS));
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)

View File

@ -842,7 +842,7 @@ void MMU2::set_filament_type(const uint8_t index, const uint8_t filamentType) {
}
void MMU2::filament_runout() {
queue.inject_P(PSTR(MMU2_FILAMENT_RUNOUT_SCRIPT));
queue.inject(F(MMU2_FILAMENT_RUNOUT_SCRIPT));
planner.synchronize();
}

View File

@ -109,7 +109,7 @@ void PrintJobRecovery::check() {
if (card.isMounted()) {
load();
if (!valid()) return cancel();
queue.inject_P(PSTR("M1000S"));
queue.inject(F("M1000S"));
}
}

View File

@ -140,7 +140,7 @@ void event_filament_runout(const uint8_t extruder) {
SERIAL_ECHOPGM("Runout Command: ");
SERIAL_ECHOLNPGM(FILAMENT_RUNOUT_SCRIPT);
#endif
queue.inject_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
queue.inject(F(FILAMENT_RUNOUT_SCRIPT));
#endif
}
}

View File

@ -103,7 +103,7 @@ void GcodeSuite::G29() {
mbl.reset();
mbl_probe_index = 0;
if (!ui.wait_for_move) {
queue.inject_P(parser.seen_test('N') ? PSTR("G28" TERN(CAN_SET_LEVELING_AFTER_G28, "L0", "") "\nG29S2") : PSTR("G29S2"));
queue.inject(parser.seen_test('N') ? F("G28" TERN(CAN_SET_LEVELING_AFTER_G28, "L0", "") "\nG29S2") : F("G29S2"));
TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
return;
}

View File

@ -126,7 +126,7 @@ bool GCodeQueue::RingBuffer::enqueue(const char *cmd, bool skip_ok/*=true*/
* Enqueue with Serial Echo
* Return true if the command was consumed
*/
bool GCodeQueue::enqueue_one(const char *cmd) {
bool GCodeQueue::enqueue_one(const char * const cmd) {
//SERIAL_ECHOLNPGM("enqueue_one(\"", cmd, "\")");
if (*cmd == 0 || ISEOL(*cmd)) return true;
@ -195,15 +195,15 @@ bool GCodeQueue::process_injected_command() {
* Enqueue and return only when commands are actually enqueued.
* Never call this from a G-code handler!
*/
void GCodeQueue::enqueue_one_now(const char *cmd) { while (!enqueue_one(cmd)) idle(); }
void GCodeQueue::enqueue_one_now(const char * const cmd) { while (!enqueue_one(cmd)) idle(); }
/**
* Attempt to enqueue a single G-code command
* and return 'true' if successful.
*/
bool GCodeQueue::enqueue_one_P(PGM_P const pgcode) {
bool GCodeQueue::enqueue_one(FSTR_P const fgcode) {
size_t i = 0;
PGM_P p = pgcode;
PGM_P p = FTOP(fgcode);
char c;
while ((c = pgm_read_byte(&p[i])) && c != '\n') i++;
char cmd[i + 1];

View File

@ -127,6 +127,7 @@ public:
* Aborts the current PROGMEM queue so only use for one or two commands.
*/
static inline void inject_P(PGM_P const pgcode) { injected_commands_P = pgcode; }
static inline void inject(FSTR_P const fgcode) { inject_P(FTOP(fgcode)); }
/**
* Enqueue command(s) to run from SRAM. Drained by process_injected_command().
@ -139,18 +140,19 @@ public:
/**
* Enqueue and return only when commands are actually enqueued
*/
static void enqueue_one_now(const char *cmd);
static void enqueue_one_now(const char * const cmd);
/**
* Attempt to enqueue a single G-code command
* and return 'true' if successful.
*/
static bool enqueue_one_P(PGM_P const pgcode);
static bool enqueue_one(FSTR_P const fgcode);
/**
* Enqueue from program memory and return only when commands are actually enqueued
*/
static void enqueue_now_P(PGM_P const cmd);
static void enqueue_now_P(PGM_P const pcmd);
static inline void enqueue_now(FSTR_P const fcmd) { enqueue_now_P(FTOP(fcmd)); }
/**
* Check whether there are any commands yet to be executed

View File

@ -2352,7 +2352,7 @@ void HMI_PauseOrStop() {
if (select_print.now == PRINT_PAUSE_RESUME) {
if (HMI_flag.select_flag) {
HMI_flag.pause_action = true;
queue.inject_P(PSTR("M25"));
queue.inject(F("M25"));
}
Goto_PrintProcess();
}
@ -2711,7 +2711,7 @@ void HMI_Prepare() {
#endif
break;
case PREPARE_CASE_DISA: queue.inject_P(PSTR("M84")); break;
case PREPARE_CASE_DISA: queue.inject(F("M84")); break;
case PREPARE_CASE_HOME: // Homing
checkkey = Last_Prepare;
@ -2729,7 +2729,7 @@ void HMI_Prepare() {
EncoderRate.enabled = true;
#else
// Apply workspace offset, making the current position 0,0,0
queue.inject_P(PSTR("G92 X0 Y0 Z0"));
queue.inject(F("G92 X0 Y0 Z0"));
HMI_AudioFeedback();
#endif
break;
@ -2944,7 +2944,7 @@ void HMI_Control() {
void HMI_Leveling() {
Popup_Window_Leveling();
DWIN_UpdateLCD();
queue.inject_P(PSTR("G28O\nG29"));
queue.inject(F("G28O\nG29"));
}
#endif
@ -3803,7 +3803,7 @@ void HMI_Tune() {
EncoderRate.enabled = true;
#else
// Apply workspace offset, making the current position 0,0,0
queue.inject_P(PSTR("G92 X0 Y0 Z0"));
queue.inject(F("G92 X0 Y0 Z0"));
HMI_AudioFeedback();
#endif
break;
@ -4112,7 +4112,7 @@ void EachMomentUpdate() {
TERN_(HAS_HEATED_BED, resume_bed_temp = thermalManager.degTargetBed());
thermalManager.disable_all_heaters();
#endif
queue.inject_P(PSTR("G1 F1200 X0 Y0"));
queue.inject(F("G1 F1200 X0 Y0"));
}
if (card.isPrinting() && checkkey == PrintProcess) { // print process
@ -4182,7 +4182,7 @@ void EachMomentUpdate() {
if (encoder_diffState == ENCODER_DIFF_ENTER) {
recovery_flag = false;
if (HMI_flag.select_flag) break;
TERN_(POWER_LOSS_RECOVERY, queue.inject_P(PSTR("M1000C")));
TERN_(POWER_LOSS_RECOVERY, queue.inject(F("M1000C")));
HMI_StartFrame(true);
return;
}
@ -4195,7 +4195,7 @@ void EachMomentUpdate() {
select_print.set(0);
HMI_ValueStruct.show_mode = 0;
queue.inject_P(PSTR("M1000"));
queue.inject(F("M1000"));
Goto_PrintProcess();
Draw_Status_Area(true);
}

View File

@ -1157,7 +1157,7 @@ void HMI_MainMenu() {
case PAGE_INFO_LEVELING:
#if HAS_ONESTEP_LEVELING
queue.inject_P(PSTR("G28XYO\nG28Z\nG29")); // TODO: 'G29' should be homing when needed. Does it make sense for every LCD to do this differently?
queue.inject(F("G28XYO\nG28Z\nG29")); // TODO: 'G29' should be homing when needed. Does it make sense for every LCD to do this differently?
#else
checkkey = Info;
Draw_Info_Menu();
@ -1376,7 +1376,7 @@ void HMI_PauseOrStop() {
if (HMI_flag.select_flag) {
HMI_flag.pause_action = true;
ICON_Resume();
queue.inject_P(PSTR("M25"));
queue.inject(F("M25"));
}
else {
// cancel pause
@ -1510,7 +1510,7 @@ void EachMomentUpdate() {
TERN_(HAS_FAN, resume_fan = thermalManager.fan_speed[0]);
#endif
IF_DISABLED(ADVANCED_PAUSE_FEATURE, thermalManager.disable_all_heaters());
IF_DISABLED(PARK_HEAD_ON_PAUSE, queue.inject_P(PSTR("G1 F1200 X0 Y0")));
IF_DISABLED(PARK_HEAD_ON_PAUSE, queue.inject(F("G1 F1200 X0 Y0")));
}
if (checkkey == PrintProcess) { // print process
@ -1588,7 +1588,7 @@ void EachMomentUpdate() {
if (encoder_diffState == ENCODER_DIFF_ENTER) {
recovery_flag = false;
if (HMI_flag.select_flag) break;
TERN_(POWER_LOSS_RECOVERY, queue.inject_P(PSTR("M1000C")));
TERN_(POWER_LOSS_RECOVERY, queue.inject(F("M1000C")));
return HMI_StartFrame(true);
}
else
@ -1600,7 +1600,7 @@ void EachMomentUpdate() {
}
select_print.set(PRINT_SETUP);
queue.inject_P(PSTR("M1000"));
queue.inject(F("M1000"));
sdprint = true;
Goto_PrintProcess();
Draw_Status_Area(true);
@ -2088,13 +2088,13 @@ void Goto_InfoMenu(){
Draw_Info_Menu();
}
void DisableMotors() { queue.inject_P(PSTR("M84")); }
void DisableMotors() { queue.inject(F("M84")); }
void AutoHome() { queue.inject_P(G28_STR); }
void SetHome() {
// Apply workspace offset, making the current position 0,0,0
queue.inject_P(PSTR("G92 X0 Y0 Z0"));
queue.inject(F("G92 X0 Y0 Z0"));
HMI_AudioFeedback();
}
@ -2241,7 +2241,7 @@ void Goto_LockScreen() { DWIN_LockScreen(true); }
void SetProbeOffsetZ() { SetPFloatOnClick(-10, 10, 2); }
void ProbeTest() {
ui.set_status_P(GET_TEXT(MSG_M48_TEST));
queue.inject_P(PSTR("G28O\nM48 P10"));
queue.inject(F("G28O\nM48 P10"));
}
#endif
@ -2321,23 +2321,23 @@ void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); }
void ChangeFilament() {
HMI_SaveProcessID(NothingToDo);
queue.inject_P(PSTR("M600 B2"));
queue.inject(F("M600 B2"));
}
void ParkHead(){
ui.set_status_P(GET_TEXT(MSG_FILAMENT_PARK_ENABLED));
queue.inject_P(PSTR("G28O\nG27"));
queue.inject(F("G28O\nG27"));
}
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
void UnloadFilament(){
ui.set_status_P(GET_TEXT(MSG_FILAMENTUNLOAD));
queue.inject_P(PSTR("M702 Z20"));
queue.inject(F("M702 Z20"));
}
void LoadFilament(){
ui.set_status_P(GET_TEXT(MSG_FILAMENTLOAD));
queue.inject_P(PSTR("M701 Z20"));
queue.inject(F("M701 Z20"));
}
#endif
@ -2436,7 +2436,7 @@ void LevBedC () { LevBed(4); }
void ManualMeshSave(){
ui.set_status_P(GET_TEXT(MSG_UBL_STORAGE_MESH_MENU));
queue.inject_P(PSTR("M211 S1\nM500"));
queue.inject(F("M211 S1\nM500"));
}
#endif // MESH_BED_LEVELING

View File

@ -1055,7 +1055,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
if (draw)
Draw_Menu_Item(row, ICON_CloseMotor, F("Disable Stepper"));
else
queue.inject_P(PSTR("M84"));
queue.inject(F("M84"));
break;
case PREPARE_HOME:
if (draw)
@ -4499,7 +4499,7 @@ void CrealityDWINClass::Print_Screen_Control() {
#endif
TERN_(HAS_FAN, thermalManager.fan_speed[0] = pausefan);
planner.synchronize();
TERN_(SDSUPPORT, queue.inject_P(PSTR("M24")));
TERN_(SDSUPPORT, queue.inject(F("M24")));
#endif
}
else {
@ -4541,10 +4541,10 @@ void CrealityDWINClass::Popup_Control() {
if (IS_SD_PRINTING()) card.pauseSDPrint();
#endif
planner.synchronize();
queue.inject_P(PSTR("M125"));
queue.inject(F("M125"));
planner.synchronize();
#else
queue.inject_P(PSTR("M25"));
queue.inject(F("M25"));
TERN_(HAS_HOTEND, pausetemp = thermalManager.temp_hotend[0].target);
TERN_(HAS_HEATED_BED, pausebed = thermalManager.temp_bed.target);
TERN_(HAS_FAN, pausefan = thermalManager.fan_speed[0]);
@ -4574,9 +4574,9 @@ void CrealityDWINClass::Popup_Control() {
break;
case Resume:
if (selection == 0)
queue.inject_P(PSTR("M1000"));
queue.inject(F("M1000"));
else {
queue.inject_P(PSTR("M1000 C"));
queue.inject(F("M1000 C"));
Draw_Main_Menu();
}
break;
@ -5008,7 +5008,7 @@ void CrealityDWINClass::Load_Settings(const char *buff) {
static bool init = true;
if (init) {
init = false;
queue.inject_P(PSTR("M1000 S"));
queue.inject(F("M1000 S"));
}
#endif
}

View File

@ -683,7 +683,7 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
void DGUSScreenHandler::HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value = swap16(*(uint16_t*)val_ptr);
if (value) {
queue.inject_P(PSTR("M1000"));
queue.inject(F("M1000"));
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), 32, true);
GotoScreen(PLR_SCREEN_RECOVER);
}

View File

@ -205,7 +205,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
bool old_relative_mode = relative_mode;
if (!relative_mode) {
//DEBUG_ECHOPGM(" G91");
queue.enqueue_now_P(PSTR("G91"));
queue.enqueue_now(F("G91"));
//DEBUG_ECHOPGM(" ✓ ");
}
char buf[32]; // G1 X9999.99 F12345
@ -227,7 +227,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
//DEBUG_ECHOLNPGM(" ✓ ");
if (!old_relative_mode) {
//DEBUG_ECHOPGM("G90");
queue.enqueue_now_P(PSTR("G90"));
queue.enqueue_now(F("G90"));
//DEBUG_ECHOPGM(" ✓ ");
}
}

View File

@ -205,7 +205,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
bool old_relative_mode = relative_mode;
if (!relative_mode) {
//DEBUG_ECHOPGM(" G91");
queue.enqueue_now_P(PSTR("G91"));
queue.enqueue_now(F("G91"));
//DEBUG_ECHOPGM(" ✓ ");
}
char buf[32]; // G1 X9999.99 F12345
@ -227,7 +227,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
//DEBUG_ECHOLNPGM(" ✓ ");
if (!old_relative_mode) {
//DEBUG_ECHOPGM("G90");
queue.enqueue_now_P(PSTR("G90"));
queue.enqueue_now(F("G90"));
//DEBUG_ECHOPGM(" ✓ ");
}
}

View File

@ -450,7 +450,7 @@ void DGUSScreenHandler::Level_Ctrl_MKS(DGUS_VP_Variable &var, void *val_ptr) {
a_first_level = 0;
queue.enqueue_now_P(G28_STR);
}
queue.enqueue_now_P(PSTR("G29"));
queue.enqueue_now(F("G29"));
#elif ENABLED(MESH_BED_LEVELING)
@ -512,10 +512,10 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
Deci2 = offset * 100;
Deci2 = Deci2 % 10;
soft_endstop._enabled = false;
queue.enqueue_now_P(PSTR("G91"));
queue.enqueue_now(F("G91"));
snprintf_P(cmd_buf, 30, PSTR("G1 Z%d.%d%d"), integer, Deci, Deci2);
queue.enqueue_one_now(cmd_buf);
queue.enqueue_now_P(PSTR("G90"));
queue.enqueue_now(F("G90"));
//soft_endstop._enabled = true;
break;
@ -527,17 +527,17 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
Deci2 = offset * 100;
Deci2 = Deci2 % 10;
soft_endstop._enabled = false;
queue.enqueue_now_P(PSTR("G91"));
queue.enqueue_now(F("G91"));
snprintf_P(cmd_buf, 30, PSTR("G1 Z-%d.%d%d"), integer, Deci, Deci2);
queue.enqueue_one_now(cmd_buf);
queue.enqueue_now_P(PSTR("G90"));
queue.enqueue_now(F("G90"));
break;
case 2:
if (mesh_point_count == GRID_MAX_POINTS) { // The first point
queue.enqueue_now_P(PSTR("G28"));
queue.enqueue_now_P(PSTR("G29S1"));
queue.enqueue_now(F("G28"));
queue.enqueue_now(F("G29S1"));
mesh_point_count--;
if (mks_language_index == MKS_English) {
@ -550,7 +550,7 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
}
}
else if (mesh_point_count > 1) { // 倒数第二个点
queue.enqueue_now_P(PSTR("G29S2"));
queue.enqueue_now(F("G29S2"));
mesh_point_count--;
if (mks_language_index == MKS_English) {
const char level_buf_en2[] = "Next Point";
@ -562,7 +562,7 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
}
}
else if (mesh_point_count == 1) {
queue.enqueue_now_P(PSTR("G29S2"));
queue.enqueue_now(F("G29S2"));
mesh_point_count--;
if (mks_language_index == MKS_English) {
const char level_buf_en2[] = "Level Finsh";
@ -620,13 +620,13 @@ void DGUSScreenHandler::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_pt
};
if (WITHIN(point_value, 0x0001, 0x0005))
queue.enqueue_now_P(PSTR("G1Z10"));
queue.enqueue_now(F("G1Z10"));
switch (point_value) {
case 0x0001:
enqueue_corner_move(X_MIN_POS + ABS(mks_corner_offsets[0].x),
Y_MIN_POS + ABS(mks_corner_offsets[0].y), level_speed);
queue.enqueue_now_P(PSTR("G28Z"));
queue.enqueue_now(F("G28Z"));
break;
case 0x0002:
enqueue_corner_move(X_MAX_POS - ABS(mks_corner_offsets[1].x),
@ -647,8 +647,8 @@ void DGUSScreenHandler::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_pt
}
if (WITHIN(point_value, 0x0002, 0x0005)) {
//queue.enqueue_now_P(PSTR("G28Z"));
queue.enqueue_now_P(PSTR("G1Z-10"));
//queue.enqueue_now(F("G28Z"));
queue.enqueue_now(F("G1Z-10"));
}
}
@ -856,7 +856,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
if (!relative_mode) {
//DEBUG_ECHOPGM(" G91");
queue.enqueue_now_P(PSTR("G91"));
queue.enqueue_now(F("G91"));
//DEBUG_ECHOPGM(" ✓ ");
}
char buf[32]; // G1 X9999.99 F12345
@ -878,8 +878,8 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
//DEBUG_ECHOLNPGM(" ✓ ");
if (!old_relative_mode) {
//DEBUG_ECHOPGM("G90");
//queue.enqueue_now_P(PSTR("G90"));
queue.enqueue_now_P(PSTR("G90"));
//queue.enqueue_now(F("G90"));
queue.enqueue_now(F("G90"));
//DEBUG_ECHOPGM(" ✓ ");
}
}
@ -1133,30 +1133,30 @@ void DGUSScreenHandler::HandleAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr
switch (flag) {
case 0:
if (step == 0.01)
queue.inject_P(PSTR("M290 Z-0.01"));
queue.inject(F("M290 Z-0.01"));
else if (step == 0.1)
queue.inject_P(PSTR("M290 Z-0.1"));
queue.inject(F("M290 Z-0.1"));
else if (step == 0.5)
queue.inject_P(PSTR("M290 Z-0.5"));
queue.inject(F("M290 Z-0.5"));
else if (step == 1)
queue.inject_P(PSTR("M290 Z-1"));
queue.inject(F("M290 Z-1"));
else
queue.inject_P(PSTR("M290 Z-0.01"));
queue.inject(F("M290 Z-0.01"));
z_offset_add = z_offset_add - ZOffset_distance;
break;
case 1:
if (step == 0.01)
queue.inject_P(PSTR("M290 Z0.01"));
queue.inject(F("M290 Z0.01"));
else if (step == 0.1)
queue.inject_P(PSTR("M290 Z0.1"));
queue.inject(F("M290 Z0.1"));
else if (step == 0.5)
queue.inject_P(PSTR("M290 Z0.5"));
queue.inject(F("M290 Z0.5"));
else if (step == 1)
queue.inject_P(PSTR("M290 Z1"));
queue.inject(F("M290 Z1"));
else
queue.inject_P(PSTR("M290 Z-0.01"));
queue.inject(F("M290 Z-0.01"));
z_offset_add = z_offset_add + ZOffset_distance;
break;
@ -1486,7 +1486,7 @@ void DGUSScreenHandler::DGUS_Runout_Idle(void) {
case RUNOUT_STATUS:
runout_mks.runout_status = RUNOUT_BEGIN_STATUS;
queue.inject_P(PSTR("M25"));
queue.inject(F("M25"));
GotoScreen(MKSLCD_SCREEN_PAUSE);
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please change filament!"), nullptr, true, true, true, true);

View File

@ -205,7 +205,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
bool old_relative_mode = relative_mode;
if (!relative_mode) {
//DEBUG_ECHOPGM(" G91");
queue.enqueue_now_P(PSTR("G91"));
queue.enqueue_now(F("G91"));
//DEBUG_ECHOPGM(" ✓ ");
}
char buf[32]; // G1 X9999.99 F12345
@ -227,7 +227,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
//DEBUG_ECHOLNPGM(" ✓ ");
if (!old_relative_mode) {
//DEBUG_ECHOPGM("G90");
queue.enqueue_now_P(PSTR("G90"));
queue.enqueue_now(F("G90"));
//DEBUG_ECHOPGM(" ✓ ");
}
}

View File

@ -523,9 +523,9 @@ void DGUSRxHandler::Probe(DGUS_VP &vp, void *data_ptr) {
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::LEVELING_PROBING);
#if ENABLED(AUTO_BED_LEVELING_UBL)
queue.enqueue_now_P(PSTR("G29P1\nG29P3\nG29P5C"));
queue.enqueue_now(F("G29P1\nG29P3\nG29P5C"));
#else
queue.enqueue_now_P(PSTR("G29"));
queue.enqueue_now(F("G29"));
#endif
queue.enqueue_now_P(DGUS_CMD_EEPROM_SAVE);
}
@ -634,13 +634,13 @@ void DGUSRxHandler::Home(DGUS_VP &vp, void *data_ptr) {
switch (axis) {
case DGUS_Data::Axis::X_Y_Z:
queue.enqueue_now_P(PSTR("G28XYZ"));
queue.enqueue_now(F("G28XYZ"));
break;
case DGUS_Data::Axis::X_Y:
queue.enqueue_now_P(PSTR("G28XY"));
queue.enqueue_now(F("G28XY"));
break;
case DGUS_Data::Axis::Z:
queue.enqueue_now_P(PSTR("G28Z"));
queue.enqueue_now(F("G28Z"));
break;
}
}
@ -784,7 +784,7 @@ void DGUSRxHandler::ResetEEPROM(DGUS_VP &vp, void *data_ptr) {
return;
}
queue.enqueue_now_P(PSTR("M502"));
queue.enqueue_now(F("M502"));
queue.enqueue_now_P(DGUS_CMD_EEPROM_SAVE);
}
@ -802,7 +802,7 @@ void DGUSRxHandler::SettingsExtra(DGUS_VP &vp, void *data_ptr) {
return;
}
queue.enqueue_now_P(PSTR(DGUS_RESET_BLTOUCH));
queue.enqueue_now(F(DGUS_RESET_BLTOUCH));
#else
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::INFOS);
#endif
@ -942,7 +942,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::HOME);
queue.enqueue_now_P(PSTR("M1000C"));
queue.enqueue_now(F("M1000C"));
}
void DGUSRxHandler::PowerLossResume(DGUS_VP &vp, void *data_ptr) {
@ -966,7 +966,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
dgus_screen_handler.TriggerScreenChange(DGUS_Screen::PRINT_STATUS);
queue.enqueue_now_P(PSTR("M1000"));
queue.enqueue_now(F("M1000"));
}
#endif // POWER_LOSS_RECOVERY

View File

@ -74,7 +74,7 @@ bool DGUSSetupHandler::LevelingMenu() {
if (ExtUI::isPositionKnown()) {
if (ExtUI::getAxisPosition_mm(ExtUI::Z) < 10.0f) {
queue.enqueue_now_P(PSTR("G0Z10"));
queue.enqueue_now(F("G0Z10"));
}
return true;
@ -124,14 +124,14 @@ bool DGUSSetupHandler::LevelingOffset() {
if (ExtUI::isPositionKnown()) {
if (ExtUI::getAxisPosition_mm(ExtUI::Z) < 4.0f) {
queue.enqueue_now_P(PSTR("G0Z4"));
queue.enqueue_now(F("G0Z4"));
}
char buffer[20];
snprintf_P(buffer, sizeof(buffer), PSTR("G0X%dY%d"), DGUS_LEVEL_CENTER_X, DGUS_LEVEL_CENTER_Y);
queue.enqueue_one_now(buffer);
queue.enqueue_now_P(PSTR("G0Z0"));
queue.enqueue_now(F("G0Z0"));
return true;
}

View File

@ -201,7 +201,7 @@ static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
draw_return_ui();
}
else if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING)) {
queue.enqueue_one_P(PSTR("M410"));
queue.enqueue_one(F("M410"));
uiCfg.filament_rate = 0;
uiCfg.filament_loading_completed = false;
uiCfg.filament_unloading_completed = false;

View File

@ -74,11 +74,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (ENABLED(HAS_MULTI_EXTRUDER)) {
if (uiCfg.extruderIndex == 0) {
uiCfg.extruderIndex = 1;
queue.inject_P(PSTR("T1"));
queue.inject(F("T1"));
}
else {
uiCfg.extruderIndex = 0;
queue.inject_P(PSTR("T0"));
queue.inject(F("T0"));
}
}
else

View File

@ -52,19 +52,19 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
queue.inject_P(G28_STR);
break;
case ID_H_X:
queue.inject_P(PSTR("G28X"));
queue.inject(F("G28X"));
break;
case ID_H_Y:
queue.inject_P(PSTR("G28Y"));
queue.inject(F("G28Y"));
break;
case ID_H_Z:
queue.inject_P(PSTR("G28Z"));
queue.inject(F("G28Z"));
break;
case ID_H_OFF_ALL:
queue.inject_P(PSTR("M84"));
queue.inject(F("M84"));
break;
case ID_H_OFF_XY:
queue.inject_P(PSTR("M84XY"));
queue.inject(F("M84XY"));
break;
case ID_H_RETURN:
clear_cur_ui();

View File

@ -62,22 +62,22 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_GCODE: lv_clear_more(); lv_draw_gcode(true); break;
#if HAS_USER_ITEM(1)
case ID_CUSTOM_1: queue.inject_P(PSTR(MAIN_MENU_ITEM_1_GCODE)); break;
case ID_CUSTOM_1: queue.inject(F(MAIN_MENU_ITEM_1_GCODE)); break;
#endif
#if HAS_USER_ITEM(2)
case ID_CUSTOM_2: queue.inject_P(PSTR(MAIN_MENU_ITEM_2_GCODE)); break;
case ID_CUSTOM_2: queue.inject(F(MAIN_MENU_ITEM_2_GCODE)); break;
#endif
#if HAS_USER_ITEM(3)
case ID_CUSTOM_3: queue.inject_P(PSTR(MAIN_MENU_ITEM_3_GCODE)); break;
case ID_CUSTOM_3: queue.inject(F(MAIN_MENU_ITEM_3_GCODE)); break;
#endif
#if HAS_USER_ITEM(4)
case ID_CUSTOM_4: queue.inject_P(PSTR(MAIN_MENU_ITEM_4_GCODE)); break;
case ID_CUSTOM_4: queue.inject(F(MAIN_MENU_ITEM_4_GCODE)); break;
#endif
#if HAS_USER_ITEM(5)
case ID_CUSTOM_5: queue.inject_P(PSTR(MAIN_MENU_ITEM_5_GCODE)); break;
case ID_CUSTOM_5: queue.inject(F(MAIN_MENU_ITEM_5_GCODE)); break;
#endif
#if HAS_USER_ITEM(6)
case ID_CUSTOM_6: queue.inject_P(PSTR(MAIN_MENU_ITEM_6_GCODE)); break;
case ID_CUSTOM_6: queue.inject(F(MAIN_MENU_ITEM_6_GCODE)); break;
#endif
case ID_M_RETURN:
lv_clear_more();

View File

@ -308,7 +308,7 @@ void setProBarRate() {
#if HAS_SUICIDE
if (gCfgItems.finish_power_off) {
gcode.process_subcommands_now(F("M1001"));
queue.inject_P(PSTR("M81"));
queue.inject(F("M81"));
marlin_state = MF_RUNNING;
}
#endif

View File

@ -57,7 +57,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
if (obj->mks_obj_id == ID_S_CONTINUE) return;
if (obj->mks_obj_id == ID_S_MOTOR_OFF) {
TERN(HAS_SUICIDE, suicide(), queue.enqueue_now_P(PSTR("M84")));
TERN(HAS_SUICIDE, suicide(), queue.enqueue_now(F("M84")));
return;
}
lv_clear_set();

View File

@ -62,7 +62,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
get_gcode_command(AUTO_LEVELING_COMMAND_ADDR, (uint8_t *)public_buf_m);
public_buf_m[sizeof(public_buf_m) - 1] = 0;
queue.inject_P(PSTR(public_buf_m));
queue.inject(public_buf_m);
#else
uiCfg.leveling_first_time = true;
lv_draw_manualLevel();

View File

@ -1169,7 +1169,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
}
send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
queue.enqueue_one_P(PSTR("M105"));
queue.enqueue_one(F("M105"));
break;
case 992:
@ -2035,7 +2035,7 @@ void get_wifi_commands() {
#endif
// Add the command to the queue
queue.enqueue_one_P(wifi_line_buffer);
queue.enqueue_one(wifi_line_buffer);
}
else if (wifi_read_count >= MAX_CMD_SIZE - 1) {

View File

@ -1542,7 +1542,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#if BOTH(PSU_CONTROL, PS_OFF_CONFIRM)
void MarlinUI::poweroff() {
queue.inject_P(PSTR("M81"));
queue.inject(F("M81"));
goto_previous_screen();
}
#endif
@ -1570,9 +1570,9 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#if ENABLED(PARK_HEAD_ON_PAUSE)
pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT); // Show message immediately to let user know about pause in progress
queue.inject_P(PSTR("M25 P\nM24"));
queue.inject(F("M25 P\nM24"));
#elif ENABLED(SDSUPPORT)
queue.inject_P(PSTR("M25"));
queue.inject(F("M25"));
#elif defined(ACTION_ON_PAUSE)
host_action_pause();
#endif

View File

@ -557,7 +557,7 @@ void menu_advanced_settings() {
//
// Set Home Offsets
//
ACTION_ITEM(MSG_SET_HOME_OFFSETS, []{ queue.inject_P(PSTR("M428")); ui.return_to_status(); });
ACTION_ITEM(MSG_SET_HOME_OFFSETS, []{ queue.inject(F("M428")); ui.return_to_status(); });
#endif
// M203 / M205 - Feedrate items

View File

@ -212,7 +212,7 @@ static void _lcd_level_bed_corners_get_next_position() {
void _lcd_draw_level_prompt() {
if (!ui.should_draw()) return;
MenuItem_confirm::confirm_screen(
[]{ queue.inject_P(TERN(HAS_LEVELING, PSTR("G29N"), G28_STR)); ui.return_to_status(); }
[]{ queue.inject(TERN(HAS_LEVELING, F("G29N"), FPSTR(G28_STR))); ui.return_to_status(); }
, []{ ui.goto_previous_screen_no_defer(); }
, GET_TEXT(MSG_BED_TRAMMING_IN_RANGE)
, (const char*)nullptr, PSTR("?")

View File

@ -103,9 +103,9 @@
ui.wait_for_move = true;
ui.goto_screen(_lcd_level_bed_done);
#if ENABLED(MESH_BED_LEVELING)
queue.inject_P(PSTR("G29S2"));
queue.inject(F("G29S2"));
#elif ENABLED(PROBE_MANUALLY)
queue.inject_P(PSTR("G29V1"));
queue.inject(F("G29V1"));
#endif
}
else
@ -155,9 +155,9 @@
// G29 Records Z, moves, and signals when it pauses
ui.wait_for_move = true;
#if ENABLED(MESH_BED_LEVELING)
queue.inject_P(manual_probe_index ? PSTR("G29S2") : PSTR("G29S1"));
queue.inject(manual_probe_index ? F("G29S2") : F("G29S1"));
#elif ENABLED(PROBE_MANUALLY)
queue.inject_P(PSTR("G29V1"));
queue.inject(F("G29V1"));
#endif
}

View File

@ -341,8 +341,8 @@ void menu_advanced_settings();
#if ENABLED(CUSTOM_MENU_CONFIG)
void _lcd_custom_menus_configuration_gcode(PGM_P const cmd) {
queue.inject_P(cmd);
void _lcd_custom_menus_configuration_gcode(FSTR_P const fstr) {
queue.inject(fstr);
TERN_(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK, ui.completion_feedback());
TERN_(CUSTOM_MENU_CONFIG_SCRIPT_RETURN, ui.return_to_status());
}
@ -358,7 +358,7 @@ void menu_advanced_settings();
#else
#define _DONE_SCRIPT ""
#endif
#define GCODE_LAMBDA_CONF(N) []{ _lcd_custom_menus_configuration_gcode(PSTR(CONFIG_MENU_ITEM_##N##_GCODE _DONE_SCRIPT)); }
#define GCODE_LAMBDA_CONF(N) []{ _lcd_custom_menus_configuration_gcode(F(CONFIG_MENU_ITEM_##N##_GCODE _DONE_SCRIPT)); }
#define _CUSTOM_ITEM_CONF(N) ACTION_ITEM_P(PSTR(CONFIG_MENU_ITEM_##N##_DESC), GCODE_LAMBDA_CONF(N));
#define _CUSTOM_ITEM_CONF_CONFIRM(N) \
SUBMENU_P(PSTR(CONFIG_MENU_ITEM_##N##_DESC), []{ \

View File

@ -209,7 +209,7 @@ void menu_change_filament() {
#else
if (thermalManager.targetHotEnoughToExtrude(active_extruder))
queue.inject_P(PSTR("M600B0"));
queue.inject(F("M600B0"));
else
ui.goto_screen([]{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); });

View File

@ -23,7 +23,7 @@
#include "menu.h"
#include "../marlinui.h"
#include "../../gcode/queue.h" // for inject_P
#include "../../gcode/queue.h" // for inject
#include "../../inc/MarlinConfigPre.h"
@ -64,8 +64,8 @@ class MenuItem_gcode : public MenuItem_button {
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
_draw(sel, row, pstr, '>', ' ');
}
static void action(PGM_P const, PGM_P const pgcode) { queue.inject_P(pgcode); }
static inline void action(PGM_P const pstr, const uint8_t, const char * const pgcode) { action(pstr, pgcode); }
static void action(PGM_P const, PGM_P const pgcode) { queue.inject(FPSTR(pgcode)); }
static inline void action(PGM_P const pstr, const uint8_t, PGM_P const pgcode) { action(pstr, pgcode); }
};
////////////////////////////////////////////

View File

@ -35,7 +35,7 @@
static void lcd_power_loss_recovery_resume() {
ui.return_to_status();
queue.inject_P(PSTR("M1000"));
queue.inject(F("M1000"));
}
void lcd_power_loss_recovery_cancel() {

View File

@ -106,8 +106,8 @@ void menu_configuration();
#if ENABLED(CUSTOM_MENU_MAIN)
void _lcd_custom_menu_main_gcode(PGM_P const cmd) {
queue.inject_P(cmd);
void _lcd_custom_menu_main_gcode(FSTR_P const fstr) {
queue.inject(fstr);
TERN_(CUSTOM_MENU_MAIN_SCRIPT_AUDIBLE_FEEDBACK, ui.completion_feedback());
TERN_(CUSTOM_MENU_MAIN_SCRIPT_RETURN, ui.return_to_status());
}
@ -123,7 +123,7 @@ void menu_configuration();
#else
#define _DONE_SCRIPT ""
#endif
#define GCODE_LAMBDA_MAIN(N) []{ _lcd_custom_menu_main_gcode(PSTR(MAIN_MENU_ITEM_##N##_GCODE _DONE_SCRIPT)); }
#define GCODE_LAMBDA_MAIN(N) []{ _lcd_custom_menu_main_gcode(F(MAIN_MENU_ITEM_##N##_GCODE _DONE_SCRIPT)); }
#define _CUSTOM_ITEM_MAIN(N) ACTION_ITEM_P(PSTR(MAIN_MENU_ITEM_##N##_DESC), GCODE_LAMBDA_MAIN(N));
#define _CUSTOM_ITEM_MAIN_CONFIRM(N) \
SUBMENU_P(PSTR(MAIN_MENU_ITEM_##N##_DESC), []{ \

View File

@ -111,7 +111,7 @@ void probe_offset_wizard_menu() {
// If wizard-homing was done by probe with PROBE_OFFSET_WIZARD_START_Z
#if HOMING_Z_WITH_PROBE && defined(PROBE_OFFSET_WIZARD_START_Z)
set_axis_never_homed(Z_AXIS); // On cancel the Z position needs correction
queue.inject_P(PSTR("G28Z"));
queue.inject(F("G28Z"));
#else // Otherwise do a Z clearance move like after Homing
z_clearance_move();
#endif

View File

@ -96,7 +96,7 @@ void goto_tramming_wizard() {
// Inject G28, wait for homing to complete,
set_all_unhomed();
queue.inject_P(TERN(CAN_SET_LEVELING_AFTER_G28, PSTR("G28L0"), G28_STR));
queue.inject(TERN(CAN_SET_LEVELING_AFTER_G28, F("G28L0"), FPSTR(G28_STR)));
ui.goto_screen([]{
_lcd_draw_homing();

View File

@ -785,7 +785,7 @@ static void z_minus() { moveAxis(Z_AXIS, -1); }
static void disable_steppers() {
quick_feedback();
queue.inject_P(PSTR("M84"));
queue.inject(F("M84"));
}
static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {

View File

@ -770,7 +770,7 @@ static void z_minus() { moveAxis(Z_AXIS, -1); }
static void disable_steppers() {
quick_feedback();
queue.inject_P(PSTR("M84"));
queue.inject(F("M84"));
}
static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {

View File

@ -772,7 +772,7 @@ static void z_minus() { moveAxis(Z_AXIS, -1); }
static void disable_steppers() {
quick_feedback();
queue.inject_P(PSTR("M84"));
queue.inject(F("M84"));
}
static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {