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 authored and danopernis committed Aug 15, 2024
1 parent d8d5ec6 commit 132592a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/common/serial_printing.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <serial_printing.hpp>
#include <state/printer_state.hpp>
#include <option/developer_mode.h>
#include <config_store/store_instance.hpp>

uint32_t SerialPrinting::last_serial_indicator_ms = 0;

Expand Down Expand Up @@ -87,6 +88,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 @@ -504,6 +504,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 @@ -388,6 +388,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
2 changes: 1 addition & 1 deletion src/gui/screen_menu_experimental_settings_debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using ScreenMenuExperimentalSettings__ = ScreenMenu<GuiDefaults::MenuFooter, MI_
MI_Z_AXIS_LEN, MI_RESET_Z_AXIS_LEN,
MI_STEPS_PER_UNIT_X, MI_STEPS_PER_UNIT_Y, MI_STEPS_PER_UNIT_Z, MI_STEPS_PER_UNIT_E, MI_RESET_STEPS_PER_UNIT,
MI_DIRECTION_X, MI_DIRECTION_Y, MI_DIRECTION_Z, MI_DIRECTION_E, MI_RESET_DIRECTION,
MI_CURRENT_X, MI_CURRENT_Y, MI_CURRENT_Z, MI_CURRENT_E, MI_RESET_CURRENTS>;
MI_CURRENT_X, MI_CURRENT_Y, MI_CURRENT_Z, MI_CURRENT_E, MI_RESET_CURRENTS, MI_SERIAL_PRINTING_SCREEN_ENABLE>;

struct ExperimentalSettingsValues {
ExperimentalSettingsValues(ScreenMenuExperimentalSettings__ &parent);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/screen_menu_experimental_settings_release.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using ScreenMenuExperimentalSettings__ = ScreenMenu<GuiDefaults::MenuFooter, MI_
#if PRINTER_IS_PRUSA_MK3_5
MI_ALT_FAN,
#endif
MI_Z_AXIS_LEN, MI_RESET_Z_AXIS_LEN, MI_STEPS_PER_UNIT_E, MI_RESET_STEPS_PER_UNIT, MI_DIRECTION_E, MI_RESET_DIRECTION>;
MI_Z_AXIS_LEN, MI_RESET_Z_AXIS_LEN, MI_STEPS_PER_UNIT_E, MI_RESET_STEPS_PER_UNIT, MI_DIRECTION_E, MI_RESET_DIRECTION, MI_SERIAL_PRINTING_SCREEN_ENABLE>;

struct ExperimentalSettingsValues {
ExperimentalSettingsValues(ScreenMenuExperimentalSettings__ &parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ struct CurrentStore

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

StoreItem<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, true, journal::hash("Enable Side LEDs dimming")> side_leds_dimming_enabled;

Expand Down

0 comments on commit 132592a

Please sign in to comment.