move files, I'm so tired LOL
This commit is contained in:
parent
5beb4c683d
commit
6c56deae4f
|
|
@ -7361,7 +7361,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
|||
} else {
|
||||
if (mcode_in_progress != 600) //M600 not in progress
|
||||
{
|
||||
if ((lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active && mmuFilamentLoading && !mmFilamentLoadSeen) {
|
||||
if ((lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active && mmuFilamentMK3Moving) {
|
||||
fsensor_check_autoload();
|
||||
} else {
|
||||
fsensor_autoload_check_stop();
|
||||
|
|
@ -9100,4 +9100,4 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|||
lcd_update_enable(false);
|
||||
}
|
||||
|
||||
#define FIL_LOAD_LENGTH 60
|
||||
#define FIL_LOAD_LENGTH 60
|
||||
|
|
|
|||
|
|
@ -287,9 +287,8 @@ bool fsensor_check_autoload(void)
|
|||
puts_P(_N("fsensor_check_autoload = true !!!\n"));
|
||||
if (mmu_enabled) {
|
||||
mmu_puts_P(PSTR("FS\n"));
|
||||
mmuFilamentLoading = false;
|
||||
mmuFilamentMK3Moving = false;
|
||||
fsensor_autoload_check_stop();
|
||||
mmuFilamentLoadSeen = true;
|
||||
} else return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -543,4 +542,4 @@ void fsensor_setup_interrupt(void)
|
|||
fsensor_int_pin_old = 0;
|
||||
|
||||
pciSetup(FSENSOR_INT_PIN);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ extern bool fsensor_not_responding;
|
|||
//enable/disable quality meassurement
|
||||
extern bool fsensor_oq_meassure_enabled;
|
||||
|
||||
//extern bool mmuFilamentLoadSeen;
|
||||
extern bool mmuFilamentLoading;
|
||||
extern bool mmuFilamentMK3Moving;
|
||||
|
||||
//! @name save restore printing
|
||||
//! @{
|
||||
|
|
@ -64,4 +63,4 @@ extern void fsensor_st_block_begin(block_t* bl);
|
|||
extern void fsensor_st_block_chunk(block_t* bl, int cnt);
|
||||
//! @}
|
||||
|
||||
#endif //FSENSOR_H
|
||||
#endif //FSENSOR_H
|
||||
|
|
|
|||
171
Firmware/mmu.cpp
171
Firmware/mmu.cpp
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#define MMU_TODELAY 100
|
||||
#define MMU_TIMEOUT 10
|
||||
#define MMU_CMD_TIMEOUT 60000ul //1min timeout for mmu commands (except P0)
|
||||
#define MMU_CMD_TIMEOUT 300000ul //5min timeout for mmu commands (except P0)
|
||||
#define MMU_P0_TIMEOUT 3000ul //timeout for P0 command: 3seconds
|
||||
|
||||
#ifdef MMU_HWRESET
|
||||
|
|
@ -30,7 +30,7 @@ bool mmu_enabled = false;
|
|||
bool mmu_ready = false;
|
||||
|
||||
//bool mmuFilamentLoadSeen = false;
|
||||
bool mmuFilamentLoading = false;
|
||||
bool mmuFilamentMK3Moving = false;
|
||||
int lastLoadedFilament = 0;
|
||||
|
||||
static int8_t mmu_state = 0;
|
||||
|
|
@ -86,7 +86,15 @@ int8_t mmu_rx_ok(void)
|
|||
return res;
|
||||
}
|
||||
|
||||
//check 'ok' response
|
||||
//check 'sensing Filament at Boot' response
|
||||
int8_t mmu_rx_sensFilatBoot()
|
||||
{
|
||||
int8_t res = uart2_rx_str_P(PSTR("FB\n")); // FB stands for filament boot
|
||||
if (res == 1) mmu_last_response = millis();
|
||||
return res;
|
||||
}
|
||||
|
||||
//check ' not ok' response
|
||||
int8_t mmu_rx_not_ok(void)
|
||||
{
|
||||
int8_t res = uart2_rx_str_P(PSTR("not_ok\n"));
|
||||
|
|
@ -133,7 +141,14 @@ void mmu_loop(void)
|
|||
#endif //MMU_DEBUG
|
||||
mmu_puts_P(PSTR("S1\n")); //send 'read version' request
|
||||
mmu_state = -2;
|
||||
}
|
||||
}else if (mmu_rx_sensFilatBoot() > 0)
|
||||
{
|
||||
printf_P(PSTR("MMU => '%Sensed Filament at Boot'\n"), mmu_finda);
|
||||
enquecommand_front_P(PSTR("M104 S210"));
|
||||
enquecommand_front_P(PSTR("M109 S210"));
|
||||
extr_unload_at_boot();
|
||||
mmu_puts_P(PSTR("FB\n")); //Advise unloaded to above bondtech for retraction
|
||||
}
|
||||
else if (millis() > 30000) //30sec after reset disable mmu
|
||||
{
|
||||
puts_P(PSTR("MMU not responding - DISABLED"));
|
||||
|
|
@ -217,11 +232,10 @@ void mmu_loop(void)
|
|||
if (lastLoadedFilament != filament) {
|
||||
fsensor_enable();
|
||||
fsensor_autoload_enabled = true;
|
||||
mmuFilamentLoading = true;
|
||||
mmuFilamentMK3Moving = 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))
|
||||
|
|
@ -247,6 +261,9 @@ void mmu_loop(void)
|
|||
printf_P(PSTR("MMU <= 'U0'\n"));
|
||||
#endif //MMU_DEBUG
|
||||
mmu_puts_P(PSTR("U0\n")); //send 'unload current filament'
|
||||
fsensor_enable();
|
||||
fsensor_autoload_enabled = true;
|
||||
mmuFilamentMK3Moving = true;
|
||||
lastLoadedFilament = -10;
|
||||
mmu_state = 3;
|
||||
}
|
||||
|
|
@ -285,7 +302,6 @@ void mmu_loop(void)
|
|||
#ifdef MMU_DEBUG
|
||||
printf_P(PSTR("MMU => '%dok'\n"), mmu_finda);
|
||||
#endif //MMU_DEBUG
|
||||
//printf_P(PSTR("Eact: %d\n"), int(e_active()));
|
||||
if (!mmu_finda && CHECK_FINDA && fsensor_enabled) {
|
||||
fsensor_stop_and_save_print();
|
||||
enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover
|
||||
|
|
@ -304,24 +320,14 @@ void mmu_loop(void)
|
|||
case 3: //response to mmu commands
|
||||
if (mmu_rx_ok() > 0)
|
||||
{
|
||||
/**
|
||||
* Started implementing FS0 & FS1 comms to MMU for FS0 to
|
||||
* only have MMU return 'ok\n', FS1 to have MMU stop load as MK3-Sensor has been reached.
|
||||
*/
|
||||
if (!mmuFilamentLoading) {
|
||||
#ifdef MMU_DEBUG
|
||||
printf_P(PSTR("MMU => 'ok'\n"));
|
||||
#endif //MMU_DEBUG
|
||||
mmu_ready = true;
|
||||
mmu_state = 1;
|
||||
} else {
|
||||
if (mmuFilamentLoadSeen) {
|
||||
mmuFilamentLoading = false;
|
||||
mmuFilamentSeen = false;
|
||||
mmu_printf_P(PSTR("FS%d\n"), 1);
|
||||
} else mmu_printf_P(PSTR("FS%d\n"), 0);
|
||||
}
|
||||
}
|
||||
if (!mmuFilamentMK3Moving) {
|
||||
printf_P(PSTR("MMU => 'ok'\n"));
|
||||
mmu_ready = true;
|
||||
mmu_state = 1;
|
||||
}
|
||||
} else if (mmu_rx_not_ok() > 0) {
|
||||
printf_P(PSTR("MMU => 'not ok'\n"));
|
||||
}
|
||||
else if ((mmu_last_request + MMU_CMD_TIMEOUT) < millis())
|
||||
{ //resend request after timeout (5 min)
|
||||
mmu_state = 1;
|
||||
|
|
@ -378,28 +384,8 @@ bool mmu_get_response(void)
|
|||
mmu_ready = false;
|
||||
// printf_P(PSTR("mmu_get_response - end %d\n"), ret?1:0);
|
||||
return ret;
|
||||
|
||||
/* //waits for "ok" from mmu
|
||||
//function returns true if "ok" was received
|
||||
//if timeout is set to true function return false if there is no "ok" received before timeout
|
||||
bool response = true;
|
||||
LongTimer mmu_get_reponse_timeout;
|
||||
KEEPALIVE_STATE(IN_PROCESS);
|
||||
mmu_get_reponse_timeout.start();
|
||||
while (mmu_rx_ok() <= 0)
|
||||
{
|
||||
delay_keep_alive(100);
|
||||
if (timeout && mmu_get_reponse_timeout.expired(5 * 60 * 1000ul))
|
||||
{ //5 minutes timeout
|
||||
response = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf_P(PSTR("mmu_get_response - end %d\n"), response?1:0);
|
||||
return response;*/
|
||||
}
|
||||
|
||||
|
||||
void manage_response(bool move_axes, bool turn_off_nozzle)
|
||||
{
|
||||
bool response = false;
|
||||
|
|
@ -855,6 +841,99 @@ void extr_unload()
|
|||
//lcd_return_to_status();
|
||||
}
|
||||
|
||||
void extr_unload_at_boot()
|
||||
{ //unload just current filament for multimaterial printers
|
||||
#ifdef SNMM
|
||||
float tmp_motor[3] = DEFAULT_PWM_MOTOR_CURRENT;
|
||||
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
|
||||
uint8_t SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
|
||||
#endif
|
||||
|
||||
if (degHotend0() > EXTRUDE_MINTEMP)
|
||||
{
|
||||
#ifndef SNMM
|
||||
st_synchronize();
|
||||
|
||||
//show which filament is currently unloaded
|
||||
lcd_update_enable(false);
|
||||
lcd_clear();
|
||||
lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT));
|
||||
lcd_print(" ");
|
||||
lcd_print(mmu_extruder + 1);
|
||||
|
||||
filament_ramming();
|
||||
|
||||
//mmu_command(MMU_CMD_U0);
|
||||
// get response
|
||||
manage_response(false, true);
|
||||
|
||||
lcd_update_enable(true);
|
||||
#else //SNMM
|
||||
|
||||
lcd_clear();
|
||||
lcd_display_message_fullscreen_P(PSTR(""));
|
||||
max_feedrate[E_AXIS] = 50;
|
||||
lcd_set_cursor(0, 0); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT));
|
||||
lcd_print(" ");
|
||||
lcd_print(mmu_extruder + 1);
|
||||
lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_PLEASE_WAIT));
|
||||
if (current_position[Z_AXIS] < 15) {
|
||||
current_position[Z_AXIS] += 15; //lifting in Z direction to make space for extrusion
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 25, active_extruder);
|
||||
}
|
||||
|
||||
current_position[E_AXIS] += 10; //extrusion
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 10, active_extruder);
|
||||
st_current_set(2, E_MOTOR_HIGH_CURRENT);
|
||||
if (current_temperature[0] < 230) { //PLA & all other filaments
|
||||
current_position[E_AXIS] += 5.4;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2800 / 60, active_extruder);
|
||||
current_position[E_AXIS] += 3.2;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder);
|
||||
current_position[E_AXIS] += 3;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3400 / 60, active_extruder);
|
||||
}
|
||||
else { //ABS
|
||||
current_position[E_AXIS] += 3.1;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2000 / 60, active_extruder);
|
||||
current_position[E_AXIS] += 3.1;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2500 / 60, active_extruder);
|
||||
current_position[E_AXIS] += 4;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder);
|
||||
/*current_position[X_AXIS] += 23; //delay
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 600 / 60, active_extruder); //delay
|
||||
current_position[X_AXIS] -= 23; //delay
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 600 / 60, active_extruder); //delay*/
|
||||
delay_keep_alive(4700);
|
||||
}
|
||||
|
||||
max_feedrate[E_AXIS] = 80;
|
||||
current_position[E_AXIS] -= (bowden_length[mmu_extruder] + 60 + FIL_LOAD_LENGTH) / 2;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 500, active_extruder);
|
||||
current_position[E_AXIS] -= (bowden_length[mmu_extruder] + 60 + FIL_LOAD_LENGTH) / 2;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 500, active_extruder);
|
||||
st_synchronize();
|
||||
//st_current_init();
|
||||
if (SilentMode != SILENT_MODE_OFF) st_current_set(2, tmp_motor[2]); //set back to normal operation currents
|
||||
else st_current_set(2, tmp_motor_loud[2]);
|
||||
lcd_update_enable(true);
|
||||
lcd_return_to_status();
|
||||
max_feedrate[E_AXIS] = 50;
|
||||
#endif //SNMM
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_clear();
|
||||
lcd_set_cursor(0, 0);
|
||||
lcd_puts_P(_T(MSG_ERROR));
|
||||
lcd_set_cursor(0, 2);
|
||||
lcd_puts_P(_T(MSG_PREHEAT_NOZZLE));
|
||||
delay(2000);
|
||||
lcd_clear();
|
||||
}
|
||||
//lcd_return_to_status();
|
||||
}
|
||||
|
||||
//wrapper functions for loading filament
|
||||
void extr_adj_0()
|
||||
{
|
||||
|
|
@ -1104,4 +1183,4 @@ void mmu_eject_filament(uint8_t filament, bool recover)
|
|||
{
|
||||
puts_P(PSTR("Filament nr out of range!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ extern int8_t mmu_rx_ok(void);
|
|||
|
||||
extern int8_t mmu_rx_not_ok(void);
|
||||
|
||||
extern int8_t mmu_rx_sensFilatBoot(void);
|
||||
|
||||
extern void mmu_init(void);
|
||||
|
||||
extern void mmu_loop(void);
|
||||
|
|
@ -72,6 +74,7 @@ extern int get_ext_nr();
|
|||
extern void display_loading();
|
||||
extern void extr_adj(int extruder);
|
||||
extern void extr_unload();
|
||||
extern void extr_unload_at_boot();
|
||||
extern void extr_adj_0();
|
||||
extern void extr_adj_1();
|
||||
extern void extr_adj_2();
|
||||
|
|
@ -97,4 +100,4 @@ extern void mmu_eject_fil_0();
|
|||
extern void mmu_eject_fil_1();
|
||||
extern void mmu_eject_fil_2();
|
||||
extern void mmu_eject_fil_3();
|
||||
extern void mmu_eject_fil_4();
|
||||
extern void mmu_eject_fil_4();
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ void extr_adj(int extruder);
|
|||
void extr_unload_all();
|
||||
void extr_unload_used();
|
||||
void extr_unload();
|
||||
void extr_unload_at_boot();
|
||||
|
||||
void unload_filament();
|
||||
|
||||
|
|
@ -192,4 +193,4 @@ enum class WizState : uint8_t
|
|||
|
||||
void lcd_wizard(WizState state);
|
||||
|
||||
#endif //ULTRALCD_H
|
||||
#endif //ULTRALCD_H
|
||||
|
|
|
|||
9103
Marlin_main.cpp
9103
Marlin_main.cpp
File diff suppressed because it is too large
Load Diff
545
fsensor.cpp
545
fsensor.cpp
|
|
@ -1,545 +0,0 @@
|
|||
//! @file
|
||||
|
||||
#include "Marlin.h"
|
||||
|
||||
#include "fsensor.h"
|
||||
#include <avr/pgmspace.h>
|
||||
#include "pat9125.h"
|
||||
#include "stepper.h"
|
||||
#include "planner.h"
|
||||
#include "fastio.h"
|
||||
#include "cmdqueue.h"
|
||||
#include "ultralcd.h"
|
||||
#include "ConfigurationStore.h"
|
||||
#include "mmu.h"
|
||||
|
||||
//! @name Basic parameters
|
||||
//! @{
|
||||
#define FSENSOR_CHUNK_LEN 0.64F //!< filament sensor chunk length 0.64mm
|
||||
#define FSENSOR_ERR_MAX 17 //!< filament sensor maximum error count for runout detection
|
||||
//! @}
|
||||
|
||||
//! @name Optical quality measurement parameters
|
||||
//! @{
|
||||
#define FSENSOR_OQ_MAX_ES 6 //!< maximum error sum while loading (length ~64mm = 100chunks)
|
||||
#define FSENSOR_OQ_MAX_EM 2 //!< maximum error counter value while loading
|
||||
#define FSENSOR_OQ_MIN_YD 2 //!< minimum yd per chunk (applied to avg value)
|
||||
#define FSENSOR_OQ_MAX_YD 200 //!< maximum yd per chunk (applied to avg value)
|
||||
#define FSENSOR_OQ_MAX_PD 4 //!< maximum positive deviation (= yd_max/yd_avg)
|
||||
#define FSENSOR_OQ_MAX_ND 5 //!< maximum negative deviation (= yd_avg/yd_min)
|
||||
#define FSENSOR_OQ_MAX_SH 13 //!< maximum shutter value
|
||||
//! @}
|
||||
|
||||
const char ERRMSG_PAT9125_NOT_RESP[] PROGMEM = "PAT9125 not responding (%d)!\n";
|
||||
|
||||
#define FSENSOR_INT_PIN 63 //!< filament sensor interrupt pin PK1
|
||||
#define FSENSOR_INT_PIN_MSK 0x02 //!< filament sensor interrupt pin mask (bit1)
|
||||
|
||||
//uint8_t fsensor_int_pin = FSENSOR_INT_PIN;
|
||||
uint8_t fsensor_int_pin_old = 0;
|
||||
int16_t fsensor_chunk_len = 0;
|
||||
|
||||
//! enabled = initialized and sampled every chunk event
|
||||
bool fsensor_enabled = true;
|
||||
//! runout watching is done in fsensor_update (called from main loop)
|
||||
bool fsensor_watch_runout = true;
|
||||
//! not responding - is set if any communication error occurred during initialization or readout
|
||||
bool fsensor_not_responding = false;
|
||||
//! printing saved
|
||||
bool fsensor_printing_saved = false;
|
||||
//! enable/disable quality meassurement
|
||||
bool fsensor_oq_meassure_enabled = false;
|
||||
|
||||
//! number of errors, updated in ISR
|
||||
uint8_t fsensor_err_cnt = 0;
|
||||
//! variable for accumulating step count (updated callbacks from stepper and ISR)
|
||||
int16_t fsensor_st_cnt = 0;
|
||||
//! last dy value from pat9125 sensor (used in ISR)
|
||||
int16_t fsensor_dy_old = 0;
|
||||
|
||||
//! log flag: 0=log disabled, 1=log enabled
|
||||
uint8_t fsensor_log = 1;
|
||||
|
||||
|
||||
//! @name filament autoload variables
|
||||
//! @{
|
||||
|
||||
//! autoload feature enabled
|
||||
bool fsensor_autoload_enabled = true;
|
||||
//! autoload watching enable/disable flag
|
||||
bool fsensor_watch_autoload = false;
|
||||
//
|
||||
uint16_t fsensor_autoload_y;
|
||||
//
|
||||
uint8_t fsensor_autoload_c;
|
||||
//
|
||||
uint32_t fsensor_autoload_last_millis;
|
||||
//
|
||||
uint8_t fsensor_autoload_sum;
|
||||
//! @}
|
||||
|
||||
|
||||
//! @name filament optical quality measurement variables
|
||||
//! @{
|
||||
|
||||
//! Measurement enable/disable flag
|
||||
bool fsensor_oq_meassure = false;
|
||||
//! skip-chunk counter, for accurate measurement is necessary to skip first chunk...
|
||||
uint8_t fsensor_oq_skipchunk;
|
||||
//! number of samples from start of measurement
|
||||
uint8_t fsensor_oq_samples;
|
||||
//! sum of steps in positive direction movements
|
||||
uint16_t fsensor_oq_st_sum;
|
||||
//! sum of deltas in positive direction movements
|
||||
uint16_t fsensor_oq_yd_sum;
|
||||
//! sum of errors during measurement
|
||||
uint16_t fsensor_oq_er_sum;
|
||||
//! max error counter value during measurement
|
||||
uint8_t fsensor_oq_er_max;
|
||||
//! minimum delta value
|
||||
int16_t fsensor_oq_yd_min;
|
||||
//! maximum delta value
|
||||
int16_t fsensor_oq_yd_max;
|
||||
//! sum of shutter value
|
||||
uint16_t fsensor_oq_sh_sum;
|
||||
//! @}
|
||||
|
||||
void fsensor_stop_and_save_print(void)
|
||||
{
|
||||
printf_P(PSTR("fsensor_stop_and_save_print\n"));
|
||||
stop_and_save_print_to_ram(0, 0); //XYZE - no change
|
||||
}
|
||||
|
||||
void fsensor_restore_print_and_continue(void)
|
||||
{
|
||||
printf_P(PSTR("fsensor_restore_print_and_continue\n"));
|
||||
fsensor_watch_runout = true;
|
||||
fsensor_err_cnt = 0;
|
||||
restore_print_from_ram_and_continue(0); //XYZ = orig, E - no change
|
||||
}
|
||||
|
||||
void fsensor_init(void)
|
||||
{
|
||||
uint8_t pat9125 = pat9125_init();
|
||||
printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
|
||||
uint8_t fsensor = eeprom_read_byte((uint8_t*)EEPROM_FSENSOR);
|
||||
fsensor_autoload_enabled=eeprom_read_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED);
|
||||
uint8_t oq_meassure_enabled = eeprom_read_byte((uint8_t*)EEPROM_FSENS_OQ_MEASS_ENABLED);
|
||||
fsensor_oq_meassure_enabled = (oq_meassure_enabled == 1)?true:false;
|
||||
fsensor_chunk_len = (int16_t)(FSENSOR_CHUNK_LEN * cs.axis_steps_per_unit[E_AXIS]);
|
||||
|
||||
if (!pat9125)
|
||||
{
|
||||
fsensor = 0; //disable sensor
|
||||
fsensor_not_responding = true;
|
||||
}
|
||||
else
|
||||
fsensor_not_responding = false;
|
||||
if (fsensor)
|
||||
fsensor_enable();
|
||||
else
|
||||
fsensor_disable();
|
||||
printf_P(PSTR("FSensor %S\n"), (fsensor_enabled?PSTR("ENABLED"):PSTR("DISABLED\n")));
|
||||
}
|
||||
|
||||
bool fsensor_enable(void)
|
||||
{
|
||||
if (mmu_enabled == false) { //filament sensor is pat9125, enable only if it is working
|
||||
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_watch_runout = 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;
|
||||
}
|
||||
else //filament sensor is FINDA, always enable
|
||||
{
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
void fsensor_disable(void)
|
||||
{
|
||||
fsensor_enabled = false;
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x00);
|
||||
FSensorStateMenu = 0;
|
||||
}
|
||||
|
||||
void fsensor_autoload_set(bool State)
|
||||
{
|
||||
fsensor_autoload_enabled = State;
|
||||
eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, fsensor_autoload_enabled);
|
||||
}
|
||||
|
||||
void pciSetup(byte pin)
|
||||
{
|
||||
*digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable pin
|
||||
PCIFR |= bit (digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
|
||||
PCICR |= bit (digitalPinToPCICRbit(pin)); // enable interrupt for the group
|
||||
}
|
||||
|
||||
void fsensor_autoload_check_start(void)
|
||||
{
|
||||
// puts_P(_N("fsensor_autoload_check_start\n"));
|
||||
if (!fsensor_enabled) return;
|
||||
if (!fsensor_autoload_enabled) return;
|
||||
if (fsensor_watch_autoload) return;
|
||||
if (!pat9125_update_y()) //update sensor
|
||||
{
|
||||
fsensor_disable();
|
||||
fsensor_not_responding = true;
|
||||
fsensor_watch_autoload = false;
|
||||
printf_P(ERRMSG_PAT9125_NOT_RESP, 3);
|
||||
return;
|
||||
}
|
||||
puts_P(_N("fsensor_autoload_check_start - autoload ENABLED\n"));
|
||||
fsensor_autoload_y = pat9125_y; //save current y value
|
||||
fsensor_autoload_c = 0; //reset number of changes counter
|
||||
fsensor_autoload_sum = 0;
|
||||
fsensor_autoload_last_millis = millis();
|
||||
fsensor_watch_runout = false;
|
||||
fsensor_watch_autoload = true;
|
||||
fsensor_err_cnt = 0;
|
||||
}
|
||||
|
||||
void fsensor_autoload_check_stop(void)
|
||||
{
|
||||
// puts_P(_N("fsensor_autoload_check_stop\n"));
|
||||
if (!fsensor_enabled) return;
|
||||
// puts_P(_N("fsensor_autoload_check_stop 1\n"));
|
||||
if (!fsensor_autoload_enabled) return;
|
||||
// puts_P(_N("fsensor_autoload_check_stop 2\n"));
|
||||
if (!fsensor_watch_autoload) return;
|
||||
puts_P(_N("fsensor_autoload_check_stop - autoload DISABLED\n"));
|
||||
fsensor_autoload_sum = 0;
|
||||
fsensor_watch_autoload = false;
|
||||
fsensor_watch_runout = true;
|
||||
fsensor_err_cnt = 0;
|
||||
}
|
||||
|
||||
bool fsensor_check_autoload(void)
|
||||
{
|
||||
if (!fsensor_enabled) return false;
|
||||
if (!fsensor_autoload_enabled) return false;
|
||||
if (!fsensor_watch_autoload)
|
||||
{
|
||||
fsensor_autoload_check_start();
|
||||
return false;
|
||||
}
|
||||
#if 0
|
||||
uint8_t fsensor_autoload_c_old = fsensor_autoload_c;
|
||||
#endif
|
||||
if ((millis() - fsensor_autoload_last_millis) < 25) return false;
|
||||
fsensor_autoload_last_millis = millis();
|
||||
if (!pat9125_update_y()) //update sensor
|
||||
{
|
||||
fsensor_disable();
|
||||
fsensor_not_responding = true;
|
||||
printf_P(ERRMSG_PAT9125_NOT_RESP, 2);
|
||||
return false;
|
||||
}
|
||||
int16_t dy = pat9125_y - fsensor_autoload_y;
|
||||
if (dy) //? dy value is nonzero
|
||||
{
|
||||
if (dy > 0) //? delta-y value is positive (inserting)
|
||||
{
|
||||
fsensor_autoload_sum += dy;
|
||||
fsensor_autoload_c += 3; //increment change counter by 3
|
||||
}
|
||||
else if (fsensor_autoload_c > 1)
|
||||
fsensor_autoload_c -= 2; //decrement change counter by 2
|
||||
fsensor_autoload_y = pat9125_y; //save current value
|
||||
}
|
||||
else if (fsensor_autoload_c > 0)
|
||||
fsensor_autoload_c--;
|
||||
if (fsensor_autoload_c == 0) fsensor_autoload_sum = 0;
|
||||
#if 0
|
||||
puts_P(_N("fsensor_check_autoload\n"));
|
||||
if (fsensor_autoload_c != fsensor_autoload_c_old)
|
||||
printf_P(PSTR("fsensor_check_autoload dy=%d c=%d sum=%d\n"), dy, fsensor_autoload_c, fsensor_autoload_sum);
|
||||
#endif
|
||||
// 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"));
|
||||
if (mmu_enabled) {
|
||||
mmu_puts_P(PSTR("FS\n"));
|
||||
mmuFilamentMK3Moving = false;
|
||||
fsensor_autoload_check_stop();
|
||||
} else return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void fsensor_oq_meassure_set(bool State)
|
||||
{
|
||||
fsensor_oq_meassure_enabled = State;
|
||||
eeprom_update_byte((unsigned char *)EEPROM_FSENS_OQ_MEASS_ENABLED, fsensor_oq_meassure_enabled);
|
||||
}
|
||||
|
||||
void fsensor_oq_meassure_start(uint8_t skip)
|
||||
{
|
||||
if (!fsensor_enabled) return;
|
||||
if (!fsensor_oq_meassure_enabled) return;
|
||||
printf_P(PSTR("fsensor_oq_meassure_start\n"));
|
||||
fsensor_oq_skipchunk = skip;
|
||||
fsensor_oq_samples = 0;
|
||||
fsensor_oq_st_sum = 0;
|
||||
fsensor_oq_yd_sum = 0;
|
||||
fsensor_oq_er_sum = 0;
|
||||
fsensor_oq_er_max = 0;
|
||||
fsensor_oq_yd_min = FSENSOR_OQ_MAX_YD;
|
||||
fsensor_oq_yd_max = 0;
|
||||
fsensor_oq_sh_sum = 0;
|
||||
pat9125_update();
|
||||
pat9125_y = 0;
|
||||
fsensor_watch_runout = false;
|
||||
fsensor_oq_meassure = true;
|
||||
}
|
||||
|
||||
void fsensor_oq_meassure_stop(void)
|
||||
{
|
||||
if (!fsensor_enabled) return;
|
||||
if (!fsensor_oq_meassure_enabled) return;
|
||||
printf_P(PSTR("fsensor_oq_meassure_stop, %hhu samples\n"), fsensor_oq_samples);
|
||||
printf_P(_N(" st_sum=%u yd_sum=%u er_sum=%u er_max=%hhu\n"), fsensor_oq_st_sum, fsensor_oq_yd_sum, fsensor_oq_er_sum, fsensor_oq_er_max);
|
||||
printf_P(_N(" yd_min=%u yd_max=%u yd_avg=%u sh_avg=%u\n"), fsensor_oq_yd_min, fsensor_oq_yd_max, (uint16_t)((uint32_t)fsensor_oq_yd_sum * fsensor_chunk_len / fsensor_oq_st_sum), (uint16_t)(fsensor_oq_sh_sum / fsensor_oq_samples));
|
||||
fsensor_oq_meassure = false;
|
||||
fsensor_watch_runout = true;
|
||||
fsensor_err_cnt = 0;
|
||||
}
|
||||
|
||||
const char _OK[] PROGMEM = "OK";
|
||||
const char _NG[] PROGMEM = "NG!";
|
||||
|
||||
bool fsensor_oq_result(void)
|
||||
{
|
||||
if (!fsensor_enabled) return true;
|
||||
if (!fsensor_oq_meassure_enabled) return true;
|
||||
printf_P(_N("fsensor_oq_result\n"));
|
||||
bool res_er_sum = (fsensor_oq_er_sum <= FSENSOR_OQ_MAX_ES);
|
||||
printf_P(_N(" er_sum = %u %S\n"), fsensor_oq_er_sum, (res_er_sum?_OK:_NG));
|
||||
bool res_er_max = (fsensor_oq_er_max <= FSENSOR_OQ_MAX_EM);
|
||||
printf_P(_N(" er_max = %hhu %S\n"), fsensor_oq_er_max, (res_er_max?_OK:_NG));
|
||||
uint8_t yd_avg = ((uint32_t)fsensor_oq_yd_sum * fsensor_chunk_len / fsensor_oq_st_sum);
|
||||
bool res_yd_avg = (yd_avg >= FSENSOR_OQ_MIN_YD) && (yd_avg <= FSENSOR_OQ_MAX_YD);
|
||||
printf_P(_N(" yd_avg = %hhu %S\n"), yd_avg, (res_yd_avg?_OK:_NG));
|
||||
bool res_yd_max = (fsensor_oq_yd_max <= (yd_avg * FSENSOR_OQ_MAX_PD));
|
||||
printf_P(_N(" yd_max = %u %S\n"), fsensor_oq_yd_max, (res_yd_max?_OK:_NG));
|
||||
bool res_yd_min = (fsensor_oq_yd_min >= (yd_avg / FSENSOR_OQ_MAX_ND));
|
||||
printf_P(_N(" yd_min = %u %S\n"), fsensor_oq_yd_min, (res_yd_min?_OK:_NG));
|
||||
|
||||
uint16_t yd_dev = (fsensor_oq_yd_max - yd_avg) + (yd_avg - fsensor_oq_yd_min);
|
||||
printf_P(_N(" yd_dev = %u\n"), yd_dev);
|
||||
|
||||
uint16_t yd_qua = 10 * yd_avg / (yd_dev + 1);
|
||||
printf_P(_N(" yd_qua = %u %S\n"), yd_qua, ((yd_qua >= 8)?_OK:_NG));
|
||||
|
||||
uint8_t sh_avg = (fsensor_oq_sh_sum / fsensor_oq_samples);
|
||||
bool res_sh_avg = (sh_avg <= FSENSOR_OQ_MAX_SH);
|
||||
if (yd_qua >= 8) res_sh_avg = true;
|
||||
|
||||
printf_P(_N(" sh_avg = %hhu %S\n"), sh_avg, (res_sh_avg?_OK:_NG));
|
||||
bool res = res_er_sum && res_er_max && res_yd_avg && res_yd_max && res_yd_min && res_sh_avg;
|
||||
printf_P(_N("fsensor_oq_result %S\n"), (res?_OK:_NG));
|
||||
return res;
|
||||
}
|
||||
|
||||
ISR(PCINT2_vect)
|
||||
{
|
||||
if (!((fsensor_int_pin_old ^ PINK) & FSENSOR_INT_PIN_MSK)) return;
|
||||
fsensor_int_pin_old = PINK;
|
||||
static bool _lock = false;
|
||||
if (_lock) return;
|
||||
_lock = true;
|
||||
int st_cnt = fsensor_st_cnt;
|
||||
fsensor_st_cnt = 0;
|
||||
sei();
|
||||
uint8_t old_err_cnt = fsensor_err_cnt;
|
||||
uint8_t pat9125_res = fsensor_oq_meassure?pat9125_update():pat9125_update_y();
|
||||
if (!pat9125_res)
|
||||
{
|
||||
fsensor_disable();
|
||||
fsensor_not_responding = true;
|
||||
printf_P(ERRMSG_PAT9125_NOT_RESP, 1);
|
||||
}
|
||||
if (st_cnt != 0)
|
||||
{ //movement
|
||||
if (st_cnt > 0) //positive movement
|
||||
{
|
||||
if (pat9125_y < 0)
|
||||
{
|
||||
if (fsensor_err_cnt)
|
||||
fsensor_err_cnt += 2;
|
||||
else
|
||||
fsensor_err_cnt++;
|
||||
}
|
||||
else if (pat9125_y > 0)
|
||||
{
|
||||
if (fsensor_err_cnt)
|
||||
fsensor_err_cnt--;
|
||||
}
|
||||
else //(pat9125_y == 0)
|
||||
if (((fsensor_dy_old <= 0) || (fsensor_err_cnt)) && (st_cnt > (fsensor_chunk_len >> 1)))
|
||||
fsensor_err_cnt++;
|
||||
if (fsensor_oq_meassure)
|
||||
{
|
||||
if (fsensor_oq_skipchunk)
|
||||
{
|
||||
fsensor_oq_skipchunk--;
|
||||
fsensor_err_cnt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (st_cnt == fsensor_chunk_len)
|
||||
{
|
||||
if (pat9125_y > 0) if (fsensor_oq_yd_min > pat9125_y) fsensor_oq_yd_min = (fsensor_oq_yd_min + pat9125_y) / 2;
|
||||
if (pat9125_y >= 0) if (fsensor_oq_yd_max < pat9125_y) fsensor_oq_yd_max = (fsensor_oq_yd_max + pat9125_y) / 2;
|
||||
}
|
||||
fsensor_oq_samples++;
|
||||
fsensor_oq_st_sum += st_cnt;
|
||||
if (pat9125_y > 0) fsensor_oq_yd_sum += pat9125_y;
|
||||
if (fsensor_err_cnt > old_err_cnt)
|
||||
fsensor_oq_er_sum += (fsensor_err_cnt - old_err_cnt);
|
||||
if (fsensor_oq_er_max < fsensor_err_cnt)
|
||||
fsensor_oq_er_max = fsensor_err_cnt;
|
||||
fsensor_oq_sh_sum += pat9125_s;
|
||||
}
|
||||
}
|
||||
}
|
||||
else //negative movement
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //no movement
|
||||
}
|
||||
|
||||
#ifdef DEBUG_FSENSOR_LOG
|
||||
if (fsensor_log)
|
||||
{
|
||||
printf_P(_N("FSENSOR cnt=%d dy=%d err=%hhu %S\n"), st_cnt, pat9125_y, fsensor_err_cnt, (fsensor_err_cnt > old_err_cnt)?_N("NG!"):_N("OK"));
|
||||
if (fsensor_oq_meassure) printf_P(_N("FSENSOR st_sum=%u yd_sum=%u er_sum=%u er_max=%hhu yd_max=%u\n"), fsensor_oq_st_sum, fsensor_oq_yd_sum, fsensor_oq_er_sum, fsensor_oq_er_max, fsensor_oq_yd_max);
|
||||
}
|
||||
#endif //DEBUG_FSENSOR_LOG
|
||||
|
||||
fsensor_dy_old = pat9125_y;
|
||||
pat9125_y = 0;
|
||||
|
||||
_lock = false;
|
||||
return;
|
||||
}
|
||||
|
||||
void fsensor_st_block_begin(block_t* bl)
|
||||
{
|
||||
if (!fsensor_enabled) return;
|
||||
if (((fsensor_st_cnt > 0) && (bl->direction_bits & 0x8)) ||
|
||||
((fsensor_st_cnt < 0) && !(bl->direction_bits & 0x8)))
|
||||
{
|
||||
if (_READ(63)) _WRITE(63, LOW);
|
||||
else _WRITE(63, HIGH);
|
||||
}
|
||||
}
|
||||
|
||||
void fsensor_st_block_chunk(block_t* bl, int cnt)
|
||||
{
|
||||
if (!fsensor_enabled) return;
|
||||
fsensor_st_cnt += (bl->direction_bits & 0x8)?-cnt:cnt;
|
||||
if ((fsensor_st_cnt >= fsensor_chunk_len) || (fsensor_st_cnt <= -fsensor_chunk_len))
|
||||
{
|
||||
if (_READ(63)) _WRITE(63, LOW);
|
||||
else _WRITE(63, HIGH);
|
||||
}
|
||||
}
|
||||
|
||||
//! @brief filament sensor update (perform M600 on filament runout)
|
||||
//!
|
||||
//! Works only if filament sensor is enabled.
|
||||
//! When the filament sensor error count is larger then FSENSOR_ERR_MAX, pauses print, tries to move filament back and forth.
|
||||
//! If there is still no plausible signal from filament sensor plans M600 (Filament change).
|
||||
void fsensor_update(void)
|
||||
{
|
||||
if (fsensor_enabled && fsensor_watch_runout && (fsensor_err_cnt > FSENSOR_ERR_MAX))
|
||||
{
|
||||
bool autoload_enabled_tmp = fsensor_autoload_enabled;
|
||||
fsensor_autoload_enabled = false;
|
||||
bool oq_meassure_enabled_tmp = fsensor_oq_meassure_enabled;
|
||||
fsensor_oq_meassure_enabled = true;
|
||||
|
||||
fsensor_stop_and_save_print();
|
||||
|
||||
fsensor_err_cnt = 0;
|
||||
fsensor_oq_meassure_start(0);
|
||||
|
||||
enquecommand_front_P((PSTR("G1 E-3 F200")));
|
||||
process_commands();
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
cmdqueue_pop_front();
|
||||
st_synchronize();
|
||||
|
||||
enquecommand_front_P((PSTR("G1 E3 F200")));
|
||||
process_commands();
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
cmdqueue_pop_front();
|
||||
st_synchronize();
|
||||
|
||||
uint8_t err_cnt = fsensor_err_cnt;
|
||||
fsensor_oq_meassure_stop();
|
||||
|
||||
bool err = false;
|
||||
err |= (err_cnt > 1);
|
||||
|
||||
err |= (fsensor_oq_er_sum > 2);
|
||||
err |= (fsensor_oq_yd_sum < (4 * FSENSOR_OQ_MIN_YD));
|
||||
|
||||
if (!err)
|
||||
{
|
||||
printf_P(PSTR("fsensor_err_cnt = 0\n"));
|
||||
fsensor_restore_print_and_continue();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf_P(PSTR("fsensor_update - M600\n"));
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1);
|
||||
eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1);
|
||||
enquecommand_front_P(PSTR("FSENSOR_RECOVER"));
|
||||
enquecommand_front_P((PSTR("M600")));
|
||||
fsensor_watch_runout = false;
|
||||
}
|
||||
fsensor_autoload_enabled = autoload_enabled_tmp;
|
||||
fsensor_oq_meassure_enabled = oq_meassure_enabled_tmp;
|
||||
}
|
||||
}
|
||||
|
||||
void fsensor_setup_interrupt(void)
|
||||
{
|
||||
|
||||
pinMode(FSENSOR_INT_PIN, OUTPUT);
|
||||
digitalWrite(FSENSOR_INT_PIN, LOW);
|
||||
fsensor_int_pin_old = 0;
|
||||
|
||||
pciSetup(FSENSOR_INT_PIN);
|
||||
}
|
||||
66
fsensor.h
66
fsensor.h
|
|
@ -1,66 +0,0 @@
|
|||
//! @file
|
||||
#ifndef FSENSOR_H
|
||||
#define FSENSOR_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
||||
//! minimum meassured chunk length in steps
|
||||
extern int16_t fsensor_chunk_len;
|
||||
// enable/disable flag
|
||||
extern bool fsensor_enabled;
|
||||
// not responding flag
|
||||
extern bool fsensor_not_responding;
|
||||
//enable/disable quality meassurement
|
||||
extern bool fsensor_oq_meassure_enabled;
|
||||
|
||||
extern bool mmuFilamentMK3Moving;
|
||||
|
||||
//! @name save restore printing
|
||||
//! @{
|
||||
extern void fsensor_stop_and_save_print(void);
|
||||
extern void fsensor_restore_print_and_continue(void);
|
||||
//! @}
|
||||
|
||||
//! initialize
|
||||
extern void fsensor_init(void);
|
||||
|
||||
//! @name enable/disable
|
||||
//! @{
|
||||
extern bool fsensor_enable(void);
|
||||
extern void fsensor_disable(void);
|
||||
//! @}
|
||||
|
||||
//autoload feature enabled
|
||||
extern bool fsensor_autoload_enabled;
|
||||
extern void fsensor_autoload_set(bool State);
|
||||
|
||||
extern void fsensor_update(void);
|
||||
|
||||
//! setup pin-change interrupt
|
||||
extern void fsensor_setup_interrupt(void);
|
||||
|
||||
//! @name autoload support
|
||||
//! @{
|
||||
extern void fsensor_autoload_check_start(void);
|
||||
extern void fsensor_autoload_check_stop(void);
|
||||
extern bool fsensor_check_autoload(void);
|
||||
//! @}
|
||||
|
||||
//! @name optical quality measurement support
|
||||
//! @{
|
||||
extern void fsensor_oq_meassure_set(bool State);
|
||||
extern void fsensor_oq_meassure_start(uint8_t skip);
|
||||
extern void fsensor_oq_meassure_stop(void);
|
||||
extern bool fsensor_oq_result(void);
|
||||
//! @}
|
||||
|
||||
|
||||
#include "planner.h"
|
||||
//! @name callbacks from stepper
|
||||
//! @{
|
||||
extern void fsensor_st_block_begin(block_t* bl);
|
||||
extern void fsensor_st_block_chunk(block_t* bl, int cnt);
|
||||
//! @}
|
||||
|
||||
#endif //FSENSOR_H
|
||||
103
mmu.h
103
mmu.h
|
|
@ -1,103 +0,0 @@
|
|||
//mmu.h
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
||||
extern bool mmu_enabled;
|
||||
extern int8_t mmu_state;
|
||||
|
||||
extern uint8_t mmu_extruder;
|
||||
|
||||
extern uint8_t tmp_extruder;
|
||||
|
||||
extern int8_t mmu_finda;
|
||||
|
||||
extern int16_t mmu_version;
|
||||
extern int16_t mmu_buildnr;
|
||||
|
||||
|
||||
#define MMU_CMD_NONE 0
|
||||
#define MMU_CMD_T0 0x10
|
||||
#define MMU_CMD_T1 0x11
|
||||
#define MMU_CMD_T2 0x12
|
||||
#define MMU_CMD_T3 0x13
|
||||
#define MMU_CMD_T4 0x14
|
||||
#define MMU_CMD_L0 0x20
|
||||
#define MMU_CMD_L1 0x21
|
||||
#define MMU_CMD_L2 0x22
|
||||
#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
|
||||
#define MMU_CMD_E2 0x52
|
||||
#define MMU_CMD_E3 0x53
|
||||
#define MMU_CMD_E4 0x54
|
||||
#define MMU_CMD_R0 0x60
|
||||
|
||||
|
||||
extern int mmu_puts_P(const char* str);
|
||||
|
||||
extern int mmu_printf_P(const char* format, ...);
|
||||
|
||||
extern int8_t mmu_rx_ok(void);
|
||||
|
||||
extern int8_t mmu_rx_not_ok(void);
|
||||
|
||||
extern int8_t mmu_rx_sensFilatBoot(void);
|
||||
|
||||
extern void mmu_init(void);
|
||||
|
||||
extern void mmu_loop(void);
|
||||
|
||||
|
||||
extern void mmu_reset(void);
|
||||
|
||||
extern int8_t mmu_set_filament_type(uint8_t extruder, uint8_t filament);
|
||||
|
||||
extern void mmu_command(uint8_t cmd);
|
||||
|
||||
extern bool mmu_get_response(void);
|
||||
|
||||
extern void manage_response(bool move_axes, bool turn_off_nozzle);
|
||||
|
||||
extern void mmu_load_to_nozzle();
|
||||
|
||||
extern void mmu_M600_load_filament(bool automatic);
|
||||
extern void mmu_M600_wait_and_beep();
|
||||
|
||||
extern void extr_mov(float shift, float feed_rate);
|
||||
extern void change_extr(int extr);
|
||||
extern int get_ext_nr();
|
||||
extern void display_loading();
|
||||
extern void extr_adj(int extruder);
|
||||
extern void extr_unload();
|
||||
extern void extr_unload_at_boot();
|
||||
extern void extr_adj_0();
|
||||
extern void extr_adj_1();
|
||||
extern void extr_adj_2();
|
||||
extern void extr_adj_3();
|
||||
extern void extr_adj_4();
|
||||
extern void load_all();
|
||||
extern void extr_change_0();
|
||||
extern void extr_change_1();
|
||||
extern void extr_change_2();
|
||||
extern void extr_change_3();
|
||||
extern void extr_unload_all();
|
||||
extern void extr_unload_used();
|
||||
extern void extr_unload_0();
|
||||
extern void extr_unload_1();
|
||||
extern void extr_unload_2();
|
||||
extern void extr_unload_3();
|
||||
extern void extr_unload_4();
|
||||
|
||||
extern bool mmu_check_version();
|
||||
extern void mmu_show_warning();
|
||||
extern void mmu_eject_filament(uint8_t filament, bool recover);
|
||||
extern void mmu_eject_fil_0();
|
||||
extern void mmu_eject_fil_1();
|
||||
extern void mmu_eject_fil_2();
|
||||
extern void mmu_eject_fil_3();
|
||||
extern void mmu_eject_fil_4();
|
||||
196
ultralcd.h
196
ultralcd.h
|
|
@ -1,196 +0,0 @@
|
|||
#ifndef ULTRALCD_H
|
||||
#define ULTRALCD_H
|
||||
|
||||
#include "Marlin.h"
|
||||
#include "lcd.h"
|
||||
#include "conv2str.h"
|
||||
#include "menu.h"
|
||||
#include "mesh_bed_calibration.h"
|
||||
|
||||
extern int lcd_puts_P(const char* str);
|
||||
extern int lcd_printf_P(const char* format, ...);
|
||||
|
||||
extern void menu_lcd_longpress_func(void);
|
||||
extern void menu_lcd_charsetup_func(void);
|
||||
extern void menu_lcd_lcdupdate_func(void);
|
||||
|
||||
// Call with a false parameter to suppress the LCD update from various places like the planner or the temp control.
|
||||
void ultralcd_init();
|
||||
void lcd_setstatus(const char* message);
|
||||
void lcd_setstatuspgm(const char* message);
|
||||
void lcd_setalertstatuspgm(const char* message);
|
||||
void lcd_reset_alert_level();
|
||||
uint8_t get_message_level();
|
||||
void lcd_adjust_z();
|
||||
void lcd_pick_babystep();
|
||||
void lcd_alright();
|
||||
void EEPROM_save_B(int pos, int* value);
|
||||
void EEPROM_read_B(int pos, int* value);
|
||||
void lcd_wait_interact();
|
||||
void lcd_change_filament();
|
||||
void lcd_loading_filament();
|
||||
void lcd_change_success();
|
||||
void lcd_loading_color();
|
||||
void lcd_sdcard_stop();
|
||||
void lcd_pause_print();
|
||||
void lcd_resume_print();
|
||||
void lcd_print_stop();
|
||||
void prusa_statistics(int _message, uint8_t _col_nr = 0);
|
||||
void lcd_confirm_print();
|
||||
unsigned char lcd_choose_color();
|
||||
//void lcd_mylang();
|
||||
|
||||
extern bool lcd_selftest();
|
||||
|
||||
void lcd_menu_statistics();
|
||||
|
||||
extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines);
|
||||
extern const char* lcd_display_message_fullscreen_P(const char *msg);
|
||||
|
||||
extern void lcd_return_to_status();
|
||||
extern void lcd_wait_for_click();
|
||||
extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
|
||||
// 0: no, 1: yes, -1: timeouted
|
||||
extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
|
||||
extern int8_t lcd_show_multiscreen_message_two_choices_and_wait_P(const char *msg, bool allow_timeouting, bool default_yes,
|
||||
const char *first_choice, const char *second_choice);
|
||||
extern int8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
|
||||
// Ask the user to move the Z axis up to the end stoppers and let
|
||||
// the user confirm that it has been done.
|
||||
|
||||
#ifndef TMC2130
|
||||
extern bool lcd_calibrate_z_end_stop_manual(bool only_z);
|
||||
#endif
|
||||
|
||||
// Show the result of the calibration process on the LCD screen.
|
||||
extern void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask);
|
||||
|
||||
extern void lcd_diag_show_end_stops();
|
||||
|
||||
|
||||
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
|
||||
#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
|
||||
#define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x))
|
||||
#define LCD_ALERTMESSAGERPGM(x) lcd_setalertstatuspgm((x))
|
||||
|
||||
|
||||
// To be used in lcd_commands_type.
|
||||
#define LCD_COMMAND_IDLE 0
|
||||
#define LCD_COMMAND_LOAD_FILAMENT 1
|
||||
#define LCD_COMMAND_STOP_PRINT 2
|
||||
#define LCD_COMMAND_FARM_MODE_CONFIRM 4
|
||||
#define LCD_COMMAND_LONG_PAUSE 5
|
||||
#define LCD_COMMAND_PID_EXTRUDER 7
|
||||
#define LCD_COMMAND_V2_CAL 8
|
||||
|
||||
extern int lcd_commands_type;
|
||||
extern int8_t FSensorStateMenu;
|
||||
|
||||
#define CUSTOM_MSG_TYPE_STATUS 0 // status message from lcd_status_message variable
|
||||
#define CUSTOM_MSG_TYPE_MESHBL 1 // Mesh bed leveling in progress
|
||||
#define CUSTOM_MSG_TYPE_F_LOAD 2 // Loading filament in progress
|
||||
#define CUSTOM_MSG_TYPE_PIDCAL 3 // PID tuning in progress
|
||||
#define CUSTOM_MSG_TYPE_TEMCAL 4 // PINDA temp calibration
|
||||
#define CUSTOM_MSG_TYPE_TEMPRE 5 // Temp compensation preheat
|
||||
|
||||
extern unsigned int custom_message_type;
|
||||
extern unsigned int custom_message_state;
|
||||
|
||||
extern uint8_t farm_mode;
|
||||
extern int farm_no;
|
||||
extern int farm_timer;
|
||||
extern int farm_status;
|
||||
|
||||
#ifdef TMC2130
|
||||
#define SILENT_MODE_NORMAL 0
|
||||
#define SILENT_MODE_STEALTH 1
|
||||
#define SILENT_MODE_OFF SILENT_MODE_NORMAL
|
||||
#else
|
||||
#define SILENT_MODE_POWER 0
|
||||
#define SILENT_MODE_SILENT 1
|
||||
#define SILENT_MODE_AUTO 2
|
||||
#define SILENT_MODE_OFF SILENT_MODE_POWER
|
||||
#endif
|
||||
|
||||
extern int8_t SilentModeMenu;
|
||||
|
||||
extern bool cancel_heatup;
|
||||
extern bool isPrintPaused;
|
||||
extern bool lcd_autoDeplete;
|
||||
|
||||
|
||||
void lcd_ignore_click(bool b=true);
|
||||
void lcd_commands();
|
||||
|
||||
|
||||
void change_extr(int extr);
|
||||
void extr_adj(int extruder);
|
||||
|
||||
void extr_unload_all();
|
||||
void extr_unload_used();
|
||||
void extr_unload();
|
||||
void extr_unload_at_boot();
|
||||
|
||||
void unload_filament();
|
||||
|
||||
void stack_error();
|
||||
void lcd_printer_connected();
|
||||
void lcd_ping();
|
||||
|
||||
void lcd_calibrate_extruder();
|
||||
void lcd_farm_sdcard_menu();
|
||||
|
||||
//void getFileDescription(char *name, char *description);
|
||||
|
||||
void lcd_farm_sdcard_menu_w();
|
||||
//void get_description();
|
||||
|
||||
void lcd_wait_for_heater();
|
||||
void lcd_wait_for_cool_down();
|
||||
void lcd_extr_cal_reset();
|
||||
|
||||
void lcd_temp_cal_show_result(bool result);
|
||||
bool lcd_wait_for_pinda(float temp);
|
||||
|
||||
|
||||
void bowden_menu();
|
||||
char reset_menu();
|
||||
uint8_t choose_menu_P(const char *header, const char *item, const char *last_item = nullptr);
|
||||
|
||||
void lcd_pinda_calibration_menu();
|
||||
void lcd_calibrate_pinda();
|
||||
void lcd_temp_calibration_set();
|
||||
|
||||
void display_loading();
|
||||
|
||||
#if !SDSORT_USES_RAM
|
||||
void lcd_set_degree();
|
||||
void lcd_set_progress();
|
||||
#endif
|
||||
|
||||
void lcd_language();
|
||||
|
||||
void lcd_wizard();
|
||||
|
||||
//! @brief Wizard state
|
||||
enum class WizState : uint8_t
|
||||
{
|
||||
Run, //!< run wizard? Entry point.
|
||||
Restore, //!< restore calibration status
|
||||
Selftest,
|
||||
Xyz, //!< xyz calibration
|
||||
Z, //!< z calibration
|
||||
IsFil, //!< Is filament loaded? Entry point for 1st layer calibration
|
||||
PreheatPla, //!< waiting for preheat nozzle for PLA
|
||||
Preheat, //!< Preheat for any material
|
||||
Unload, //!< Unload filament
|
||||
LoadFil, //!< Load filament
|
||||
IsPla, //!< Is PLA filament?
|
||||
Lay1Cal, //!< First layer calibration
|
||||
RepeatLay1Cal, //!< Repeat first layer calibration?
|
||||
Finish, //!< Deactivate wizard
|
||||
};
|
||||
|
||||
void lcd_wizard(WizState state);
|
||||
|
||||
#endif //ULTRALCD_H
|
||||
Loading…
Reference in New Issue