Fsensor autoload enabled menu and eeprom variable

This commit is contained in:
Robert Pelnar 2017-12-20 22:29:41 +01:00
parent c88938e813
commit a3a0e70eeb
7 changed files with 44 additions and 6 deletions

View File

@ -90,6 +90,8 @@
#define EEPROM_SD_SORT (EEPROM_DIRS - 1) //0 -time, 1-alpha, 2-none
#define EEPROM_SECOND_SERIAL_ACTIVE (EEPROM_SD_SORT - 1)
#define EEPROM_FSENS_AUTOLOAD_ENABLED (EEPROM_SECOND_SERIAL_ACTIVE - 1)
//TMC2130 configuration
#define EEPROM_TMC_AXIS_SIZE //axis configuration block size
#define EEPROM_TMC_X (EEPROM_TMC + 0 * EEPROM_TMC_AXIS_SIZE) //X axis configuration blok

View File

@ -586,6 +586,9 @@ static void lcd_language_menu();
void stop_and_save_print_to_ram(float z_move, float e_move);
void restore_print_from_ram_and_continue(float e_move);
bool fans_check_enabled = true;
bool filament_autoload_enabled = true;
extern int8_t CrashDetectMenu;
void crashdet_enable()
@ -936,6 +939,8 @@ void setup()
puts_P(PSTR("DISABLED\n"));
fsensor_disable();
}
filament_autoload_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED) > 0);
#endif //PAT9125
@ -5585,14 +5590,14 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
//load_filament_time = millis();
KEEPALIVE_STATE(PAUSED_FOR_USER);
#ifdef PAT9125
if (fsensor_M600) fsensor_autoload_check_start();
if (filament_autoload_enabled && fsensor_M600) fsensor_autoload_check_start();
#endif //PAT9125
while(!lcd_clicked())
{
manage_heater();
manage_inactivity(true);
#ifdef PAT9125
if (fsensor_M600 && fsensor_check_autoload())
if (filament_autoload_enabled && fsensor_M600 && fsensor_check_autoload())
break;
#endif //PAT9125
/*#ifdef SNMM
@ -5603,7 +5608,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
}
#ifdef PAT9125
if (fsensor_M600) fsensor_autoload_check_stop();
if (filament_autoload_enabled && fsensor_M600) fsensor_autoload_check_stop();
#endif //PAT9125
//WRITE(BEEPER, LOW);
KEEPALIVE_STATE(IN_HANDLER);
@ -6378,7 +6383,7 @@ void handle_status_leds(void) {
void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h
{
if (fsensor_enabled && !fsensor_M600 && !moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && (current_temperature[0] > EXTRUDE_MINTEMP))
if (fsensor_enabled && filament_autoload_enabled && !fsensor_M600 && !moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && (current_temperature[0] > EXTRUDE_MINTEMP))
{
if (fsensor_autoload_enabled)
{

View File

@ -740,6 +740,16 @@ const char * const MSG_FSENSOR_ON_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_FSENSOR_ON_CZ
};
const char MSG_FSENS_AUTOLOAD_OFF_EN[] PROGMEM = "F. autoload [off]";
const char * const MSG_FSENS_AUTOLOAD_OFF_LANG_TABLE[1] PROGMEM = {
MSG_FSENS_AUTOLOAD_OFF_EN
};
const char MSG_FSENS_AUTOLOAD_ON_EN[] PROGMEM = "F. autoload [on]";
const char * const MSG_FSENS_AUTOLOAD_ON_LANG_TABLE[1] PROGMEM = {
MSG_FSENS_AUTOLOAD_ON_EN
};
const char MSG_HEATING_EN[] PROGMEM = "Heating";
const char MSG_HEATING_CZ[] PROGMEM = "Zahrivani";
const char * const MSG_HEATING_LANG_TABLE[LANG_NUM] PROGMEM = {

View File

@ -260,6 +260,10 @@ extern const char* const MSG_FSENSOR_OFF_LANG_TABLE[LANG_NUM];
#define MSG_FSENSOR_OFF LANG_TABLE_SELECT(MSG_FSENSOR_OFF_LANG_TABLE)
extern const char* const MSG_FSENSOR_ON_LANG_TABLE[LANG_NUM];
#define MSG_FSENSOR_ON LANG_TABLE_SELECT(MSG_FSENSOR_ON_LANG_TABLE)
extern const char* const MSG_FSENS_AUTOLOAD_OFF_LANG_TABLE[1];
#define MSG_FSENS_AUTOLOAD_OFF LANG_TABLE_SELECT_EXPLICIT(MSG_FSENS_AUTOLOAD_OFF_LANG_TABLE, 0)
extern const char* const MSG_FSENS_AUTOLOAD_ON_LANG_TABLE[1];
#define MSG_FSENS_AUTOLOAD_ON LANG_TABLE_SELECT_EXPLICIT(MSG_FSENS_AUTOLOAD_ON_LANG_TABLE, 0)
extern const char* const MSG_HEATING_LANG_TABLE[LANG_NUM];
#define MSG_HEATING LANG_TABLE_SELECT(MSG_HEATING_LANG_TABLE)
extern const char* const MSG_HEATING_COMPLETE_LANG_TABLE[LANG_NUM];

View File

@ -369,6 +369,8 @@
#define(length=11, lines=1) MSG_INFO_FILAMENT_YDIFF "Fil. Ydiff:"
#define(length=17, lines=1) MSG_FANS_CHECK_ON "Fans check [on]"
#define(length=17, lines=1) MSG_FANS_CHECK_OFF "Fans check [off]"
#define(length=17, lines=1) MSG_FSENS_AUTOLOAD_ON "F. autoload [on]"
#define(length=17, lines=1) MSG_FSENS_AUTOLOAD_OFF "F. autoload [off]"
#define(length=20, lines=4) MSG_PRESS_TO_UNLOAD "Please press the knob to unload filament"
#define(length=20, lines=2) MSG_UNLOAD_SUCCESSFULL "Repeat unloading filament?"
#define(length=20, lines=2) MSG_FILE_INCOMPLETE "File incomplete. Continue anyway?"

View File

@ -476,9 +476,11 @@ void countFanSpeed()
fan_edge_counter[1] = 0;
}
extern bool fans_check_enabled;
void checkFanSpeed()
{
bool fans_check_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED) > 0);
fans_check_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED) > 0);
static unsigned char fan_speed_errors[2] = { 0,0 };
if (fan_speed[0] == 0 && (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE)) fan_speed_errors[0]++;

View File

@ -30,7 +30,8 @@
int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
extern int lcd_change_fil_state;
extern bool fans_check_enabled = true;
extern bool fans_check_enabled;
extern bool filament_autoload_enabled;
//Function pointer to menu functions.
typedef void (*menuFunc_t)();
@ -1703,6 +1704,12 @@ void lcd_set_fan_check() {
lcd_goto_menu(lcd_settings_menu, 8);
}
void lcd_set_filament_autoload() {
filament_autoload_enabled = !filament_autoload_enabled;
eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, filament_autoload_enabled);
lcd_goto_menu(lcd_settings_menu, 8);
}
void lcd_unLoadFilament()
{
@ -3735,6 +3742,12 @@ static void lcd_settings_menu()
} else {
MENU_ITEM(function, MSG_FSENSOR_ON, lcd_fsensor_state_set);
}
if (filament_autoload_enabled == true) {
MENU_ITEM(function, MSG_FSENS_AUTOLOAD_ON, lcd_set_filament_autoload);
}
else {
MENU_ITEM(function, MSG_FSENS_AUTOLOAD_OFF, lcd_set_filament_autoload);
}
if (fans_check_enabled == true) {
MENU_ITEM(function, MSG_FANS_CHECK_ON, lcd_set_fan_check);
}