Преглед изворни кода

Move farm mode to separate file

Alex Voinea пре 2 година
родитељ
комит
7d597eb8b0

+ 2 - 0
Firmware/Configuration.h

@@ -567,5 +567,7 @@ enum CalibrationStatus
 #include "Configuration_adv.h"
 #include "thermistortables.h"
 
+#define PRUSA_FARM
+
 
 #endif //__CONFIGURATION_H

+ 1 - 0
Firmware/Marlin_main.cpp

@@ -81,6 +81,7 @@
 #include "math.h"
 #include "util.h"
 #include "Timer.h"
+#include "Prusa_farm.h"
 
 #include <avr/wdt.h>
 #include <avr/pgmspace.h>

+ 3 - 0
Firmware/Prusa_farm.cpp

@@ -0,0 +1,3 @@
+#include "Prusa_farm.h"
+
+uint8_t farm_mode = 0;

+ 11 - 0
Firmware/Prusa_farm.h

@@ -0,0 +1,11 @@
+#pragma once
+
+#include <inttypes.h>
+#include "Configuration.h"
+
+#ifdef PRUSA_FARM
+extern uint8_t farm_mode;
+#else
+#define farm_mode 0
+#error prusa_farm_include_error
+#endif

+ 1 - 0
Firmware/cardreader.cpp

@@ -7,6 +7,7 @@
 #include "stepper.h"
 #include "temperature.h"
 #include "language.h"
+#include "Prusa_farm.h"
 
 #ifdef SDSUPPORT
 

+ 1 - 0
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];

+ 1 - 0
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"

+ 4 - 7
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

+ 0 - 2
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();
 

+ 1 - 0
Firmware/util.cpp

@@ -6,6 +6,7 @@
 #include "language.h"
 #include "util.h"
 #include <avr/pgmspace.h>
+#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;