Skip to content

Commit

Permalink
Make serial printing screen a menu option
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkPandaKatie committed Jul 3, 2024
1 parent ce6d58b commit 52033f2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/common/serial_printing.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <serial_printing.hpp>
#include <state/printer_state.hpp>
#include <config_store/store_instance.hpp>

uint32_t SerialPrinting::last_serial_indicator_ms = 0;

Expand Down Expand Up @@ -81,6 +82,10 @@ void SerialPrinting::serial_command_hook(const char *command) {
return;
}

if (!config_store().serial_print_screen_enabled.get()) {
return;
}

remove_N_prefix(command);
if (print_indicating_gcode(command)) {
last_serial_indicator_ms = ticks_ms();
Expand Down
9 changes: 9 additions & 0 deletions src/gui/MItem_menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,15 @@ void MI_EEPROM_DIAGNOSTICS::click(IWindowMenu & /*window_menu*/) {
Screens::Access()->Open(ScreenFactory::Screen<ScreenMenuEepromDiagnostics>);
}

/**********************************************************************************************/
// MI_SERIAL_PRINTING_SCREEN_ENABLE
MI_SERIAL_PRINTING_SCREEN_ENABLE::MI_SERIAL_PRINTING_SCREEN_ENABLE()
: WI_ICON_SWITCH_OFF_ON_t(config_store().serial_print_screen_enabled.get(), _(label), nullptr, is_enabled_t::yes, is_hidden_t::no) {
}
void MI_SERIAL_PRINTING_SCREEN_ENABLE::OnChange(size_t old_index) {
config_store().serial_print_screen_enabled.set(!old_index);
}

/**********************************************************************************************/
// MI_USB_MSC_ENABLE
MI_USB_MSC_ENABLE::MI_USB_MSC_ENABLE()
Expand Down
8 changes: 8 additions & 0 deletions src/gui/MItem_menus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,14 @@ class MI_PRUSALINK : public IWindowMenuItem {
virtual void click(IWindowMenu &windowMenu) override;
};

class MI_SERIAL_PRINTING_SCREEN_ENABLE : public WI_ICON_SWITCH_OFF_ON_t {
static constexpr const char *const label = N_("Serial Printing Screen");

public:
MI_SERIAL_PRINTING_SCREEN_ENABLE();
virtual void OnChange(size_t old_index) override;
};

class MI_USB_MSC_ENABLE : public WI_ICON_SWITCH_OFF_ON_t {
constexpr static char const *label = "USB MSC";

Expand Down
3 changes: 2 additions & 1 deletion src/gui/screen_menu_user_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ using ScreenMenuUserInterface__ = ScreenMenu<GuiDefaults::MenuFooter, MI_RETURN,
#if not PRINTER_IS_PRUSA_MINI
MI_PRINT_PROGRESS_TIME,
#endif
MI_TIMEOUT, MI_SOUND_MODE, MI_HEATUP_BED
MI_TIMEOUT, MI_SOUND_MODE, MI_HEATUP_BED,
MI_SERIAL_PRINTING_SCREEN_ENABLE
#if (!PRINTER_IS_PRUSA_XL && !PRINTER_IS_PRUSA_MK4 && !PRINTER_IS_PRUSA_MK3_5)
,
MI_SOUND_VOLUME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ struct CurrentStore

StoreItem<bool, defaults::bool_true, journal::hash("Enable Side LEDs")> side_leds_enabled;

StoreItem<bool, defaults::bool_true, journal::hash("Enable Serial Printing Screen")> serial_print_screen_enabled;

/// Whether the side leds should dim down a bit when user is not interacting with the printer or stay on full power the whole time
StoreItem<bool, defaults::bool_true, journal::hash("Enable Side LEDs dimming")> side_leds_dimming_enabled;

Expand Down

0 comments on commit 52033f2

Please sign in to comment.