Move farm mode to separate file

This commit is contained in:
Alex Voinea 2022-08-25 10:51:01 +03:00 committed by DRracer
parent 4e7d686b83
commit 7d597eb8b0
10 changed files with 25 additions and 9 deletions

View File

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

View File

@ -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
Firmware/Prusa_farm.cpp Normal file
View File

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

11
Firmware/Prusa_farm.h Normal file
View File

@ -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

View File

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

View File

@ -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];

View File

@ -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"

View File

@ -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

View File

@ -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();

View File

@ -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;