Store cutter enable state in EEPROM.

This commit is contained in:
Marek Bel 2019-02-27 17:34:03 +01:00
parent 4a4eb9962c
commit 02a692c5d9
5 changed files with 15 additions and 10 deletions

View File

@ -285,7 +285,6 @@ void setPwmFrequency(uint8_t pin, int val);
#endif //CRITICAL_SECTION_START #endif //CRITICAL_SECTION_START
extern bool fans_check_enabled; extern bool fans_check_enabled;
extern bool cutter_enabled;
extern float homing_feedrate[]; extern float homing_feedrate[];
extern bool axis_relative_modes[]; extern bool axis_relative_modes[];
extern int feedmultiply; extern int feedmultiply;

View File

@ -510,8 +510,6 @@ void servo_init()
bool fans_check_enabled = true; bool fans_check_enabled = true;
bool cutter_enabled = false;
#ifdef TMC2130 #ifdef TMC2130

View File

@ -153,7 +153,7 @@
#define EEPROM_MMU_LOAD_FAIL_TOT (EEPROM_MMU_FAIL - 2) //uint16_t #define EEPROM_MMU_LOAD_FAIL_TOT (EEPROM_MMU_FAIL - 2) //uint16_t
#define EEPROM_MMU_LOAD_FAIL (EEPROM_MMU_LOAD_FAIL_TOT - 1) //uint8_t #define EEPROM_MMU_LOAD_FAIL (EEPROM_MMU_LOAD_FAIL_TOT - 1) //uint8_t
#define EEPROM_MMU_CUTTER_ENABLED (EEPROM_MMU_LOAD_FAIL - 1)
// !!!!! // !!!!!
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
// !!!!! // !!!!!

View File

@ -1439,7 +1439,7 @@ void mmu_continue_loading()
if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1); if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1);
if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1); if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1);
if (cutter_enabled) if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
{ {
mmu_command(MmuCmd::K0 + tmp_extruder); mmu_command(MmuCmd::K0 + tmp_extruder);
manage_response(true, true, MMU_UNLOAD_MOVE); manage_response(true, true, MMU_UNLOAD_MOVE);

View File

@ -2293,8 +2293,16 @@ void lcd_set_fan_check() {
eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED, fans_check_enabled); eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED, fans_check_enabled);
} }
void lcd_cutter_enabled() { void lcd_cutter_enabled()
cutter_enabled = !cutter_enabled; {
if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
{
eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 0);
}
else
{
eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 1);
}
} }
void lcd_set_filament_autoload() { void lcd_set_filament_autoload() {
@ -5212,10 +5220,10 @@ static void lcd_settings_menu()
SETTINGS_AUTO_DEPLETE; SETTINGS_AUTO_DEPLETE;
if (cutter_enabled == true) if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
MENU_ITEM_FUNCTION_P(_i("Cutter [on]"), lcd_cutter_enabled);////MSG_FANS_CHECK_ON c=17 r=1 MENU_ITEM_FUNCTION_P(_i("Cutter [on]"), lcd_cutter_enabled);//// c=17 r=1
else else
MENU_ITEM_FUNCTION_P(_i("Cutter [off]"), lcd_cutter_enabled);////MSG_FANS_CHECK_OFF c=17 r=1 MENU_ITEM_FUNCTION_P(_i("Cutter [off]"), lcd_cutter_enabled);//// c=17 r=1
if (fans_check_enabled == true) if (fans_check_enabled == true)
MENU_ITEM_FUNCTION_P(_i("Fans check [on]"), lcd_set_fan_check);////MSG_FANS_CHECK_ON c=17 r=1 MENU_ITEM_FUNCTION_P(_i("Fans check [on]"), lcd_set_fan_check);////MSG_FANS_CHECK_ON c=17 r=1