FSensor - code cleaning + simplification
+ removed DEBUG_DISABLE_FSENSORCHECK + added FILAMENT_SENSOR
This commit is contained in:
parent
ca2d69271c
commit
1309c52bcf
@ -638,7 +638,6 @@ 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 fsensor_autoload_enabled = true;
|
||||
|
||||
|
||||
#ifdef TMC2130
|
||||
@ -1187,8 +1186,7 @@ void setup()
|
||||
tmc2130_current_r[E_AXIS] = 36;
|
||||
#endif //TMC2130
|
||||
//disabled filament autoload (PFW360)
|
||||
fsensor_autoload_enabled = false;
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED, 0);
|
||||
fsensor_autoload_set(false);
|
||||
}
|
||||
MYSERIAL.begin(BAUDRATE);
|
||||
fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream
|
||||
@ -1625,9 +1623,7 @@ void setup()
|
||||
#endif //DEBUG_DISABLE_FANCHECK
|
||||
|
||||
#ifdef PAT9125
|
||||
#ifndef DEBUG_DISABLE_FSENSORCHECK
|
||||
fsensor_setup_interrupt();
|
||||
#endif //DEBUG_DISABLE_FSENSORCHECK
|
||||
#endif //PAT9125
|
||||
for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
|
||||
|
||||
@ -3084,7 +3080,6 @@ void gcode_M701()
|
||||
custom_message = true;
|
||||
custom_message_type = 2;
|
||||
|
||||
bool old_watch_runout = fsensor_watch_runout;
|
||||
fsensor_oq_meassure_start();
|
||||
|
||||
lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT));
|
||||
@ -3129,12 +3124,7 @@ void gcode_M701()
|
||||
|
||||
fsensor_oq_meassure_stop();
|
||||
|
||||
fsensor_err_cnt = 0;
|
||||
fsensor_watch_runout = old_watch_runout;
|
||||
|
||||
printf_P(_N("\nFSENSOR st_sum=%lu yd_sum=%lu er_sum=%u er_max=%u\n"), fsensor_oq_st_sum, fsensor_oq_yd_sum, fsensor_oq_er_sum, fsensor_oq_er_max);
|
||||
printf_P(_N("\nFSENSOR yd_min=%hhu yd_max=%hhu yd_avg=%hhu\n"), fsensor_oq_yd_min, fsensor_oq_yd_max, fsensor_oq_yd_sum * FSENSOR_CHUNK_LEN / fsensor_oq_st_sum);
|
||||
printf_P(PSTR("gcode_M701 end\n"));
|
||||
|
||||
|
||||
if (!fsensor_oq_result())
|
||||
@ -7501,43 +7491,35 @@ static void handleSafetyTimer()
|
||||
void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h
|
||||
{
|
||||
#ifdef PAT9125
|
||||
if (fsensor_enabled && fsensor_autoload_enabled && fsensor_watch_runout && !moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL))
|
||||
if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL))
|
||||
{
|
||||
if (fsensor_watch_autoload)
|
||||
if (fsensor_check_autoload())
|
||||
{
|
||||
if (fsensor_check_autoload())
|
||||
{
|
||||
|
||||
if (degHotend0() > EXTRUDE_MINTEMP)
|
||||
{
|
||||
fsensor_autoload_check_stop();
|
||||
tone(BEEPER, 1000);
|
||||
delay_keep_alive(50);
|
||||
noTone(BEEPER);
|
||||
loading_flag = true;
|
||||
enquecommand_front_P((PSTR("M701")));
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_update_enable(false);
|
||||
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_update_enable(true);
|
||||
}
|
||||
|
||||
}
|
||||
if (degHotend0() > EXTRUDE_MINTEMP)
|
||||
{
|
||||
fsensor_autoload_check_stop();
|
||||
tone(BEEPER, 1000);
|
||||
delay_keep_alive(50);
|
||||
noTone(BEEPER);
|
||||
loading_flag = true;
|
||||
enquecommand_front_P((PSTR("M701")));
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_update_enable(false);
|
||||
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_update_enable(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
fsensor_autoload_check_start();
|
||||
}
|
||||
else
|
||||
if (fsensor_watch_autoload)
|
||||
fsensor_autoload_check_stop();
|
||||
fsensor_autoload_check_stop();
|
||||
#endif //PAT9125
|
||||
|
||||
#ifdef SAFETYTIMER
|
||||
@ -9128,14 +9110,14 @@ void M600_load_filament(bool fsensor_enabled) {
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
|
||||
#ifdef PAT9125
|
||||
if (fsensor_watch_autoload && (fsensor_enabled || fsensor_watch_runout)) fsensor_autoload_check_start();
|
||||
fsensor_autoload_check_start();
|
||||
#endif //PAT9125
|
||||
while(!lcd_clicked())
|
||||
{
|
||||
manage_heater();
|
||||
manage_inactivity(true);
|
||||
#ifdef PAT9125
|
||||
if (fsensor_watch_autoload && (fsensor_enabled || fsensor_watch_runout) && fsensor_check_autoload())
|
||||
if (fsensor_check_autoload())
|
||||
{
|
||||
tone(BEEPER, 1000);
|
||||
delay_keep_alive(50);
|
||||
@ -9146,7 +9128,7 @@ void M600_load_filament(bool fsensor_enabled) {
|
||||
|
||||
}
|
||||
#ifdef PAT9125
|
||||
if (fsensor_watch_autoload && (fsensor_enabled || fsensor_watch_runout)) fsensor_autoload_check_stop();
|
||||
fsensor_autoload_check_stop();
|
||||
#endif //PAT9125
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
|
||||
|
@ -19,37 +19,6 @@ extern void stop_and_save_print_to_ram(float z_move, float e_move);
|
||||
extern void restore_print_from_ram_and_continue(float e_move);
|
||||
extern int8_t FSensorStateMenu;
|
||||
|
||||
void fsensor_init(void)
|
||||
{
|
||||
int pat9125 = pat9125_init();
|
||||
printf_P(_N("PAT9125_init:%d\n"), pat9125);
|
||||
uint8_t fsensor = eeprom_read_byte((uint8_t*)EEPROM_FSENSOR);
|
||||
fsensor_autoload_enabled=eeprom_read_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED);
|
||||
if (!pat9125)
|
||||
{
|
||||
fsensor = 0; //disable sensor
|
||||
fsensor_not_responding = true;
|
||||
}
|
||||
else {
|
||||
fsensor_not_responding = false;
|
||||
}
|
||||
puts_P(PSTR("FSensor "));
|
||||
if (fsensor)
|
||||
{
|
||||
puts_P(PSTR("ENABLED\n"));
|
||||
fsensor_enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
puts_P(PSTR("DISABLED\n"));
|
||||
fsensor_disable();
|
||||
}
|
||||
#ifdef DEBUG_DISABLE_FSENSORCHECK
|
||||
fsensor_autoload_enabled = false;
|
||||
fsensor_disable();
|
||||
#endif //DEBUG_DISABLE_FSENSORCHECK
|
||||
}
|
||||
|
||||
void fsensor_stop_and_save_print(void)
|
||||
{
|
||||
stop_and_save_print_to_ram(0, 0); //XYZE - no change
|
||||
@ -64,38 +33,91 @@ void fsensor_restore_print_and_continue(void)
|
||||
uint8_t fsensor_int_pin_old = 0;
|
||||
int16_t fsensor_chunk_len = FSENSOR_CHUNK_LEN;
|
||||
|
||||
//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 occured durring initialization or readout
|
||||
bool fsensor_not_responding = false;
|
||||
|
||||
//number of errors, updated in ISR
|
||||
uint8_t fsensor_err_cnt = 0;
|
||||
//variable for accumolating step count
|
||||
int16_t fsensor_st_cnt = 0;
|
||||
|
||||
|
||||
//log flag: 0=log disabled, 1=log enabled
|
||||
uint8_t fsensor_log = 1;
|
||||
|
||||
//autoload enable/disable flag
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//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 = 0;
|
||||
//
|
||||
uint8_t fsensor_autoload_c = 0;
|
||||
//
|
||||
uint32_t fsensor_autoload_last_millis = 0;
|
||||
//
|
||||
uint8_t fsensor_autoload_sum = 0;
|
||||
|
||||
//filament optical quality meassurement
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//filament optical quality meassurement variables
|
||||
|
||||
//meassurement enable/disable flag
|
||||
bool fsensor_oq_meassure = false;
|
||||
//skip-chunk counter, for accurate meassurement is necesary to skip first chunk...
|
||||
uint8_t fsensor_oq_skipchunk;
|
||||
uint32_t fsensor_oq_st_sum;
|
||||
uint32_t fsensor_oq_yd_sum;
|
||||
//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 durring meassurement
|
||||
uint16_t fsensor_oq_er_sum;
|
||||
//max error counter value durring meassurement
|
||||
uint8_t fsensor_oq_er_max;
|
||||
//minimum delta value
|
||||
uint16_t fsensor_oq_yd_min;
|
||||
//maximum delta value
|
||||
uint16_t fsensor_oq_yd_max;
|
||||
|
||||
|
||||
bool fsensor_enable(void)
|
||||
void fsensor_init(void)
|
||||
{
|
||||
int pat9125 = pat9125_init();
|
||||
printf_P(PSTR("PAT9125_init:%d\n"), pat9125);
|
||||
printf_P(_N("PAT9125_init:%d\n"), pat9125);
|
||||
uint8_t fsensor = eeprom_read_byte((uint8_t*)EEPROM_FSENSOR);
|
||||
fsensor_autoload_enabled=eeprom_read_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED);
|
||||
if (!pat9125)
|
||||
{
|
||||
fsensor = 0; //disable sensor
|
||||
fsensor_not_responding = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fsensor_not_responding = false;
|
||||
}
|
||||
puts_P(PSTR("FSensor "));
|
||||
if (fsensor)
|
||||
{
|
||||
fsensor_enable();
|
||||
puts_P(PSTR("ENABLED\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
fsensor_disable();
|
||||
puts_P(PSTR("DISABLED\n"));
|
||||
}
|
||||
}
|
||||
|
||||
bool fsensor_enable(void)
|
||||
{
|
||||
uint8_t pat9125 = pat9125_init();
|
||||
printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
|
||||
if (pat9125)
|
||||
fsensor_not_responding = false;
|
||||
else
|
||||
@ -113,7 +135,6 @@ bool fsensor_enable(void)
|
||||
|
||||
void fsensor_disable(void)
|
||||
{
|
||||
// puts_P(PSTR("fsensor_disable\n"));
|
||||
fsensor_enabled = false;
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x00);
|
||||
FSensorStateMenu = 0;
|
||||
@ -134,41 +155,54 @@ void pciSetup(byte pin)
|
||||
|
||||
void fsensor_autoload_check_start(void)
|
||||
{
|
||||
// puts_P(PSTR("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
|
||||
{
|
||||
printf_P(ERRMSG_PAT9125_NOT_RESP, 3);
|
||||
fsensor_disable();
|
||||
fsensor_not_responding = true;
|
||||
fsensor_watch_autoload = false;
|
||||
printf_P(ERRMSG_PAT9125_NOT_RESP, 3);
|
||||
return;
|
||||
}
|
||||
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(PSTR("fsensor_autoload_check_stop\n"));
|
||||
if (!fsensor_enabled) return;
|
||||
if (!fsensor_autoload_enabled) return;
|
||||
if (!fsensor_watch_autoload) return;
|
||||
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;
|
||||
}
|
||||
uint8_t fsensor_autoload_c_old = fsensor_autoload_c;
|
||||
if ((millis() - fsensor_autoload_last_millis) < 25) return false;
|
||||
fsensor_autoload_last_millis = millis();
|
||||
if (!pat9125_update_y())
|
||||
{
|
||||
printf_P(ERRMSG_PAT9125_NOT_RESP, 2);
|
||||
fsensor_disable();
|
||||
fsensor_not_responding = true;
|
||||
printf_P(ERRMSG_PAT9125_NOT_RESP, 2);
|
||||
return false; //update sensor
|
||||
}
|
||||
int16_t dy = fsensor_autoload_y - pat9125_y;
|
||||
@ -210,7 +244,12 @@ void fsensor_oq_meassure_start(void)
|
||||
|
||||
void fsensor_oq_meassure_stop(void)
|
||||
{
|
||||
printf_P(PSTR("fsensor_oq_meassure_stop\n"));
|
||||
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\n"), fsensor_oq_yd_min, fsensor_oq_yd_max, fsensor_oq_yd_sum * FSENSOR_CHUNK_LEN / fsensor_oq_st_sum);
|
||||
fsensor_oq_meassure = false;
|
||||
fsensor_err_cnt = 0;
|
||||
fsensor_watch_runout = true;
|
||||
}
|
||||
|
||||
bool fsensor_oq_result(void)
|
||||
@ -241,9 +280,9 @@ ISR(PCINT2_vect)
|
||||
uint8_t old_err_cnt = fsensor_err_cnt;
|
||||
if (!pat9125_update_y())
|
||||
{
|
||||
printf_P(ERRMSG_PAT9125_NOT_RESP, 1);
|
||||
fsensor_disable();
|
||||
fsensor_not_responding = true;
|
||||
printf_P(ERRMSG_PAT9125_NOT_RESP, 1);
|
||||
}
|
||||
if (st_cnt != 0)
|
||||
{ //movement
|
||||
@ -308,8 +347,6 @@ void fsensor_st_block_begin(block_t* bl)
|
||||
if (_READ(63)) _WRITE(63, LOW);
|
||||
else _WRITE(63, HIGH);
|
||||
}
|
||||
// PINK |= FSENSOR_INT_PIN_MSK; //toggle pin
|
||||
// _WRITE(fsensor_int_pin, LOW);
|
||||
}
|
||||
|
||||
void fsensor_st_block_chunk(block_t* bl, int cnt)
|
||||
@ -321,8 +358,6 @@ void fsensor_st_block_chunk(block_t* bl, int cnt)
|
||||
if (_READ(63)) _WRITE(63, LOW);
|
||||
else _WRITE(63, HIGH);
|
||||
}
|
||||
// PINK |= FSENSOR_INT_PIN_MSK; //toggle pin
|
||||
// _WRITE(fsensor_int_pin, LOW);
|
||||
}
|
||||
|
||||
void fsensor_update(void)
|
||||
|
@ -18,12 +18,14 @@
|
||||
extern void fsensor_stop_and_save_print(void);
|
||||
extern void fsensor_restore_print_and_continue(void);
|
||||
|
||||
//initialize
|
||||
extern void fsensor_init(void);
|
||||
|
||||
//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);
|
||||
|
||||
@ -56,19 +58,11 @@ extern bool fsensor_watch_runout;
|
||||
//not responding flag
|
||||
extern bool fsensor_not_responding;
|
||||
|
||||
//error counter
|
||||
extern uint8_t fsensor_err_cnt;
|
||||
|
||||
//autoload enable/disable flag
|
||||
extern bool fsensor_watch_autoload;
|
||||
|
||||
//filament optical quality meassurement
|
||||
extern bool fsensor_oq_meassure;
|
||||
extern uint8_t fsensor_oq_skipchunk;
|
||||
extern uint32_t fsensor_oq_st_sum;
|
||||
extern uint32_t fsensor_oq_yd_sum;
|
||||
extern uint16_t fsensor_oq_er_sum;
|
||||
extern uint8_t fsensor_oq_er_max;
|
||||
extern uint16_t fsensor_oq_yd_min;
|
||||
extern uint16_t fsensor_oq_yd_max;
|
||||
|
||||
#endif //FSENSOR_H
|
||||
|
@ -27,6 +27,10 @@
|
||||
#include "pat9125.h"
|
||||
#endif //PAT9125
|
||||
|
||||
#ifdef FILAMENT_SENSOR
|
||||
#include "fsensor.h"
|
||||
#endif //FILAMENT_SENSOR
|
||||
|
||||
#ifdef TMC2130
|
||||
#include "tmc2130.h"
|
||||
#endif //TMC2130
|
||||
@ -38,12 +42,7 @@
|
||||
|
||||
extern int lcd_change_fil_state;
|
||||
extern bool fans_check_enabled;
|
||||
extern bool fsensor_autoload_enabled;
|
||||
|
||||
#ifdef PAT9125
|
||||
extern bool fsensor_not_responding;
|
||||
extern bool fsensor_enabled;
|
||||
#endif //PAT9125
|
||||
|
||||
int scrollstuff = 0;
|
||||
char longFilenameOLD[LONG_FILENAME_LENGTH];
|
||||
@ -2506,7 +2505,7 @@ void lcd_alright() {
|
||||
|
||||
}
|
||||
|
||||
#ifdef PAT9125
|
||||
#ifdef FILAMENT_SENSOR
|
||||
static void lcd_menu_AutoLoadFilament()
|
||||
{
|
||||
if (degHotend0() > EXTRUDE_MINTEMP)
|
||||
@ -2526,7 +2525,7 @@ static void lcd_menu_AutoLoadFilament()
|
||||
}
|
||||
menu_back_if_clicked();
|
||||
}
|
||||
#endif //PAT9125
|
||||
#endif //FILAMENT_SENSOR
|
||||
|
||||
static void lcd_LoadFilament()
|
||||
{
|
||||
@ -4024,7 +4023,7 @@ static void lcd_crash_mode_info2()
|
||||
}
|
||||
#endif //TMC2130
|
||||
|
||||
#ifdef PAT9125
|
||||
#ifdef FILAMENT_SENSOR
|
||||
static void lcd_filament_autoload_info()
|
||||
{
|
||||
uint8_t nlines;
|
||||
@ -4050,7 +4049,7 @@ uint8_t nlines;
|
||||
}
|
||||
menu_back_if_clicked();
|
||||
}
|
||||
#endif //PAT9125
|
||||
#endif //FILAMENT_SENSOR
|
||||
|
||||
|
||||
static void lcd_silent_mode_set() {
|
||||
@ -4107,7 +4106,7 @@ static void lcd_crash_mode_set()
|
||||
#endif //TMC2130
|
||||
|
||||
|
||||
#ifdef PAT9125
|
||||
#ifdef FILAMENT_SENSOR
|
||||
static void lcd_fsensor_state_set()
|
||||
{
|
||||
FSensorStateMenu = !FSensorStateMenu; //set also from fsensor_enable() and fsensor_disable()
|
||||
@ -4121,7 +4120,7 @@ static void lcd_fsensor_state_set()
|
||||
menu_submenu(lcd_fsensor_fail);
|
||||
}
|
||||
}
|
||||
#endif //PAT9125
|
||||
#endif //FILAMENT_SENSOR
|
||||
|
||||
|
||||
#if !SDSORT_USES_RAM
|
||||
@ -4581,130 +4580,120 @@ void lcd_settings_linearity_correction_menu(void)
|
||||
*/
|
||||
static void lcd_settings_menu()
|
||||
{
|
||||
EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu));
|
||||
MENU_BEGIN();
|
||||
MENU_ITEM_BACK_P(_T(MSG_MAIN));
|
||||
EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu));
|
||||
MENU_BEGIN();
|
||||
MENU_ITEM_BACK_P(_T(MSG_MAIN));
|
||||
|
||||
MENU_ITEM_SUBMENU_P(_i("Temperature"), lcd_control_temperature_menu);////MSG_TEMPERATURE c=0 r=0
|
||||
if (!homing_flag)
|
||||
MENU_ITEM_SUBMENU_P(_i("Move axis"), lcd_move_menu_1mm);////MSG_MOVE_AXIS c=0 r=0
|
||||
if (!isPrintPaused)
|
||||
MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS c=0 r=0
|
||||
|
||||
MENU_ITEM_SUBMENU_P(_i("Temperature"), lcd_control_temperature_menu);////MSG_TEMPERATURE c=0 r=0
|
||||
if (!homing_flag)
|
||||
{
|
||||
MENU_ITEM_SUBMENU_P(_i("Move axis"), lcd_move_menu_1mm);////MSG_MOVE_AXIS c=0 r=0
|
||||
}
|
||||
if (!isPrintPaused)
|
||||
{
|
||||
MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS c=0 r=0
|
||||
}
|
||||
#ifndef TMC2130
|
||||
if (!farm_mode) { //dont show in menu if we are in farm mode
|
||||
switch (SilentModeMenu) {
|
||||
case SILENT_MODE_POWER: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set); break;
|
||||
case SILENT_MODE_SILENT: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_ON), lcd_silent_mode_set); break;
|
||||
case SILENT_MODE_AUTO: MENU_ITEM_FUNCTION_P(_T(MSG_AUTO_MODE_ON), lcd_silent_mode_set); break;
|
||||
default: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set); break; // (probably) not needed
|
||||
}
|
||||
}
|
||||
if (!farm_mode)
|
||||
{ //dont show in menu if we are in farm mode
|
||||
switch (SilentModeMenu)
|
||||
{
|
||||
case SILENT_MODE_POWER: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set); break;
|
||||
case SILENT_MODE_SILENT: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_ON), lcd_silent_mode_set); break;
|
||||
case SILENT_MODE_AUTO: MENU_ITEM_FUNCTION_P(_T(MSG_AUTO_MODE_ON), lcd_silent_mode_set); break;
|
||||
default: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set); break; // (probably) not needed
|
||||
}
|
||||
}
|
||||
#endif //TMC2130
|
||||
|
||||
#ifdef PAT9125
|
||||
#ifndef DEBUG_DISABLE_FSENSORCHECK
|
||||
if (FSensorStateMenu == 0) {
|
||||
if (fsensor_not_responding){
|
||||
// Filament sensor not working
|
||||
MENU_ITEM_FUNCTION_P(_i("Fil. sensor [N/A]"), lcd_fsensor_state_set);////MSG_FSENSOR_NA c=0 r=0
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_fsensor_fail);
|
||||
}
|
||||
else{
|
||||
// Filament sensor turned off, working, no problems
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_OFF), lcd_fsensor_state_set);
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_filament_autoload_info);
|
||||
}
|
||||
} else {
|
||||
// Filament sensor turned on, working, no problems
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_ON), lcd_fsensor_state_set);
|
||||
|
||||
#ifdef FILAMENT_SENSOR
|
||||
if (FSensorStateMenu == 0)
|
||||
{
|
||||
if (fsensor_not_responding)
|
||||
{
|
||||
// Filament sensor not working
|
||||
MENU_ITEM_FUNCTION_P(_i("Fil. sensor [N/A]"), lcd_fsensor_state_set);////MSG_FSENSOR_NA c=0 r=0
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_fsensor_fail);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Filament sensor turned off, working, no problems
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_OFF), lcd_fsensor_state_set);
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_filament_autoload_info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Filament sensor turned on, working, no problems
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_ON), lcd_fsensor_state_set);
|
||||
if (fsensor_autoload_enabled)
|
||||
MENU_ITEM_FUNCTION_P(_i("F. autoload [on]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_ON c=17 r=1
|
||||
else
|
||||
MENU_ITEM_FUNCTION_P(_i("F. autoload [off]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_OFF c=17 r=1
|
||||
}
|
||||
#endif //FILAMENT_SENSOR
|
||||
|
||||
if (fsensor_autoload_enabled) {
|
||||
MENU_ITEM_FUNCTION_P(_i("F. autoload [on]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_ON c=17 r=1
|
||||
}
|
||||
else {
|
||||
MENU_ITEM_FUNCTION_P(_i("F. autoload [off]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_OFF c=17 r=1
|
||||
}
|
||||
|
||||
}
|
||||
#endif //DEBUG_DISABLE_FSENSORCHECK
|
||||
#endif //PAT9125
|
||||
|
||||
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
|
||||
}
|
||||
else {
|
||||
MENU_ITEM_FUNCTION_P(_i("Fans check [off]"), lcd_set_fan_check);////MSG_FANS_CHECK_OFF c=17 r=1
|
||||
}
|
||||
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
|
||||
else
|
||||
MENU_ITEM_FUNCTION_P(_i("Fans check [off]"), lcd_set_fan_check);////MSG_FANS_CHECK_OFF c=17 r=1
|
||||
|
||||
#ifdef TMC2130
|
||||
if(!farm_mode)
|
||||
{
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL) { MENU_ITEM_FUNCTION_P(_T(MSG_STEALTH_MODE_OFF), lcd_silent_mode_set); }
|
||||
else MENU_ITEM_FUNCTION_P(_T(MSG_STEALTH_MODE_ON), lcd_silent_mode_set);
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL)
|
||||
{
|
||||
if (CrashDetectMenu == 0) { MENU_ITEM_FUNCTION_P(_T(MSG_CRASHDETECT_OFF), lcd_crash_mode_set); }
|
||||
else MENU_ITEM_FUNCTION_P(_T(MSG_CRASHDETECT_ON), lcd_crash_mode_set);
|
||||
}
|
||||
else MENU_ITEM_SUBMENU_P(_T(MSG_CRASHDETECT_NA), lcd_crash_mode_info);
|
||||
}
|
||||
if(!farm_mode)
|
||||
{
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL) { MENU_ITEM_FUNCTION_P(_T(MSG_STEALTH_MODE_OFF), lcd_silent_mode_set); }
|
||||
else MENU_ITEM_FUNCTION_P(_T(MSG_STEALTH_MODE_ON), lcd_silent_mode_set);
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL)
|
||||
{
|
||||
if (CrashDetectMenu == 0) { MENU_ITEM_FUNCTION_P(_T(MSG_CRASHDETECT_OFF), lcd_crash_mode_set); }
|
||||
else MENU_ITEM_FUNCTION_P(_T(MSG_CRASHDETECT_ON), lcd_crash_mode_set);
|
||||
}
|
||||
else MENU_ITEM_SUBMENU_P(_T(MSG_CRASHDETECT_NA), lcd_crash_mode_info);
|
||||
}
|
||||
|
||||
// MENU_ITEM_SUBMENU_P(_i("Lin. correction"), lcd_settings_linearity_correction_menu);
|
||||
#endif //TMC2130
|
||||
|
||||
if (temp_cal_active == false) {
|
||||
if (temp_cal_active == false)
|
||||
MENU_ITEM_FUNCTION_P(_i("Temp. cal. [off]"), lcd_temp_calibration_set);////MSG_TEMP_CALIBRATION_OFF c=20 r=1
|
||||
}
|
||||
else {
|
||||
else
|
||||
MENU_ITEM_FUNCTION_P(_i("Temp. cal. [on]"), lcd_temp_calibration_set);////MSG_TEMP_CALIBRATION_ON c=20 r=1
|
||||
}
|
||||
|
||||
#ifdef HAS_SECOND_SERIAL_PORT
|
||||
if (selectedSerialPort == 0) {
|
||||
MENU_ITEM_FUNCTION_P(_i("RPi port [off]"), lcd_second_serial_set);////MSG_SECOND_SERIAL_OFF c=17 r=1
|
||||
}
|
||||
else {
|
||||
MENU_ITEM_FUNCTION_P(_i("RPi port [on]"), lcd_second_serial_set);////MSG_SECOND_SERIAL_ON c=17 r=1
|
||||
}
|
||||
if (selectedSerialPort == 0)
|
||||
MENU_ITEM_FUNCTION_P(_i("RPi port [off]"), lcd_second_serial_set);////MSG_SECOND_SERIAL_OFF c=17 r=1
|
||||
else
|
||||
MENU_ITEM_FUNCTION_P(_i("RPi port [on]"), lcd_second_serial_set);////MSG_SECOND_SERIAL_ON c=17 r=1
|
||||
#endif //HAS_SECOND_SERIAL
|
||||
|
||||
if (!isPrintPaused && !homing_flag)
|
||||
{
|
||||
if (!isPrintPaused && !homing_flag)
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);
|
||||
}
|
||||
|
||||
#if (LANG_MODE != 0)
|
||||
MENU_ITEM_SUBMENU_P(_i("Select language"), lcd_language_menu);////MSG_LANGUAGE_SELECT c=0 r=0
|
||||
#endif //(LANG_MODE != 0)
|
||||
|
||||
if (card.ToshibaFlashAir_isEnabled()) {
|
||||
MENU_ITEM_FUNCTION_P(_i("SD card [FlshAir]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON c=19 r=1
|
||||
} else {
|
||||
MENU_ITEM_FUNCTION_P(_i("SD card [normal]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF c=19 r=1
|
||||
}
|
||||
if (card.ToshibaFlashAir_isEnabled())
|
||||
MENU_ITEM_FUNCTION_P(_i("SD card [FlshAir]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON c=19 r=1
|
||||
else
|
||||
MENU_ITEM_FUNCTION_P(_i("SD card [normal]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF c=19 r=1
|
||||
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
if (!farm_mode) {
|
||||
uint8_t sdSort;
|
||||
EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));
|
||||
switch (sdSort) {
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
if (!farm_mode)
|
||||
{
|
||||
uint8_t sdSort;
|
||||
EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));
|
||||
switch (sdSort)
|
||||
{
|
||||
case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort: [Time]"), lcd_sort_type_set); break;////MSG_SORT_TIME c=17 r=1
|
||||
case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort: [Alphabet]"), lcd_sort_type_set); break;////MSG_SORT_ALPHA c=17 r=1
|
||||
default: MENU_ITEM_FUNCTION_P(_i("Sort: [None]"), lcd_sort_type_set);////MSG_SORT_NONE c=17 r=1
|
||||
}
|
||||
}
|
||||
#endif // SDCARD_SORT_ALPHA
|
||||
}
|
||||
}
|
||||
#endif // SDCARD_SORT_ALPHA
|
||||
|
||||
if (farm_mode)
|
||||
{
|
||||
MENU_ITEM_SUBMENU_P(PSTR("Farm number"), lcd_farm_no);
|
||||
if (farm_mode)
|
||||
{
|
||||
MENU_ITEM_SUBMENU_P(PSTR("Farm number"), lcd_farm_no);
|
||||
MENU_ITEM_FUNCTION_P(PSTR("Disable farm mode"), lcd_disable_farm_mode);
|
||||
}
|
||||
}
|
||||
|
||||
MENU_END();
|
||||
}
|
||||
@ -5962,7 +5951,7 @@ static void lcd_main_menu()
|
||||
#endif
|
||||
|
||||
#else
|
||||
#ifdef PAT9125
|
||||
#ifdef FILAMENT_SENSOR
|
||||
if ( ((fsensor_autoload_enabled == true) && (fsensor_enabled == true)))
|
||||
MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=17 r=0
|
||||
else
|
||||
@ -6092,16 +6081,14 @@ static void lcd_tune_menu()
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//7
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_DISABLE_FSENSORCHECK
|
||||
#ifdef PAT9125
|
||||
#ifdef FILAMENT_SENSOR
|
||||
if (FSensorStateMenu == 0) {
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_OFF), lcd_fsensor_state_set);
|
||||
}
|
||||
else {
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_ON), lcd_fsensor_state_set);
|
||||
}
|
||||
#endif //PAT9125
|
||||
#endif //DEBUG_DISABLE_FSENSORCHECK
|
||||
#endif //FILAMENT_SENSOR
|
||||
|
||||
#ifdef TMC2130
|
||||
if(!farm_mode)
|
||||
@ -6454,16 +6441,16 @@ bool lcd_selftest()
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(8, _progress, 3, true, 2000); //bed ok
|
||||
#ifdef PAT9125
|
||||
#ifdef FILAMENT_SENSOR
|
||||
_progress = lcd_selftest_screen(9, _progress, 3, true, 2000); //check filaments sensor
|
||||
_result = lcd_selftest_fsensor();
|
||||
#endif // PAT9125
|
||||
#endif // FILAMENT_SENSOR
|
||||
}
|
||||
if (_result)
|
||||
{
|
||||
#ifdef PAT9125
|
||||
#ifdef FILAMENT_SENSOR
|
||||
_progress = lcd_selftest_screen(10, _progress, 3, true, 2000); //fil sensor OK
|
||||
#endif // PAT9125
|
||||
#endif // FILAMENT_SENSOR
|
||||
_progress = lcd_selftest_screen(11, _progress, 3, true, 5000); //all correct
|
||||
}
|
||||
else
|
||||
@ -7012,17 +6999,18 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
|
||||
|
||||
}
|
||||
|
||||
#ifdef PAT9125
|
||||
static bool lcd_selftest_fsensor() {
|
||||
#ifdef FILAMENT_SENSOR
|
||||
static bool lcd_selftest_fsensor(void)
|
||||
{
|
||||
fsensor_init();
|
||||
if (fsensor_not_responding)
|
||||
{
|
||||
const char *_err;
|
||||
lcd_selftest_error(11, _err, _err);
|
||||
}
|
||||
return(!fsensor_not_responding);
|
||||
return (!fsensor_not_responding);
|
||||
}
|
||||
#endif //PAT9125
|
||||
#endif //FILAMENT_SENSOR
|
||||
|
||||
static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ extern void menu_lcd_lcdupdate_func(void);
|
||||
static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator);
|
||||
static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite);
|
||||
static bool lcd_selftest_fan_dialog(int _fan);
|
||||
static bool lcd_selftest_fsensor();
|
||||
static bool lcd_selftest_fsensor(void);
|
||||
static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2);
|
||||
void lcd_menu_statistics();
|
||||
|
||||
|
@ -110,7 +110,7 @@
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
|
||||
#define FILAMENT_SENSOR
|
||||
|
||||
|
||||
//#define DEBUG_BUILD
|
||||
@ -137,7 +137,6 @@
|
||||
//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3)
|
||||
//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3)
|
||||
//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled)
|
||||
//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled)
|
||||
//#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line
|
||||
//#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message.
|
||||
//#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display.
|
||||
|
@ -110,7 +110,7 @@
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
|
||||
#define FILAMENT_SENSOR
|
||||
|
||||
|
||||
//#define DEBUG_BUILD
|
||||
@ -137,7 +137,6 @@
|
||||
//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3)
|
||||
//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3)
|
||||
//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled)
|
||||
//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled)
|
||||
//#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line
|
||||
//#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message.
|
||||
//#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display.
|
||||
|
@ -133,6 +133,7 @@
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
#define FILAMENT_SENSOR
|
||||
|
||||
// Backlash -
|
||||
//#define BACKLASH_X
|
||||
|
Loading…
Reference in New Issue
Block a user