Initiale upload

This commit is contained in:
TheZeroBeast 2018-10-29 09:03:53 +10:00 committed by GitHub
parent 65b5ca51b3
commit 94a52e8d58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14235 additions and 15 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7329,7 +7329,6 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
{
if (fsensor_check_autoload())
{
fsensor_autoload_check_stop();
if (degHotend0() > EXTRUDE_MINTEMP)
{
if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE))
@ -7359,6 +7358,16 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
fsensor_update();
}
}
} else {
if (mcode_in_progress != 600) //M600 not in progress
{
if ((lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active && mmuFilamentLoading) {
fsensor_check_autoload();
} else {
fsensor_autoload_check_stop();
fsensor_update();
}
}
}
#endif //FILAMENT_SENSOR

View File

@ -161,9 +161,22 @@ bool fsensor_enable(void)
}
else //filament sensor is FINDA, always enable
{
fsensor_enabled = true;
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x01);
FSensorStateMenu = 1;
/**
* Enabling fsensor for load detection (hopfully jams as well)
*/
uint8_t pat9125 = pat9125_init();
printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
if (pat9125)
fsensor_not_responding = false;
else
fsensor_not_responding = true;
fsensor_enabled = pat9125 ? true : false;
fsensor_autoload_enabled = true;
fsensor_oq_meassure = false;
fsensor_err_cnt = 0;
fsensor_dy_old = 0;
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, fsensor_enabled ? 0x01 : 0x00);
FSensorStateMenu = fsensor_enabled ? 1 : 0;
}
return fsensor_enabled;
}
@ -271,8 +284,13 @@ bool fsensor_check_autoload(void)
// if ((fsensor_autoload_c >= 15) && (fsensor_autoload_sum > 30))
if ((fsensor_autoload_c >= 12) && (fsensor_autoload_sum > 20))
{
// puts_P(_N("fsensor_check_autoload = true !!!\n"));
return true;
puts_P(_N("fsensor_check_autoload = true !!!\n"));
if (mmu_enabled) {
mmu_puts_P(PSTR("FS\n"));
mmuFilamentLoading = false;
fsensor_autoload_check_stop();
//mmuFilamentLoadSeen = true;
} else return true;
}
return false;
}

View File

@ -14,6 +14,8 @@ extern bool fsensor_not_responding;
//enable/disable quality meassurement
extern bool fsensor_oq_meassure_enabled;
//extern bool mmuFilamentLoadSeen;
extern bool mmuFilamentLoading;
//! @name save restore printing
//! @{

View File

@ -18,7 +18,7 @@
#define MMU_TODELAY 100
#define MMU_TIMEOUT 10
#define MMU_CMD_TIMEOUT 300000ul //5min timeout for mmu commands (except P0)
#define MMU_CMD_TIMEOUT 60000ul //1min timeout for mmu commands (except P0)
#define MMU_P0_TIMEOUT 3000ul //timeout for P0 command: 3seconds
#ifdef MMU_HWRESET
@ -29,6 +29,10 @@ bool mmu_enabled = false;
bool mmu_ready = false;
//bool mmuFilamentLoadSeen = false;
bool mmuFilamentLoading = false;
int lastLoadedFilament = 0;
static int8_t mmu_state = 0;
uint8_t mmu_cmd = 0;
@ -47,7 +51,6 @@ int16_t mmu_buildnr = -1;
uint32_t mmu_last_request = 0;
uint32_t mmu_last_response = 0;
//clear rx buffer
void mmu_clr_rx_buf(void)
{
@ -83,6 +86,14 @@ int8_t mmu_rx_ok(void)
return res;
}
//check 'ok' response
int8_t mmu_rx_not_ok(void)
{
int8_t res = uart2_rx_str_P(PSTR("not_ok\n"));
if (res == 1) mmu_last_response = millis();
return res;
}
//check 'start' response
int8_t mmu_rx_start(void)
{
@ -203,6 +214,14 @@ void mmu_loop(void)
printf_P(PSTR("MMU <= 'T%d'\n"), filament);
#endif //MMU_DEBUG
mmu_printf_P(PSTR("T%d\n"), filament);
if (lastLoadedFilament != filament) {
fsensor_enable();
fsensor_autoload_enabled = true;
mmuFilamentLoading = true;
//mmuFilamentLoadSeen = false;
lastLoadedFilament = filament;
}
//last_filament = filament;
mmu_state = 3; // wait for response
}
else if ((mmu_cmd >= MMU_CMD_L0) && (mmu_cmd <= MMU_CMD_L4))
@ -219,7 +238,7 @@ void mmu_loop(void)
#ifdef MMU_DEBUG
printf_P(PSTR("MMU <= 'C0'\n"));
#endif //MMU_DEBUG
mmu_puts_P(PSTR("C0\n")); //send 'continue loading'
mmu_puts_P(PSTR("C0\n")); //send 'continue loading'
mmu_state = 3;
}
else if (mmu_cmd == MMU_CMD_U0)
@ -228,6 +247,7 @@ void mmu_loop(void)
printf_P(PSTR("MMU <= 'U0'\n"));
#endif //MMU_DEBUG
mmu_puts_P(PSTR("U0\n")); //send 'unload current filament'
lastLoadedFilament = -10;
mmu_state = 3;
}
else if ((mmu_cmd >= MMU_CMD_E0) && (mmu_cmd <= MMU_CMD_E4))
@ -284,11 +304,19 @@ void mmu_loop(void)
case 3: //response to mmu commands
if (mmu_rx_ok() > 0)
{
if (!mmuFilamentLoading) {
// mmu_puts_P(PSTR("C1\n")); //send 'cut retry'
// mmuFilamentLoading = false;
//} else {
#ifdef MMU_DEBUG
printf_P(PSTR("MMU => 'ok'\n"));
printf_P(PSTR("MMU => 'ok'\n"));
#endif //MMU_DEBUG
mmu_ready = true;
mmu_state = 1;
mmu_ready = true;
mmu_state = 1;
}
} else if (mmu_rx_not_ok() > 0) {
// do something with error responses from MMU
mmuFilamentLoading = false;
}
else if ((mmu_last_request + MMU_CMD_TIMEOUT) < millis())
{ //resend request after timeout (5 min)
@ -543,7 +571,7 @@ void mmu_M600_load_filament(bool automatic)
manage_response(false, true);
mmu_command(MMU_CMD_C0);
mmu_extruder = tmp_extruder; //filament change is finished
mmu_extruder = tmp_extruder; //filament change is finished
mmu_load_to_nozzle();

View File

@ -4,6 +4,7 @@
extern bool mmu_enabled;
extern int8_t mmu_state;
extern uint8_t mmu_extruder;
@ -27,6 +28,7 @@ extern int16_t mmu_buildnr;
#define MMU_CMD_L3 0x23
#define MMU_CMD_L4 0x24
#define MMU_CMD_C0 0x30
#define MMU_CMD_C1 0x31
#define MMU_CMD_U0 0x40
#define MMU_CMD_E0 0x50
#define MMU_CMD_E1 0x51
@ -42,6 +44,7 @@ extern int mmu_printf_P(const char* format, ...);
extern int8_t mmu_rx_ok(void);
extern int8_t mmu_rx_not_ok(void);
extern void mmu_init(void);

View File

@ -26,6 +26,8 @@
#define PAT9125_BANK_SELECTION 0x7f
#define PAT9125_NEW_INIT
#ifdef PAT9125_SWSPI
#include "swspi.h"
#endif //PAT9125_SWSPI

View File

@ -4098,7 +4098,7 @@ static void lcd_fsensor_state_set()
FSensorStateMenu = !FSensorStateMenu; //set also from fsensor_enable() and fsensor_disable()
if (!FSensorStateMenu) {
fsensor_disable();
if (fsensor_autoload_enabled && !mmu_enabled)
if (fsensor_autoload_enabled)
menu_submenu(lcd_filament_autoload_info);
}
else {
@ -7426,4 +7426,3 @@ void menu_lcd_lcdupdate_func(void)
lcd_send_status();
if (lcd_commands_type == LCD_COMMAND_V2_CAL) lcd_commands();
}