Merge branch 'MK3' into MK3

This commit is contained in:
PavelSindler 2017-12-21 00:07:01 +01:00 committed by GitHub
commit f227952c0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 168 additions and 43 deletions

View File

@ -395,6 +395,10 @@ extern void print_world_coordinates();
extern void print_physical_coordinates();
extern void print_mesh_bed_leveling_table();
#ifdef PAT9125
extern void fsensor_init();
#endif //PAT9125
#ifdef HOST_KEEPALIVE_FEATURE
// States for managing Marlin and host communication

View File

@ -920,30 +920,10 @@ void setup()
#endif //TMC2130
#ifdef PAT9125
int pat9125 = pat9125_init(PAT9125_XRES, PAT9125_YRES);
printf_P(PSTR("PAT9125_init:%d\n"), pat9125);
uint8_t fsensor = eeprom_read_byte((uint8_t*)EEPROM_FSENSOR);
if (!pat9125)
{
fsensor = 0; //disable sensor
fsensor_not_responding = true;
}
puts_P(PSTR("FSensor "));
if (fsensor)
{
puts_P(PSTR("ENABLED\n"));
fsensor_enable();
}
else
{
puts_P(PSTR("DISABLED\n"));
fsensor_disable();
}
filament_autoload_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED) > 0);
fsensor_init();
#endif //PAT9125
st_init(); // Initialize stepper, this enables interrupts!
setup_photpin();
@ -1069,8 +1049,7 @@ void setup()
card.ToshibaFlashAir_enable(eeprom_read_byte((unsigned char*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY) == 1);
if (eeprom_read_dword((uint32_t*)(EEPROM_TOP - 4)) == 0x0ffffffff &&
eeprom_read_dword((uint32_t*)(EEPROM_TOP - 8)) == 0x0ffffffff &&
eeprom_read_dword((uint32_t*)(EEPROM_TOP - 12)) == 0x0ffffffff) {
eeprom_read_dword((uint32_t*)(EEPROM_TOP - 8)) == 0x0ffffffff) {
// Maiden startup. The firmware has been loaded and first started on a virgin RAMBo board,
// where all the EEPROM entries are set to 0x0ff.
// Once a firmware boots up, it forces at least a language selection, which changes
@ -1213,6 +1192,34 @@ void setup()
wdt_enable(WDTO_4S);
}
#ifdef PAT9125
void fsensor_init() {
int pat9125 = pat9125_init(PAT9125_XRES, PAT9125_YRES);
printf_P(PSTR("PAT9125_init:%d\n"), pat9125);
uint8_t fsensor = eeprom_read_byte((uint8_t*)EEPROM_FSENSOR);
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();
}
}
#endif //PAT9125
void trace();
#define CHUNK_SIZE 64 // bytes

View File

@ -47,6 +47,14 @@ uint16_t fsensor_autoload_y = 0;
uint8_t fsensor_autoload_c = 0;
uint32_t fsensor_autoload_last_millis = 0;
void fsensor_block()
{
fsensor_enabled = false;
}
void fsensor_unblock() {
fsensor_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FSENSOR) == 0x01);
}
bool fsensor_enable()
{

View File

@ -7,6 +7,10 @@
extern void fsensor_stop_and_save_print();
extern void fsensor_restore_print_and_continue();
//temporarily enable/disable without writing to eeprom
extern void fsensor_block();
extern void fsensor_unblock();
//enable/disable
extern bool fsensor_enable();
extern void fsensor_disable();

View File

@ -626,6 +626,13 @@ const char * const MSG_FILAMENT_LOADING_T3_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_FILAMENT_LOADING_T3_CZ
};
const char MSG_FILAMENT_SENSOR_EN[] PROGMEM = "Filament sensor";
const char MSG_FILAMENT_SENSOR_CZ[] PROGMEM = "Senzor filamentu";
const char * const MSG_FILAMENT_SENSOR_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_FILAMENT_SENSOR_EN,
MSG_FILAMENT_SENSOR_CZ
};
const char MSG_FILE_CNT_EN[] PROGMEM = "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100.";
const char MSG_FILE_CNT_CZ[] PROGMEM = "Nektere soubory nebudou setrideny. Maximalni pocet souboru pro setrideni je 100.";
const char * const MSG_FILE_CNT_LANG_TABLE[LANG_NUM] PROGMEM = {
@ -1589,6 +1596,13 @@ const char * const MSG_SELFTEST_CHECK_ENDSTOPS_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_SELFTEST_CHECK_ENDSTOPS_CZ
};
const char MSG_SELFTEST_CHECK_FSENSOR_EN[] PROGMEM = "Checking sensors ";
const char MSG_SELFTEST_CHECK_FSENSOR_CZ[] PROGMEM = "Kontrola senzoru";
const char * const MSG_SELFTEST_CHECK_FSENSOR_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_SELFTEST_CHECK_FSENSOR_EN,
MSG_SELFTEST_CHECK_FSENSOR_CZ
};
const char MSG_SELFTEST_CHECK_HOTEND_EN[] PROGMEM = "Checking hotend ";
const char MSG_SELFTEST_CHECK_HOTEND_CZ[] PROGMEM = "Kontrola hotend ";
const char * const MSG_SELFTEST_CHECK_HOTEND_LANG_TABLE[LANG_NUM] PROGMEM = {
@ -1651,6 +1665,13 @@ const char * const MSG_SELFTEST_EXTRUDER_FAN_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_SELFTEST_EXTRUDER_FAN_CZ
};
const char MSG_SELFTEST_EXTRUDER_FAN_SPEED_EN[] PROGMEM = "Extruder fan:";
const char MSG_SELFTEST_EXTRUDER_FAN_SPEED_CZ[] PROGMEM = "Levy vent.:";
const char * const MSG_SELFTEST_EXTRUDER_FAN_SPEED_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_SELFTEST_EXTRUDER_FAN_SPEED_EN,
MSG_SELFTEST_EXTRUDER_FAN_SPEED_CZ
};
const char MSG_SELFTEST_FAILED_EN[] PROGMEM = "Selftest failed ";
const char MSG_SELFTEST_FAILED_CZ[] PROGMEM = "Selftest selhal ";
const char * const MSG_SELFTEST_FAILED_LANG_TABLE[LANG_NUM] PROGMEM = {
@ -1686,6 +1707,13 @@ const char * const MSG_SELFTEST_FAN_YES_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_SELFTEST_FAN_YES_CZ
};
const char MSG_SELFTEST_FILAMENT_SENSOR_EN[] PROGMEM = "Filament sensor:";
const char MSG_SELFTEST_FILAMENT_SENSOR_CZ[] PROGMEM = "Senzor filamentu:";
const char * const MSG_SELFTEST_FILAMENT_SENSOR_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_SELFTEST_FILAMENT_SENSOR_EN,
MSG_SELFTEST_FILAMENT_SENSOR_CZ
};
const char MSG_SELFTEST_HEATERTHERMISTOR_EN[] PROGMEM = "Heater/Thermistor";
const char * const MSG_SELFTEST_HEATERTHERMISTOR_LANG_TABLE[1] PROGMEM = {
MSG_SELFTEST_HEATERTHERMISTOR_EN
@ -1715,6 +1743,13 @@ const char * const MSG_SELFTEST_PLEASECHECK_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_SELFTEST_PLEASECHECK_CZ
};
const char MSG_SELFTEST_PRINT_FAN_SPEED_EN[] PROGMEM = "Print fan:";
const char MSG_SELFTEST_PRINT_FAN_SPEED_CZ[] PROGMEM = "Tiskovy vent.:";
const char * const MSG_SELFTEST_PRINT_FAN_SPEED_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_SELFTEST_PRINT_FAN_SPEED_EN,
MSG_SELFTEST_PRINT_FAN_SPEED_CZ
};
const char MSG_SELFTEST_START_EN[] PROGMEM = "Self test start ";
const char * const MSG_SELFTEST_START_LANG_TABLE[1] PROGMEM = {
MSG_SELFTEST_START_EN

View File

@ -224,6 +224,8 @@ extern const char* const MSG_FILAMENT_LOADING_T2_LANG_TABLE[LANG_NUM];
#define MSG_FILAMENT_LOADING_T2 LANG_TABLE_SELECT(MSG_FILAMENT_LOADING_T2_LANG_TABLE)
extern const char* const MSG_FILAMENT_LOADING_T3_LANG_TABLE[LANG_NUM];
#define MSG_FILAMENT_LOADING_T3 LANG_TABLE_SELECT(MSG_FILAMENT_LOADING_T3_LANG_TABLE)
extern const char* const MSG_FILAMENT_SENSOR_LANG_TABLE[LANG_NUM];
#define MSG_FILAMENT_SENSOR LANG_TABLE_SELECT(MSG_FILAMENT_SENSOR_LANG_TABLE)
extern const char* const MSG_FILE_CNT_LANG_TABLE[LANG_NUM];
#define MSG_FILE_CNT LANG_TABLE_SELECT(MSG_FILE_CNT_LANG_TABLE)
extern const char* const MSG_FILE_INCOMPLETE_LANG_TABLE[LANG_NUM];
@ -540,6 +542,8 @@ extern const char* const MSG_SELFTEST_CHECK_BED_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_CHECK_BED LANG_TABLE_SELECT(MSG_SELFTEST_CHECK_BED_LANG_TABLE)
extern const char* const MSG_SELFTEST_CHECK_ENDSTOPS_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_CHECK_ENDSTOPS LANG_TABLE_SELECT(MSG_SELFTEST_CHECK_ENDSTOPS_LANG_TABLE)
extern const char* const MSG_SELFTEST_CHECK_FSENSOR_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_CHECK_FSENSOR LANG_TABLE_SELECT(MSG_SELFTEST_CHECK_FSENSOR_LANG_TABLE)
extern const char* const MSG_SELFTEST_CHECK_HOTEND_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_CHECK_HOTEND LANG_TABLE_SELECT(MSG_SELFTEST_CHECK_HOTEND_LANG_TABLE)
extern const char* const MSG_SELFTEST_CHECK_X_LANG_TABLE[LANG_NUM];
@ -560,6 +564,8 @@ extern const char* const MSG_SELFTEST_ERROR_LANG_TABLE[1];
#define MSG_SELFTEST_ERROR LANG_TABLE_SELECT_EXPLICIT(MSG_SELFTEST_ERROR_LANG_TABLE, 0)
extern const char* const MSG_SELFTEST_EXTRUDER_FAN_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_EXTRUDER_FAN LANG_TABLE_SELECT(MSG_SELFTEST_EXTRUDER_FAN_LANG_TABLE)
extern const char* const MSG_SELFTEST_EXTRUDER_FAN_SPEED_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_EXTRUDER_FAN_SPEED LANG_TABLE_SELECT(MSG_SELFTEST_EXTRUDER_FAN_SPEED_LANG_TABLE)
extern const char* const MSG_SELFTEST_FAILED_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_FAILED LANG_TABLE_SELECT(MSG_SELFTEST_FAILED_LANG_TABLE)
extern const char* const MSG_SELFTEST_FAN_LANG_TABLE[LANG_NUM];
@ -570,6 +576,8 @@ extern const char* const MSG_SELFTEST_FAN_NO_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_FAN_NO LANG_TABLE_SELECT(MSG_SELFTEST_FAN_NO_LANG_TABLE)
extern const char* const MSG_SELFTEST_FAN_YES_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_FAN_YES LANG_TABLE_SELECT(MSG_SELFTEST_FAN_YES_LANG_TABLE)
extern const char* const MSG_SELFTEST_FILAMENT_SENSOR_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_FILAMENT_SENSOR LANG_TABLE_SELECT(MSG_SELFTEST_FILAMENT_SENSOR_LANG_TABLE)
extern const char* const MSG_SELFTEST_HEATERTHERMISTOR_LANG_TABLE[1];
#define MSG_SELFTEST_HEATERTHERMISTOR LANG_TABLE_SELECT_EXPLICIT(MSG_SELFTEST_HEATERTHERMISTOR_LANG_TABLE, 0)
extern const char* const MSG_SELFTEST_MOTOR_LANG_TABLE[1];
@ -580,6 +588,8 @@ extern const char* const MSG_SELFTEST_OK_LANG_TABLE[1];
#define MSG_SELFTEST_OK LANG_TABLE_SELECT_EXPLICIT(MSG_SELFTEST_OK_LANG_TABLE, 0)
extern const char* const MSG_SELFTEST_PLEASECHECK_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_PLEASECHECK LANG_TABLE_SELECT(MSG_SELFTEST_PLEASECHECK_LANG_TABLE)
extern const char* const MSG_SELFTEST_PRINT_FAN_SPEED_LANG_TABLE[LANG_NUM];
#define MSG_SELFTEST_PRINT_FAN_SPEED LANG_TABLE_SELECT(MSG_SELFTEST_PRINT_FAN_SPEED_LANG_TABLE)
extern const char* const MSG_SELFTEST_START_LANG_TABLE[1];
#define MSG_SELFTEST_START LANG_TABLE_SELECT_EXPLICIT(MSG_SELFTEST_START_LANG_TABLE, 0)
extern const char* const MSG_SELFTEST_SWAPPED_LANG_TABLE[LANG_NUM];

View File

@ -204,6 +204,11 @@
#define MSG_SELFTEST_CHECK_ALLCORRECT "Vse OK "
#define MSG_SELFTEST "Selftest "
#define MSG_SELFTEST_FAILED "Selftest selhal "
#define MSG_SELFTEST_EXTRUDER_FAN_SPEED "Levy vent.:"
#define MSG_SELFTEST_PRINT_FAN_SPEED "Tiskovy vent.:"
#define MSG_SELFTEST_FILAMENT_SENSOR "Senzor filamentu:"
#define MSG_SELFTEST_CHECK_FSENSOR "Kontrola senzoru"
#define MSG_FILAMENT_SENSOR "Senzor filamentu"
#define MSG_STATISTICS "Statistika "
#define MSG_USB_PRINTING "Tisk z USB "

View File

@ -175,6 +175,9 @@
#define MSG_SELFTEST_ENDSTOP "Endstop"
#define MSG_SELFTEST_FANS "Front/left fans"
#define MSG_SELFTEST_SWAPPED "Swapped"
#define(length=18) MSG_SELFTEST_EXTRUDER_FAN_SPEED "Extruder fan:"
#define(length=18) MSG_SELFTEST_PRINT_FAN_SPEED "Print fan:"
#define(length=18) MSG_SELFTEST_FILAMENT_SENSOR "Filament sensor:"
#define(length=20,lines=1) MSG_SELFTEST_ENDSTOP_NOTHIT "Endstop not hit"
#define MSG_SELFTEST_OK "Self test OK"
@ -197,6 +200,8 @@
#define(length=20) MSG_SELFTEST_CHECK_Y "Checking Y axis "
#define(length=20) MSG_SELFTEST_CHECK_Z "Checking Z axis "
#define(length=20) MSG_SELFTEST_CHECK_BED "Checking bed "
#define(length=20) MSG_SELFTEST_CHECK_FSENSOR "Checking sensors "
#define(length=20) MSG_FILAMENT_SENSOR "Filament sensor"
#define(length=20) MSG_SELFTEST_CHECK_ALLCORRECT "All correct "
#define MSG_SELFTEST "Selftest "
#define(length=20) MSG_SELFTEST_FAILED "Selftest failed "

View File

@ -111,6 +111,9 @@ int8_t FSensorStateMenu = 1;
int8_t CrashDetectMenu = 1;
extern void fsensor_block();
extern void fsensor_unblock();
extern bool fsensor_enable();
extern void fsensor_disable();
@ -374,7 +377,6 @@ void set_language_from_EEPROM() {
static void lcd_status_screen()
{
if (firstrun == 1)
{
firstrun = 0;
@ -2654,11 +2656,16 @@ void lcd_show_fullscreen_message_and_wait_P(const char *msg)
while (lcd_clicked()) ;
delay(10);
while (lcd_clicked()) ;
KEEPALIVE_STATE(IN_HANDLER);
lcd_set_custom_characters();
lcd_update_enable(true);
lcd_update(2);
return;
if (msg_next == NULL) {
KEEPALIVE_STATE(IN_HANDLER);
lcd_set_custom_characters();
lcd_update_enable(true);
lcd_update(2);
return;
}
else {
break;
}
}
}
if (multi_screen) {
@ -3626,15 +3633,16 @@ void lcd_wizard(int state) {
state = 7;
break;
case 7: //load filament
fsensor_block();
lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_LOAD_FILAMENT);
lcd_update_enable(false);
lcd_implementation_clear();
lcd_print_at_PGM(0, 2, MSG_LOADING_FILAMENT);
loading_flag = true;
#ifdef SNMM
change_extr(0);
#endif
gcode_M701();
fsensor_unblock();
state = 9;
break;
case 8:
@ -5566,16 +5574,27 @@ static bool lcd_selftest()
if (_result)
{
_progress = lcd_selftest_screen(7, _progress, 3, true, 2000);
_progress = lcd_selftest_screen(7, _progress, 3, true, 2000); //check bed
_result = lcd_selfcheck_check_heater(true);
}
if (_result)
{
_progress = lcd_selftest_screen(8, _progress, 3, true, 5000);
_progress = lcd_selftest_screen(8, _progress, 3, true, 2000); //bed ok
#ifdef PAT9125
_progress = lcd_selftest_screen(9, _progress, 3, true, 2000); //check filaments sensor
_result = lcd_selftest_fsensor();
#endif // PAT9125
}
if (_result)
{
#ifdef PAT9125
_progress = lcd_selftest_screen(10, _progress, 3, true, 2000); //fil sensor OK
#endif // PAT9125
_progress = lcd_selftest_screen(11, _progress, 3, true, 5000); //all correct
}
else
{
_progress = lcd_selftest_screen(9, _progress, 3, true, 5000);
_progress = lcd_selftest_screen(12, _progress, 3, true, 5000);
}
lcd_reset_alert_level();
enquecommand_P(PSTR("M84"));
@ -6120,6 +6139,12 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
lcd.setCursor(18, 3);
lcd.print(_error_1);
break;
case 11:
lcd.setCursor(0, 2);
lcd_printPGM(MSG_FILAMENT_SENSOR);
lcd.setCursor(0, 3);
lcd_printPGM(MSG_SELFTEST_WIRINGERROR);
break;
}
delay(1000);
@ -6136,6 +6161,18 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
}
#ifdef PAT9125
static bool lcd_selftest_fsensor() {
fsensor_init();
if (fsensor_not_responding)
{
const char *_err;
lcd_selftest_error(11, _err, _err);
}
return(!fsensor_not_responding);
}
#endif //PAT9125
static bool lcd_selftest_fan_dialog(int _fan)
{
bool _result = true;
@ -6160,10 +6197,10 @@ static bool lcd_selftest_fan_dialog(int _fan)
fanSpeed = 150; //print fan
for (uint8_t i = 0; i < 5; i++) {
delay_keep_alive(1000);
lcd.setCursor(14, 3);
lcd.setCursor(18, 3);
lcd.print("-");
delay_keep_alive(1000);
lcd.setCursor(14, 3);
lcd.setCursor(18, 3);
lcd.print("|");
}
fanSpeed = 0;
@ -6214,22 +6251,31 @@ static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bo
if (_step == 5) lcd_printPGM(MSG_SELFTEST_CHECK_Y);
if (_step == 6) lcd_printPGM(MSG_SELFTEST_CHECK_Z);
if (_step == 7) lcd_printPGM(MSG_SELFTEST_CHECK_BED);
if (_step == 8) lcd_printPGM(MSG_SELFTEST_CHECK_ALLCORRECT);
if (_step == 9) lcd_printPGM(MSG_SELFTEST_FAILED);
if (_step == 8) lcd_printPGM(MSG_SELFTEST_CHECK_BED);
if (_step == 9) lcd_printPGM(MSG_SELFTEST_CHECK_FSENSOR);
if (_step == 10) lcd_printPGM(MSG_SELFTEST_CHECK_FSENSOR);
if (_step == 11) lcd_printPGM(MSG_SELFTEST_CHECK_ALLCORRECT);
if (_step == 12) lcd_printPGM(MSG_SELFTEST_FAILED);
lcd.setCursor(0, 1);
lcd.print("--------------------");
if ((_step >= -1) && (_step <= 1))
{
//SERIAL_ECHOLNPGM("Fan test");
lcd_print_at_PGM(0, 2, PSTR("Extruder fan:"));
lcd.setCursor(14, 2);
lcd_print_at_PGM(0, 2, MSG_SELFTEST_EXTRUDER_FAN_SPEED);
lcd.setCursor(18, 2);
(_step < 0) ? lcd.print(_indicator) : lcd.print("OK");
lcd_print_at_PGM(0, 3, PSTR("Print fan:"));
lcd.setCursor(14, 3);
lcd_print_at_PGM(0, 3, MSG_SELFTEST_PRINT_FAN_SPEED);
lcd.setCursor(18, 3);
(_step < 1) ? lcd.print(_indicator) : lcd.print("OK");
}
else if (_step != 9)
else if (_step >= 9 && _step <= 10)
{
lcd_print_at_PGM(0, 2, MSG_SELFTEST_FILAMENT_SENSOR);
lcd.setCursor(18, 2);
(_step == 9) ? lcd.print(_indicator) : lcd.print("OK");
}
else if (_step < 9)
{
//SERIAL_ECHOLNPGM("Other tests");
_step_block = 3;

View File

@ -47,6 +47,7 @@ void lcd_mylang();
static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bool _clear, int _delay);
static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator);
static bool lcd_selftest_fan_dialog(int _fan);
static bool lcd_selftest_fsensor();
static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2);
void lcd_menu_statistics();
static bool lcd_selfcheck_pulleys(int axis);