Skip to content

Commit

Permalink
🎨 Apply F() to status message
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Dec 25, 2021
1 parent 433eedd commit 360311f
Show file tree
Hide file tree
Showing 44 changed files with 194 additions and 196 deletions.
10 changes: 5 additions & 5 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed
if (ELAPSED(ms, next_home_key_ms)) {
next_home_key_ms = ms + HOME_DEBOUNCE_DELAY;
LCD_MESSAGEPGM(MSG_AUTO_HOME);
LCD_MESSAGE(MSG_AUTO_HOME);
queue.inject_P(G28_STR);
}
}
Expand All @@ -499,8 +499,8 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
} \
}while(0)

#define CHECK_CUSTOM_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, NOOP)
#define CHECK_BETTER_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, if (strlen(BUTTON##N##_DESC)) LCD_MESSAGEPGM_P(PSTR(BUTTON##N##_DESC)))
#define CHECK_CUSTOM_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, NOOP)
#define CHECK_BETTER_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, if (strlen(BUTTON##N##_DESC)) LCD_MESSAGE_F(BUTTON##N##_DESC))

#if HAS_BETTER_USER_BUTTON(1)
CHECK_BETTER_USER_BUTTON(1);
Expand Down Expand Up @@ -935,7 +935,7 @@ void stop() {

if (!IsStopped()) {
SERIAL_ERROR_MSG(STR_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED);
LCD_MESSAGE(MSG_STOPPED);
safe_delay(350); // allow enough time for messages to get out before stopping
marlin_state = MF_STOPPED;
}
Expand Down Expand Up @@ -1551,7 +1551,7 @@ void setup() {
HMI_Init();
HMI_SetLanguageCache();
HMI_StartFrame(true);
DWIN_StatusChanged_P(GET_TEXT(WELCOME_MSG));
DWIN_StatusChanged(GET_TEXT_F(WELCOME_MSG));
#endif

#if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC
Expand Down
38 changes: 19 additions & 19 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ void unified_bed_leveling::shift_mesh_height() {

const uint8_t point_num = (GRID_MAX_POINTS - count) + 1;
SERIAL_ECHOLNPGM("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, ".");
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS)));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS)));

#if HAS_LCD_MENU
if (ui.button_pressed()) {
Expand Down Expand Up @@ -789,12 +789,12 @@ void unified_bed_leveling::shift_mesh_height() {

#endif // HAS_BED_PROBE

void set_message_with_feedback(PGM_P const msg_P) {
void set_message_with_feedback(FSTR_P const fstr) {
#if HAS_LCD_MENU
ui.set_status_P(msg_P);
ui.set_status(fstr);
ui.quick_feedback();
#else
UNUSED(msg_P);
UNUSED(fstr);
#endif
}

Expand Down Expand Up @@ -850,7 +850,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
planner.synchronize();

SERIAL_ECHOPGM("Place shim under nozzle");
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
LCD_MESSAGE(MSG_UBL_BC_INSERT);
ui.return_to_status();
echo_and_take_a_measurement();

Expand All @@ -859,7 +859,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
planner.synchronize();

SERIAL_ECHOPGM("Remove shim");
LCD_MESSAGEPGM(MSG_UBL_BC_REMOVE);
LCD_MESSAGE(MSG_UBL_BC_REMOVE);
echo_and_take_a_measurement();

const float z2 = measure_point_with_encoder();
Expand Down Expand Up @@ -905,7 +905,7 @@ void set_message_with_feedback(PGM_P const msg_P) {

if (!position_is_reachable(ppos)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points)

LCD_MESSAGEPGM(MSG_UBL_MOVING_TO_NEXT);
LCD_MESSAGE(MSG_UBL_MOVING_TO_NEXT);

do_blocking_move_to(ppos);
do_z_clearance(z_clearance);
Expand All @@ -917,11 +917,11 @@ void set_message_with_feedback(PGM_P const msg_P) {

if (parser.seen_test('B')) {
SERIAL_ECHOPGM("Place Shim & Measure");
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
LCD_MESSAGE(MSG_UBL_BC_INSERT);
}
else {
SERIAL_ECHOPGM("Measure");
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT2);
LCD_MESSAGE(MSG_UBL_BC_INSERT2);
}

const float z_step = 0.01f; // 0.01mm per encoder tick, occasionally step
Expand Down Expand Up @@ -974,7 +974,7 @@ void set_message_with_feedback(PGM_P const msg_P) {

save_ubl_active_state_and_disable();

LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH);
LCD_MESSAGE(MSG_UBL_FINE_TUNE_MESH);
ui.capture(); // Take over control of the LCD encoder

do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES); // Move to the given XY with probe clearance
Expand Down Expand Up @@ -1039,7 +1039,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
if (_click_and_hold([]{
ui.return_to_status();
do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES);
set_message_with_feedback(GET_TEXT(MSG_EDITING_STOPPED));
set_message_with_feedback(GET_TEXT_F(MSG_EDITING_STOPPED));
})) break;

// TODO: Disable leveling here so the Z value becomes the 'native' Z value.
Expand All @@ -1060,7 +1060,7 @@ void set_message_with_feedback(PGM_P const msg_P) {

do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES);

LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH);
LCD_MESSAGE(MSG_UBL_DONE_EDITING_MESH);
SERIAL_ECHOLNPGM("Done Editing Mesh");

if (lcd_map_control)
Expand All @@ -1077,7 +1077,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
bool unified_bed_leveling::G29_parse_parameters() {
bool err_flag = false;

set_message_with_feedback(GET_TEXT(MSG_UBL_DOING_G29));
set_message_with_feedback(GET_TEXT_F(MSG_UBL_DOING_G29));

param.C_constant = 0;
param.R_repetition = 0;
Expand Down Expand Up @@ -1200,7 +1200,7 @@ void unified_bed_leveling::save_ubl_active_state_and_disable() {
ubl_state_recursion_chk++;
if (ubl_state_recursion_chk != 1) {
SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row.");
set_message_with_feedback(GET_TEXT(MSG_UBL_SAVE_ERROR));
set_message_with_feedback(GET_TEXT_F(MSG_UBL_SAVE_ERROR));
return;
}
#endif
Expand All @@ -1213,7 +1213,7 @@ void unified_bed_leveling::restore_ubl_active_state_and_leave() {
#if ENABLED(UBL_DEVEL_DEBUGGING)
if (--ubl_state_recursion_chk) {
SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
set_message_with_feedback(GET_TEXT(MSG_UBL_RESTORE_ERROR));
set_message_with_feedback(GET_TEXT_F(MSG_UBL_RESTORE_ERROR));
return;
}
#endif
Expand Down Expand Up @@ -1438,7 +1438,7 @@ void unified_bed_leveling::smart_fill_mesh() {

if (do_3_pt_leveling) {
SERIAL_ECHOLNPGM("Tilting mesh (1/3)");
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));

measured_z = probe.probe_at_point(points[0], PROBE_PT_RAISE, param.V_verbosity);
if (isnan(measured_z))
Expand All @@ -1457,7 +1457,7 @@ void unified_bed_leveling::smart_fill_mesh() {

if (!abort_flag) {
SERIAL_ECHOLNPGM("Tilting mesh (2/3)");
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));

measured_z = probe.probe_at_point(points[1], PROBE_PT_RAISE, param.V_verbosity);
#ifdef VALIDATE_MESH_TILT
Expand All @@ -1477,7 +1477,7 @@ void unified_bed_leveling::smart_fill_mesh() {

if (!abort_flag) {
SERIAL_ECHOLNPGM("Tilting mesh (3/3)");
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));

measured_z = probe.probe_at_point(points[2], PROBE_PT_LAST_STOW, param.V_verbosity);
#ifdef VALIDATE_MESH_TILT
Expand Down Expand Up @@ -1518,7 +1518,7 @@ void unified_bed_leveling::smart_fill_mesh() {

if (!abort_flag) {
SERIAL_ECHOLNPGM("Tilting mesh point ", point_num, "/", total_points, "\n");
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points));

measured_z = probe.probe_at_point(rpos, parser.seen_test('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity); // TODO: Needs error handling

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/cancel_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void CancelObject::set_active_object(const int8_t obj) {

#if BOTH(HAS_STATUS_MESSAGE, CANCEL_OBJECTS_REPORTING)
if (active_object >= 0)
ui.status_printf_P(0, PSTR(S_FMT " %i"), GET_TEXT(MSG_PRINTING_OBJECT), int(active_object));
ui.status_printf(0, F(S_FMT " %i"), GET_TEXT(MSG_PRINTING_OBJECT), int(active_object));
else
ui.reset_status();
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/hotend_idle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void HotendIdleProtection::check() {
void HotendIdleProtection::timed_out() {
next_protect_ms = 0;
SERIAL_ECHOLNPGM("Hotend Idle Timeout");
LCD_MESSAGEPGM(MSG_HOTEND_IDLE_TIMEOUT);
LCD_MESSAGE(MSG_HOTEND_IDLE_TIMEOUT);
HOTEND_LOOP() {
if ((HOTEND_IDLE_NOZZLE_TARGET) < thermalManager.degTargetHotend(e))
thermalManager.setTargetHotend(HOTEND_IDLE_NOZZLE_TARGET, e);
Expand Down
24 changes: 12 additions & 12 deletions Marlin/src/feature/mmu/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ void MMU2::check_version() {
}

static void mmu2_not_responding() {
LCD_MESSAGEPGM(MSG_MMU2_NOT_RESPONDING);
LCD_MESSAGE(MSG_MMU2_NOT_RESPONDING);
BUZZ(100, 659);
BUZZ(200, 698);
BUZZ(100, 659);
Expand Down Expand Up @@ -487,7 +487,7 @@ static void mmu2_not_responding() {
if (index != extruder) {

stepper.disable_extruder();
ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(index + 1));

command(MMU_CMD_T0 + index);
manage_response(true, true);
Expand Down Expand Up @@ -573,7 +573,7 @@ static void mmu2_not_responding() {
command(MMU_CMD_U0);
manage_response(true, true);
}
ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
mmu_loading_flag = true;
command(MMU_CMD_T0 + index);
manage_response(true, true);
Expand Down Expand Up @@ -671,7 +671,7 @@ static void mmu2_not_responding() {

if (index != extruder) {
stepper.disable_extruder();
ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
command(MMU_CMD_T0 + index);
manage_response(true, true);
command(MMU_CMD_C0);
Expand Down Expand Up @@ -808,14 +808,14 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {

if (turn_off_nozzle && resume_hotend_temp) {
thermalManager.setTargetHotend(resume_hotend_temp, active_extruder);
LCD_MESSAGEPGM(MSG_HEATING);
LCD_MESSAGE(MSG_HEATING);
BUZZ(200, 40);

while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(1000);
}

if (move_axes && all_axes_homed()) {
LCD_MESSAGEPGM(MSG_MMU2_RESUMING);
LCD_MESSAGE(MSG_MMU2_RESUMING);
BUZZ(198, 404); BUZZ(4, 0); BUZZ(198, 404);

// Move XY to starting position, then Z
Expand All @@ -826,7 +826,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
}
else {
BUZZ(198, 404); BUZZ(4, 0); BUZZ(198, 404);
LCD_MESSAGEPGM(MSG_MMU2_RESUMING);
LCD_MESSAGE(MSG_MMU2_RESUMING);
}
}
}
Expand Down Expand Up @@ -908,7 +908,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {

if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD);
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
return false;
}

Expand Down Expand Up @@ -944,11 +944,11 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {

if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD);
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
return false;
}

LCD_MESSAGEPGM(MSG_MMU2_EJECTING_FILAMENT);
LCD_MESSAGE(MSG_MMU2_EJECTING_FILAMENT);

stepper.enable_extruder();
current_position.e -= MMU2_FILAMENTCHANGE_EJECT_FEED;
Expand All @@ -958,7 +958,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
manage_response(false, false);

if (recover) {
LCD_MESSAGEPGM(MSG_MMU2_EJECT_RECOVER);
LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER);
BUZZ(200, 404);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), CONTINUE_STR));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("MMU2 Eject Recover")));
Expand Down Expand Up @@ -993,7 +993,7 @@ bool MMU2::unload() {

if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD);
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep

TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged_P(GET_TEXT(MSG_REHEATING)));

TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status_P(GET_TEXT(MSG_REHEATING)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATING));

// Re-enable the heaters if they timed out
HOTEND_LOOP() thermalManager.reset_hotend_idle_timer(e);
Expand All @@ -556,7 +556,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep

TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_REHEATDONE), CONTINUE_STR));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_REHEATDONE)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status_P(GET_TEXT(MSG_REHEATDONE)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATDONE));

IF_DISABLED(PAUSE_REHEAT_FAST_RESUME, wait_for_user = true);

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/stepper_driver_safety.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void stepper_driver_backward_error(PGM_P str) {
SERIAL_ERROR_START();
SERIAL_ECHOPGM_P(str);
SERIAL_ECHOLNPGM(" driver is backward!");
ui.status_printf_P(2, PSTR(S_FMT S_FMT), str, GET_TEXT(MSG_DRIVER_BACKWARD));
ui.status_printf(2, F(S_FMT S_FMT), str, GET_TEXT(MSG_DRIVER_BACKWARD));
}

void stepper_driver_backward_check() {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/tmc_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ void test_tmc_connection(LOGICAL_AXIS_ARGS(const bool)) {
#endif
}

if (axis_connection) LCD_MESSAGEPGM(MSG_ERROR_TMC);
if (axis_connection) LCD_MESSAGE(MSG_ERROR_TMC);
}

#endif // HAS_TRINAMIC_CONFIG
Loading

0 comments on commit 360311f

Please sign in to comment.