Merge pull request #368 from XPila/MK3

Missing serial characters debuging
This commit is contained in:
XPila 2018-01-02 20:56:11 +01:00 committed by GitHub
commit 00698b00b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 47 additions and 13 deletions

View File

@ -11,7 +11,7 @@
#define FW_version "3.1.1-RC4" #define FW_version "3.1.1-RC4"
#define FW_build 143 #define FW_build 143
//#define FW_build --BUILD-NUMBER-- //#define FW_build --BUILD-NUMBER--
#define FW_version_build FW_version " b" STR(FW_build) "a" #define FW_version_build FW_version " b" STR(FW_build) "b"
#define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC "PRUSA3DFW"

View File

@ -129,10 +129,13 @@ void Config_StoreSettings(uint16_t offset, uint8_t level)
#endif #endif
#endif #endif
#ifdef LIN_ADVANCE
if (level >= 10) { if (level >= 10) {
EEPROM_WRITE_VAR(i, extruder_advance_k); EEPROM_WRITE_VAR(i, extruder_advance_k);
EEPROM_WRITE_VAR(i, advance_ed_ratio); EEPROM_WRITE_VAR(i, advance_ed_ratio);
} }
#endif //LIN_ADVANCE
/*MYSERIAL.print("Top address used:\n"); /*MYSERIAL.print("Top address used:\n");
MYSERIAL.print(i); MYSERIAL.print(i);
MYSERIAL.print("\n"); MYSERIAL.print("\n");
@ -365,11 +368,14 @@ void Config_RetrieveSettings(uint16_t offset, uint8_t level)
EEPROM_READ_VAR(i, filament_size[2]); EEPROM_READ_VAR(i, filament_size[2]);
#endif #endif
#endif #endif
#ifdef LIN_ADVANCE
if (level >= 10) { if (level >= 10) {
EEPROM_READ_VAR(i, extruder_advance_k); EEPROM_READ_VAR(i, extruder_advance_k);
EEPROM_READ_VAR(i, advance_ed_ratio); EEPROM_READ_VAR(i, advance_ed_ratio);
} }
calculate_volumetric_multipliers(); calculate_volumetric_multipliers();
#endif //LIN_ADVANCE
// Call updatePID (similar to when we have processed M301) // Call updatePID (similar to when we have processed M301)
updatePID(); updatePID();
SERIAL_ECHO_START; SERIAL_ECHO_START;

View File

@ -318,7 +318,7 @@
* K=0 means advance disabled. * K=0 means advance disabled.
* See Marlin documentation for calibration instructions. * See Marlin documentation for calibration instructions.
*/ */
#define LIN_ADVANCE //#define LIN_ADVANCE
#ifdef LIN_ADVANCE #ifdef LIN_ADVANCE
#define LIN_ADVANCE_K 0 //Try around 45 for PLA, around 25 for ABS. #define LIN_ADVANCE_K 0 //Try around 45 for PLA, around 25 for ABS.

View File

@ -124,6 +124,9 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) //#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_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3)
//#define DEBUG_BLINK_ACTIVE //#define DEBUG_BLINK_ACTIVE
#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
#endif #endif

View File

@ -68,6 +68,9 @@ SIGNAL(M_USARTx_RX_vect)
unsigned char c = M_UDRx; unsigned char c = M_UDRx;
if (selectedSerialPort == 0) if (selectedSerialPort == 0)
store_char(c); store_char(c);
#ifdef DEBUG_DUMP_TO_2ND_SERIAL
UDR1 = c;
#endif //DEBUG_DUMP_TO_2ND_SERIAL
} }
} }
#ifndef SNMM #ifndef SNMM
@ -86,6 +89,9 @@ SIGNAL(USART1_RX_vect)
unsigned char c = UDR1; unsigned char c = UDR1;
if (selectedSerialPort == 1) if (selectedSerialPort == 1)
store_char(c); store_char(c);
#ifdef DEBUG_DUMP_TO_2ND_SERIAL
M_UDRx = c;
#endif //DEBUG_DUMP_TO_2ND_SERIAL
} }
} }
#endif #endif

View File

@ -111,16 +111,16 @@ class MarlinSerial //: public Stream
} }
*/ */
void write(uint8_t c) void write(uint8_t c)
{
if (selectedSerialPort == 0)
{ {
if (selectedSerialPort == 0) { while (!((M_UCSRxA) & (1 << M_UDREx)));
while (!((M_UCSRxA) & (1 << M_UDREx))) M_UDRx = c;
;
M_UDRx = c;
} }
else if (selectedSerialPort == 1) { else if (selectedSerialPort == 1)
while (!((UCSR1A) & (1 << UDRE1))) {
; while (!((UCSR1A) & (1 << UDRE1)));
UDR1 = c; UDR1 = c;
} }
} }
@ -144,7 +144,10 @@ class MarlinSerial //: public Stream
rx_buffer.buffer[rx_buffer.head] = c; rx_buffer.buffer[rx_buffer.head] = c;
rx_buffer.head = i; rx_buffer.head = i;
} }
selectedSerialPort = 0; //selectedSerialPort = 0;
#ifdef DEBUG_DUMP_TO_2ND_SERIAL
UDR1 = c;
#endif //DEBUG_DUMP_TO_2ND_SERIAL
} }
} }
} else if(selectedSerialPort == 1) { } else if(selectedSerialPort == 1) {
@ -165,7 +168,10 @@ class MarlinSerial //: public Stream
rx_buffer.buffer[rx_buffer.head] = c; rx_buffer.buffer[rx_buffer.head] = c;
rx_buffer.head = i; rx_buffer.head = i;
} }
selectedSerialPort = 1; //selectedSerialPort = 1;
#ifdef DEBUG_DUMP_TO_2ND_SERIAL
M_UDRx = c;
#endif //DEBUG_DUMP_TO_2ND_SERIAL
} }
} }
} }

View File

@ -1112,8 +1112,12 @@ void setup()
check_babystep(); //checking if Z babystep is in allowed range check_babystep(); //checking if Z babystep is in allowed range
setup_uvlo_interrupt(); setup_uvlo_interrupt();
#ifndef DEBUG_DISABLE_FANCHECK
setup_fan_interrupt(); setup_fan_interrupt();
#endif //DEBUG_DISABLE_FANCHECK
#ifndef DEBUG_DISABLE_FSENSORCHECK
fsensor_setup_interrupt(); fsensor_setup_interrupt();
#endif //DEBUG_DISABLE_FSENSORCHECK
for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]); for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
#ifndef DEBUG_DISABLE_STARTMSGS #ifndef DEBUG_DISABLE_STARTMSGS
@ -1219,6 +1223,10 @@ void fsensor_init() {
puts_P(PSTR("DISABLED\n")); puts_P(PSTR("DISABLED\n"));
fsensor_disable(); fsensor_disable();
} }
#ifdef DEBUG_DISABLE_FSENSORCHECK
filament_autoload_enabled = false;
fsensor_disable();
#endif //DEBUG_DISABLE_FSENSORCHECK
} }
#endif //PAT9125 #endif //PAT9125

View File

@ -697,6 +697,7 @@ void manage_heater()
#endif #endif
} // End extruder for loop } // End extruder for loop
#ifndef DEBUG_DISABLE_FANCHECK
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \ #if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \ (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1) (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
@ -708,6 +709,7 @@ void manage_heater()
extruder_autofan_last_check = millis(); extruder_autofan_last_check = millis();
} }
#endif #endif
#endif //DEBUG_DISABLE_FANCHECK
#ifndef PIDTEMPBED #ifndef PIDTEMPBED
if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL) if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)

View File

@ -3783,7 +3783,7 @@ static void lcd_settings_menu()
{ {
MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84")); MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84"));
} }
#ifndef DEBUG_DISABLE_FSENSORCHECK
if (FSensorStateMenu == 0) { if (FSensorStateMenu == 0) {
if (fsensor_not_responding){ if (fsensor_not_responding){
// Filament sensor not working // Filament sensor not working
@ -3807,6 +3807,7 @@ static void lcd_settings_menu()
} }
} }
#endif //DEBUG_DISABLE_FSENSORCHECK
if (fans_check_enabled == true) { if (fans_check_enabled == true) {
MENU_ITEM(function, MSG_FANS_CHECK_ON, lcd_set_fan_check); MENU_ITEM(function, MSG_FANS_CHECK_ON, lcd_set_fan_check);
@ -5150,11 +5151,13 @@ static void lcd_tune_menu()
MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_colorprint_change);//7 MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_colorprint_change);//7
#endif #endif
#ifndef DEBUG_DISABLE_FSENSORCHECK
if (FSensorStateMenu == 0) { if (FSensorStateMenu == 0) {
MENU_ITEM(function, MSG_FSENSOR_OFF, lcd_fsensor_state_set); MENU_ITEM(function, MSG_FSENSOR_OFF, lcd_fsensor_state_set);
} else { } else {
MENU_ITEM(function, MSG_FSENSOR_ON, lcd_fsensor_state_set); MENU_ITEM(function, MSG_FSENSOR_ON, lcd_fsensor_state_set);
} }
#endif //DEBUG_DISABLE_FSENSORCHECK
if (SilentModeMenu == 0) MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); if (SilentModeMenu == 0) MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set);
else MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set); else MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set);