Merge branch 'MK3' into detect_bad_load

This commit is contained in:
Marek Bel 2019-02-25 10:41:26 +01:00
commit 8f5fbe569c
6 changed files with 117 additions and 54 deletions

View File

@ -7,8 +7,8 @@
#define STR(x) STR_HELPER(x)
// Firmware version
#define FW_VERSION "3.5.3"
#define FW_COMMIT_NR 2007
#define FW_VERSION "3.6.0-RC1"
#define FW_COMMIT_NR 2060
// FW_VERSION_UNKNOWN means this is an unofficial build.
// The firmware should only be checked into github with this symbol.
#define FW_DEV_VERSION FW_VERSION_UNKNOWN

View File

@ -94,7 +94,11 @@ void cmdqueue_reset()
bufindr = 0;
bufindw = 0;
buflen = 0;
cmdbuffer_front_already_processed = false;
//commands are removed from command queue after process_command() function is finished
//reseting command queue and enqueing new commands during some (usually long running) command processing would cause that new commands are immediately removed from queue (or damaged)
//this will ensure that all new commands which are enqueued after cmdqueue reset, will be always executed
cmdbuffer_front_already_processed = true;
}
// How long a string could be pushed to the front of the command queue?

View File

@ -16,7 +16,7 @@
extern int32_t lcd_encoder;
#define MENU_DEPTH_MAX 4
#define MENU_DEPTH_MAX 6
static menu_record_t menu_stack[MENU_DEPTH_MAX];
@ -85,7 +85,6 @@ void menu_end(void)
}
}
//-//
void menu_back(uint8_t nLevel)
{
menu_depth = ((menu_depth > nLevel) ? (menu_depth - nLevel) : 0);
@ -97,17 +96,6 @@ void menu_back(void)
menu_back(1);
}
/*
void menu_back(void)
{
if (menu_depth > 0)
{
menu_depth--;
menu_goto(menu_stack[menu_depth].menu, menu_stack[menu_depth].position, true, true);
}
}
*/
static void menu_back_no_reset(void)
{
if (menu_depth > 0)
@ -394,8 +382,3 @@ template uint8_t menu_item_edit_P<int16_t*>(const char* str, int16_t *pval, int1
template uint8_t menu_item_edit_P<uint8_t*>(const char* str, uint8_t *pval, int16_t min_val, int16_t max_val);
#undef _menu_data

View File

@ -1022,6 +1022,28 @@ void mmu_filament_ramming()
}
}
//-//
void extr_unload_()
{
//if(bFilamentAction)
if(0)
{
bFilamentAction=false;
extr_unload();
}
else {
eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
{
bFilamentPreheatState=true;
mFilamentItem(target_temperature[0],target_temperature_bed);
}
// else menu_submenu(mFilamentMenu);
else mFilamentMenu();
}
}
void extr_unload()
{ //unload just current filament for multimaterial printers
#ifdef SNMM
@ -1030,11 +1052,8 @@ void extr_unload()
uint8_t SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
#endif
//-// if (degHotend0() > EXTRUDE_MINTEMP)
//if(current_temperature[0]>(target_temperature[0]*0.95))
if(bFilamentAction)
if (degHotend0() > EXTRUDE_MINTEMP)
{
bFilamentAction=false;
#ifndef SNMM
st_synchronize();
@ -1108,13 +1127,7 @@ bFilamentAction=false;
}
else
{
eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP) {
bFilamentPreheatState=true;
mFilamentItem(target_temperature[0],target_temperature_bed);
}
else menu_submenu(mFilamentMenu);
show_preheat_nozzle_warning();
}
//lcd_return_to_status();
}
@ -1172,51 +1185,71 @@ void extr_adj_4()
void mmu_load_to_nozzle_0()
{
//-//
menu_back();
lcd_mmu_load_to_nozzle(0);
}
void mmu_load_to_nozzle_1()
{
//-//
menu_back();
lcd_mmu_load_to_nozzle(1);
}
void mmu_load_to_nozzle_2()
{
//-//
menu_back();
lcd_mmu_load_to_nozzle(2);
}
void mmu_load_to_nozzle_3()
{
//-//
menu_back();
lcd_mmu_load_to_nozzle(3);
}
void mmu_load_to_nozzle_4()
{
//-//
menu_back();
lcd_mmu_load_to_nozzle(4);
}
void mmu_eject_fil_0()
{
//-//
menu_back();
mmu_eject_filament(0, true);
}
void mmu_eject_fil_1()
{
//-//
menu_back();
mmu_eject_filament(1, true);
}
void mmu_eject_fil_2()
{
//-//
menu_back();
mmu_eject_filament(2, true);
}
void mmu_eject_fil_3()
{
//-//
menu_back();
mmu_eject_filament(3, true);
}
void mmu_eject_fil_4()
{
//-//
menu_back();
mmu_eject_filament(4, true);
}
@ -1344,7 +1377,7 @@ void mmu_show_warning()
void lcd_mmu_load_to_nozzle(uint8_t filament_nr)
{
//-//
bFilamentAction=false;
bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()"
if (degHotend0() > EXTRUDE_MINTEMP)
{
tmp_extruder = filament_nr;
@ -1377,7 +1410,7 @@ bFilamentAction=false;
void mmu_eject_filament(uint8_t filament, bool recover)
{
//-//
bFilamentAction=false;
bFilamentAction=false; // NOT in "mmu_fil_eject_menu()"
if (filament < 5)
{

View File

@ -101,6 +101,8 @@ extern int get_ext_nr();
extern void display_loading();
extern void extr_adj(int extruder);
extern void extr_unload();
//-//
extern void extr_unload_();
extern void extr_adj_0();
extern void extr_adj_1();
extern void extr_adj_2();

View File

@ -2310,6 +2310,8 @@ bool bFilamentAction=false;
static void mFilamentPrompt()
{
uint8_t nLevel;
lcd_set_cursor(0,0);
lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0));
lcd_set_cursor(0,2);
@ -2332,14 +2334,13 @@ switch(eFilamentAction)
}
if(lcd_clicked())
{
//./ menu_back();
//./ menu_back();
menu_back(2);
nLevel=2;
if(!bFilamentPreheatState)
{
menu_back();
//-// setTargetHotend0(0.0);
nLevel++;
// setTargetHotend0(0.0); // uncoment if return to base state is required
}
menu_back(nLevel);
switch(eFilamentAction)
{
case e_FILAMENT_ACTION_Load:
@ -2350,20 +2351,27 @@ menu_back(2);
case e_FILAMENT_ACTION_unLoad:
enquecommand_P(PSTR("M702")); // unload filament
break;
/*
case e_FILAMENT_ACTION_mmuLoad:
MYSERIAL.println("mFilamentPrompt - mmuLoad");
bFilamentAction=true;
//./ MYSERIAL.println("mFilamentPrompt - mmuLoad");
bFilamentAction=true;
menu_submenu(mmu_load_to_nozzle_menu);
break;
*/
/*
case e_FILAMENT_ACTION_mmuUnLoad:
bFilamentAction=true;
//./ MYSERIAL.println("mFilamentPrompt - mmuUnLoad");
bFilamentAction=true;
extr_unload();
break;
*/
/*
case e_FILAMENT_ACTION_mmuEject:
MYSERIAL.println("mFilamentPrompt - mmuEject");
bFilamentAction=true;
menu_submenu(mmu_fil_eject_menu);
bFilamentAction=true;
// menu_submenu(mmu_fil_eject_menu);
break;
*/
}
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
@ -2373,6 +2381,8 @@ bFilamentAction=true;
void mFilamentItem(uint16_t nTemp,uint16_t nTempBed)
{
static int nTargetOld,nTargetBedOld;
uint8_t nLevel;
static bool bBeep=false;
//if(bPreheatState) // not necessary
nTargetOld=target_temperature[0];
@ -2416,12 +2426,47 @@ if(lcd_clicked())
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
}
//./else if(!isHeatingHotend0())
else if(current_temperature[0]>(target_temperature[0]*0.95))
else {
if(current_temperature[0]>(target_temperature[0]*0.95))
{
menu_submenu(mFilamentPrompt);
Sound_MakeSound(e_SOUND_TYPE_StandardPrompt);
switch(eFilamentAction)
{
case e_FILAMENT_ACTION_Load:
case e_FILAMENT_ACTION_autoLoad:
case e_FILAMENT_ACTION_unLoad:
menu_submenu(mFilamentPrompt);
break;
case e_FILAMENT_ACTION_mmuLoad:
nLevel=1;
if(!bFilamentPreheatState)
nLevel++;
bFilamentAction=true;
menu_back(nLevel);
menu_submenu(mmu_load_to_nozzle_menu);
break;
case e_FILAMENT_ACTION_mmuUnLoad:
nLevel=1;
if(!bFilamentPreheatState)
nLevel++;
bFilamentAction=true;
menu_back(nLevel);
extr_unload();
break;
case e_FILAMENT_ACTION_mmuEject:
nLevel=1;
if(!bFilamentPreheatState)
nLevel++;
bFilamentAction=true;
menu_back(nLevel);
menu_submenu(mmu_fil_eject_menu);
break;
}
if(bBeep)
Sound_MakeSound(e_SOUND_TYPE_StandardPrompt);
bBeep=false;
}
else bBeep=true;
}
}
static void mFilamentItem_PLA()
@ -5643,10 +5688,8 @@ static void fil_load_menu()
static void mmu_load_to_nozzle_menu()
{
//-//if (degHotend0() > EXTRUDE_MINTEMP)
//if(current_temperature[0]>(target_temperature[0]*0.95))
if(bFilamentAction)
{
//../bFilamentAction=false;
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle_0);
@ -5671,10 +5714,8 @@ else {
static void mmu_fil_eject_menu()
{
//-//if (degHotend0() > EXTRUDE_MINTEMP)
//if(current_temperature[0]>(target_temperature[0]*0.95))
if(bFilamentAction)
{
//../bFilamentAction=false;
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_fil_0);
@ -5685,7 +5726,6 @@ if(bFilamentAction)
MENU_END();
}
else {
MYSERIAL.println(" eject - else");
eFilamentAction=e_FILAMENT_ACTION_mmuEject;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
@ -6166,7 +6206,8 @@ static void lcd_main_menu()
MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu);
MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu);
//-// MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload);
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload);
//bFilamentFirstRun=true;
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload_);
MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu);
}
else