From 8a5ba89a9cedb4a6785e0e751f2e97c4c7719365 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Tue, 2 Jan 2018 20:55:33 +0100 Subject: [PATCH] Missing serial characters debuging disabled fan ISR disabled fsensor ISR disabled linear advance build 143b --- Firmware/Configuration.h | 2 +- Firmware/ConfigurationStore.cpp | 6 ++++++ Firmware/Configuration_adv.h | 2 +- Firmware/Configuration_prusa.h | 3 +++ Firmware/MarlinSerial.cpp | 6 ++++++ Firmware/MarlinSerial.h | 26 ++++++++++++++++---------- Firmware/Marlin_main.cpp | 8 ++++++++ Firmware/temperature.cpp | 2 ++ Firmware/ultralcd.cpp | 5 ++++- 9 files changed, 47 insertions(+), 13 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 7c01902c..955ba3d9 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -11,7 +11,7 @@ #define FW_version "3.1.1-RC4" #define FW_build 143 //#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" diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index 6911a10d..61600a2c 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -129,10 +129,13 @@ void Config_StoreSettings(uint16_t offset, uint8_t level) #endif #endif +#ifdef LIN_ADVANCE if (level >= 10) { EEPROM_WRITE_VAR(i, extruder_advance_k); EEPROM_WRITE_VAR(i, advance_ed_ratio); } +#endif //LIN_ADVANCE + /*MYSERIAL.print("Top address used:\n"); MYSERIAL.print(i); MYSERIAL.print("\n"); @@ -365,11 +368,14 @@ void Config_RetrieveSettings(uint16_t offset, uint8_t level) EEPROM_READ_VAR(i, filament_size[2]); #endif #endif +#ifdef LIN_ADVANCE if (level >= 10) { EEPROM_READ_VAR(i, extruder_advance_k); EEPROM_READ_VAR(i, advance_ed_ratio); } calculate_volumetric_multipliers(); +#endif //LIN_ADVANCE + // Call updatePID (similar to when we have processed M301) updatePID(); SERIAL_ECHO_START; diff --git a/Firmware/Configuration_adv.h b/Firmware/Configuration_adv.h index d7ca0814..36b247cd 100644 --- a/Firmware/Configuration_adv.h +++ b/Firmware/Configuration_adv.h @@ -318,7 +318,7 @@ * K=0 means advance disabled. * See Marlin documentation for calibration instructions. */ -#define LIN_ADVANCE +//#define LIN_ADVANCE #ifdef LIN_ADVANCE #define LIN_ADVANCE_K 0 //Try around 45 for PLA, around 25 for ABS. diff --git a/Firmware/Configuration_prusa.h b/Firmware/Configuration_prusa.h index 7095d66e..ad950519 100644 --- a/Firmware/Configuration_prusa.h +++ b/Firmware/Configuration_prusa.h @@ -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_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) //#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 diff --git a/Firmware/MarlinSerial.cpp b/Firmware/MarlinSerial.cpp index 06d6badf..359aaa59 100644 --- a/Firmware/MarlinSerial.cpp +++ b/Firmware/MarlinSerial.cpp @@ -68,6 +68,9 @@ SIGNAL(M_USARTx_RX_vect) unsigned char c = M_UDRx; if (selectedSerialPort == 0) store_char(c); +#ifdef DEBUG_DUMP_TO_2ND_SERIAL + UDR1 = c; +#endif //DEBUG_DUMP_TO_2ND_SERIAL } } #ifndef SNMM @@ -86,6 +89,9 @@ SIGNAL(USART1_RX_vect) unsigned char c = UDR1; if (selectedSerialPort == 1) store_char(c); +#ifdef DEBUG_DUMP_TO_2ND_SERIAL + M_UDRx = c; +#endif //DEBUG_DUMP_TO_2ND_SERIAL } } #endif diff --git a/Firmware/MarlinSerial.h b/Firmware/MarlinSerial.h index 24e9f79f..d23b69f0 100644 --- a/Firmware/MarlinSerial.h +++ b/Firmware/MarlinSerial.h @@ -111,16 +111,16 @@ class MarlinSerial //: public Stream } */ void write(uint8_t c) + { + if (selectedSerialPort == 0) { - if (selectedSerialPort == 0) { - while (!((M_UCSRxA) & (1 << M_UDREx))) - ; - M_UDRx = c; + while (!((M_UCSRxA) & (1 << M_UDREx))); + M_UDRx = c; } - else if (selectedSerialPort == 1) { - while (!((UCSR1A) & (1 << UDRE1))) - ; - UDR1 = c; + else if (selectedSerialPort == 1) + { + while (!((UCSR1A) & (1 << UDRE1))); + UDR1 = c; } } @@ -144,7 +144,10 @@ class MarlinSerial //: public Stream rx_buffer.buffer[rx_buffer.head] = c; 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) { @@ -165,7 +168,10 @@ class MarlinSerial //: public Stream rx_buffer.buffer[rx_buffer.head] = c; rx_buffer.head = i; } - selectedSerialPort = 1; + //selectedSerialPort = 1; +#ifdef DEBUG_DUMP_TO_2ND_SERIAL + M_UDRx = c; +#endif //DEBUG_DUMP_TO_2ND_SERIAL } } } diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c3b097a5..828cfbf5 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1112,8 +1112,12 @@ void setup() check_babystep(); //checking if Z babystep is in allowed range setup_uvlo_interrupt(); +#ifndef DEBUG_DISABLE_FANCHECK setup_fan_interrupt(); +#endif //DEBUG_DISABLE_FANCHECK +#ifndef DEBUG_DISABLE_FSENSORCHECK 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]); #ifndef DEBUG_DISABLE_STARTMSGS @@ -1219,6 +1223,10 @@ void fsensor_init() { puts_P(PSTR("DISABLED\n")); fsensor_disable(); } +#ifdef DEBUG_DISABLE_FSENSORCHECK + filament_autoload_enabled = false; + fsensor_disable(); +#endif //DEBUG_DISABLE_FSENSORCHECK } #endif //PAT9125 diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 8556a9a1..2e3644b0 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -697,6 +697,7 @@ void manage_heater() #endif } // End extruder for loop +#ifndef DEBUG_DISABLE_FANCHECK #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_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1) @@ -708,6 +709,7 @@ void manage_heater() extruder_autofan_last_check = millis(); } #endif +#endif //DEBUG_DISABLE_FANCHECK #ifndef PIDTEMPBED if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 893991d5..b00995e1 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3783,7 +3783,7 @@ static void lcd_settings_menu() { MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84")); } - +#ifndef DEBUG_DISABLE_FSENSORCHECK if (FSensorStateMenu == 0) { if (fsensor_not_responding){ // Filament sensor not working @@ -3807,6 +3807,7 @@ static void lcd_settings_menu() } } +#endif //DEBUG_DISABLE_FSENSORCHECK if (fans_check_enabled == true) { 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 #endif +#ifndef DEBUG_DISABLE_FSENSORCHECK if (FSensorStateMenu == 0) { MENU_ITEM(function, MSG_FSENSOR_OFF, lcd_fsensor_state_set); } else { 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); else MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set);