From 7d597eb8b0ec81845e719be80ef06bd359d5f321 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Thu, 25 Aug 2022 10:51:01 +0300 Subject: [PATCH] Move farm mode to separate file --- Firmware/Configuration.h | 2 ++ Firmware/Marlin_main.cpp | 1 + Firmware/Prusa_farm.cpp | 3 +++ Firmware/Prusa_farm.h | 11 +++++++++++ Firmware/cardreader.cpp | 1 + Firmware/cmdqueue.cpp | 1 + Firmware/temperature.cpp | 1 + Firmware/ultralcd.cpp | 11 ++++------- Firmware/ultralcd.h | 2 -- Firmware/util.cpp | 1 + 10 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 Firmware/Prusa_farm.cpp create mode 100644 Firmware/Prusa_farm.h diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 274b2ca3..9424f326 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -567,5 +567,7 @@ enum CalibrationStatus #include "Configuration_adv.h" #include "thermistortables.h" +#define PRUSA_FARM + #endif //__CONFIGURATION_H diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6abb22a0..c65bffe9 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -81,6 +81,7 @@ #include "math.h" #include "util.h" #include "Timer.h" +#include "Prusa_farm.h" #include #include diff --git a/Firmware/Prusa_farm.cpp b/Firmware/Prusa_farm.cpp new file mode 100644 index 00000000..3a6f5133 --- /dev/null +++ b/Firmware/Prusa_farm.cpp @@ -0,0 +1,3 @@ +#include "Prusa_farm.h" + +uint8_t farm_mode = 0; diff --git a/Firmware/Prusa_farm.h b/Firmware/Prusa_farm.h new file mode 100644 index 00000000..aba17cf2 --- /dev/null +++ b/Firmware/Prusa_farm.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include "Configuration.h" + +#ifdef PRUSA_FARM +extern uint8_t farm_mode; +#else +#define farm_mode 0 +#error prusa_farm_include_error +#endif diff --git a/Firmware/cardreader.cpp b/Firmware/cardreader.cpp index ba618412..f58aa3d5 100644 --- a/Firmware/cardreader.cpp +++ b/Firmware/cardreader.cpp @@ -7,6 +7,7 @@ #include "stepper.h" #include "temperature.h" #include "language.h" +#include "Prusa_farm.h" #ifdef SDSUPPORT diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp index a13b344a..3707d651 100755 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -1,6 +1,7 @@ #include "cmdqueue.h" #include "cardreader.h" #include "ultralcd.h" +#include "Prusa_farm.h" // Reserve BUFSIZE lines of length MAX_CMD_SIZE plus CMDBUFFER_RESERVE_FRONT. char cmdbuffer[BUFSIZE * (MAX_CMD_SIZE + 1) + CMDBUFFER_RESERVE_FRONT]; diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 56c61176..9d47fad9 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -45,6 +45,7 @@ #include "ConfigurationStore.h" #include "Timer.h" #include "Configuration_prusa.h" +#include "Prusa_farm.h" #if (ADC_OVRSAMPL != OVERSAMPLENR) #error "ADC_OVRSAMPL oversampling must match OVERSAMPLENR" diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 414f570b..26cac2d1 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -53,6 +53,7 @@ #include "la10compat.h" #endif +#include "Prusa_farm.h" int clock_interval = 0; static ShortTimer NcTime; @@ -81,7 +82,6 @@ CustomMsg custom_message_type = CustomMsg::Status; uint8_t custom_message_state = 0; bool isPrintPaused = false; -uint8_t farm_mode = 0; uint8_t farm_timer = 8; bool printer_connected = true; @@ -5929,12 +5929,9 @@ static void lcd_main_menu() if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) { if (!card.isFileOpen()) { if (!usb_timer.running() && (lcd_commands_type != LcdCommands::Layer1Cal)) { - //if (farm_mode) MENU_ITEM_SUBMENU_P(MSG_FARM_CARD_MENU, lcd_farm_sdcard_menu); - /*else*/{ - bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function - MENU_ITEM_SUBMENU_P(_T(MSG_CARD_MENU), lcd_sdcard_menu); - } - } + bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function + MENU_ITEM_SUBMENU_P(_T(MSG_CARD_MENU), lcd_sdcard_menu); + } #if SDCARDDETECT < 1 MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user////MSG_CNG_SDCARD #endif //SDCARDDETECT diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index e0a2e6e4..ea0a3300 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -130,8 +130,6 @@ enum class CustomMsg : uint_least8_t extern CustomMsg custom_message_type; extern uint8_t custom_message_state; -extern uint8_t farm_mode; - extern bool UserECoolEnabled(); extern bool FarmOrUserECool(); diff --git a/Firmware/util.cpp b/Firmware/util.cpp index ce823f14..3a0203b1 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -6,6 +6,7 @@ #include "language.h" #include "util.h" #include +#include "Prusa_farm.h" // Allocate the version string in the program memory. Otherwise the string lands either on the stack or in the global RAM. static const char FW_VERSION_STR[] PROGMEM = FW_VERSION;