diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f84bbc9e2e..bac4ae5a99 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -20,13 +20,13 @@ Please, before you create a new bug report, please make sure you searched in ope **Describe the bug** A clear and concise description of what the bug is. - + **To Reproduce** Please describe steps to reproduce the behavior. - + **Expected behavior** A clear and concise description of what you expected to happen. - + **G-code** Please attach a G-code. This will make it easier for us to replicate the error. diff --git a/.github/ISSUE_TEMPLATE/enhancement.md b/.github/ISSUE_TEMPLATE/enhancement.md index 1592c6fc6c..96b6e5de0b 100644 --- a/.github/ISSUE_TEMPLATE/enhancement.md +++ b/.github/ISSUE_TEMPLATE/enhancement.md @@ -15,6 +15,6 @@ Enter what type of printer or upgrade the enhancement applies to. **Is your enhancement related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - + **Describe the solution you'd like** A clear and concise description of what you want to happen. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index abc71cbb4f..a9fd99c29e 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -15,6 +15,6 @@ If it makes sense, enter what type of printer or upgrade the feature request app **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - + **Describe the solution you'd like** A clear and concise description of what you want to happen. diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index e57d519ce3..f7bf764fac 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -17,8 +17,8 @@ jobs: # Don't ever mark PRs as stale. days-before-pr-stale: -1 stale-issue-message: 'This issue has been flagged as stale because it has been open for 60 days with no activity. The issue will be closed in 7 days unless someone removes the "stale" label or adds a comment.' - close-issue-message: 'This issue has been closed due to lack of recent activity. Please consider opening a new one if needed.' - # Don't act on things assigned to a milestone or assigned to someone. + close-issue-message: 'This issue has been closed due to lack of recent activity. Please consider opening a new one if needed.' + # Don't act on things assigned to a milestone or assigned to someone. exempt-all-milestones: true exempt-all-assignees: true enable-statistics: true diff --git a/Community_made.md b/Community_made.md index 1be499844d..982a87117e 100644 --- a/Community_made.md +++ b/Community_made.md @@ -16,7 +16,7 @@ Help `./PF-build.sh -h` # MK404 Simulator -## MK404-build.sh +## MK404-build.sh **MK404 is a community 3d printer simulator created by @vintagepc** Please checkout and support his github repository [MK404](https://github.com/vintagepc/MK404) and the [MK404 Wiki](https://github.com/vintagepc/MK404/wiki) diff --git a/Firmware/BlinkM.cpp b/Firmware/BlinkM.cpp index de604ecd35..0ed9ba4b74 100644 --- a/Firmware/BlinkM.cpp +++ b/Firmware/BlinkM.cpp @@ -15,7 +15,7 @@ void SendColors(byte red, byte grn, byte blu) { - Wire.begin(); + Wire.begin(); Wire.beginTransmission(0x09); Wire.write('o'); //to disable ongoing script, only needs to be used once Wire.write('n'); diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index 0a07b99176..709f5fa22e 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -206,7 +206,7 @@ bool Config_RetrieveSettings() eeprom_init_default_byte(&EEPROM_M500_base->n_arc_correction, pgm_read_byte(&default_conf.n_arc_correction)); eeprom_init_default_word(&EEPROM_M500_base->min_arc_segments, pgm_read_word(&default_conf.min_arc_segments)); eeprom_init_default_word(&EEPROM_M500_base->arc_segments_per_sec, pgm_read_word(&default_conf.arc_segments_per_sec)); - + // Initialize the travel_acceleration in eeprom if not already eeprom_init_default_float(&EEPROM_M500_base->travel_acceleration, pgm_read_float(&default_conf.travel_acceleration)); @@ -271,7 +271,7 @@ void Config_ResetDefault() // steps per sq second need to be updated to agree with the units per sq second reset_acceleration_rates(); - + #ifdef PIDTEMP updatePID(); #endif//PIDTEMP diff --git a/Firmware/Configuration_adv.h b/Firmware/Configuration_adv.h index b57c549e85..d4d8c21188 100644 --- a/Firmware/Configuration_adv.h +++ b/Firmware/Configuration_adv.h @@ -54,7 +54,7 @@ /** * Auto-report all at once with M155 S C[bitmask] with single timer - * + * * bit 0 = Auto-report temperatures * bit 1 = Auto-report fans * bit 2 = Auto-report position @@ -229,7 +229,7 @@ * limit is exceeded. */ #define SDCARD_SORT_ALPHA //Alphabetical sorting of SD files menu - + // SD Card Sorting options #ifdef SDCARD_SORT_ALPHA #define SD_SORT_TIME 0 @@ -238,11 +238,11 @@ #define INSERTSORT // #define SORTING_DUMP // #define SORTING_SPEEDTEST - + #define SDSORT_LIMIT 100 // Maximum number of sorted items (10-256). #define FOLDER_SORTING -1 // -1=above 0=none 1=below #endif - + #if defined(SDCARD_SORT_ALPHA) #define HAS_FOLDER_SORTING (FOLDER_SORTING) #endif @@ -392,7 +392,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st /** * Enable M120/M121 G-code commands - * + * */ //#define M120_M121_ENABLED //Be careful enabling and using these G-code commands. diff --git a/Firmware/Dcodes.cpp b/Firmware/Dcodes.cpp index 432e86f9b9..29e955cb90 100644 --- a/Firmware/Dcodes.cpp +++ b/Firmware/Dcodes.cpp @@ -162,19 +162,19 @@ void dcode_core(daddr_t addr_start, const daddr_t addr_end, const dcode_mem_t ty ### D3 - Read/Write EEPROM D3: Read/Write EEPROM This command can be used without any additional parameters. It will read the entire eeprom. #### Usage - + D3 [ A | C | X ] - + #### Parameters - `A` - Address (x0000-x0fff) - `C` - Count (1-4096) - `X` - Data (hex) - + #### Notes - The hex address needs to be lowercase without the 0 before the x - - Count is decimal + - Count is decimal - The hex data needs to be lowercase - + */ void dcode_3() { @@ -203,9 +203,9 @@ extern float axis_steps_per_mm[NUM_AXIS]; /*! * ### D-1 - Endless Loop D-1: Endless Loop - + D-1 - + * */ void dcode__1() @@ -220,9 +220,9 @@ void dcode__1() /*! ### D0 - Reset D0: Reset #### Usage - + D0 [ B ] - + #### Parameters - `B` - Bootloader */ @@ -245,9 +245,9 @@ void dcode_0() /*! * ### D1 - Clear EEPROM and RESET D1: Clear EEPROM and RESET - + D1 - + * */ void dcode_1() @@ -287,13 +287,13 @@ void dcode_2() #ifdef DEBUG_DCODES /*! - + ### D4 - Read/Write PIN D4: Read/Write PIN To read the digital value of a pin you need only to define the pin number. #### Usage - + D4 [ P | F | V ] - + #### Parameters - `P` - Pin (0-255) - `F` - Function in/out (0/1) @@ -335,20 +335,19 @@ void dcode_4() ### D5 - Read/Write FLASH D5: Read/Write Flash This command can be used without any additional parameters. It will read the 1kb FLASH. #### Usage - + D5 [ A | C | X | E ] - + #### Parameters - `A` - Address (x00000-x3ffff) - `C` - Count (1-8192) - `X` - Data (hex) - `E` - Erase - + #### Notes - The hex address needs to be lowercase without the 0 before the x - - Count is decimal + - Count is decimal - The hex data needs to be lowercase - */ void dcode_5() { @@ -457,9 +456,9 @@ void dcode_7() /*! ### D8 - Read/Write PINDA D8: Read/Write PINDA #### Usage - + D8 [ ? | ! | P | Z ] - + #### Parameters - `?` - Read PINDA temperature shift values - `!` - Reset PINDA temperature shift values to default @@ -510,11 +509,11 @@ void dcode_8() /*! ### D9 - Read ADC D9: Read ADC #### Usage - + D9 [ I | V ] - + #### Parameters - - `I` - ADC channel index + - `I` - ADC channel index - `0` - Heater 0 temperature - `1` - Heater 1 temperature - `2` - Bed temperature @@ -618,9 +617,9 @@ void dcode_12() ### D80 - Bed check D80: Bed check This command will log data to SD card file "mesh.txt". #### Usage - + D80 [ E | F | G | H | I | J ] - + #### Parameters - `E` - Dimension X (default 40) - `F` - Dimention Y (default 40) @@ -658,9 +657,9 @@ void dcode_80() ### D81 - Bed analysis D80: Bed analysis This command will log data to SD card file "wldsd.txt". #### Usage - + D81 [ E | F | G | H | I | J ] - + #### Parameters - `E` - Dimension X (default 40) - `F` - Dimention Y (default 40) @@ -684,9 +683,9 @@ void dcode_81() if (code_seen("H")) { strchr_pointer+=1; points_y = code_value(); } if (code_seen("I")) { strchr_pointer+=1; offset_x = code_value(); } if (code_seen("J")) { strchr_pointer+=1; offset_y = code_value(); } - + bed_analysis(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y); - + } #endif //HEATBED_ANALYSIS @@ -713,11 +712,11 @@ extern void st_synchronize(); /*! ### D2130 - Trinamic stepper controller D2130: Trinamic stepper controller @todo Please review by owner of the code. RepRap Wiki Gcode needs to be updated after review of owner as well. - + #### Usage - + D2130 [ Axis | Command | Subcommand | Value ] - + #### Parameters - Axis - `X` - X stepper driver @@ -746,21 +745,21 @@ extern void st_synchronize(); - `0, 180 --> 250` - Off - `0.9 --> 1.25` - Valid values (recommended is 1.1) - `@` - Home calibrate axis - + Examples: - + D2130E?wave - + Print extruder microstep linearity compensation curve - + D2130E!wave0 - + Disable extruder linearity compensation curve, (sine curve is used) - + D2130E!wave220 - + (sin(x))^1.1 extruder microstep compensation curve used - + Notes: For more information see https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2130_datasheet.pdf * @@ -870,9 +869,9 @@ void dcode_2130() /*! ### D9125 - PAT9125 filament sensor D9125: PAT9125 filament sensor #### Usage - + D9125 [ ? | ! | R | X | Y | L ] - + #### Parameters - `?` - Print values - `!` - Print values diff --git a/Firmware/Filament_sensor.h b/Firmware/Filament_sensor.h index f715f86180..6d39a69d1b 100644 --- a/Firmware/Filament_sensor.h +++ b/Firmware/Filament_sensor.h @@ -21,7 +21,7 @@ class FSensorBlockRunout { }; /// Base class Filament sensor -/// +/// /// Ideally, there could have been a nice class hierarchy of filament sensor types with common functionality /// extracted into this base class. /// But: @@ -37,43 +37,43 @@ class Filament_sensor { ready, error, }; - + enum class SensorActionOnError : uint8_t { _Continue = 0, _Pause = 1, _Undef = EEPROM_EMPTY_VALUE }; - + static void setEnabled(bool enabled); - + void setAutoLoadEnabled(bool state, bool updateEEPROM = false); bool getAutoLoadEnabled() const { return autoLoadEnabled; } - + void setRunoutEnabled(bool state, bool updateEEPROM = false); bool getRunoutEnabled() const { return runoutEnabled; } - + void setActionOnError(SensorActionOnError state, bool updateEEPROM = false); SensorActionOnError getActionOnError() const { return sensorActionOnError; } - + bool getFilamentLoadEvent() const { return postponedLoadEvent; } - + bool isError() const { return state == State::error; } bool isReady() const { return state == State::ready; } bool isEnabled() const { return state != State::disabled; } - + protected: void settings_init_common(); - + bool checkFilamentEvents(); - + void triggerFilamentInserted(); - + void triggerFilamentRemoved(); void filRunout(); - + void triggerError(); - + State state; bool autoLoadEnabled; bool runoutEnabled; @@ -109,37 +109,37 @@ class IR_sensor_analog: public IR_sensor { void init(); bool update(); void voltUpdate(uint16_t raw); - + uint16_t __attribute__((noinline)) getVoltRaw(); - + enum class SensorRevision : uint8_t { _Old = 0, _Rev04 = 1, _Undef = EEPROM_EMPTY_VALUE }; - + SensorRevision getSensorRevision() const { return sensorRevision; } - + const char* __attribute__((noinline)) getIRVersionText(); - + void setSensorRevision(SensorRevision rev, bool updateEEPROM = false); - + constexpr static uint16_t IRsensor_Ldiode_TRESHOLD = Voltage2Raw(0.3F); // ~0.3V, raw value=982 constexpr static uint16_t IRsensor_Lmax_TRESHOLD = Voltage2Raw(1.5F); // ~1.5V (0.3*Vcc), raw value=4910 constexpr static uint16_t IRsensor_Hmin_TRESHOLD = Voltage2Raw(3.0F); // ~3.0V (0.6*Vcc), raw value=9821 constexpr static uint16_t IRsensor_Hopen_TRESHOLD = Voltage2Raw(4.6F); // ~4.6V (N.C. @ Ru~20-50k, Rd'=56k, Ru'=10k), raw value=15059 constexpr static uint16_t IRsensor_VMax_TRESHOLD = Voltage2Raw(5.F); // ~5V, raw value=16368 - + private: SensorRevision sensorRevision; - + bool voltReady; // set by the adc ISR, therefore avoid accessing the variable directly but use getVoltReady() bool getVoltReady()const; void clearVoltReady(); - + uint16_t voltRaw; // set by the adc ISR, therefore avoid accessing the variable directly but use getVoltRaw() bool checkVoltage(uint16_t raw); - + uint16_t minVolt = Voltage2Raw(6.F); uint16_t maxVolt = 0; uint16_t nFSCheckCount; @@ -165,14 +165,14 @@ class PAT9125_sensor: public Filament_sensor { #ifdef FSENSOR_PROBING bool probeOtherType(); //checks if the wrong fsensor type is detected. #endif - + void setJamDetectionEnabled(bool state, bool updateEEPROM = false); bool getJamDetectionEnabled() const { return jamDetection; } - + void stStep(bool rev) { //from stepper isr stepCount += rev ? -1 : 1; } - + void settings_init(); private: static constexpr uint16_t pollingPeriod = 10; //[ms] @@ -180,23 +180,23 @@ class PAT9125_sensor: public Filament_sensor { ShortTimer pollingTimer; uint8_t filter; uint8_t filterFilPresent; - + bool jamDetection; int16_t oldPos; int16_t stepCount; int16_t chunkSteps; uint8_t jamErrCnt; - + constexpr void calcChunkSteps(float u) { chunkSteps = (int16_t)(1.25 * u); //[mm] } - + int16_t getStepCount(); - + void resetStepCount(); - + void filJam(); - + bool updatePAT9125(); }; #endif //(FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 23b7082e6d..9bcd473d62 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -136,7 +136,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); #define disable_y() ; #endif -#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1 +#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1 #if defined(Z_AXIS_ALWAYS_ON) #ifdef Z_DUAL_STEPPER_DRIVERS #define poweron_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); } @@ -351,7 +351,7 @@ bool babystep_allowed_strict(); extern void calculate_extruder_multipliers(); -// Similar to the default Arduino delay function, +// Similar to the default Arduino delay function, // but it keeps the background tasks running. extern void delay_keep_alive(unsigned int ms); diff --git a/Firmware/MarlinSerial.cpp b/Firmware/MarlinSerial.cpp index 7eccd84876..96f11a8c22 100644 --- a/Firmware/MarlinSerial.cpp +++ b/Firmware/MarlinSerial.cpp @@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + Modified 23 November 2006 by David A. Mellis Modified 28 September 2010 by Mark Sproul */ @@ -26,7 +26,7 @@ uint8_t selectedSerialPort = 0; #ifndef AT90USB -// this next line disables the entire HardwareSerial.cpp, +// this next line disables the entire HardwareSerial.cpp, // this is so I can support Attiny series and any other chip without a UART #if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H) @@ -129,8 +129,8 @@ void MarlinSerial::begin(long baud) sbi(M_UCSRxB, M_RXENx); sbi(M_UCSRxB, M_TXENx); sbi(M_UCSRxB, M_RXCIEx); - - if (selectedSerialPort == 1) { //set up also the second serial port + + if (selectedSerialPort == 1) { //set up also the second serial port if (useU2X) { UCSR1A = 1 << U2X1; baud_setting = (F_CPU / 4 / baud - 1) / 2; @@ -142,7 +142,7 @@ void MarlinSerial::begin(long baud) // assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register) UBRR1H = baud_setting >> 8; UBRR1L = baud_setting; - + sbi(UCSR1B, RXEN1); sbi(UCSR1B, TXEN1); sbi(UCSR1B, RXCIE1); @@ -250,7 +250,7 @@ void MarlinSerial::print(double n, int digits) void MarlinSerial::println(void) { // print('\r'); - print('\n'); + print('\n'); } /*void MarlinSerial::println(const String &s) @@ -311,13 +311,13 @@ void MarlinSerial::println(double n, int digits) void MarlinSerial::printNumber(unsigned long n, uint8_t base) { - unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars. + unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars. uint8_t i = 0; if (n == 0) { print('0'); return; - } + } while (n > 0) { buf[i++] = n % base; @@ -330,8 +330,8 @@ void MarlinSerial::printNumber(unsigned long n, uint8_t base) 'A' + buf[i - 1] - 10)); } -void MarlinSerial::printFloat(double number, uint8_t digits) -{ +void MarlinSerial::printFloat(double number, uint8_t digits) +{ // Handle negative numbers if (number < 0.0) { @@ -343,7 +343,7 @@ void MarlinSerial::printFloat(double number, uint8_t digits) double rounding = 0.5; for (uint8_t i=0; i 0) - print('.'); + print('.'); // Extract digits from the remainder one at a time while (digits-- > 0) @@ -361,8 +361,8 @@ void MarlinSerial::printFloat(double number, uint8_t digits) remainder *= 10.0; int toPrint = int(remainder); print(toPrint); - remainder -= toPrint; - } + remainder -= toPrint; + } } // Preinstantiate Objects ////////////////////////////////////////////////////// diff --git a/Firmware/MarlinSerial.h b/Firmware/MarlinSerial.h index 61da27603e..c83bcdb80f 100644 --- a/Firmware/MarlinSerial.h +++ b/Firmware/MarlinSerial.h @@ -23,7 +23,7 @@ #define MarlinSerial_h #include "Marlin.h" -#if !defined(SERIAL_PORT) +#if !defined(SERIAL_PORT) #define SERIAL_PORT 0 #endif @@ -34,7 +34,7 @@ (SERIAL_PORT == 3 && defined(UBRR3H))) #define HAS_UART #endif - + // These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor // requires two levels of indirection to expand macro values properly) #if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary @@ -43,15 +43,15 @@ #define SERIAL_REGNAME(registerbase,number,suffix) _REGNAME(registerbase, number, suffix) #endif -// Registers used by MarlinSerial class (these are expanded +// Registers used by MarlinSerial class (these are expanded // depending on selected serial port #define M_UCSRxA SERIAL_REGNAME(UCSR,SERIAL_PORT,A) // defines M_UCSRxA to be UCSRnA where n is the serial port number -#define M_UCSRxB SERIAL_REGNAME(UCSR,SERIAL_PORT,B) -#define M_RXENx SERIAL_REGNAME(RXEN,SERIAL_PORT,) -#define M_TXENx SERIAL_REGNAME(TXEN,SERIAL_PORT,) -#define M_RXCIEx SERIAL_REGNAME(RXCIE,SERIAL_PORT,) -#define M_UDREx SERIAL_REGNAME(UDRE,SERIAL_PORT,) -#define M_UDRx SERIAL_REGNAME(UDR,SERIAL_PORT,) +#define M_UCSRxB SERIAL_REGNAME(UCSR,SERIAL_PORT,B) +#define M_RXENx SERIAL_REGNAME(RXEN,SERIAL_PORT,) +#define M_TXENx SERIAL_REGNAME(TXEN,SERIAL_PORT,) +#define M_RXCIEx SERIAL_REGNAME(RXCIE,SERIAL_PORT,) +#define M_UDREx SERIAL_REGNAME(UDRE,SERIAL_PORT,) +#define M_UDRx SERIAL_REGNAME(UDR,SERIAL_PORT,) #define M_UBRRxH SERIAL_REGNAME(UBRR,SERIAL_PORT,H) #define M_UBRRxL SERIAL_REGNAME(UBRR,SERIAL_PORT,L) #define M_RXCx SERIAL_REGNAME(RXC,SERIAL_PORT,) @@ -97,7 +97,7 @@ class MarlinSerial //: public Stream static int peek(void); static int read(void); static void flush(void); - + static /*FORCE_INLINE*/ int available(void) { return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE; @@ -124,7 +124,7 @@ class MarlinSerial //: public Stream UDR1 = c; } } - + static void checkRx(void) { if (selectedSerialPort == 0) { @@ -177,15 +177,15 @@ class MarlinSerial //: public Stream } } } - - + + private: static void printNumber(unsigned long, uint8_t); static void printFloat(double, uint8_t); - - + + public: - + static /*FORCE_INLINE*/ void write(const char *str) { while (*str) @@ -205,7 +205,7 @@ class MarlinSerial //: public Stream write(s[i]); } }*/ - + static FORCE_INLINE void print(const char *str) { write(str); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 40e4bc796f..72cd52fc66 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -341,9 +341,9 @@ class AutoReportFeatures { uint8_t auto_report_period; public: LongTimer auto_report_timer; - AutoReportFeatures():auto_report_period(0){ + AutoReportFeatures():auto_report_period(0){ #if defined(AUTO_REPORT) - arFunctionsActive.byte = 0xff; + arFunctionsActive.byte = 0xff; #else arFunctionsActive.byte = 0; #endif //AUTO_REPORT @@ -850,7 +850,7 @@ void lcd_splash() } -void factory_reset() +void factory_reset() { KEEPALIVE_STATE(PAUSED_FOR_USER); if (!READ(BTN_ENC)) @@ -1296,12 +1296,12 @@ void setup() SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE); //lcd_update_enable(false); // why do we need this?? - andre // loads data from EEPROM if available else uses defaults (and resets step acceleration rate) - - bool previous_settings_retrieved = false; + + bool previous_settings_retrieved = false; uint8_t hw_changed = check_printer_version(); if (!(hw_changed & 0b10)) { //if printer version wasn't changed, check for eeprom version and retrieve settings from eeprom in case that version wasn't changed previous_settings_retrieved = Config_RetrieveSettings(); - } + } else { //printer version was changed so use default settings Config_ResetDefault(); } @@ -1535,22 +1535,22 @@ void setup() check_if_fw_is_on_right_printer(); #endif //defined(FILAMENT_SENSOR) && defined(FSENSOR_PROBING) #if 0 - show_fw_version_warnings(); + show_fw_version_warnings(); #endif } - switch (hw_changed) { + switch (hw_changed) { //if motherboard or printer type was changed inform user as it can indicate flashing wrong firmware version //if user confirms with knob, new hw version (printer and/or motherboard) is written to eeprom and message will be not shown next time - case(0b01): + case(0b01): lcd_show_fullscreen_message_and_wait_P(_T(MSG_CHANGED_MOTHERBOARD)); eeprom_write_word_notify((uint16_t*)EEPROM_BOARD_TYPE, MOTHERBOARD); break; - case(0b10): + case(0b10): lcd_show_fullscreen_message_and_wait_P(_T(MSG_CHANGED_PRINTER)); eeprom_write_word_notify((uint16_t*)EEPROM_PRINTER_TYPE, PRINTER_TYPE); break; - case(0b11): + case(0b11): lcd_show_fullscreen_message_and_wait_P(_T(MSG_CHANGED_BOTH)); eeprom_write_word_notify((uint16_t*)EEPROM_PRINTER_TYPE, PRINTER_TYPE); eeprom_write_word_notify((uint16_t*)EEPROM_BOARD_TYPE, MOTHERBOARD); @@ -1647,12 +1647,12 @@ void setup() uvlo_auto_recovery_ready = (degBed() > ( (float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED) - AUTOMATIC_UVLO_BED_TEMP_OFFSET)); if (uvlo_auto_recovery_ready){ #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER - puts_P(_N("Automatic recovery!")); + puts_P(_N("Automatic recovery!")); #endif //DEBUG_UVLO_AUTOMATIC_RECOVER recover_print(1); } else { #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER - puts_P(_N("Normal recovery!")); + puts_P(_N("Normal recovery!")); #endif //DEBUG_UVLO_AUTOMATIC_RECOVER if (saved_printing_type == PowerPanic::PRINT_TYPE_HOST) { recover_print(0); @@ -1802,7 +1802,7 @@ void loop() { //we read byte-by byte serial_read_stream(); - } + } else #endif { @@ -1869,7 +1869,7 @@ void loop() sei(); } } - else if((*ptr == CMDBUFFER_CURRENT_TYPE_USB_WITH_LINENR) && !IS_SD_PRINTING){ + else if((*ptr == CMDBUFFER_CURRENT_TYPE_USB_WITH_LINENR) && !IS_SD_PRINTING){ cli(); *ptr ++ = CMDBUFFER_CURRENT_TYPE_TO_BE_REMOVED; // and one for each command to previous block in the planner queue. @@ -2125,7 +2125,7 @@ inline void gcode_M900() { bool check_commands() { bool end_command_found = false; - + while (buflen) { if ((code_seen_P(MSG_M84)) || (code_seen_P(PSTR("M 84")))) end_command_found = true; @@ -2134,7 +2134,7 @@ bool check_commands() { cmdbuffer_front_already_processed = false; } return end_command_found; - + } /// @brief Safely move Z-axis by distance delta (mm) @@ -2374,7 +2374,7 @@ void homeaxis(uint8_t axis, uint8_t cnt) { #ifdef TMC2130 FORCE_HIGH_POWER_START; -#endif +#endif int axis_home_dir = home_dir(axis); current_position[axis] = 0; plan_set_position_curposXYZE(); @@ -2406,7 +2406,7 @@ void homeaxis(uint8_t axis, uint8_t cnt) axis_known_position[axis] = true; #ifdef TMC2130 FORCE_HIGH_POWER_END; -#endif +#endif } enable_endstops(endstops_enabled); } @@ -2675,7 +2675,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon } #endif /* QUICK_HOME */ -#ifdef TMC2130 +#ifdef TMC2130 if(home_x) { if (!calib) @@ -3168,7 +3168,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) #endif // TMC2130 FORCE_BL_ON_START; - + // Only Z calibration? if (!onlyZ) { @@ -3210,7 +3210,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) if (lcd_calibrate_z_end_stop_manual(onlyZ)) { #endif //TMC2130 - + lcd_show_fullscreen_message_and_wait_P(_T(MSG_CONFIRM_NOZZLE_CLEAN)); if(onlyZ){ lcd_display_message_fullscreen_P(_T(MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1)); @@ -3242,7 +3242,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) lcd_display_message_fullscreen_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1)); lcd_puts_at_P(0,3,_n("1/4")); } - + bool endstops_enabled = enable_endstops(false); raise_z(-1); @@ -3315,7 +3315,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40); st_synchronize(); - // if (result >= 0) babystep_apply(); + // if (result >= 0) babystep_apply(); #endif //HEATBED_V2 } //#endif //NEW_XYZCAL @@ -3738,7 +3738,7 @@ static void gcode_PRUSA_BadRAMBoFanTest(){ if( tach1max < tachMeasure ) tach1max = tachMeasure; //printf_P(PSTR("TACH_1: %d: capacitor check time=%lu us\n"), (int)tach1cntr, tachMeasure); - } + } //printf_P(PSTR("TACH_1: max=%lu us\n"), tach1max); SERIAL_PROTOCOLPGM("RAMBo FAN "); if( tach1max > 500 ){ @@ -4383,7 +4383,7 @@ void process_commands() - `S` - Time to wait, in seconds */ - case 4: + case 4: codenum = 0; if(code_seen('P')) codenum = code_value(); // milliseconds to wait if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait @@ -4410,7 +4410,7 @@ void process_commands() ### G10 - Retract G10: Retract Retracts filament according to settings of `M207` */ - case 10: + case 10: #if EXTRUDERS > 1 retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1); // checks for swap retract argument retract(true,retracted_swap[active_extruder]); @@ -4424,7 +4424,7 @@ void process_commands() ### G11 - Retract recover G11: Unretract Unretracts/recovers filament according to settings of `M208` */ - case 11: + case 11: #if EXTRUDERS > 1 retract(false,retracted_swap[active_extruder]); #else @@ -4438,7 +4438,7 @@ void process_commands() ### G21 - Sets Units to Millimters G21: Set Units to Millimeters Units are in millimeters. Prusa doesn't support inches. */ - case 21: + case 21: break; //Doing nothing. This is just to prevent serial UNKOWN warnings. /*! @@ -4455,7 +4455,7 @@ void process_commands() - `W` - Suppress mesh bed leveling if `X`, `Y` or `Z` are not provided - `C` - Calibrate X and Y origin (home) - Only on MK3/s */ - case 28: + case 28: { long home_x_value = 0; long home_y_value = 0; @@ -4489,7 +4489,7 @@ void process_commands() See `G81` */ - case 29: + case 29: { #if Z_MIN_PIN == -1 #error "You must have a Z_MIN endstop in order to enable Auto Bed Leveling feature! Z_MIN_PIN must point to a valid hardware pin." @@ -4637,7 +4637,7 @@ void process_commands() ### G30 - Single Z Probe G30: Single Z-Probe In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code. */ - case 30: + case 30: { st_synchronize(); // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly @@ -4663,7 +4663,7 @@ void process_commands() ### G31 - Dock the sled G31: Dock Z Probe sled In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code. */ - case 31: + case 31: dock_sled(true); break; @@ -4672,7 +4672,7 @@ void process_commands() ### G32 - Undock the sled G32: Undock Z Probe sled In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code. */ - case 32: + case 32: dock_sled(false); break; #endif // Z_PROBE_SLED @@ -4685,7 +4685,7 @@ void process_commands() Sensor must be over the bed. The maximum travel distance before an error is triggered is 10mm. */ - case 30: + case 30: { st_synchronize(); homing_flag = true; @@ -4703,7 +4703,7 @@ void process_commands() homing_flag = false; } break; - + /*! ### G75 - Print temperature interpolation G75: Print temperature interpolation Show/print PINDA temperature interpolating. @@ -4738,7 +4738,7 @@ void process_commands() echo PINDA temperature -- Z shift (mm): 0.--- ``` */ - case 76: + case 76: { #ifdef PINDA_THERMISTOR if (!has_temperature_compensation()) @@ -4917,12 +4917,12 @@ void process_commands() current_position[Z_AXIS] = PINDA_PREHEAT_Z; plan_buffer_line_curposXYZE(3000 / 60); st_synchronize(); - + while (fabs(degBed() - PINDA_MIN_T) > 1) { delay_keep_alive(1000); serialecho_temperatures(); } - + //enquecommand_P(PSTR("M190 S50")); for (int i = 0; i < PINDA_HEAT_T; i++) { delay_keep_alive(1000); @@ -4937,7 +4937,7 @@ void process_commands() current_position[Y_AXIS] = BED_Y0; plan_buffer_line_curposXYZE(3000 / 60); st_synchronize(); - + find_bed_induction_sensor_point_z(-1.f); zero_z = current_position[Z_AXIS]; @@ -4974,8 +4974,8 @@ void process_commands() printf_P(_N("\nTemperature: %d Z shift (mm): %.3f\n"), t_c, current_position[Z_AXIS] - zero_z); eeprom_update_word_notify((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + i, z_shift); - - + + } custom_message_type = CustomMsg::Status; @@ -4989,9 +4989,9 @@ void process_commands() lcd_show_fullscreen_message_and_wait_P(_T(MSG_PINDA_CALIBRATION_DONE)); eeprom_update_byte_notify((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 1); lcd_update_enable(true); - lcd_update(2); + lcd_update(2); + - #endif //PINDA_THERMISTOR } break; @@ -5323,7 +5323,7 @@ void process_commands() /*! ### M22 - Release SD card M22: Release SD card */ - case 22: + case 22: card.release(); break; @@ -5334,7 +5334,7 @@ void process_commands() M23 [filename] */ - case 23: + case 23: card.openFileReadFilteredGcode(strchr_pointer + 4, true); break; @@ -5381,7 +5381,7 @@ void process_commands() #### Parameters - `S` - Index in bytes */ - case 26: + case 26: if(card.mounted && code_seen('S')) { long index = code_value_long(); card.setIndex(index); @@ -5407,7 +5407,7 @@ void process_commands() /*! ### M28 - Start SD write M28: Begin write to SD card */ - case 28: + case 28: card.openFileWrite(strchr_pointer+4); break; @@ -5494,7 +5494,7 @@ void process_commands() M928 [filename] */ - case 928: + case 928: card.openLogFile(strchr_pointer+5); break; @@ -5621,10 +5621,10 @@ void process_commands() SERIAL_PROTOCOL('.'); SERIAL_PROTOCOLLN(uint8_t(ip[3])); } else { - SERIAL_PROTOCOLPGM("?Toshiba FlashAir GetIP failed\n"); + SERIAL_PROTOCOLPGM("?Toshiba FlashAir GetIP failed\n"); } } else { - SERIAL_PROTOCOLLNPGM("n/a"); + SERIAL_PROTOCOLLNPGM("n/a"); } break; } @@ -5677,7 +5677,7 @@ void process_commands() #ifdef ENABLE_AUTO_BED_LEVELING -#ifdef Z_PROBE_REPEATABILITY_TEST +#ifdef Z_PROBE_REPEATABILITY_TEST /*! ### M48 - Z-Probe repeatability measurement function M48: Measure Z-Probe repeatability @@ -5703,14 +5703,14 @@ void process_commands() #error "You must have a Z_MIN endstop in order to enable calculation of Z-Probe repeatability." #endif - double sum=0.0; - double mean=0.0; + double sum=0.0; + double mean=0.0; double sigma=0.0; double sample_set[50]; int verbose_level=1, n=0, j, n_samples = 10, n_legs=0; double X_current, Y_current, Z_current; double X_probe_location, Y_probe_location, Z_start_location, ext_position; - + if (code_seen('V')) { verbose_level = code_value(); if (verbose_level<0 || verbose_level>4 ) { @@ -5756,7 +5756,7 @@ void process_commands() if (code_seen('L') || code_seen('l') ) { n_legs = code_value(); - if ( n_legs==1 ) + if ( n_legs==1 ) n_legs = 2; if ( n_legs<0 || n_legs>15 ) { SERIAL_PROTOCOLPGM("?Specified number of legs in movement not plausable.\n"); @@ -5780,7 +5780,7 @@ void process_commands() // get us close to the bed. If the Z-Axis is far from the bed, we don't want to // use that as a starting point for each probe. // - if (verbose_level > 2) + if (verbose_level > 2) SERIAL_PROTOCOL("Positioning probe for the test.\n"); plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location, @@ -5869,7 +5869,7 @@ void process_commands() // // Get the current mean for the data points we have so far // - sum=0.0; + sum=0.0; for( j=0; j<=n; j++) { sum = sum + sample_set[j]; } @@ -5879,7 +5879,7 @@ void process_commands() // data points we have so far // - sum=0.0; + sum=0.0; for( j=0; j<=n; j++) { sum = sum + (sample_set[j]-mean) * (sample_set[j]-mean); } @@ -5901,10 +5901,10 @@ void process_commands() SERIAL_PROTOCOL_F(sigma,6); } - if (verbose_level > 0) + if (verbose_level > 0) SERIAL_PROTOCOLPGM("\n"); - plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location, + plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location, current_position[E_AXIS], homing_feedrate[Z_AXIS]/60); st_synchronize(); @@ -6112,7 +6112,7 @@ SERIAL_PROTOCOLPGM("\n\n"); ### M112 - Emergency stop M112: Full (Emergency) Stop It is processed much earlier as to bypass the cmdqueue. */ - case 112: + case 112: kill(MSG_M112_KILL); break; @@ -6125,7 +6125,7 @@ SERIAL_PROTOCOLPGM("\n\n"); #### Parameters - `S` - Target temperature */ - case 140: + case 140: if (code_seen('S')) setTargetBed(code_value()); break; @@ -6258,24 +6258,24 @@ SERIAL_PROTOCOLPGM("\n\n"); If no parameter is supplied, waits for heating or cooling to previously set temperature. */ - case 190: + case 190: #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 { bool CooldownNoWait = false; LCD_MESSAGERPGM(_T(MSG_BED_HEATING)); heating_status = HeatingStatus::BED_HEATING; prusa_statistics(1); - if (code_seen('S')) + if (code_seen('S')) { setTargetBed(code_value()); CooldownNoWait = true; - } - else if (code_seen('R')) + } + else if (code_seen('R')) { setTargetBed(code_value()); } codenum = _millis(); - + cancel_heatup = false; target_direction = isHeatingBed(); // true if heating, false if cooling @@ -6469,7 +6469,7 @@ SERIAL_PROTOCOLPGM("\n\n"); #### Parameters - `S` - specifies the time in seconds. If a value of 0 is specified, the timer is disabled. */ - case 86: + case 86: if (code_seen('S')) { safetytimer_inactive_time = code_value() * 1000; safetyTimer.start(); @@ -6977,7 +6977,7 @@ SERIAL_PROTOCOLPGM("\n\n"); - `Z` - Maximum Z jerk (units/s) - `E` - Maximum E jerk (units/s) */ - case 205: + case 205: { if(code_seen('S')) cs.minimumfeedrate = code_value(); if(code_seen('T')) cs.mintravelfeedrate = code_value(); @@ -7081,7 +7081,7 @@ SERIAL_PROTOCOLPGM("\n\n"); { switch(code_value_uint8()) { - case 0: + case 0: { cs.autoretract_enabled=false; retracted[0]=false; @@ -7092,7 +7092,7 @@ SERIAL_PROTOCOLPGM("\n\n"); retracted[2]=false; #endif }break; - case 1: + case 1: { cs.autoretract_enabled=true; retracted[0]=false; @@ -7437,7 +7437,7 @@ SERIAL_PROTOCOLPGM("\n\n"); chdkActive = true; #else - + #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1 const uint8_t NUM_PULSES=16; const float PULSE_LENGTH=0.01524; @@ -8019,7 +8019,7 @@ SERIAL_PROTOCOLPGM("\n\n"); bool bIsActive=false; strLabel[7] = '\0'; // null terminate. size_t max_sheets = sizeof(EEPROM_Sheets_base->s)/sizeof(EEPROM_Sheets_base->s[0]); - + if (code_seen('S')) { iSel = code_value_uint8(); if (iSel>=max_sheets) @@ -8028,11 +8028,11 @@ SERIAL_PROTOCOLPGM("\n\n"); SERIAL_PROTOCOL(max_sheets-1); SERIAL_PROTOCOLLN(""); break; // invalid sheet ID - } + } } else { iSel = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); } - + if (code_seen('Z')){ z_val = code_value(); zraw = z_val*cs.axis_steps_per_mm[Z_AXIS]; @@ -8040,7 +8040,7 @@ SERIAL_PROTOCOLPGM("\n\n"); { SERIAL_PROTOCOLLNPGM(" Z VALUE OUT OF RANGE"); break; - } + } eeprom_update_word_notify(reinterpret_cast(&(EEPROM_Sheets_base->s[iSel].z_offset)),zraw); } else @@ -8048,14 +8048,14 @@ SERIAL_PROTOCOLPGM("\n\n"); zraw = eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base->s[iSel].z_offset))); z_val = ((float)zraw/cs.axis_steps_per_mm[Z_AXIS]); } - + if (code_seen('L')) { char *src = strchr_pointer + 1; while (*src == ' ') ++src; if (*src != '\0') { - strncpy(strLabel,src,7); + strncpy(strLabel,src,7); } eeprom_update_block_notify(strLabel,EEPROM_Sheets_base->s[iSel].name,sizeof(Sheet::name)); } @@ -8063,7 +8063,7 @@ SERIAL_PROTOCOLPGM("\n\n"); { eeprom_read_block(strLabel, EEPROM_Sheets_base->s[iSel].name, sizeof(Sheet::name)); } - + if (code_seen('B')) { iBedC = code_value_uint8(); @@ -8073,7 +8073,7 @@ SERIAL_PROTOCOLPGM("\n\n"); { iBedC = eeprom_read_byte(&EEPROM_Sheets_base->s[iSel].bed_temp); } - + if (code_seen('P')) { iPindaC = code_value_uint8(); @@ -8083,7 +8083,7 @@ SERIAL_PROTOCOLPGM("\n\n"); { iPindaC = eeprom_read_byte(&EEPROM_Sheets_base->s[iSel].pinda_temp); } - + if (code_seen('A')) { bIsActive |= code_value_uint8() || (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == iSel); @@ -8097,13 +8097,13 @@ SERIAL_PROTOCOLPGM("\n\n"); { bIsActive = (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == iSel); } - + SERIAL_PROTOCOLPGM("Sheet "); SERIAL_PROTOCOL((int)iSel); if (!eeprom_is_sheet_initialized(iSel)) SERIAL_PROTOCOLLNPGM(" NOT INITIALIZED"); - - + + SERIAL_PROTOCOLPGM(" Z"); SERIAL_PROTOCOL_F(z_val,4); SERIAL_PROTOCOLPGM(" R"); @@ -8130,7 +8130,7 @@ SERIAL_PROTOCOLPGM("\n\n"); #### Parameters - `S` - Target temperature */ - case 860: + case 860: { int set_target_pinda = 0; @@ -8454,7 +8454,7 @@ SERIAL_PROTOCOLPGM("\n\n"); - `Z` - Z stepper driver holding current value - `E` - Extruder stepper driver holding current value */ - case 911: + case 911: { for (uint8_t axis = 0; axis < NUM_AXIS; axis++) { if (code_seen(axis_codes[axis])) { @@ -8478,7 +8478,7 @@ SERIAL_PROTOCOLPGM("\n\n"); - `Z` - Z stepper driver running current value - `E` - Extruder stepper driver running current value */ - case 912: + case 912: { for (uint8_t axis = 0; axis < NUM_AXIS; axis++) { if (code_seen(axis_codes[axis])) { @@ -8552,8 +8552,8 @@ SERIAL_PROTOCOLPGM("\n\n"); } if (tmc2130_mode != newMode -#ifdef PSU_Delta - || !bEnableForce_z +#ifdef PSU_Delta + || !bEnableForce_z #endif ) { @@ -8657,10 +8657,10 @@ SERIAL_PROTOCOLPGM("\n\n"); - `B` - Second extruder new resolution - `S` - All axes new resolution */ - case 350: + case 350: { #ifdef TMC2130 - for (uint_least8_t i=0; i Z_HIGH_POWER) { //SERIAL_ECHOLNPGM("HIGH"); @@ -9482,13 +9482,13 @@ void update_currents() { /*MYSERIAL.print(int(i)); SERIAL_ECHOPGM(": "); MYSERIAL.println(current_high[i]);*/ - } + } } else { for (uint8_t i = 0; i < 3; i++) { float q = current_low[i] - Z_SILENT*((current_high[i] - current_low[i]) / (Z_HIGH_POWER - Z_SILENT)); tmp_motor[i] = ((current_high[i] - current_low[i]) / (Z_HIGH_POWER - Z_SILENT))*destination[Z_AXIS] + q; - st_current_set(i, tmp_motor[i]); + st_current_set(i, tmp_motor[i]); /*MYSERIAL.print(int(i)); SERIAL_ECHOPGM(": "); MYSERIAL.println(tmp_motor[i]);*/ @@ -9713,7 +9713,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s static int killCount = 0; // make the inactivity button a bit less responsive const int KILL_DELAY = 10000; #endif - + if(buflen < (BUFSIZE-1)){ get_command(); } @@ -10169,12 +10169,12 @@ void check_babystep() s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)), babystep_z); lcd_show_fullscreen_message_and_wait_P(PSTR("Z live adjust out of range. Setting to 0. Click to continue.")); - lcd_update_enable(true); - } + lcd_update_enable(true); + } } #ifdef HEATBED_ANALYSIS void d_setup() -{ +{ pinMode(D_DATACLOCK, INPUT_PULLUP); pinMode(D_DATA, INPUT_PULLUP); pinMode(D_REQUIRE, OUTPUT); @@ -10327,24 +10327,24 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi //strcat(data_wldsd, numb_wldsd); - + //MYSERIAL.println(data_wldsd); //delay(1000); //delay(3000); //t1 = millis(); - + //while (digitalRead(D_DATACLOCK) == LOW) {} //while (digitalRead(D_DATACLOCK) == HIGH) {} memset(digit, 0, sizeof(digit)); //cli(); - digitalWrite(D_REQUIRE, LOW); - + digitalWrite(D_REQUIRE, LOW); + for (int i = 0; i<13; i++) { //t1 = millis(); for (int j = 0; j < 4; j++) { - while (digitalRead(D_DATACLOCK) == LOW) {} + while (digitalRead(D_DATACLOCK) == LOW) {} while (digitalRead(D_DATACLOCK) == HIGH) {} //printf_P(PSTR("Done %d\n"), j); bitWrite(digit[i], j, digitalRead(D_DATA)); @@ -10360,11 +10360,11 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi mergeOutput[0] = '\0'; output = 0; for (int r = 5; r <= 10; r++) //Merge digits - { + { sprintf(str, "%d", digit[r]); strcat(mergeOutput, str); } - + output = atof(mergeOutput); if (digit[4] == 8) //Handle sign @@ -10376,16 +10376,16 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi { output *= 0.1; } - + //output = d_ReadData(); //row[ix] = current_position[Z_AXIS]; - + //row[ix] = d_ReadData(); - + row[ix] = output; if (iy % 2 == 1 ? ix == 0 : ix == x_points_num - 1) { @@ -10443,7 +10443,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ // Push the commands to the front of the message queue in the reverse order! // There shall be always enough space reserved for these commands. repeatcommand_front(); // repeat G80 with all its parameters - + enquecommand_front_P(G28W); enquecommand_front_P((PSTR("G1 Z5"))); return; @@ -10506,24 +10506,24 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ //strcat(data_wldsd, numb_wldsd); - + //MYSERIAL.println(data_wldsd); //_delay(1000); //_delay(3000); //t1 = _millis(); - + //while (digitalRead(D_DATACLOCK) == LOW) {} //while (digitalRead(D_DATACLOCK) == HIGH) {} memset(digit, 0, sizeof(digit)); //cli(); - digitalWrite(D_REQUIRE, LOW); - + digitalWrite(D_REQUIRE, LOW); + for (int i = 0; i<13; i++) { //t1 = _millis(); for (int j = 0; j < 4; j++) { - while (digitalRead(D_DATACLOCK) == LOW) {} + while (digitalRead(D_DATACLOCK) == LOW) {} while (digitalRead(D_DATACLOCK) == HIGH) {} bitWrite(digit[i], j, digitalRead(D_DATA)); } @@ -10537,11 +10537,11 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ mergeOutput[0] = '\0'; output = 0; for (int r = 5; r <= 10; r++) //Merge digits - { + { sprintf(str, "%d", digit[r]); strcat(mergeOutput, str); } - + output = atof(mergeOutput); if (digit[4] == 8) //Handle sign @@ -10553,7 +10553,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ { output *= 0.1; } - + //output = d_ReadData(); @@ -10574,9 +10574,9 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ //strcat(data_wldsd, ";"); card.write_command(data_wldsd); - + //row[ix] = d_ReadData(); - + row[ix] = output; // current_position[Z_AXIS]; if (iy % 2 == 1 ? ix == 0 : ix == x_points_num - 1) { @@ -10608,7 +10608,7 @@ static void temp_compensation_start() { current_position[E_AXIS] -= default_retraction; } plan_buffer_line_curposXYZE(400); - + current_position[X_AXIS] = PINDA_PREHEAT_X; current_position[Y_AXIS] = PINDA_PREHEAT_Y; current_position[Z_AXIS] = PINDA_PREHEAT_Z; @@ -10621,7 +10621,7 @@ static void temp_compensation_start() { custom_message_state = PINDA_HEAT_T - i; if (custom_message_state == 99 || custom_message_state == 9) lcd_update(2); //force whole display redraw if number of digits changed else lcd_update(1); - } + } custom_message_type = CustomMsg::Status; custom_message_state = 0; } @@ -10645,7 +10645,7 @@ static void temp_compensation_apply() { st_synchronize(); plan_set_z_position(current_position[Z_AXIS]); } - else { + else { //we have no temp compensation data } } @@ -10854,7 +10854,7 @@ void save_print_file_state() { if (cmdbuffer[_bufindr] == CMDBUFFER_CURRENT_TYPE_SDCARD) { sdlen_single.lohi.lo = cmdbuffer[_bufindr + 1]; sdlen_single.lohi.hi = cmdbuffer[_bufindr + 2]; - } + } SERIAL_ECHOPGM("Buffer line (from buffer): "); MYSERIAL.print(int(iline), DEC); SERIAL_ECHOPGM(", type: "); @@ -10892,7 +10892,7 @@ void restore_print_file_state() { card.sdprinting = true; } else if (saved_printing_type == PowerPanic::PRINT_TYPE_HOST) { //was usb printing gcode_LastN = saved_sdpos; //saved_sdpos was reused for storing line number when usb printing - serial_count = 0; + serial_count = 0; FlushSerialRequestResend(); } else { //not sd printing nor usb printing @@ -11266,7 +11266,7 @@ void M600_wait_for_user() { manage_heater(); manage_inactivity(true); if (wait_for_user_state != 2) sound_wait_for_user(); - + switch (wait_for_user_state) { case 0: //nozzle is hot, waiting for user to press the knob to unload filament delay_keep_alive(4); @@ -11281,7 +11281,7 @@ void M600_wait_for_user() { break; case 1: //nozzle target temperature is set to zero, waiting for user to start nozzle preheat delay_keep_alive(4); - + if (lcd_clicked()) { setTargetHotend(saved_extruder_temperature); lcd_wait_for_heater(); diff --git a/Firmware/Prusa_farm.cpp b/Firmware/Prusa_farm.cpp index b037724f68..70fc119a87 100644 --- a/Firmware/Prusa_farm.cpp +++ b/Firmware/Prusa_farm.cpp @@ -132,7 +132,7 @@ static void lcd_connect_printer() { int i = 0; int t = 0; - lcd_puts_at_P(0, 0, PSTR("Connect printer to")); + lcd_puts_at_P(0, 0, PSTR("Connect printer to")); lcd_puts_at_P(0, 1, PSTR("monitoring or hold")); lcd_puts_at_P(0, 2, PSTR("the knob to continue")); while (no_response) { @@ -145,7 +145,7 @@ static void lcd_connect_printer() { t = 0; } if (READ(BTN_ENC)) { //if button is not pressed - i = 0; + i = 0; lcd_puts_at_P(0, 3, PSTR(" ")); } if (i != 0) @@ -232,7 +232,7 @@ void prusa_statistics(uint8_t _message) { const uint8_t _fil_nr = 0; if (!farm_mode) return; - + switch (_message) { case 0: // default message if (busy_state == PAUSED_FOR_USER) { @@ -389,7 +389,7 @@ void prusa_statistics_update_from_lcd_update() { } void farm_mode_init() { - farm_mode = eeprom_init_default_byte((uint8_t*)EEPROM_FARM_MODE, 0); + farm_mode = eeprom_init_default_byte((uint8_t*)EEPROM_FARM_MODE, 0); if (farm_mode) { no_response = true; //we need confirmation by recieving PRUSA thx prusa_statistics(8); @@ -410,7 +410,7 @@ void farm_mode_init() { bool farm_prusa_code_seen() { if (!farm_mode) return false; - + if (code_seen_P(PSTR("PRN"))) { // PRUSA PRN printf_P(_N("%u"), status_number); } @@ -441,7 +441,7 @@ bool farm_prusa_code_seen() { else { return false; } - + return true; } diff --git a/Firmware/Sd2Card.cpp b/Firmware/Sd2Card.cpp index aa0d3ccfeb..528eccb4fa 100644 --- a/Firmware/Sd2Card.cpp +++ b/Firmware/Sd2Card.cpp @@ -767,7 +767,7 @@ uint8_t Sd2Card::waitStartBlock(void) { return false; } -// Toshiba FlashAir support, copied from +// Toshiba FlashAir support, copied from // https://flashair-developers.com/en/documents/tutorials/arduino/ // However, the official website was closed in September 2019. // There is an archived website (written in Japanese). @@ -783,7 +783,7 @@ uint8_t Sd2Card::readExt(uint32_t arg, uint8_t* dst, uint16_t count) { error(SD_CARD_ERROR_CMD48); goto fail; } - + // wait for start block token. if (!waitStartBlock()) { goto fail; @@ -793,7 +793,7 @@ uint8_t Sd2Card::readExt(uint32_t arg, uint8_t* dst, uint16_t count) { for (i = 0; i < count; ++i) { dst[i] = spiRec(); } - + // skip dummy bytes and 16-bit crc. for (; i < 514; ++i) { spiRec(); @@ -815,19 +815,19 @@ uint8_t Sd2Card::readExt(uint32_t arg, uint8_t* dst, uint16_t count) { * \return The value one, true, is returned for success and * the value zero, false, is returned for failure. */ -uint8_t Sd2Card::readExtMemory(uint8_t mio, uint8_t func, +uint8_t Sd2Card::readExtMemory(uint8_t mio, uint8_t func, uint32_t addr, uint16_t count, uint8_t* dst) { uint32_t offset = addr & 0x1FF; if (offset + count > 512) count = 512 - offset; - + if (count == 0) return true; - - uint32_t arg = - (((uint32_t)mio & 0x1) << 31) | + + uint32_t arg = + (((uint32_t)mio & 0x1) << 31) | (mio ? (((uint32_t)func & 0x7) << 28) : (((uint32_t)func & 0xF) << 27)) | ((addr & 0x1FFFF) << 9) | ((count - 1) & 0x1FF); - + return readExt(arg, dst, count); } diff --git a/Firmware/Sd2Card.h b/Firmware/Sd2Card.h index ae78f6d7b1..5590804dc8 100644 --- a/Firmware/Sd2Card.h +++ b/Firmware/Sd2Card.h @@ -174,7 +174,7 @@ class Sd2Card { /** * Read a card's CID register. The CID contains card identification * information such as Manufacturer ID, Product name, Product serial - * number and Manufacturing date. + * number and Manufacturing date. * * \param[out] cid pointer to area for returned data. * @@ -243,4 +243,4 @@ class Sd2Card { #endif // Sd2Card_h -#endif \ No newline at end of file +#endif diff --git a/Firmware/SdBaseFile.cpp b/Firmware/SdBaseFile.cpp index 08b55651aa..df31a45c53 100644 --- a/Firmware/SdBaseFile.cpp +++ b/Firmware/SdBaseFile.cpp @@ -1115,7 +1115,7 @@ int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) { int16_t n; // if not a directory file or miss-positioned return an error if (!isDir() || (0X1F & curPosition_)) return -1; - + //If we have a longFilename buffer, mark it as invalid. If we find a long filename it will be filled automaticly. if (longFilename != NULL) { diff --git a/Firmware/SdBaseFile.h b/Firmware/SdBaseFile.h index a6bd311feb..ca74cd809e 100644 --- a/Firmware/SdBaseFile.h +++ b/Firmware/SdBaseFile.h @@ -281,7 +281,7 @@ class SdBaseFile { static void printFatDate(uint16_t fatDate); static void printFatTime( uint16_t fatTime); bool printName(); -protected: +protected: int16_t read(); int16_t read(void* buf, uint16_t nbyte); public: diff --git a/Firmware/SdFatStructs.h b/Firmware/SdFatStructs.h index 3867216160..b7bccabdc1 100644 --- a/Firmware/SdFatStructs.h +++ b/Firmware/SdFatStructs.h @@ -468,29 +468,29 @@ uint32_t const FAT32MASK = 0X0FFFFFFF; * \brief FAT short directory entry * * Short means short 8.3 name, not the entry size. - * - * Date Format. A FAT directory entry date stamp is a 16-bit field that is + * + * Date Format. A FAT directory entry date stamp is a 16-bit field that is * basically a date relative to the MS-DOS epoch of 01/01/1980. Here is the - * format (bit 0 is the LSB of the 16-bit word, bit 15 is the MSB of the + * format (bit 0 is the LSB of the 16-bit word, bit 15 is the MSB of the * 16-bit word): - * - * Bits 9-15: Count of years from 1980, valid value range 0-127 + * + * Bits 9-15: Count of years from 1980, valid value range 0-127 * inclusive (1980-2107). - * + * * Bits 5-8: Month of year, 1 = January, valid value range 1-12 inclusive. * * Bits 0-4: Day of month, valid value range 1-31 inclusive. * * Time Format. A FAT directory entry time stamp is a 16-bit field that has - * a granularity of 2 seconds. Here is the format (bit 0 is the LSB of the + * a granularity of 2 seconds. Here is the format (bit 0 is the LSB of the * 16-bit word, bit 15 is the MSB of the 16-bit word). - * + * * Bits 11-15: Hours, valid value range 0-23 inclusive. - * + * * Bits 5-10: Minutes, valid value range 0-59 inclusive. - * + * * Bits 0-4: 2-second count, valid value range 0-29 inclusive (0 - 58 seconds). - * + * * The valid time range is from Midnight 00:00:00 to 23:59:58. */ struct directoryEntry { @@ -548,7 +548,7 @@ struct directoryEntry { * * directoryVFATEntries are found in the same list as normal directoryEntry. * But have the attribute field set to DIR_ATT_LONG_NAME. - * + * * Long filenames are saved in multiple directoryVFATEntries. * Each entry containing 13 UTF-16 characters. */ diff --git a/Firmware/SdFatUtil.cpp b/Firmware/SdFatUtil.cpp index 50206ab94d..162bb0ec15 100644 --- a/Firmware/SdFatUtil.cpp +++ b/Firmware/SdFatUtil.cpp @@ -45,7 +45,7 @@ int SdFatUtil::FreeRam() { #endif // __arm void SdFatUtil::set_stack_guard() -{ +{ uint32_t *stack_guard; stack_guard = (uint32_t*)(&__bss_end + STACK_GUARD_MARGIN); diff --git a/Firmware/SdFile.cpp b/Firmware/SdFile.cpp index e21144ee18..b4a463ce14 100644 --- a/Firmware/SdFile.cpp +++ b/Firmware/SdFile.cpp @@ -87,7 +87,7 @@ int16_t SdFile::readFilteredGcode(){ // It may seem unreasonable to copy the variable into a local one and copy it back at the end of this method, // but there is an important point of view: the compiler is unsure whether it can optimize the reads/writes - // to gfReadPtr within this method, because it is a class member variable. + // to gfReadPtr within this method, because it is a class member variable. // The compiler cannot see, if omitting read/write won't have any incorrect side-effects to the rest of the whole FW. // So this trick explicitly states, that rdPtr is a local variable limited to the scope of this method, // therefore the compiler can omit read/write to it (keep it in registers!) as it sees fit. @@ -96,7 +96,7 @@ int16_t SdFile::readFilteredGcode(){ // the same applies to gfXBegin, codesize dropped another 100B! const uint8_t *blockBuffBegin = gfBlockBuffBegin(); - + uint8_t consecutiveCommentLines = 0; while( *rdPtr == ';' ){ for(;;){ @@ -104,8 +104,8 @@ int16_t SdFile::readFilteredGcode(){ //while( *(++gfReadPtr) != '\n' ); // skip until a newline is found - suboptimal code! // Wondering, why this "nice while cycle" is done in such a weird way using a separate find_endl() function? // Have a look at the ASM code GCC produced! - - // At first - a separate find_endl() makes the compiler understand, + + // At first - a separate find_endl() makes the compiler understand, // that I don't need to store gfReadPtr every time, I'm only interested in the final address where the '\n' was found // - the cycle can run on CPU registers only without touching memory besides reading the character being compared. // Not only makes the code run considerably faster, but is also 40B shorter! @@ -118,7 +118,7 @@ int16_t SdFile::readFilteredGcode(){ // 11c62: sbci r19, 0xFF ; 255 // 11c64: ld r22, Z // 11c66: cpi r22, 0x0A ; 10 - // 11c68: brne .-12 ; 0x11c5e + // 11c68: brne .-12 ; 0x11c5e // Still, even that was suboptimal as the compiler seems not to understand the usage of ld r22, Z+ (the plus is important) // aka automatic increment of the Z register (R30:R31 pair) @@ -153,7 +153,7 @@ int16_t SdFile::readFilteredGcode(){ { gfUpdateCurrentPosition( rdPtr - start + 1 ); int16_t rv = *rdPtr++; - + if( curPosition_ >= fileSize_ ){ // past the end of file goto eof_or_fail; @@ -200,7 +200,7 @@ bool SdFile::gfComputeNextFileBlock() { // SHR by 9 means skip the last byte and shift just 3 bytes by 1 // -> should be 8 instructions... and not the horrible loop shifting 4 bytes at once // still need to get some work on this - gfBlock = vol_->rootDirStart() + (curPosition_ >> 9); + gfBlock = vol_->rootDirStart() + (curPosition_ >> 9); } else { uint8_t blockOfCluster = vol_->blockOfCluster(curPosition_); if (gfOffset == 0 && blockOfCluster == 0) { diff --git a/Firmware/SdFile.h b/Firmware/SdFile.h index 465224623c..13df9c02c2 100644 --- a/Firmware/SdFile.h +++ b/Firmware/SdFile.h @@ -35,19 +35,19 @@ */ class SdFile : public SdBaseFile/*, public Print*/ { // GCode filtering vars and methods - due to optimization reasons not wrapped in a separate class - + // beware - this read ptr is manipulated inside just 2 methods - readFilteredGcode and gfReset // If you even want to call gfReset from readFilteredGcode, you must make sure // to update gfReadPtr inside readFilteredGcode from a local copy (see explanation of this trick in readFilteredGcode) const uint8_t *gfReadPtr; - + uint32_t gfBlock; // remember the current file block to be kept in cache - due to reuse of the memory, the block may fall out a must be read back uint16_t gfOffset; const uint8_t *gfBlockBuffBegin()const; - + void gfReset(); - + bool gfEnsureBlock(); bool gfComputeNextFileBlock(); void gfUpdateCurrentPosition(uint16_t inc); @@ -59,7 +59,7 @@ class SdFile : public SdBaseFile/*, public Print*/ { #else void write(uint8_t b); #endif - + bool openFilteredGcode(SdBaseFile* dirFile, const char* path); int16_t readFilteredGcode(); bool seekSetFilteredGcode(uint32_t pos); diff --git a/Firmware/Servo.cpp b/Firmware/Servo.cpp index bcb4b074f8..289a2ec8a2 100644 --- a/Firmware/Servo.cpp +++ b/Firmware/Servo.cpp @@ -41,7 +41,7 @@ detach() - Stops an attached servos from pulsing its i/o pin. */ -#include "Configuration.h" +#include "Configuration.h" #ifdef NUM_SERVOS #include diff --git a/Firmware/Tcodes.cpp b/Firmware/Tcodes.cpp index 962cb60e95..8e8e280098 100644 --- a/Firmware/Tcodes.cpp +++ b/Firmware/Tcodes.cpp @@ -11,12 +11,12 @@ static const char duplicate_Tcode_ignored[] PROGMEM = "Duplicate T-code ignored."; -inline bool IsInvalidTCode(char *const s, uint8_t i) { - return ((s[i] < '0' || s[i] > '4') && s[i] != '?' && s[i] != 'x' && s[i] != 'c'); +inline bool IsInvalidTCode(char *const s, uint8_t i) { + return ((s[i] < '0' || s[i] > '4') && s[i] != '?' && s[i] != 'x' && s[i] != 'c'); } -inline void TCodeInvalid() { - SERIAL_ECHOLNPGM("Invalid T code."); +inline void TCodeInvalid() { + SERIAL_ECHOLNPGM("Invalid T code."); } void TCodes(char *const strchr_pointer, const uint8_t codeValue) { @@ -40,7 +40,7 @@ void TCodes(char *const strchr_pointer, const uint8_t codeValue) { } } else { // Process T0 ... T4 if (MMU2::mmu2.Enabled()) { - if (codeValue == MMU2::mmu2.get_current_tool()){ + if (codeValue == MMU2::mmu2.get_current_tool()){ // don't execute the same T-code twice in a row puts_P(duplicate_Tcode_ignored); } else { diff --git a/Firmware/backlight.cpp b/Firmware/backlight.cpp index ad8271ee0f..daab6e2ab2 100644 --- a/Firmware/backlight.cpp +++ b/Firmware/backlight.cpp @@ -45,7 +45,7 @@ void force_bl_on(bool section_start) void backlight_wake(const uint8_t flashNo) { if (!backlightSupport) return; - + if (flashNo) { uint8_t backlightMode_bck = backlightMode; @@ -71,7 +71,7 @@ void backlight_save() //saves all backlight data to eeprom. void backlight_update() { if (!backlightSupport) return; - + if (backlightMode == BACKLIGHT_MODE_AUTO) { if (backlightTimer.expired((uint32_t)backlightTimer_period * 1000ul)) analogWrite(LCD_BL_PIN, backlightLevel_LOW); diff --git a/Firmware/cardreader.cpp b/Firmware/cardreader.cpp index 16abcc0263..15afb10192 100644 --- a/Firmware/cardreader.cpp +++ b/Firmware/cardreader.cpp @@ -35,20 +35,20 @@ CardReader::CardReader() lastnr=0; //power to SD reader #if SDPOWER > -1 - SET_OUTPUT(SDPOWER); + SET_OUTPUT(SDPOWER); WRITE(SDPOWER,HIGH); #endif //SDPOWER - + autostart_atmillis.start(); // reset timer } char *createFilename(char *buffer,const dir_t &p) //buffer>12characters { char *pos=buffer; - for (uint8_t i = 0; i < 11; i++) + for (uint8_t i = 0; i < 11; i++) { if (p.name[i] == ' ')continue; - if (i == 8) + if (i == 8) { *pos++='.'; } @@ -74,7 +74,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m _incrementer() {recursionCnt++;} ~_incrementer() {recursionCnt--;} } recursionCntIncrementer; - + dir_t p; uint8_t cnt = 0; // Read the next entry from a directory @@ -103,10 +103,10 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m // Serial.print(path); // Get a new directory object using the full path // and dive recursively into it. - + if (lsParams.LFN) printf_P(PSTR("DIR_ENTER: %s \"%s\"\n"), path, longFilename[0] ? longFilename : lfilename); - + SdFile dir; if (!dir.open(parent, lfilename, O_READ)) { //SERIAL_ECHO_START(); @@ -115,7 +115,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m } lsDive(path, dir, NULL, lsAction, lsParams); // close() is done automatically by destructor of SdFile - + if (lsParams.LFN) puts_P(PSTR("DIR_EXIT")); } @@ -126,15 +126,15 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m case LS_Count: nrFiles++; break; - + case LS_SerialPrint: createFilename(filename, p); SERIAL_PROTOCOL(prepend); SERIAL_PROTOCOL(filename); - + MYSERIAL.write(' '); SERIAL_PROTOCOL(p.fileSize); - + if (lsParams.timestamp) { crmodDate = p.lastWriteDate; @@ -145,14 +145,14 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m } printf_P(PSTR(" %#lx"), ((uint32_t)crmodDate << 16) | crmodTime); } - + if (lsParams.LFN) printf_P(PSTR(" \"%s\""), LONGEST_FILENAME); - + SERIAL_PROTOCOLLN(); manage_heater(); break; - + case LS_GetFilename: //SERIAL_ECHOPGM("File: "); createFilename(filename, p); @@ -219,12 +219,12 @@ void CardReader::mount(bool doPresort/* = true*/) SERIAL_ERROR_START; SERIAL_ERRORLNRPGM(_n("volume.init failed"));////MSG_SD_VOL_INIT_FAIL } - else if (!root.openRoot(&volume)) + else if (!root.openRoot(&volume)) { SERIAL_ERROR_START; SERIAL_ERRORLNRPGM(_n("openRoot failed"));////MSG_SD_OPENROOT_FAIL } - else + else { mounted = true; SERIAL_ECHO_START; @@ -276,7 +276,7 @@ void CardReader::openLogFile(const char* name) } void CardReader::getDirName(char* name, uint8_t level) -{ +{ workDirParents[level].getFilename(name); } @@ -291,7 +291,7 @@ void CardReader::getAbsFilename(char *t) for(uint8_t i=0;i(int)SD_PROCEDURE_DEPTH-1){ @@ -396,15 +396,15 @@ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_curren kill(ofKill); return; } - + SERIAL_ECHO_START; SERIAL_ECHORPGM(ofSubroutineCallTgt); SERIAL_ECHO(name); SERIAL_ECHORPGM(ofParent); - + //store current filename and position getAbsFilename(filenames[file_subcall_ctr]); - + SERIAL_ECHO(filenames[file_subcall_ctr]); SERIAL_ECHORPGM(ofPos); SERIAL_ECHOLN(sdpos); @@ -423,11 +423,11 @@ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_curren SERIAL_ECHOLN(name); } sdprinting = false; - + const char *fname=name; if (!diveSubfolder(fname)) return; - + if (file.openFilteredGcode(curDir, fname)) { getfilename(0, fname); filesize = file.fileSize(); @@ -436,7 +436,7 @@ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_curren SERIAL_PROTOCOLRPGM(ofSize);////MSG_SD_SIZE SERIAL_PROTOCOLLN(filesize); sdpos = 0; - + SERIAL_PROTOCOLLNRPGM(ofFileSelected);////MSG_SD_FILE_SELECTED lcd_setstatuspgm(ofFileSelected); scrollstuff = 0; @@ -463,15 +463,15 @@ void CardReader::openFileWrite(const char* name) kill(ofKill); return; } - + SERIAL_ECHO_START; SERIAL_ECHORPGM(ofSubroutineCallTgt); SERIAL_ECHO(name); SERIAL_ECHORPGM(ofParent); - + //store current filename and position getAbsFilename(filenames[file_subcall_ctr]); - + SERIAL_ECHO(filenames[file_subcall_ctr]); SERIAL_ECHORPGM(ofPos); SERIAL_ECHOLN(sdpos); @@ -488,11 +488,11 @@ void CardReader::openFileWrite(const char* name) SERIAL_ECHOLN(name); } sdprinting = false; - + const char *fname=name; if (!diveSubfolder(fname)) return; - + //write if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)){ SERIAL_PROTOCOLRPGM(MSG_SD_OPEN_FILE_FAIL); @@ -504,7 +504,7 @@ void CardReader::openFileWrite(const char* name) SERIAL_PROTOCOLRPGM(ofWritingToFile);////MSG_SD_WRITE_TO_FILE printAbsFilenameFast(); SERIAL_PROTOCOLLN(); - + SERIAL_PROTOCOLLNRPGM(ofFileSelected);////MSG_SD_FILE_SELECTED lcd_setstatuspgm(ofFileSelected); scrollstuff = 0; @@ -521,7 +521,7 @@ void CardReader::removeFile(const char* name) if (!diveSubfolder(fname)) return; - if (file.remove(curDir, fname)) + if (file.remove(curDir, fname)) { SERIAL_PROTOCOLPGM("File deleted:"); SERIAL_PROTOCOLLN(fname); @@ -536,7 +536,7 @@ void CardReader::removeFile(const char* name) SERIAL_PROTOCOL(fname); SERIAL_PROTOCOLLN('.'); } - + } uint32_t CardReader::getFileSize() @@ -562,7 +562,7 @@ void CardReader::getStatus(bool arg_P) } else SERIAL_PROTOCOLLN(LONGEST_FILENAME); - + SERIAL_PROTOCOLRPGM(_N("SD printing byte "));////MSG_SD_PRINTING_BYTE SERIAL_PROTOCOL(sdpos); SERIAL_PROTOCOL('/'); @@ -605,7 +605,7 @@ void CardReader::checkautostart(bool force) { // The SD start is delayed because otherwise the serial cannot answer // fast enough to make contact with the host software. - static bool autostart_stilltocheck = true; + static bool autostart_stilltocheck = true; if(!force) { if(!autostart_stilltocheck) @@ -620,7 +620,7 @@ void CardReader::checkautostart(bool force) if(!mounted) //fail return; } - + char autoname[30]; sprintf_P(autoname, PSTR("auto%i.g"), lastnr); for(int8_t i=0;i<(int8_t)strlen(autoname);i++) @@ -628,9 +628,9 @@ void CardReader::checkautostart(bool force) dir_t p; root.rewind(); - + bool found=false; - while (root.readDir(p, NULL) > 0) + while (root.readDir(p, NULL) > 0) { for(int8_t i=0;i<(int8_t)strlen((char*)p.name);i++) p.name[i]=tolower(p.name[i]); @@ -657,17 +657,17 @@ void CardReader::closefile(bool store_location) { file.sync(); file.close(); - saving = false; + saving = false; logging = false; - + if(store_location) { //future: store printer state, filename and position for continuing a stopped print // so one can unplug the printer and continue printing the next day. - + } - + } void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/) @@ -676,7 +676,7 @@ void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/) nrFiles=nr; curDir->rewind(); lsDive("",*curDir,match, LS_GetFilename); - + } void CardReader::getfilename_simple(uint16_t entry, const char * const match/*=NULL*/) @@ -709,10 +709,10 @@ bool CardReader::chdir(const char * relpath, bool doPresort) { SdFile newfile; SdFile *parent=&root; - + if(workDir.isOpen()) parent=&workDir; - + if(!newfile.open(*parent,relpath, O_READ) || ((workDirDepth + 1) >= MAX_DIR_DEPTH)) { SERIAL_ECHO_START; @@ -789,7 +789,7 @@ void CardReader::getfilename_afterMaxSorting(uint16_t entry, const char * const void CardReader::presort() { // Throw away old sort index flush_presort(); - + if (IS_SD_INSERTED == false) return; //sorting is not used in farm mode uint8_t sdSort = eeprom_read_byte((uint8_t*)EEPROM_SD_SORT); @@ -808,7 +808,7 @@ void CardReader::presort() { } sort_count = fileCnt; - + // Init sort order. for (uint16_t i = 0; i < fileCnt; i++) { if (!IS_SD_INSERTED) return; @@ -867,14 +867,14 @@ void CardReader::presort() { uint16_t j = i; for (; j > 0; --j){ if (!IS_SD_INSERTED) return; - + #ifdef SORTING_DUMP for (uint16_t z = 0; z < fileCnt; z++){ printf_P(PSTR("%2u "), sort_entries[z]); } MYSERIAL.println(); #endif - + manage_heater(); const uint16_t o2 = sort_entries[j - 1]; @@ -894,7 +894,7 @@ void CardReader::presort() { } else { #ifdef SORTING_DUMP puts_P(PSTR("shift")); - #endif + #endif sort_entries[j] = o2; } } @@ -957,7 +957,7 @@ void CardReader::presort() { #ifdef SORTING_DUMP puts_P(PSTR("swap")); #endif - + sort_entries[j] = o2; sort_entries[j + 1] = o1; didSwap = true; @@ -966,11 +966,11 @@ void CardReader::presort() { if (!didSwap) break; } //end of bubble sort loop #endif - + #ifdef SORTING_SPEEDTEST printf_P(PSTR("sortingSpeedtestTimer:%lu\n"), sortingSpeedtestTimer.elapsed()); #endif //SORTING_SPEEDTEST - + #ifdef SORTING_DUMP for (uint16_t z = 0; z < fileCnt; z++) printf_P(PSTR("%2u "), sort_entries[z]); diff --git a/Firmware/cardreader.h b/Firmware/cardreader.h index a94d62cab2..db3bbb50db 100644 --- a/Firmware/cardreader.h +++ b/Firmware/cardreader.h @@ -12,7 +12,7 @@ class CardReader { public: CardReader(); - + enum LsAction : uint8_t { LS_SerialPrint, @@ -26,14 +26,14 @@ class CardReader inline ls_param():LFN(0), timestamp(0) { } inline ls_param(bool LFN, bool timestamp):LFN(LFN), timestamp(timestamp) { } } __attribute__((packed)); - + void mount(bool doPresort = true); void write_command(char *buf); void write_command_no_newline(char *buf); //files auto[0-9].g on the sd card are performed in a row //this is to delay autostart and hence the initialisaiton of the sd card to some seconds after the normal init, so the device is available quick after a reset - void checkautostart(bool x); + void checkautostart(bool x); void openFileWrite(const char* name); void openFileReadFilteredGcode(const char* name, bool replace_current = false); void openLogFile(const char* name); @@ -49,12 +49,11 @@ class CardReader void getfilename_simple(uint16_t entry, const char * const match = NULL); void getfilename_next(uint32_t position, const char * const match = NULL); uint16_t getnrfilenames(); - + void getAbsFilename(char *t); void printAbsFilenameFast(); void getDirName(char* name, uint8_t level); uint8_t getWorkDirDepth(); - void ls(ls_param params); bool chdir(const char * relpath, bool doPresort); @@ -90,7 +89,7 @@ class CardReader public: bool saving; bool logging; - bool sdprinting ; + bool sdprinting; bool mounted; char filename[FILENAME_LENGTH]; // There are scenarios when simple modification time is not enough (on MS Windows) @@ -147,7 +146,7 @@ extern CardReader card; #define IS_SD_PRINTING (card.sdprinting) #if (SDCARDDETECT > -1) -# ifdef SDCARDDETECTINVERTED +# ifdef SDCARDDETECTINVERTED # define IS_SD_INSERTED (READ(SDCARDDETECT)!=0) # else # define IS_SD_INSERTED (READ(SDCARDDETECT)==0) diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp index 016ae02670..6121eca40c 100755 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -108,7 +108,7 @@ void cmdqueue_reset() //commands are removed from command queue after process_command() function is finished //reseting command queue and enqueing new commands during some (usually long running) command processing would cause that new commands are immediately removed from queue (or damaged) //this will ensure that all new commands which are enqueued after cmdqueue reset, will be always executed - cmdbuffer_front_already_processed = true; + cmdbuffer_front_already_processed = true; } // How long a string could be pushed to the front of the command queue? @@ -354,7 +354,7 @@ void enquecommand_front(const char *cmd, bool from_progmem) void repeatcommand_front() { cmdbuffer_front_already_processed = true; -} +} void get_command() { @@ -369,7 +369,7 @@ void get_command() // start of serial line processing loop while (((MYSERIAL.available() > 0 && !saved_printing) || (MYSERIAL.available() > 0 && printingIsPaused())) && !cmdqueue_serial_disabled) { //is print is saved (crash detection or filament detection), dont process data from serial line - + #ifdef ENABLE_MEATPACK // MeatPack Changes // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -596,9 +596,9 @@ void get_command() { // This is either an empty line, or a line with just a comment. // Continue to the following line, and continue accumulating the number of bytes - // read from the sdcard into sd_count, + // read from the sdcard into sd_count, // so that the length of the already read empty lines and comments will be added - // to the following non-empty line. + // to the following non-empty line. return; // prevent cycling indefinitely - let manage_heaters do their job } // The new command buffer could be updated non-atomically, because it is not yet considered @@ -635,7 +635,7 @@ void get_command() comment_mode = false; //for new command serial_count = 0; //clear buffer - + if(card.eof()) break; // The following line will reserve buffer space if available. diff --git a/Firmware/cmdqueue.h b/Firmware/cmdqueue.h index 96ec6d7723..83220cfabb 100644 --- a/Firmware/cmdqueue.h +++ b/Firmware/cmdqueue.h @@ -4,9 +4,9 @@ #include "Marlin.h" // String circular buffer. Commands may be pushed to the buffer from both sides: -// Chained commands will be pushed to the front, interactive (from LCD menu) +// Chained commands will be pushed to the front, interactive (from LCD menu) // and printing commands (from serial line or from SD card) are pushed to the tail. -// First character of each entry indicates the type of the entry: +// First character of each entry indicates the type of the entry: #define CMDBUFFER_CURRENT_TYPE_UNKNOWN 0 // Command in cmdbuffer was sent over USB. #define CMDBUFFER_CURRENT_TYPE_USB 1 @@ -16,8 +16,8 @@ #define CMDBUFFER_CURRENT_TYPE_UI 3 // Command in cmdbuffer was generated by another G-code. #define CMDBUFFER_CURRENT_TYPE_CHAINED 4 -// Command has been processed and its SD card length has been possibly pushed -// to the planner queue, but not yet removed from the cmdqueue. +// Command has been processed and its SD card length has been possibly pushed +// to the planner queue, but not yet removed from the cmdqueue. // This is a temporary state to reduce stepper interrupt locking time. #define CMDBUFFER_CURRENT_TYPE_TO_BE_REMOVED 5 //Command in cmdbuffer was sent over USB and contains line number diff --git a/Firmware/config.h b/Firmware/config.h index b8bdc3b9eb..aa77d684ff 100644 --- a/Firmware/config.h +++ b/Firmware/config.h @@ -65,7 +65,7 @@ #define LANG_SIZE_RESERVED 0x3500 // reserved space for secondary language (13568 bytes). // 0x3D00 Maximum 15616 bytes as it depends on xflash_layout.h - // 16 Languages max. per group including stock + // 16 Languages max. per group including stock #if (LANG_SIZE_RESERVED % 256) #error "LANG_SIZE_RESERVED should be a multiple of a page size" diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 30a8b88ea5..1904272f24 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -32,7 +32,7 @@ void eeprom_init() int last_babystep = eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z); eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[0].z_offset)), last_babystep); } - + // initialize the sheet names in eeprom for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); i++) { SheetName sheetName; diff --git a/Firmware/fancheck.cpp b/Firmware/fancheck.cpp index d207eff49b..bec0d56dc4 100755 --- a/Firmware/fancheck.cpp +++ b/Firmware/fancheck.cpp @@ -194,7 +194,7 @@ ISR(INT7_vect) { if ((millis_nc() - t_fan_rising_edge) >= FAN_PULSE_WIDTH_LIMIT) {//this pulse was from sensor and not from pwm fan_edge_counter[1] += 2; //we are currently counting all edges so lets count two edges for one pulse } - } + } EICRB ^= (1 << 6); //change edge } #endif //(defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1)) diff --git a/Firmware/fastio.h b/Firmware/fastio.h index b857cbc0b4..1bc35f98f1 100644 --- a/Firmware/fastio.h +++ b/Firmware/fastio.h @@ -62,7 +62,7 @@ /// Write to a pin wrapper, non critical. /// This macro is cheaper than WRITE(IO,v) on ports H,I,J,K,L, as _WRITE_C disables / enables interrupts /// and stores the old CPU flags on the stack. -/// This macro should only be called, where it cannot be interrupted. +/// This macro should only be called, where it cannot be interrupted. #define WRITE_NC(IO, v) _WRITE_NC(IO, v) /// toggle a pin wrapper @@ -2067,7 +2067,7 @@ pins pins */ -//#define AT90USBxx_TEENSYPP_ASSIGNMENTS // Use Teensy++ 2.0 assignments +//#define AT90USBxx_TEENSYPP_ASSIGNMENTS // Use Teensy++ 2.0 assignments #ifndef AT90USBxx_TEENSYPP_ASSIGNMENTS // Use traditional Marlin pin assignments #define DIO0_PIN PINA0 @@ -2707,8 +2707,8 @@ pins /* -AT90USB 51 50 49 48 47 46 45 44 10 11 12 13 14 15 16 17 35 36 37 38 39 40 41 42 25 26 27 28 29 30 31 32 33 34 43 09 18 19 01 02 61 60 59 58 57 56 55 54 -Port A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 +AT90USB 51 50 49 48 47 46 45 44 10 11 12 13 14 15 16 17 35 36 37 38 39 40 41 42 25 26 27 28 29 30 31 32 33 34 43 09 18 19 01 02 61 60 59 58 57 56 55 54 +Port A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 Marlin 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 Teensy 28 29 30 31 32 33 34 35 20 21 22 23 24 25 26 27 10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07 08 09(46*47)36 37 18 19 38 39 40 41 42 43 44 45 The pins 46 and 47 are not supported by Teensyduino, but are supported below. diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index e4f3187a3f..5e61f1f061 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -93,7 +93,7 @@ bool lay1cal_load_filament(uint8_t filament) //! @brief Print intro line //! @param extraPurgeNeeded false if the first MMU-related "G1 E29" have to be skipped because the nozzle is already full of filament //! @param layer_height the height of the calibration layer -//! @param extrusion_width the width of the extrusion layer +//! @param extrusion_width the width of the extrusion layer void lay1cal_intro_line(bool extraPurgeNeeded, float layer_height, float extrusion_width) { static const char cmd_intro_mmu_3[] PROGMEM = "G1 X55 E29 F1073"; diff --git a/Firmware/heatbed_pwm.cpp b/Firmware/heatbed_pwm.cpp index 85432d1833..5a233247f8 100755 --- a/Firmware/heatbed_pwm.cpp +++ b/Firmware/heatbed_pwm.cpp @@ -11,7 +11,7 @@ // Doing this at higher frequency than the bed "loudspeaker" can handle makes the click barely audible. // Technically: // timer0 is set to fast PWM mode at 62.5kHz (timer0 is linked to the bed heating pin) (zero prescaler) -// To keep the bed switching at 30Hz - we don't want the PWM running at 62kHz all the time +// To keep the bed switching at 30Hz - we don't want the PWM running at 62kHz all the time // since it would burn the heatbed's MOSFET: // 16MHz/256 levels of PWM duty gives us 62.5kHz // 62.5kHz/256 gives ~244Hz, that is still too fast - 244/8 gives ~30Hz, that's what we need @@ -19,9 +19,9 @@ // The finite automaton is running in the ISR(TIMER0_OVF_vect) // 2019-08-14 update: the original algorithm worked very well, however there were 2 regressions: -// 1. 62kHz ISR requires considerable amount of processing power, +// 1. 62kHz ISR requires considerable amount of processing power, // USB transfer speed dropped by 20%, which was most notable when doing short G-code segments. -// 2. Some users reported TLed PSU started clicking when running at 120V/60Hz. +// 2. Some users reported TLed PSU started clicking when running at 120V/60Hz. // This looks like the original algorithm didn't maintain base PWM 30Hz, but only 15Hz // To address both issues, there is an improved approach based on the idea of leveraging // different CLK prescalers in some automaton states - i.e. when holding LOW or HIGH on the output pin, @@ -40,7 +40,7 @@ // - it can toggle unnoticed, which will result in bed clicking again. // That's why there are special transition states ZERO_TO_RISE and ONE_TO_FALL, which enable the // counter change its operation atomically and without artefacts on the output pin. -// The resulting signal on the output pin was checked with an osciloscope. +// The resulting signal on the output pin was checked with an osciloscope. // If there are any change requirements in the future, the signal must be checked with an osciloscope again, // ad-hoc changes may completely screw things up! @@ -57,7 +57,7 @@ enum class States : uint8_t { ZERO_TO_RISE, ///< metastate allowing the timer change its state atomically without artefacts on the output pin RISE, ///< 16 fast PWM cycles with increasing duty up to steady ON RISE_TO_ONE, ///< metastate allowing the timer change its state atomically without artefacts on the output pin - ONE, ///< steady 1 (ON), no change for the whole period + ONE, ///< steady 1 (ON), no change for the whole period FALL, ///< 16 fast PWM cycles with decreasing duty down to steady OFF FALL_TO_ZERO ///< metastate allowing the timer change its state atomically without artefacts on the output pin }; @@ -92,7 +92,7 @@ static const uint8_t fastShift = 4; /// increment slowCounter by 1 /// but use less bits of soft PWM - something like soft_pwm_bed >> 2 /// that may further reduce the CPU cycles required by the bed heating automaton -/// Due to the nature of bed heating the reduced PID precision may not be a major issue, however doing 8x less ISR(timer0_ovf) may significantly improve the performance +/// Due to the nature of bed heating the reduced PID precision may not be a major issue, however doing 8x less ISR(timer0_ovf) may significantly improve the performance static const uint8_t slowInc = 1; ISR(TIMER0_OVF_vect) // timer compare interrupt service routine @@ -177,6 +177,6 @@ ISR(TIMER0_OVF_vect) // timer compare interrupt service routine TCNT0 = 128; OCR0B = 255; TCCR0B = (1 << CS01); // change prescaler to 8, i.e. 7.8kHz - break; + break; } } diff --git a/Firmware/language.c b/Firmware/language.c index e0aa162dc1..169c6e4bf8 100644 --- a/Firmware/language.c +++ b/Firmware/language.c @@ -248,7 +248,7 @@ const char* lang_get_name_by_code(uint16_t code) #endif // COMMUNITY_LANG_GROUP1_RO //Use the 3 lines below as a template and replace 'QR' and 'New language' -//#ifdef COMMUNITY_LANG_GROUP1_QR +//#ifdef COMMUNITY_LANG_GROUP1_QR // case LANG_CODE_QR: return _n("New language"); //community contribution //#endif // COMMUNITY_LANG_GROUP1_QR #endif // COMMUNITY_LANGUAGE_SUPPORT diff --git a/Firmware/language.h b/Firmware/language.h index 25f97e9925..a58fb7c34d 100644 --- a/Firmware/language.h +++ b/Firmware/language.h @@ -43,7 +43,7 @@ /** @brief lang_table_header_t structure - (size= 16byte) */ typedef struct { - uint32_t magic; //+0 + uint32_t magic; //+0 uint16_t size; //+4 uint16_t count; //+6 uint16_t checksum; //+8 diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 09018ae066..cc89a577db 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -118,7 +118,7 @@ void lcd_escape_write(uint8_t chr); #endif static void lcd_pulseEnable(void) -{ +{ WRITE(LCD_PINS_ENABLE,HIGH); _delay_us(1); // enable pulse must be >450ns WRITE(LCD_PINS_ENABLE,LOW); @@ -136,7 +136,7 @@ static void lcd_writebits(uint8_t value) WRITE(LCD_PINS_D5, value & 0x20); WRITE(LCD_PINS_D6, value & 0x40); WRITE(LCD_PINS_D7, value & 0x80); - + lcd_pulseEnable(); } @@ -199,7 +199,7 @@ static void lcd_begin(uint8_t clear) // finally, set # lines, font size, etc.0 lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); // turn the display on with no cursor or blinking default - lcd_displaycontrol = LCD_CURSOROFF | LCD_BLINKOFF; + lcd_displaycontrol = LCD_CURSOROFF | LCD_BLINKOFF; lcd_display(); // clear it off if (clear) lcd_clear(); @@ -207,7 +207,7 @@ static void lcd_begin(uint8_t clear) lcd_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT; // set the entry mode lcd_command(LCD_ENTRYMODESET | lcd_displaymode); - + #ifdef VT100 lcd_escape[0] = 0; #endif @@ -235,12 +235,12 @@ void lcd_init(void) SET_OUTPUT(LCD_PINS_D5); SET_OUTPUT(LCD_PINS_D6); SET_OUTPUT(LCD_PINS_D7); - + #ifdef LCD_8BIT lcd_displayfunction |= LCD_8BITMODE; #endif lcd_displayfunction |= LCD_2LINE; - _delay_us(50000); + _delay_us(50000); lcd_begin(1); //first time init fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream } @@ -394,10 +394,10 @@ void lcd_createChar_P(uint8_t location, const CustomCharacter *char_p) // The LCD expects the CGRAM data to be sent as pixel data, row by row. Since there are 8 rows per character, 8 bytes need to be sent. // However, storing the data in the flash as the LCD expects it is wasteful since 3 bits per row are don't care and are not used. // Therefore, flash can be saved if the character data is packed. For the AVR to unpack efficiently and quickly, the following scheme was used: - // + // // colbyte data0 data1 data2 data3 // a b c d e - // + // // ** ** ** b7 b6 b5 b4 a0 // ** ** ** b3 b2 b1 b0 a1 // ** ** ** c7 c6 c5 c4 a2 @@ -406,7 +406,7 @@ void lcd_createChar_P(uint8_t location, const CustomCharacter *char_p) // ** ** ** d3 d2 d1 d0 a5 // ** ** ** e7 e6 e5 e4 a6 // ** ** ** e3 e2 e1 e0 a7 - // + // // The bits marked as ** in the unpacked data are don't care and they will contain garbage. uint8_t temp; @@ -414,7 +414,7 @@ void lcd_createChar_P(uint8_t location, const CustomCharacter *char_p) __asm__ __volatile__ ( // load colByte "lpm %1, Z+" "\n\t" - + // begin for loop "ldi %0, 8" "\n\t" "mov __zero_reg__, %0" "\n\t" // use zero_reg as loop counter @@ -431,7 +431,7 @@ void lcd_createChar_P(uint8_t location, const CustomCharacter *char_p) // end for loop "dec __zero_reg__" "\n\t" "brne forBegin_%=" "\n\t" - + : "=&d" (temp), "=&r" (colByte) : "z" (char_p), "e" (charmap) ); @@ -690,13 +690,13 @@ void lcd_print(unsigned long n, int base) void lcd_printNumber(unsigned long n, uint8_t base) { - unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars. + unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars. uint8_t i = 0; if (n == 0) { lcd_print('0'); return; - } + } while (n > 0) { buf[i++] = n % base; @@ -869,7 +869,7 @@ void lcd_buttons_update(void) uint8_t enc_bits = 0; if (!READ(BTN_EN1)) enc_bits |= _BV(0); if (!READ(BTN_EN2)) enc_bits |= _BV(1); - + if (enc_bits != enc_bits_old) { int8_t newDiff = pgm_read_byte(&encrot_table[(enc_bits_old << 2) | enc_bits]); @@ -956,9 +956,9 @@ void lcd_frame_start() { #endif // DEBUG_CUSTOM_CHARACTERS lcd_custom_characters[i] = 0x7F; } - + } - + #ifdef DEBUG_CUSTOM_CHARACTERS printf_P(PSTR("frame start:")); for (uint8_t i = 0; i < 8; i++) { diff --git a/Firmware/meatpack.cpp b/Firmware/meatpack.cpp index b68a2ca711..db60f4f415 100644 --- a/Firmware/meatpack.cpp +++ b/Firmware/meatpack.cpp @@ -326,7 +326,7 @@ void FORCE_INLINE mp_handle_cmd(const MeatPack_Command c) { break; } - mp_echo_config_state(); + mp_echo_config_state(); } //========================================================================== diff --git a/Firmware/meatpack.h b/Firmware/meatpack.h index 4c949abf29..7a2bdde72f 100644 --- a/Firmware/meatpack.h +++ b/Firmware/meatpack.h @@ -22,7 +22,7 @@ * objects with high curvature, especially at high speeds. There is also the issue of the limited * baud rate provided by Prusa's Atmega2560-based boards, over the USB serial connection. So soft- * ware like OctoPrint would also suffer this same micro-stuttering and poor print quality issue. -* +* */ #include #include "Configuration.h" diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 2ce6280427..9ceb0c1f40 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -110,7 +110,7 @@ void menu_back_no_reset(void) { if (menu_depth > 0) { - menu_depth--; + menu_depth--; menu_goto(menu_stack[menu_depth].menu, menu_stack[menu_depth].position, false); } } @@ -145,7 +145,7 @@ void menu_item_ret(void) { lcd_draw_update = 2; menu_item++; - + //prevent the rest of the menu items from rendering or getting clicked menu_row = LCD_HEIGHT; // early exit from the MENU_BEGIN() for loop at the end of the current cycle menu_line = 0; // prevent subsequent menu items from rendering at all in the current MENU_BEGIN() for loop cycle @@ -433,24 +433,24 @@ static void menu_draw_P(const char chr, const char* str, const int16_t val) //! @brief Draw up to 10 chars of text and a float number in format from +0.0 to +12345.0. The increased range is necessary //! for displaying large values of extruder positions, which caused text overflow in the previous implementation. -//! +//! //! @param str string label to print -//! @param val value to print aligned to the right side of the display -//! +//! @param val value to print aligned to the right side of the display +//! //! Implementation comments: //! The text needs to come with a colon ":", this function does not append it anymore. //! That resulted in a much shorter implementation (234628B -> 234476B) //! There are similar functions around which may be shortened in a similar way void menu_draw_float31(const char* str, float val) { - lcd_printf_P(menu_fmt_float31, str, val); + lcd_printf_P(menu_fmt_float31, str, val); } //! @brief Draw up to 14 chars of text and a float number in format +1.234 -//! +//! //! @param str string label to print -//! @param val value to print aligned to the right side of the display -//! +//! @param val value to print aligned to the right side of the display +//! //! Implementation comments: //! This function uses similar optimization principles as menu_draw_float31 //! (i.e. str must include a ':' at its end) @@ -501,7 +501,7 @@ void menu_item_edit_P(const char* str, void* pval, uint8_t pbits, int16_t min_va { int16_t cur_val = (pbits == 8 ? *((uint8_t*)pval) : *((int16_t*)pval)); - if (lcd_draw_update) + if (lcd_draw_update) { lcd_set_cursor(0, menu_row); menu_draw_P(menu_selection_mark(), str, cur_val); @@ -530,7 +530,7 @@ void menu_progressbar_init(uint16_t total, const char* title) lcd_clear(); progressbar_block_count = 0; progressbar_total = total; - + lcd_set_cursor(0, 1); lcd_print_pad_P(title, LCD_WIDTH); lcd_set_cursor(0, 2); diff --git a/Firmware/menu.h b/Firmware/menu.h index 4475186af0..c999f60b63 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -10,7 +10,7 @@ //Function pointer to menu functions. typedef void (*menu_func_t)(void); -typedef struct +typedef struct { menu_func_t menu; int8_t position; diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 15c495c1d5..94a3c880a3 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -262,26 +262,26 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( for (uint8_t i = 0; i < npts; ++i) { // First for the residuum in the x axis: if (r != 1 && c != 1) { - float a = + float a = (r == 0) ? 1.f : ((r == 2) ? (-s1 * measured_pts[2 * i]) : (-c2 * measured_pts[2 * i + 1])); - float b = + float b = (c == 0) ? 1.f : ((c == 2) ? (-s1 * measured_pts[2 * i]) : (-c2 * measured_pts[2 * i + 1])); float w = point_weight_x(i, measured_pts[2 * i + 1]); acc += a * b * w; } - // Second for the residuum in the y axis. + // Second for the residuum in the y axis. // The first row of the points have a low weight, because their position may not be known // with a sufficient accuracy. if (r != 0 && c != 0) { - float a = + float a = (r == 1) ? 1.f : ((r == 2) ? ( c1 * measured_pts[2 * i]) : (-s2 * measured_pts[2 * i + 1])); - float b = + float b = (c == 1) ? 1.f : ((c == 2) ? ( c1 * measured_pts[2 * i]) : (-s2 * measured_pts[2 * i + 1])); @@ -295,7 +295,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( acc = 0.f; for (uint8_t i = 0; i < npts; ++i) { { - float j = + float j = (r == 0) ? 1.f : ((r == 1) ? 0.f : ((r == 2) ? (-s1 * measured_pts[2 * i]) : @@ -305,7 +305,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( acc += j * fx * w; } { - float j = + float j = (r == 0) ? 0.f : ((r == 1) ? 1.f : ((r == 2) ? ( c1 * measured_pts[2 * i]) : @@ -455,7 +455,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( if (err > BED_CALIBRATION_POINT_OFFSET_MAX_EUCLIDIAN) { result = BED_SKEW_OFFSET_DETECTION_FITTING_FAILED; #ifdef SUPPORT_VERBOSITY - if(verbosity_level >= 20) SERIAL_ECHOPGM(", error > max. error euclidian"); + if(verbosity_level >= 20) SERIAL_ECHOPGM(", error > max. error euclidian"); #endif // SUPPORT_VERBOSITY } } @@ -684,7 +684,7 @@ void reset_bed_offset_and_skew() bool is_bed_z_jitter_data_valid() // offsets of the Z heiths of the calibration points from the first point are saved as 16bit signed int, scaled to tenths of microns // if at least one 16bit integer has different value then -1 (0x0FFFF), data are considered valid and function returns true, otherwise it returns false -{ +{ for (int8_t i = 0; i < 8; ++i) { if (eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + i * 2)) != 0x0FFFF) return true; @@ -947,11 +947,11 @@ bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int #endif //SUPPORT_VERBOSITY ) { - bool high_deviation_occured = false; + bool high_deviation_occured = false; bedPWMDisabled = 1; #ifdef TMC2130 bool bHighPowerForced = false; - if (tmc2130_mode == TMC2130_MODE_SILENT) + if (tmc2130_mode == TMC2130_MODE_SILENT) { FORCE_HIGH_POWER_START; bHighPowerForced = true; @@ -985,7 +985,7 @@ bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int #endif //TMC2130 for (uint8_t i = 0; i < n_iter; ++ i) { - + current_position[Z_AXIS] += high_deviation_occured ? 0.5 : 0.2; float z_bckp = current_position[Z_AXIS]; go_to_current(homing_feedrate[Z_AXIS]/60); @@ -997,7 +997,7 @@ bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int update_current_position_z(); //printf_P(PSTR("Zs: %f, Z: %f, delta Z: %f"), z_bckp, current_position[Z_AXIS], (z_bckp - current_position[Z_AXIS])); if (fabs(current_position[Z_AXIS] - z_bckp) < 0.025) { - //printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); + //printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); raise_z(0.5); current_position[Z_AXIS] = minimum_z; go_to_current(homing_feedrate[Z_AXIS]/(4*60)); @@ -1026,12 +1026,12 @@ bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int //printf_P(PSTR("Z[%d] = %d, dz=%d\n"), i, (int)(current_position[Z_AXIS] * 1000), (int)(dz * 1000)); //printf_P(PSTR("Z- measurement deviation from avg value %f um\n"), dz); if (dz > 0.05) { //deviation > 50um - if (high_deviation_occured == false) { //first occurence may be caused in some cases by mechanic resonance probably especially if printer is placed on unstable surface + if (high_deviation_occured == false) { //first occurence may be caused in some cases by mechanic resonance probably especially if printer is placed on unstable surface //printf_P(PSTR("high dev. first occurence\n")); delay_keep_alive(500); //damping //start measurement from the begining, but this time with higher movements in Z axis which should help to reduce mechanical resonance high_deviation_occured = true; - i = -1; + i = -1; z = 0; } else { @@ -1208,7 +1208,7 @@ BedSkewOffsetDetectionResultType find_bed_induction_sensor_point_xy(int // we have to let the planner know where we are right now as it is not where we said to go. update_current_position_xyz(); enable_z_endstop(false); - + for (int8_t iter = 0; iter < 2; ++iter) { /*SERIAL_ECHOPGM("iter: "); MYSERIAL.println(iter); @@ -1227,7 +1227,7 @@ BedSkewOffsetDetectionResultType find_bed_induction_sensor_point_xy(int invert_z_endstop(true); for (int iteration = 0; iteration < 8; iteration++) { - found = false; + found = false; enable_z_endstop(true); go_xy(init_x_position + 16.0f, current_position[Y_AXIS], feedrate / 5); update_current_position_xyz(); @@ -1253,7 +1253,7 @@ BedSkewOffsetDetectionResultType find_bed_induction_sensor_point_xy(int current_position[X_AXIS] = 0.5f * (a + b); go_xy(current_position[X_AXIS], init_y_position, feedrate / 5); found = true; - + // Search in the Y direction along a cross. found = false; enable_z_endstop(true); @@ -1329,7 +1329,7 @@ BedSkewOffsetDetectionResultType find_bed_induction_sensor_point_xy(int break; } } - + enable_z_endstop(false); invert_z_endstop(false); return found; @@ -1817,7 +1817,7 @@ inline bool improve_bed_induction_sensor_point2(bool lift_z_on_min_y, int8_t ver #define IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_RADIUS (8.f) #define IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_STEP_FINE_Y (0.1f) inline bool improve_bed_induction_sensor_point3(int verbosity_level) -{ +{ float center_old_x = current_position[X_AXIS]; float center_old_y = current_position[Y_AXIS]; float a, b; @@ -2192,7 +2192,7 @@ float __attribute__((noinline)) BED_Y(const uint8_t row) } BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level, uint8_t &too_far_mask) -{ +{ // Don't let the manage_inactivity() function remove power from the motors. refresh_cmd_timeout(); @@ -2203,13 +2203,13 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level float *vec_y = vec_x + 2; float *cntr = vec_y + 2; memset(pts, 0, sizeof(float) * 7 * 7); - uint8_t iteration = 0; + uint8_t iteration = 0; BedSkewOffsetDetectionResultType result; // SERIAL_ECHOLNPGM("find_bed_offset_and_skew verbosity level: "); // SERIAL_ECHO(int(verbosity_level)); // SERIAL_ECHOPGM(""); - + #ifdef NEW_XYZCAL { #else //NEW_XYZCAL @@ -2221,7 +2221,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 20) { SERIAL_ECHOLNPGM("Vectors: "); - + SERIAL_ECHOPGM("vec_x[0]:"); MYSERIAL.print(vec_x[0], 5); SERIAL_ECHOLNPGM(""); @@ -2290,7 +2290,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level else { // if first iteration failed, count corrected point coordinates as initial // Use the corrected coordinate, which is a result of find_bed_offset_and_skew(). - + current_position[X_AXIS] = vec_x[0] * pgm_read_float(bed_ref_points_4 + k * 2) + vec_y[0] * pgm_read_float(bed_ref_points_4 + k * 2 + 1) + cntr[0]; current_position[Y_AXIS] = vec_x[1] * pgm_read_float(bed_ref_points_4 + k * 2) + vec_y[1] * pgm_read_float(bed_ref_points_4 + k * 2 + 1) + cntr[1]; @@ -2333,7 +2333,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level #ifndef NEW_XYZCAL #ifndef HEATBED_V2 - + if (k == 0 || k == 1) { // Improve the position of the 1st row sensor points by a zig-zag movement. find_bed_induction_sensor_point_z(); @@ -2372,11 +2372,11 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level pt[0] += (current_position[X_AXIS]/(iteration + 1)); //count average pt[1] = (pt[1] * iteration) / (iteration + 1); pt[1] += (current_position[Y_AXIS] / (iteration + 1)); - - + + //pt[0] += current_position[X_AXIS]; //if(iteration > 0) pt[0] = pt[0] / 2; - + //pt[1] += current_position[Y_AXIS]; //if (iteration > 0) pt[1] = pt[1] / 2; @@ -2410,7 +2410,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level } DBG(_n("All 4 calibration points found.\n")); delay_keep_alive(0); //manage_heater, reset watchdog, manage inactivity - + #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 20) { // Test the positions. Are the positions reproducible? Now the calibration is active in the planner. @@ -2437,7 +2437,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level } result = calculate_machine_skew_and_offset_LS(pts, 4, bed_ref_points_4, vec_x, vec_y, cntr, verbosity_level); delay_keep_alive(0); //manage_heater, reset watchdog, manage inactivity - + if (result >= 0) { DBG(_n("Calibration success.\n")); world2machine_update(vec_x, vec_y, cntr); @@ -2500,7 +2500,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level } iteration++; } - return result; + return result; } #ifndef NEW_XYZCAL @@ -2903,7 +2903,7 @@ bool sample_mesh_and_store_reference() kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); } // Get cords of measuring point - + mbl.set_z(ix, iy, current_position[Z_AXIS]); } { @@ -3060,11 +3060,11 @@ void babystep_load() if (calibration_status_get(CALIBRATION_STATUS_LIVE_ADJUST)) { check_babystep(); //checking if babystep is in allowed range, otherwise setting babystep to 0 - + // End of G80: Apply the baby stepping value. babystepLoadZ = eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset))); - + #if 0 SERIAL_ECHO("Z baby step: "); SERIAL_ECHO(babystepLoadZ); @@ -3091,7 +3091,7 @@ void babystep_undo() void babystep_reset() { - babystepLoadZ = 0; + babystepLoadZ = 0; } void count_xyz_details(float (&distanceMin)[2]) { @@ -3120,8 +3120,8 @@ void mbl_settings_init() { eeprom_init_default_byte((uint8_t*)EEPROM_MBL_PROBE_NR, 3); } -//parameter ix: index of mesh bed leveling point in X-axis (for meas_points == 7 is valid range from 0 to 6; for meas_points == 3 is valid range from 0 to 2 ) -//parameter iy: index of mesh bed leveling point in Y-axis (for meas_points == 7 is valid range from 0 to 6; for meas_points == 3 is valid range from 0 to 2 ) +//parameter ix: index of mesh bed leveling point in X-axis (for meas_points == 7 is valid range from 0 to 6; for meas_points == 3 is valid range from 0 to 2 ) +//parameter iy: index of mesh bed leveling point in Y-axis (for meas_points == 7 is valid range from 0 to 6; for meas_points == 3 is valid range from 0 to 2 ) //function returns true if point is considered valid (typicaly in safe distance from magnet or another object which inflences PINDA measurements) bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy) { //"human readable" heatbed plan diff --git a/Firmware/mesh_bed_calibration.h b/Firmware/mesh_bed_calibration.h index 651eaba719..95b3201379 100644 --- a/Firmware/mesh_bed_calibration.h +++ b/Firmware/mesh_bed_calibration.h @@ -133,7 +133,7 @@ inline bool world2machine_clamp(float &x, float &y) tmpx = X_MAX_POS; clamped = true; } - + if (tmpy < Y_MIN_POS) { tmpy = Y_MIN_POS; clamped = true; @@ -169,7 +169,7 @@ enum BedSkewOffsetDetectionResultType { BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND = -1, //!< Point not found. BED_SKEW_OFFSET_DETECTION_FITTING_FAILED = -2, //!< Fitting failed BED_SKEW_OFFSET_DETECTION_POINT_SCAN_FAILED = -3, //!< Point scan failed, try again - + // Detection finished with success. BED_SKEW_OFFSET_DETECTION_PERFECT = 0, //!< Perfect. BED_SKEW_OFFSET_DETECTION_SKEW_MILD = 1, //!< Mildly skewed. @@ -195,7 +195,7 @@ extern bool is_bed_z_jitter_data_valid(); // Useful for visualizing the behavior of the bed induction detector. extern bool scan_bed_induction_points(int8_t verbosity_level); -// Load Z babystep value from the EEPROM into babystepLoadZ, +// Load Z babystep value from the EEPROM into babystepLoadZ, // but don't apply it through the planner. This is useful on wake up // after power panic, when it is expected, that the baby step has been already applied. extern void babystep_load(); diff --git a/Firmware/mesh_bed_leveling.cpp b/Firmware/mesh_bed_leveling.cpp index 9ffcbb59d6..f49f96f7dc 100644 --- a/Firmware/mesh_bed_leveling.cpp +++ b/Firmware/mesh_bed_leveling.cpp @@ -14,7 +14,7 @@ void mesh_bed_leveling::reset() { float mesh_bed_leveling::get_z(float x, float y) { int i, j; float s, t; - + i = int(floor((x - (BED_X0 + X_PROBE_OFFSET_FROM_EXTRUDER)) / x_mesh_density)); if (i < 0) { i = 0; @@ -36,7 +36,7 @@ float mesh_bed_leveling::get_z(float x, float y) { } t = (y - get_y(j)) / y_mesh_density; } - + float si = 1.f-s; float z0 = si * z_values[j ][i] + s * z_values[j ][i+1]; float z1 = si * z_values[j+1][i] + s * z_values[j+1][i+1]; @@ -60,7 +60,7 @@ void mesh_bed_leveling::upsample_3x3() if (!isnan(z_values[j][i])) continue; float x = get_x(i); - z_values[j][i] = + z_values[j][i] = z_values[j][idx0] * (x - x1) * (x - x2) / ((x0 - x1) * (x0 - x2)) + z_values[j][idx1] * (x - x0) * (x - x2) / ((x1 - x0) * (x1 - x2)) + z_values[j][idx2] * (x - x0) * (x - x1) / ((x2 - x0) * (x2 - x1)); @@ -78,7 +78,7 @@ void mesh_bed_leveling::upsample_3x3() if (!isnan(z_values[j][i])) continue; float y = get_y(j); - z_values[j][i] = + z_values[j][i] = z_values[idx0][i] * (y - y1) * (y - y2) / ((y0 - y1) * (y0 - y2)) + z_values[idx1][i] * (y - y0) * (y - y2) / ((y1 - y0) * (y1 - y2)) + z_values[idx2][i] * (y - y0) * (y - y1) / ((y2 - y0) * (y2 - y1)); diff --git a/Firmware/mesh_bed_leveling.h b/Firmware/mesh_bed_leveling.h index 7b3313a12b..837801b97b 100644 --- a/Firmware/mesh_bed_leveling.h +++ b/Firmware/mesh_bed_leveling.h @@ -7,9 +7,9 @@ class mesh_bed_leveling { public: uint8_t active; float z_values[MESH_NUM_Y_POINTS][MESH_NUM_X_POINTS]; - + mesh_bed_leveling() { reset(); } - + void reset(); static float get_x(int i) { return BED_X(i) + X_PROBE_OFFSET_FROM_EXTRUDER; } diff --git a/Firmware/mmu2/check-pce.sh b/Firmware/mmu2/check-pce.sh index 33a97b7ee9..197bc6dcc5 100755 --- a/Firmware/mmu2/check-pce.sh +++ b/Firmware/mmu2/check-pce.sh @@ -1,6 +1,6 @@ #!/bin/bash -# download Prusa Error Codes for MMU +# download Prusa Error Codes for MMU #wget https://raw.githubusercontent.com/3d-gussner/Prusa-Error-Codes/master/04_MMU/error-codes.yaml --output-document=error-codes.yaml wget https://raw.githubusercontent.com/prusa3d/Prusa-Error-Codes/master/04_MMU/error-codes.yaml --output-document=error-codes.yaml diff --git a/Firmware/mmu2/errors_list.h b/Firmware/mmu2/errors_list.h index 20cc0ce600..9232d4c90f 100644 --- a/Firmware/mmu2/errors_list.h +++ b/Firmware/mmu2/errors_list.h @@ -124,10 +124,10 @@ static const constexpr uint16_t errorCodes[] PROGMEM = { ERR_ELECTRICAL_MMU_MCU_ERROR, ERR_CONNECT_MMU_NOT_RESPONDING, ERR_CONNECT_COMMUNICATION_ERROR, - ERR_SYSTEM_FILAMENT_ALREADY_LOADED, - ERR_SYSTEM_INVALID_TOOL, - ERR_SYSTEM_QUEUE_FULL, - ERR_SYSTEM_FW_UPDATE_NEEDED, + ERR_SYSTEM_FILAMENT_ALREADY_LOADED, + ERR_SYSTEM_INVALID_TOOL, + ERR_SYSTEM_QUEUE_FULL, + ERR_SYSTEM_FW_UPDATE_NEEDED, ERR_SYSTEM_FW_RUNTIME_ERROR, ERR_SYSTEM_UNLOAD_MANUALLY, ERR_SYSTEM_FILAMENT_EJECTED, diff --git a/Firmware/mmu2_error_converter.cpp b/Firmware/mmu2_error_converter.cpp index 52fa17fc55..b5fe89ac87 100644 --- a/Firmware/mmu2_error_converter.cpp +++ b/Firmware/mmu2_error_converter.cpp @@ -67,17 +67,17 @@ uint8_t PrusaErrorCodeIndex(ErrorCode ec) { case ErrorCode::STALLED_PULLEY: case ErrorCode::MOVE_PULLEY_FAILED: return FindErrorIndex(ERR_MECHANICAL_PULLEY_CANNOT_MOVE); - + case ErrorCode::HOMING_SELECTOR_FAILED: return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_HOME); case ErrorCode::MOVE_SELECTOR_FAILED: return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_MOVE); - + case ErrorCode::HOMING_IDLER_FAILED: return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_HOME); case ErrorCode::MOVE_IDLER_FAILED: return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_MOVE); - + case ErrorCode::MMU_NOT_RESPONDING: return FindErrorIndex(ERR_CONNECT_MMU_NOT_RESPONDING); case ErrorCode::PROTOCOL_ERROR: @@ -98,7 +98,7 @@ uint8_t PrusaErrorCodeIndex(ErrorCode ec) { return FindErrorIndex(ERR_ELECTRICAL_MMU_MCU_ERROR); default: break; } - + // Electrical issues which can be detected somehow. // Need to be placed before TMC-related errors in order to process couples of error bits between single ones // and to keep the code size down. @@ -199,7 +199,7 @@ Buttons ButtonPressed(ErrorCode ec) { Buttons ButtonAvailable(ErrorCode ec) { uint8_t ei = PrusaErrorCodeIndex(ec); - + // The list of responses which occur in mmu error dialogs // Return button index or perform some action on the MK3 by itself (like Reset MMU) // Based on Prusa-Error-Codes errors_list.h @@ -266,23 +266,23 @@ Buttons ButtonAvailable(ErrorCode ec) { break; } break; - + case ERR_TEMPERATURE_TMC_PULLEY_OVERHEAT_ERROR: case ERR_TEMPERATURE_TMC_SELECTOR_OVERHEAT_ERROR: case ERR_TEMPERATURE_TMC_IDLER_OVERHEAT_ERROR: - + case ERR_ELECTRICAL_TMC_PULLEY_DRIVER_ERROR: case ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_ERROR: case ERR_ELECTRICAL_TMC_IDLER_DRIVER_ERROR: - + case ERR_ELECTRICAL_TMC_PULLEY_DRIVER_RESET: case ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_RESET: case ERR_ELECTRICAL_TMC_IDLER_DRIVER_RESET: - + case ERR_ELECTRICAL_TMC_PULLEY_UNDERVOLTAGE_ERROR: case ERR_ELECTRICAL_TMC_SELECTOR_UNDERVOLTAGE_ERROR: case ERR_ELECTRICAL_TMC_IDLER_UNDERVOLTAGE_ERROR: - + case ERR_ELECTRICAL_TMC_PULLEY_DRIVER_SHORTED: case ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_SHORTED: case ERR_ELECTRICAL_TMC_IDLER_DRIVER_SHORTED: @@ -323,7 +323,7 @@ Buttons ButtonAvailable(ErrorCode ec) { break; } break; - + case ERR_SYSTEM_INVALID_TOOL: switch (buttonSelectedOperation) { case ButtonOperations::StopPrint: // "Stop print" @@ -338,7 +338,7 @@ Buttons ButtonAvailable(ErrorCode ec) { default: break; } - + return Buttons::NoButton; } diff --git a/Firmware/mmu2_reporting.cpp b/Firmware/mmu2_reporting.cpp index 428136b3ad..31960ad0fb 100644 --- a/Firmware/mmu2_reporting.cpp +++ b/Firmware/mmu2_reporting.cpp @@ -157,7 +157,7 @@ static uint8_t ReportErrorHookMonitor(uint8_t ei) { //! | | //! |>(left) | //! ---------------------- - //! Three choices + //! Three choices //! |>(left)>(mid)>(righ)| //! ---------------------- //! Two choices @@ -236,7 +236,7 @@ bool TuneMenuEntered() { void ReportErrorHook(CommandInProgress /*cip*/, ErrorCode ec, uint8_t /*es*/) { if (putErrorScreenToSleep) return; - + if (mmu2.MMUCurrentErrorCode() == ErrorCode::OK && mmu2.MMULastErrorSource() == MMU2::ErrorSourceMMU) { // If the error code suddenly changes to OK, that means // a button was pushed on the MMU and the LCD should @@ -472,7 +472,7 @@ void tuneIdlerStallguardThreshold() { // To save the print, make the Tune button unresponsive for now. return; } - + putErrorScreenToSleep = true; menu_submenu(tuneIdlerStallguardThresholdMenu); } diff --git a/Firmware/motion_control.cpp b/Firmware/motion_control.cpp index 16ed62da21..0e163a379b 100644 --- a/Firmware/motion_control.cpp +++ b/Firmware/motion_control.cpp @@ -24,13 +24,13 @@ #include "stepper.h" #include "planner.h" -// The arc is approximated by generating a huge number of tiny, linear segments. The length of each -// segment is configured in settings.mm_per_arc_segment. +// The arc is approximated by generating a huge number of tiny, linear segments. The length of each +// segment is configured in settings.mm_per_arc_segment. void mc_arc(const float* position, float* target, const float* offset, float feed_rate, float radius, bool isclockwise, uint16_t start_segment_idx) { float start_position[4]; memcpy(start_position, position, sizeof(start_position)); - + float r_axis_x = -offset[X_AXIS]; // Radius vector from center to current location float r_axis_y = -offset[Y_AXIS]; float center_axis_x = start_position[X_AXIS] - r_axis_x; @@ -89,7 +89,7 @@ void mc_arc(const float* position, float* target, const float* offset, float fee // calculating here const float millimeters_of_travel_arc = hypot(angular_travel_total * radius, fabs(travel_z)); if (millimeters_of_travel_arc < 0.001) { return; } - + // Calculate the number of arc segments unsigned short segments = static_cast(ceil(millimeters_of_travel_arc / mm_per_arc_segment)); diff --git a/Firmware/motion_control.h b/Firmware/motion_control.h index f81f37d048..097104ecf1 100644 --- a/Firmware/motion_control.h +++ b/Firmware/motion_control.h @@ -4,7 +4,7 @@ Copyright (c) 2009-2011 Simen Svale Skogsrud Copyright (c) 2011 Sungeun K. Jeon - + Grbl is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -22,7 +22,7 @@ #ifndef motion_control_h #define motion_control_h -// Execute an arc in offset mode format. position == current xyz, target == target xyz, +// Execute an arc in offset mode format. position == current xyz, target == target xyz, // offset == offset from current xyz, axis_XXX defines circle plane in tool space, axis_linear is // the direction of helical travel, radius == circle radius, isclockwise boolean. Used // for vector transformation direction. diff --git a/Firmware/optiboot_xflash.cpp b/Firmware/optiboot_xflash.cpp index 2b846cdda7..e6bd1a4300 100644 --- a/Firmware/optiboot_xflash.cpp +++ b/Firmware/optiboot_xflash.cpp @@ -13,7 +13,7 @@ #define OPTIBOOT_MAJVER 6 #define OPTIBOOT_CUSTOMVER 0 #define OPTIBOOT_MINVER 2 -static unsigned const int __attribute__((section(".version"))) +static unsigned const int __attribute__((section(".version"))) optiboot_version = 256*(OPTIBOOT_MAJVER + OPTIBOOT_CUSTOMVER) + OPTIBOOT_MINVER; #if 0 diff --git a/Firmware/pat9125.cpp b/Firmware/pat9125.cpp index e159076280..b1f4013458 100644 --- a/Firmware/pat9125.cpp +++ b/Firmware/pat9125.cpp @@ -54,7 +54,7 @@ const PROGMEM uint8_t pat9125_init_bank0[] = { PAT9125_RES_Y, PAT9125_YRES, // Set data format and sensor orientation. PAT9125_ORIENTATION, ((PAT9125_12B_RES?0x04:0) | (PAT9125_INVERT_X?0x08:0) | (PAT9125_INVERT_Y?0x10:0) | (PAT9125_SWAP_XY?0x20:0)), - + // Now continues the magic sequence from the PAT912EL Application Note: Firmware Guides for Tracking Optimization. 0x5e, 0x08, 0x20, 0x64, @@ -136,22 +136,22 @@ uint8_t pat9125_init(void) pat9125_wr_reg(PAT9125_CONFIG, 0x97); // Wait until the sensor reboots. _delay_ms(1); - + //Write init sequence in bank0. MUST ALREADY BE IN bank0. if (!pat9125_wr_seq(pat9125_init_bank0)) return 0; - + _delay_ms(10); // not sure why this is here. But I'll allow it. - + // Switch to bank1, not allowed to perform pat9125_wr_reg_verify on this register. pat9125_wr_reg(PAT9125_BANK_SELECTION, 0x01); //Write init sequence in bank1. MUST ALREADY BE IN bank1. if (!pat9125_wr_seq(pat9125_init_bank1)) return 0; - + // Switch to bank0, not allowed to perform pat9125_wr_reg_verify on this register. pat9125_wr_reg(PAT9125_BANK_SELECTION, 0x00); - + // Enable write protect. pat9125_wr_reg(PAT9125_WP, 0x00); //prevents writing to registers over 0x09 @@ -161,14 +161,14 @@ uint8_t pat9125_init(void) #else //PAT9125_NEW_INIT // Disable write protect. pat9125_wr_reg(PAT9125_WP, 0x5a); //allows writing to all registers - + pat9125_wr_reg(PAT9125_RES_X, PAT9125_XRES); pat9125_wr_reg(PAT9125_RES_Y, PAT9125_YRES); printf_P(PSTR("PAT9125_RES_X=%u\n"), pat9125_rd_reg(PAT9125_RES_X)); printf_P(PSTR("PAT9125_RES_Y=%u\n"), pat9125_rd_reg(PAT9125_RES_Y)); - + pat9125_wr_reg(PAT9125_ORIENTATION, ((PAT9125_12B_RES?0x04:0) | (PAT9125_INVERT_X?0x08:0) | (PAT9125_INVERT_Y?0x10:0) | (PAT9125_SWAP_XY?0x20:0))); - + // Enable write protect. pat9125_wr_reg(PAT9125_WP, 0x00); //prevents writing to registers over 0x09 #endif //PAT9125_NEW_INIT diff --git a/Firmware/pins_Einsy_1_0.h b/Firmware/pins_Einsy_1_0.h index 12409de4e7..785767f472 100755 --- a/Firmware/pins_Einsy_1_0.h +++ b/Firmware/pins_Einsy_1_0.h @@ -119,7 +119,7 @@ #define SDCARDDETECT 15 #define TACH_0 79 // !!! changed from 81 (EINY03) -#define TACH_1 80 +#define TACH_1 80 #define IR_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8) diff --git a/Firmware/pins_Rambo_1_0.h b/Firmware/pins_Rambo_1_0.h index 17629af6bc..2fb967e455 100644 --- a/Firmware/pins_Rambo_1_0.h +++ b/Firmware/pins_Rambo_1_0.h @@ -101,7 +101,7 @@ #define SDCARDDETECT 72 -#define IR_SENSOR_PIN 20 //idler sensor +#define IR_SENSOR_PIN 20 //idler sensor // Support for an 8 bit logic analyzer, for example the Saleae. // Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop. diff --git a/Firmware/planner.cpp b/Firmware/planner.cpp index 00f2cf8ce2..dc4f7e2028 100644 --- a/Firmware/planner.cpp +++ b/Firmware/planner.cpp @@ -1,53 +1,53 @@ /* planner.c - buffers movement commands and manages the acceleration profile plan Part of Grbl - + Copyright (c) 2009-2011 Simen Svale Skogsrud - + Grbl is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + Grbl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Grbl. If not, see . */ /* The ring buffer implementation gleaned from the wiring_serial library by David A. Mellis. */ -/* +/* Reasoning behind the mathematics in this module (in the key of 'Mathematica'): - + s == speed, a == acceleration, t == time, d == distance - + Basic definitions: - - Speed[s_, a_, t_] := s + (a*t) + + Speed[s_, a_, t_] := s + (a*t) Travel[s_, a_, t_] := Integrate[Speed[s, a, t], t] - + Distance to reach a specific speed with a constant acceleration: - + Solve[{Speed[s, a, t] == m, Travel[s, a, t] == d}, d, t] d -> (m^2 - s^2)/(2 a) --> estimate_acceleration_distance() - + Speed after a given distance of travel with constant acceleration: - + Solve[{Speed[s, a, t] == m, Travel[s, a, t] == d}, m, t] - m -> Sqrt[2 a d + s^2] - + m -> Sqrt[2 a d + s^2] + DestinationSpeed[s_, a_, d_] := Sqrt[2 a d + s^2] - + When to start braking (di) to reach a specified destionation speed (s2) after accelerating from initial speed s1 without ever stopping at a plateau: - + Solve[{DestinationSpeed[s1, a, di] == DestinationSpeed[s2, a, d - di]}, di] di -> (2 a d - s1^2 + s2^2)/(4 a) --> intersection_distance() - + IntersectionDistance[s1_, s2_, a_, d_] := (2 a d - s1^2 + s2^2)/(4 a) */ @@ -114,7 +114,7 @@ volatile uint8_t block_buffer_head; // Index of the next block to be pus volatile uint8_t block_buffer_tail; // Index of the block to process now #ifdef PLANNER_DIAGNOSTICS -// Diagnostic function: Minimum number of planned moves since the last +// Diagnostic function: Minimum number of planned moves since the last static uint8_t g_cntr_planner_queue_min = 0; #endif /* PLANNER_DIAGNOSTICS */ @@ -155,7 +155,7 @@ static inline uint8_t prev_block_index(uint8_t block_index) { //=============================functions ============================ //=========================================================================== -// Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the +// Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the // given acceleration: FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration) { @@ -168,12 +168,12 @@ FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float targ } } -// This function gives you the point at which you must start braking (at the rate of -acceleration) if +// This function gives you the point at which you must start braking (at the rate of -acceleration) if // you started at speed initial_rate and accelerated until this point and want to end at the final_rate after // a total travel of distance. This can be used to compute the intersection point between acceleration and // deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed) -FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) +FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) { if (acceleration!=0) { return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/ @@ -188,7 +188,7 @@ FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, f #define MINIMAL_STEP_RATE 120 // Calculates trapezoid parameters so that the entry- and exit-speed is compensated by the provided factors. -void calculate_trapezoid_for_block(block_t *block, float entry_speed, float exit_speed) +void calculate_trapezoid_for_block(block_t *block, float entry_speed, float exit_speed) { // These two lines are the only floating point calculations performed in this routine. // initial_rate, final_rate in Hz. @@ -248,7 +248,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_speed, float exit // Avoid negative numbers if (final_rate_sqr >= initial_rate_sqr) { // accelerate_steps = ceil(intersection_distance(initial_rate, final_rate, acceleration, block->step_event_count)); - // intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) + // intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) // (2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/(4.0*acceleration); #if 0 accelerate_steps = (block->step_event_count >> 1) + (final_rate_sqr - initial_rate_sqr + acceleration_x4 - 1 + (block->step_event_count & 1) * acceleration_x2) / acceleration_x4; @@ -308,9 +308,9 @@ void calculate_trapezoid_for_block(block_t *block, float entry_speed, float exit CRITICAL_SECTION_END; } -// Calculates the maximum allowable entry speed, when you must be able to reach target_velocity using the +// Calculates the maximum allowable entry speed, when you must be able to reach target_velocity using the // decceleration within the allotted distance. -FORCE_INLINE float max_allowable_entry_speed(float decceleration, float target_velocity, float distance) +FORCE_INLINE float max_allowable_entry_speed(float decceleration, float target_velocity, float distance) { // assert(decceleration < 0); return sqrt(target_velocity*target_velocity-2*decceleration*distance); @@ -318,17 +318,17 @@ FORCE_INLINE float max_allowable_entry_speed(float decceleration, float target_v // Recalculates the motion plan according to the following algorithm: // -// 1. Go over every block in reverse order and calculate a junction speed reduction (i.e. block_t.entry_factor) +// 1. Go over every block in reverse order and calculate a junction speed reduction (i.e. block_t.entry_factor) // so that: // a. The junction jerk is within the set limit -// b. No speed reduction within one block requires faster deceleration than the one, true constant +// b. No speed reduction within one block requires faster deceleration than the one, true constant // acceleration. -// 2. Go over every block in chronological order and dial down junction speed reduction values if -// a. The speed increase within one block would require faster accelleration than the one, true +// 2. Go over every block in chronological order and dial down junction speed reduction values if +// a. The speed increase within one block would require faster accelleration than the one, true // constant acceleration. // -// When these stages are complete all blocks have an entry_factor that will allow all speed changes to -// be performed using only the one, true constant acceleration, and where no junction jerk is jerkier than +// When these stages are complete all blocks have an entry_factor that will allow all speed changes to +// be performed using only the one, true constant acceleration, and where no junction jerk is jerkier than // the set limit. Finally it will: // // 3. Recalculate trapezoids for all blocks. @@ -340,20 +340,20 @@ FORCE_INLINE float max_allowable_entry_speed(float decceleration, float target_v // Following sources may be used to optimize the 8-bit AVR code: // http://www.mikrocontroller.net/articles/AVR_Arithmetik // http://darcy.rsgc.on.ca/ACES/ICE4M/FixedPoint/avrfix.pdf -// +// // https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/avr/lib1funcs-fixed.S // https://gcc.gnu.org/onlinedocs/gcc/Fixed-Point.html // https://gcc.gnu.org/onlinedocs/gccint/Fixed-point-fractional-library-routines.html -// +// // https://ucexperiment.wordpress.com/2015/04/04/arduino-s15-16-fixed-point-math-routines/ // https://mekonik.wordpress.com/2009/03/18/arduino-avr-gcc-multiplication/ // https://github.com/rekka/avrmultiplication -// +// // https://people.ece.cornell.edu/land/courses/ece4760/Math/Floating_point/ // https://courses.cit.cornell.edu/ee476/Math/ // https://courses.cit.cornell.edu/ee476/Math/GCC644/fixedPt/multASM.S // -void planner_recalculate(const float &safe_final_speed) +void planner_recalculate(const float &safe_final_speed) { // Reverse pass // Make a local copy of block_buffer_tail, because the interrupt can alter it @@ -531,7 +531,7 @@ bool e_active() void check_axes_activity() { uint8_t x_active = 0; - uint8_t y_active = 0; + uint8_t y_active = 0; uint8_t z_active = 0; uint8_t e_active = 0; uint8_t tail_fan_speed = fanSpeed; @@ -627,7 +627,7 @@ void planner_reset_position() current_position[Z_AXIS] -= mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS]); else { float t = float(step_events_completed) / float(current_block->step_event_count); - float vec[3] = { + float vec[3] = { current_block->steps_x / cs.axis_steps_per_mm[X_AXIS], current_block->steps_y / cs.axis_steps_per_mm[Y_AXIS], current_block->steps_z / cs.axis_steps_per_mm[Z_AXIS] @@ -690,7 +690,7 @@ void plan_set_position_curposXYZE(){ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); } -// Add a new linear movement to the buffer. steps_x, _y and _z is the absolute position in +// Add a new linear movement to the buffer. steps_x, _y and _z is the absolute position in // mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration // calculation the caller must also provide the physical length of the line in millimeters. void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const float* gcode_start_position, uint16_t segment_idx) @@ -706,9 +706,9 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate // Rest here until there is room in the buffer. if (block_buffer_tail == next_buffer_head) { do { - manage_heater(); + manage_heater(); // Vojtech: Don't disable motors inside the planner! - manage_inactivity(false); + manage_inactivity(false); lcd_update(0); } while (block_buffer_tail == next_buffer_head); } @@ -736,7 +736,7 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate memcpy(block->gcode_start_position, gcode_start_position, sizeof(block_t::gcode_start_position)); else memcpy(block->gcode_start_position, current_position, sizeof(block_t::gcode_start_position)); - + // Save the index of this segment (when a single G0/1/2/3 command plans multiple segments) block->segment_idx = segment_idx; @@ -828,7 +828,7 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate int32_t dx = target[X_AXIS] - position[X_AXIS]; int32_t dy = target[Y_AXIS] - position[Y_AXIS]; int32_t dz = target[Z_AXIS] - position[Z_AXIS]; - + #ifdef PREVENT_DANGEROUS_EXTRUDE if(de) { @@ -842,7 +842,7 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate SERIAL_ECHO_START; SERIAL_ECHOLNRPGM(_n(" cold extrusion prevented"));////MSG_ERR_COLD_EXTRUDE_STOP } - + #ifdef PREVENT_LENGTHY_EXTRUDE if(labs(de) > cs.axis_steps_per_mm[E_AXIS]*EXTRUDE_MAXLENGTH) { @@ -875,11 +875,11 @@ block->steps[Y_AXIS].wide = labs(dx - dy); // Bail if this is a zero-length block if (block->step_event_count.wide <= dropsegments) - { + { #ifdef PLANNER_DIAGNOSTICS planner_update_queue_min_counter(); #endif /* PLANNER_DIAGNOSTICS */ - return; + return; } block->fan_speed = fanSpeed; @@ -917,15 +917,15 @@ block->steps[Y_AXIS].wide = labs(dx - dy); else { if(feed_ratesteps[X_AXIS].wide <=dropsegments && block->steps[Y_AXIS].wide <=dropsegments && block->steps[Z_AXIS].wide <=dropsegments ) { block->millimeters = fabs(delta_mm[E_AXIS]); - } + } else { #ifndef COREXY block->millimeters = sqrt(square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])); #else block->millimeters = sqrt(square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS])); - #endif + #endif } - float inverse_millimeters = 1.0/block->millimeters; // Inverse millimeters to remove multiple divides + float inverse_millimeters = 1.0/block->millimeters; // Inverse millimeters to remove multiple divides // Calculate speed in mm/second for each axis. No divide by zero due to previous checks. float inverse_second = feed_rate * inverse_millimeters; @@ -986,7 +986,7 @@ Having the real displacement of the head, we can calculate the total movement le } } - // Correct the speed + // Correct the speed if( speed_factor < 1.0) { for(unsigned char i=0; i < 4; i++) @@ -1000,7 +1000,7 @@ Having the real displacement of the head, we can calculate the total movement le #ifdef LIN_ADVANCE float e_D_ratio = 0; #endif - // Compute and limit the acceleration rate for the trapezoid generator. + // Compute and limit the acceleration rate for the trapezoid generator. // block->step_event_count ... event count of the fastest axis // block->millimeters ... Euclidian length of the XYZ movement or the E length, if no XYZ movement. float steps_per_mm = block->step_event_count.wide/block->millimeters; @@ -1142,11 +1142,11 @@ Having the real displacement of the head, we can calculate the total movement le v_entry *= v_factor; } // Calculate the jerk depending on whether the axis is coasting in the same direction or reversing a direction. - float jerk = + float jerk = (v_exit > v_entry) ? ((v_entry > 0.f || v_exit < 0.f) ? // coasting - (v_exit - v_entry) : + (v_exit - v_entry) : // axis reversal max(v_exit, - v_entry)) : // v_exit <= v_entry @@ -1269,7 +1269,7 @@ Having the real displacement of the head, we can calculate the total movement le position_float[Z_AXIS] = z; position_float[E_AXIS] = e; #endif - + // Recalculate the trapezoids to maximize speed at the segment transitions while respecting // the machine limits (maximum acceleration and maximum jerk). // This runs asynchronously with the stepper interrupt controller, which may @@ -1317,7 +1317,7 @@ void plan_set_position(float x, float y, float z, const float &e) position[X_AXIS] = lround(x*cs.axis_steps_per_mm[X_AXIS]); position[Y_AXIS] = lround(y*cs.axis_steps_per_mm[Y_AXIS]); #ifdef MESH_BED_LEVELING - position[Z_AXIS] = mbl.active ? + position[Z_AXIS] = mbl.active ? lround((z+mbl.get_z(x, y))*cs.axis_steps_per_mm[Z_AXIS]) : lround(z*cs.axis_steps_per_mm[Z_AXIS]); #else @@ -1350,7 +1350,7 @@ void plan_set_e_position(const float &e) #ifdef LIN_ADVANCE position_float[E_AXIS] = e; #endif - position[E_AXIS] = lround(e*cs.axis_steps_per_mm[E_AXIS]); + position[E_AXIS] = lround(e*cs.axis_steps_per_mm[E_AXIS]); st_set_e_position(position[E_AXIS]); } @@ -1422,7 +1422,7 @@ uint16_t planner_calc_sd_length() while (_block_buffer_head != _block_buffer_tail) { sdlen += block_buffer[_block_buffer_tail].sdlen; - _block_buffer_tail = (_block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1); + _block_buffer_tail = (_block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1); } return sdlen; } diff --git a/Firmware/planner.h b/Firmware/planner.h index 7c578a200f..4e6342671b 100644 --- a/Firmware/planner.h +++ b/Firmware/planner.h @@ -18,7 +18,7 @@ along with Grbl. If not, see . */ -// This module is to be considered a sub-module of stepper.c. Please don't include +// This module is to be considered a sub-module of stepper.c. Please don't include // this file from any other module. #ifndef planner_h @@ -66,7 +66,7 @@ union dda_usteps_t }; }; -// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in +// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in // the source g-code and may never actually be reached if acceleration management is active. typedef struct { // Fields used by the bresenham algorithm for tracing the line @@ -99,8 +99,8 @@ typedef struct { // Settings for the trapezoid generator (runs inside an interrupt handler). // Changing the following values in the planner needs to be synchronized with the interrupt handler by disabling the interrupts. - uint32_t nominal_rate; // The nominal step rate for this block in step_events/sec - uint32_t initial_rate; // The jerk-adjusted step rate at start of block + uint32_t nominal_rate; // The nominal step rate for this block in step_events/sec + uint32_t initial_rate; // The jerk-adjusted step rate at start of block uint32_t final_rate; // The minimal rate at exit uint32_t acceleration_steps_per_s2; // acceleration steps/sec^2 uint8_t fan_speed; // Print fan speed, ranges from 0 to 255 @@ -135,10 +135,10 @@ extern float extruder_advance_K; // Linear-advance K factor extern matrix_3x3 plan_bed_level_matrix; #endif // #ifdef ENABLE_AUTO_BED_LEVELING -// Initialize the motion plan subsystem +// Initialize the motion plan subsystem void plan_init(); -// Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in +// Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in // millimaters. Feed rate specifies the speed of the motion. #ifdef ENABLE_AUTO_BED_LEVELING @@ -148,7 +148,7 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate vector_3 plan_get_position(); #else -/// Extracting common call of +/// Extracting common call of /// plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], ... /// saves almost 5KB. /// The performance penalty is negligible, since these planned lines are usually maintenance moves with the extruder. @@ -187,7 +187,7 @@ extern float* max_feedrate; // Use M201 to override by software -extern uint32_t* max_acceleration_mm_per_s2; +extern uint32_t* max_acceleration_mm_per_s2; extern uint32_t max_acceleration_steps_per_s2[NUM_AXIS]; extern long position[NUM_AXIS]; @@ -211,15 +211,15 @@ extern block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for // Index of the next block to be pushed into the planner queue. extern volatile uint8_t block_buffer_head; // Index of the first block in the planner queue. -// This is the block, which is being currently processed by the stepper routine, +// This is the block, which is being currently processed by the stepper routine, // or which is first to be processed by the stepper routine. extern volatile uint8_t block_buffer_tail; // Called when the current block is no longer needed. Discards the block and makes the memory -// available for new blocks. -FORCE_INLINE void plan_discard_current_block() +// available for new blocks. +FORCE_INLINE void plan_discard_current_block() { if (block_buffer_head != block_buffer_tail) { - block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1); + block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1); } } @@ -227,10 +227,10 @@ FORCE_INLINE void plan_discard_current_block() // Mark this block as busy, so its velocities and acceperations will be no more recalculated // by the planner routine. // Returns NULL if buffer empty -FORCE_INLINE block_t *plan_get_current_block() +FORCE_INLINE block_t *plan_get_current_block() { - if (block_buffer_head == block_buffer_tail) { - return(NULL); + if (block_buffer_head == block_buffer_tail) { + return(NULL); } block_t *block = &block_buffer[block_buffer_tail]; block->busy = true; @@ -238,8 +238,8 @@ FORCE_INLINE block_t *plan_get_current_block() } // Returns true if the buffer has a queued block, false otherwise -FORCE_INLINE bool blocks_queued() { - return (block_buffer_head != block_buffer_tail); +FORCE_INLINE bool blocks_queued() { + return (block_buffer_head != block_buffer_tail); } //return the nr of buffered moves @@ -250,7 +250,7 @@ FORCE_INLINE uint8_t moves_planned() { FORCE_INLINE bool planner_queue_full() { uint8_t next_block_index = block_buffer_head; if (++ next_block_index == BLOCK_BUFFER_SIZE) - next_block_index = 0; + next_block_index = 0; return block_buffer_tail == next_block_index; } diff --git a/Firmware/power_panic.h b/Firmware/power_panic.h index c34a831e3d..a9820c72e0 100644 --- a/Firmware/power_panic.h +++ b/Firmware/power_panic.h @@ -16,5 +16,5 @@ enum PrintType : uint8_t { } // namespace PowerPanic void uvlo_(); -void recover_print(uint8_t automatic); +void recover_print(uint8_t automatic); void setup_uvlo_interrupt(); diff --git a/Firmware/qr_solve.cpp b/Firmware/qr_solve.cpp index f19d989d41..b8f2fdb388 100644 --- a/Firmware/qr_solve.cpp +++ b/Firmware/qr_solve.cpp @@ -327,7 +327,7 @@ void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy ) Licensing: - This code is distributed under the GNU LGPL license. + This code is distributed under the GNU LGPL license. Modified: @@ -345,8 +345,8 @@ void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy ) Charles Lawson, Richard Hanson, David Kincaid, Fred Krogh, Basic Linear Algebra Subprograms for Fortran Usage, - Algorithm 539, - ACM Transactions on Mathematical Software, + Algorithm 539, + ACM Transactions on Mathematical Software, Volume 5, Number 3, September 1979, pages 308-323. Parameters: @@ -448,7 +448,7 @@ double ddot ( int n, double dx[], int incx, double dy[], int incy ) Licensing: - This code is distributed under the GNU LGPL license. + This code is distributed under the GNU LGPL license. Modified: @@ -466,8 +466,8 @@ double ddot ( int n, double dx[], int incx, double dy[], int incy ) Charles Lawson, Richard Hanson, David Kincaid, Fred Krogh, Basic Linear Algebra Subprograms for Fortran Usage, - Algorithm 539, - ACM Transactions on Mathematical Software, + Algorithm 539, + ACM Transactions on Mathematical Software, Volume 5, Number 3, September 1979, pages 308-323. Parameters: @@ -543,10 +543,10 @@ double ddot ( int n, double dx[], int incx, double dy[], int incy ) for ( i = m; i < n; i = i + 5 ) { - dtemp = dtemp + dx[i ] * dy[i ] - + dx[i+1] * dy[i+1] - + dx[i+2] * dy[i+2] - + dx[i+3] * dy[i+3] + dtemp = dtemp + dx[i ] * dy[i ] + + dx[i+1] * dy[i+1] + + dx[i+2] * dy[i+2] + + dx[i+3] * dy[i+3] + dx[i+4] * dy[i+4]; } } @@ -568,7 +568,7 @@ double dnrm2 ( int n, double x[], int incx ) Licensing: - This code is distributed under the GNU LGPL license. + This code is distributed under the GNU LGPL license. Modified: @@ -648,7 +648,7 @@ double dnrm2 ( int n, double x[], int incx ) } /******************************************************************************/ -void dqrank ( double a[], int lda, int m, int n, double tol, int *kr, +void dqrank ( double a[], int lda, int m, int n, double tol, int *kr, int jpvt[], double qraux[] ) /******************************************************************************/ @@ -673,7 +673,7 @@ void dqrank ( double a[], int lda, int m, int n, double tol, int *kr, Licensing: - This code is distributed under the GNU LGPL license. + This code is distributed under the GNU LGPL license. Modified: @@ -757,7 +757,7 @@ void dqrank ( double a[], int lda, int m, int n, double tol, int *kr, } /******************************************************************************/ -void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[], +void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[], double work[], int job ) /******************************************************************************/ @@ -775,7 +775,7 @@ void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[], Licensing: - This code is distributed under the GNU LGPL license. + This code is distributed under the GNU LGPL license. Modified: @@ -969,7 +969,7 @@ void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[], */ for ( j = l + 1; j <= p; j++ ) { - t = -ddot ( n-l+1, a+l-1+(l-1)*lda, 1, a+l-1+(j-1)*lda, 1 ) + t = -ddot ( n-l+1, a+l-1+(l-1)*lda, 1, a+l-1+(j-1)*lda, 1 ) / a[l-1+(l-1)*lda]; daxpy ( n-l+1, t, a+l-1+(l-1)*lda, 1, a+l-1+(j-1)*lda, 1 ); @@ -1006,7 +1006,7 @@ void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[], } /******************************************************************************/ -int dqrls ( double a[], int lda, int m, int n, double tol, int *kr, double b[], +int dqrls ( double a[], int lda, int m, int n, double tol, int *kr, double b[], double x[], double rsd[], int jpvt[], double qraux[], int itask ) /******************************************************************************/ @@ -1042,7 +1042,7 @@ int dqrls ( double a[], int lda, int m, int n, double tol, int *kr, double b[], Licensing: - This code is distributed under the GNU LGPL license. + This code is distributed under the GNU LGPL license. Modified: @@ -1160,7 +1160,7 @@ int dqrls ( double a[], int lda, int m, int n, double tol, int *kr, double b[], } /******************************************************************************/ -void dqrlss ( double a[], int lda, int m, int n, int kr, double b[], double x[], +void dqrlss ( double a[], int lda, int m, int n, int kr, double b[], double x[], double rsd[], int jpvt[], double qraux[] ) /******************************************************************************/ @@ -1190,7 +1190,7 @@ void dqrlss ( double a[], int lda, int m, int n, int kr, double b[], double x[], Licensing: - This code is distributed under the GNU LGPL license. + This code is distributed under the GNU LGPL license. Modified: @@ -1278,7 +1278,7 @@ void dqrlss ( double a[], int lda, int m, int n, int kr, double b[], double x[], } /******************************************************************************/ -int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[], +int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[], double qy[], double qty[], double b[], double rsd[], double ab[], int job ) /******************************************************************************/ @@ -1344,7 +1344,7 @@ int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[], Licensing: - This code is distributed under the GNU LGPL license. + This code is distributed under the GNU LGPL license. Modified: @@ -1617,14 +1617,14 @@ int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[], if ( cr ) { - t = -ddot ( n-j+1, a+j-1+(j-1)*lda, 1, rsd+j-1, 1 ) + t = -ddot ( n-j+1, a+j-1+(j-1)*lda, 1, rsd+j-1, 1 ) / a[j-1+(j-1)*lda]; daxpy ( n-j+1, t, a+j-1+(j-1)*lda, 1, rsd+j-1, 1 ); } if ( cab ) { - t = -ddot ( n-j+1, a+j-1+(j-1)*lda, 1, ab+j-1, 1 ) + t = -ddot ( n-j+1, a+j-1+(j-1)*lda, 1, ab+j-1, 1 ) / a[j-1+(j-1)*lda]; daxpy ( n-j+1, t, a+j-1+(j-1)*lda, 1, ab+j-1, 1 ); } @@ -1649,7 +1649,7 @@ void dscal ( int n, double sa, double x[], int incx ) Licensing: - This code is distributed under the GNU LGPL license. + This code is distributed under the GNU LGPL license. Modified: @@ -1739,7 +1739,7 @@ void dswap ( int n, double x[], int incx, double y[], int incy ) Licensing: - This code is distributed under the GNU LGPL license. + This code is distributed under the GNU LGPL license. Modified: @@ -1757,8 +1757,8 @@ void dswap ( int n, double x[], int incx, double y[], int incy ) Charles Lawson, Richard Hanson, David Kincaid, Fred Krogh, Basic Linear Algebra Subprograms for Fortran Usage, - Algorithm 539, - ACM Transactions on Mathematical Software, + Algorithm 539, + ACM Transactions on Mathematical Software, Volume 5, Number 3, September 1979, pages 308-323. Parameters: @@ -1920,7 +1920,7 @@ double *qr_solve ( int m, int n, double a[], double b[] ) free ( a_qr ); free ( jpvt ); - free ( qraux ); + free ( qraux ); free ( r ); return x; diff --git a/Firmware/qr_solve.h b/Firmware/qr_solve.h index b38086aad0..a16850a6c4 100644 --- a/Firmware/qr_solve.h +++ b/Firmware/qr_solve.h @@ -5,15 +5,15 @@ void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy ); double ddot ( int n, double dx[], int incx, double dy[], int incy ); double dnrm2 ( int n, double x[], int incx ); -void dqrank ( double a[], int lda, int m, int n, double tol, int *kr, +void dqrank ( double a[], int lda, int m, int n, double tol, int *kr, int jpvt[], double qraux[] ); -void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[], +void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[], double work[], int job ); -int dqrls ( double a[], int lda, int m, int n, double tol, int *kr, double b[], +int dqrls ( double a[], int lda, int m, int n, double tol, int *kr, double b[], double x[], double rsd[], int jpvt[], double qraux[], int itask ); -void dqrlss ( double a[], int lda, int m, int n, int kr, double b[], double x[], +void dqrlss ( double a[], int lda, int m, int n, int kr, double b[], double x[], double rsd[], int jpvt[], double qraux[] ); -int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[], +int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[], double qy[], double qty[], double b[], double rsd[], double ab[], int job ); void dscal ( int n, double sa, double x[], int incx ); void dswap ( int n, double x[], int incx, double y[], int incy ); diff --git a/Firmware/sm4.c b/Firmware/sm4.c index 994e016aac..04befb77c8 100644 --- a/Firmware/sm4.c +++ b/Firmware/sm4.c @@ -106,7 +106,7 @@ uint8_t sm4_get_dir_bits(void) if (portL & 2) dir_bits |= 2; if (portL & 4) dir_bits |= 4; if (portL & 64) dir_bits |= 8; - dir_bits ^= dir_mask; + dir_bits ^= dir_mask; #endif return dir_bits; } @@ -123,7 +123,7 @@ void sm4_set_dir_bits(uint8_t dir_bits) if (dir_bits & 4) portL |= 4; //set Z direction bit if (dir_bits & 8) portL |= 64; //set E direction bit #elif ((MOTHERBOARD == BOARD_EINSY_1_0a)) - dir_bits ^= dir_mask; + dir_bits ^= dir_mask; if (dir_bits & 1) portL |= 1; //set X direction bit if (dir_bits & 2) portL |= 2; //set Y direction bit if (dir_bits & 4) portL |= 4; //set Z direction bit diff --git a/Firmware/sound.h b/Firmware/sound.h index 8411611816..03b46903c7 100644 --- a/Firmware/sound.h +++ b/Firmware/sound.h @@ -22,12 +22,12 @@ typedef enum : uint8_t { e_SOUND_TYPE_BlindAlert } eSOUND_TYPE; -typedef enum : uint8_t { - e_SOUND_CLASS_Echo, - e_SOUND_CLASS_Prompt, - e_SOUND_CLASS_Confirm, - e_SOUND_CLASS_Warning, - e_SOUND_CLASS_Alert +typedef enum : uint8_t { + e_SOUND_CLASS_Echo, + e_SOUND_CLASS_Prompt, + e_SOUND_CLASS_Confirm, + e_SOUND_CLASS_Warning, + e_SOUND_CLASS_Alert } eSOUND_CLASS; extern eSOUND_MODE eSoundMode; diff --git a/Firmware/speed_lookuptable.cpp b/Firmware/speed_lookuptable.cpp index b8930e7bbb..1b063b82c8 100644 --- a/Firmware/speed_lookuptable.cpp +++ b/Firmware/speed_lookuptable.cpp @@ -3,72 +3,72 @@ #if F_CPU == 16000000 const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\ -{ 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135}, -{ 961, 105}, { 856, 85}, { 771, 69}, { 702, 58}, { 644, 49}, { 595, 42}, { 553, 37}, { 516, 32}, -{ 484, 28}, { 456, 25}, { 431, 23}, { 408, 20}, { 388, 19}, { 369, 16}, { 353, 16}, { 337, 14}, -{ 323, 13}, { 310, 11}, { 299, 11}, { 288, 11}, { 277, 9}, { 268, 9}, { 259, 8}, { 251, 8}, -{ 243, 8}, { 235, 7}, { 228, 6}, { 222, 6}, { 216, 6}, { 210, 6}, { 204, 5}, { 199, 5}, -{ 194, 5}, { 189, 4}, { 185, 4}, { 181, 4}, { 177, 4}, { 173, 4}, { 169, 4}, { 165, 3}, -{ 162, 3}, { 159, 4}, { 155, 3}, { 152, 3}, { 149, 2}, { 147, 3}, { 144, 3}, { 141, 2}, -{ 139, 3}, { 136, 2}, { 134, 2}, { 132, 3}, { 129, 2}, { 127, 2}, { 125, 2}, { 123, 2}, -{ 121, 2}, { 119, 1}, { 118, 2}, { 116, 2}, { 114, 1}, { 113, 2}, { 111, 2}, { 109, 1}, -{ 108, 2}, { 106, 1}, { 105, 2}, { 103, 1}, { 102, 1}, { 101, 1}, { 100, 2}, { 98, 1}, -{ 97, 1}, { 96, 1}, { 95, 2}, { 93, 1}, { 92, 1}, { 91, 1}, { 90, 1}, { 89, 1}, -{ 88, 1}, { 87, 1}, { 86, 1}, { 85, 1}, { 84, 1}, { 83, 0}, { 83, 1}, { 82, 1}, -{ 81, 1}, { 80, 1}, { 79, 1}, { 78, 0}, { 78, 1}, { 77, 1}, { 76, 1}, { 75, 0}, -{ 75, 1}, { 74, 1}, { 73, 1}, { 72, 0}, { 72, 1}, { 71, 1}, { 70, 0}, { 70, 1}, -{ 69, 0}, { 69, 1}, { 68, 1}, { 67, 0}, { 67, 1}, { 66, 0}, { 66, 1}, { 65, 0}, -{ 65, 1}, { 64, 1}, { 63, 0}, { 63, 1}, { 62, 0}, { 62, 1}, { 61, 0}, { 61, 1}, -{ 60, 0}, { 60, 0}, { 60, 1}, { 59, 0}, { 59, 1}, { 58, 0}, { 58, 1}, { 57, 0}, -{ 57, 1}, { 56, 0}, { 56, 0}, { 56, 1}, { 55, 0}, { 55, 1}, { 54, 0}, { 54, 0}, -{ 54, 1}, { 53, 0}, { 53, 0}, { 53, 1}, { 52, 0}, { 52, 0}, { 52, 1}, { 51, 0}, -{ 51, 0}, { 51, 1}, { 50, 0}, { 50, 0}, { 50, 1}, { 49, 0}, { 49, 0}, { 49, 1}, -{ 48, 0}, { 48, 0}, { 48, 1}, { 47, 0}, { 47, 0}, { 47, 0}, { 47, 1}, { 46, 0}, -{ 46, 0}, { 46, 1}, { 45, 0}, { 45, 0}, { 45, 0}, { 45, 1}, { 44, 0}, { 44, 0}, -{ 44, 0}, { 44, 1}, { 43, 0}, { 43, 0}, { 43, 0}, { 43, 1}, { 42, 0}, { 42, 0}, -{ 42, 0}, { 42, 1}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 1}, { 40, 0}, -{ 40, 0}, { 40, 0}, { 40, 0}, { 40, 1}, { 39, 0}, { 39, 0}, { 39, 0}, { 39, 0}, -{ 39, 1}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 1}, { 37, 0}, { 37, 0}, -{ 37, 0}, { 37, 0}, { 37, 0}, { 37, 1}, { 36, 0}, { 36, 0}, { 36, 0}, { 36, 0}, -{ 36, 1}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 1}, -{ 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 1}, { 33, 0}, { 33, 0}, -{ 33, 0}, { 33, 0}, { 33, 0}, { 33, 0}, { 33, 1}, { 32, 0}, { 32, 0}, { 32, 0}, -{ 32, 0}, { 32, 0}, { 32, 0}, { 32, 0}, { 32, 1}, { 31, 0}, { 31, 0}, { 31, 0}, +{ 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135}, +{ 961, 105}, { 856, 85}, { 771, 69}, { 702, 58}, { 644, 49}, { 595, 42}, { 553, 37}, { 516, 32}, +{ 484, 28}, { 456, 25}, { 431, 23}, { 408, 20}, { 388, 19}, { 369, 16}, { 353, 16}, { 337, 14}, +{ 323, 13}, { 310, 11}, { 299, 11}, { 288, 11}, { 277, 9}, { 268, 9}, { 259, 8}, { 251, 8}, +{ 243, 8}, { 235, 7}, { 228, 6}, { 222, 6}, { 216, 6}, { 210, 6}, { 204, 5}, { 199, 5}, +{ 194, 5}, { 189, 4}, { 185, 4}, { 181, 4}, { 177, 4}, { 173, 4}, { 169, 4}, { 165, 3}, +{ 162, 3}, { 159, 4}, { 155, 3}, { 152, 3}, { 149, 2}, { 147, 3}, { 144, 3}, { 141, 2}, +{ 139, 3}, { 136, 2}, { 134, 2}, { 132, 3}, { 129, 2}, { 127, 2}, { 125, 2}, { 123, 2}, +{ 121, 2}, { 119, 1}, { 118, 2}, { 116, 2}, { 114, 1}, { 113, 2}, { 111, 2}, { 109, 1}, +{ 108, 2}, { 106, 1}, { 105, 2}, { 103, 1}, { 102, 1}, { 101, 1}, { 100, 2}, { 98, 1}, +{ 97, 1}, { 96, 1}, { 95, 2}, { 93, 1}, { 92, 1}, { 91, 1}, { 90, 1}, { 89, 1}, +{ 88, 1}, { 87, 1}, { 86, 1}, { 85, 1}, { 84, 1}, { 83, 0}, { 83, 1}, { 82, 1}, +{ 81, 1}, { 80, 1}, { 79, 1}, { 78, 0}, { 78, 1}, { 77, 1}, { 76, 1}, { 75, 0}, +{ 75, 1}, { 74, 1}, { 73, 1}, { 72, 0}, { 72, 1}, { 71, 1}, { 70, 0}, { 70, 1}, +{ 69, 0}, { 69, 1}, { 68, 1}, { 67, 0}, { 67, 1}, { 66, 0}, { 66, 1}, { 65, 0}, +{ 65, 1}, { 64, 1}, { 63, 0}, { 63, 1}, { 62, 0}, { 62, 1}, { 61, 0}, { 61, 1}, +{ 60, 0}, { 60, 0}, { 60, 1}, { 59, 0}, { 59, 1}, { 58, 0}, { 58, 1}, { 57, 0}, +{ 57, 1}, { 56, 0}, { 56, 0}, { 56, 1}, { 55, 0}, { 55, 1}, { 54, 0}, { 54, 0}, +{ 54, 1}, { 53, 0}, { 53, 0}, { 53, 1}, { 52, 0}, { 52, 0}, { 52, 1}, { 51, 0}, +{ 51, 0}, { 51, 1}, { 50, 0}, { 50, 0}, { 50, 1}, { 49, 0}, { 49, 0}, { 49, 1}, +{ 48, 0}, { 48, 0}, { 48, 1}, { 47, 0}, { 47, 0}, { 47, 0}, { 47, 1}, { 46, 0}, +{ 46, 0}, { 46, 1}, { 45, 0}, { 45, 0}, { 45, 0}, { 45, 1}, { 44, 0}, { 44, 0}, +{ 44, 0}, { 44, 1}, { 43, 0}, { 43, 0}, { 43, 0}, { 43, 1}, { 42, 0}, { 42, 0}, +{ 42, 0}, { 42, 1}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 1}, { 40, 0}, +{ 40, 0}, { 40, 0}, { 40, 0}, { 40, 1}, { 39, 0}, { 39, 0}, { 39, 0}, { 39, 0}, +{ 39, 1}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 1}, { 37, 0}, { 37, 0}, +{ 37, 0}, { 37, 0}, { 37, 0}, { 37, 1}, { 36, 0}, { 36, 0}, { 36, 0}, { 36, 0}, +{ 36, 1}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 1}, +{ 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 1}, { 33, 0}, { 33, 0}, +{ 33, 0}, { 33, 0}, { 33, 0}, { 33, 0}, { 33, 1}, { 32, 0}, { 32, 0}, { 32, 0}, +{ 32, 0}, { 32, 0}, { 32, 0}, { 32, 0}, { 32, 1}, { 31, 0}, { 31, 0}, { 31, 0}, { 31, 0}, { 31, 0}, { 31, 0}, { 31, 1}, { 30, 0}, { 30, 0}, { 30, 0}, { 30, 0} }; const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {\ -{ 62500, 12500}, { 50000, 8334}, { 41666, 5952}, { 35714, 4464}, { 31250, 3473}, { 27777, 2777}, { 25000, 2273}, { 22727, 1894}, -{ 20833, 1603}, { 19230, 1373}, { 17857, 1191}, { 16666, 1041}, { 15625, 920}, { 14705, 817}, { 13888, 731}, { 13157, 657}, -{ 12500, 596}, { 11904, 541}, { 11363, 494}, { 10869, 453}, { 10416, 416}, { 10000, 385}, { 9615, 356}, { 9259, 331}, -{ 8928, 308}, { 8620, 287}, { 8333, 269}, { 8064, 252}, { 7812, 237}, { 7575, 223}, { 7352, 210}, { 7142, 198}, -{ 6944, 188}, { 6756, 178}, { 6578, 168}, { 6410, 160}, { 6250, 153}, { 6097, 145}, { 5952, 139}, { 5813, 132}, -{ 5681, 126}, { 5555, 121}, { 5434, 115}, { 5319, 111}, { 5208, 106}, { 5102, 102}, { 5000, 99}, { 4901, 94}, -{ 4807, 91}, { 4716, 87}, { 4629, 84}, { 4545, 81}, { 4464, 79}, { 4385, 75}, { 4310, 73}, { 4237, 71}, -{ 4166, 68}, { 4098, 66}, { 4032, 64}, { 3968, 62}, { 3906, 60}, { 3846, 59}, { 3787, 56}, { 3731, 55}, -{ 3676, 53}, { 3623, 52}, { 3571, 50}, { 3521, 49}, { 3472, 48}, { 3424, 46}, { 3378, 45}, { 3333, 44}, -{ 3289, 43}, { 3246, 41}, { 3205, 41}, { 3164, 39}, { 3125, 39}, { 3086, 38}, { 3048, 36}, { 3012, 36}, -{ 2976, 35}, { 2941, 35}, { 2906, 33}, { 2873, 33}, { 2840, 32}, { 2808, 31}, { 2777, 30}, { 2747, 30}, -{ 2717, 29}, { 2688, 29}, { 2659, 28}, { 2631, 27}, { 2604, 27}, { 2577, 26}, { 2551, 26}, { 2525, 25}, -{ 2500, 25}, { 2475, 25}, { 2450, 23}, { 2427, 24}, { 2403, 23}, { 2380, 22}, { 2358, 22}, { 2336, 22}, -{ 2314, 21}, { 2293, 21}, { 2272, 20}, { 2252, 20}, { 2232, 20}, { 2212, 20}, { 2192, 19}, { 2173, 18}, -{ 2155, 19}, { 2136, 18}, { 2118, 18}, { 2100, 17}, { 2083, 17}, { 2066, 17}, { 2049, 17}, { 2032, 16}, -{ 2016, 16}, { 2000, 16}, { 1984, 16}, { 1968, 15}, { 1953, 16}, { 1937, 14}, { 1923, 15}, { 1908, 15}, -{ 1893, 14}, { 1879, 14}, { 1865, 14}, { 1851, 13}, { 1838, 14}, { 1824, 13}, { 1811, 13}, { 1798, 13}, -{ 1785, 12}, { 1773, 13}, { 1760, 12}, { 1748, 12}, { 1736, 12}, { 1724, 12}, { 1712, 12}, { 1700, 11}, -{ 1689, 12}, { 1677, 11}, { 1666, 11}, { 1655, 11}, { 1644, 11}, { 1633, 10}, { 1623, 11}, { 1612, 10}, -{ 1602, 10}, { 1592, 10}, { 1582, 10}, { 1572, 10}, { 1562, 10}, { 1552, 9}, { 1543, 10}, { 1533, 9}, -{ 1524, 9}, { 1515, 9}, { 1506, 9}, { 1497, 9}, { 1488, 9}, { 1479, 9}, { 1470, 9}, { 1461, 8}, -{ 1453, 8}, { 1445, 9}, { 1436, 8}, { 1428, 8}, { 1420, 8}, { 1412, 8}, { 1404, 8}, { 1396, 8}, -{ 1388, 7}, { 1381, 8}, { 1373, 7}, { 1366, 8}, { 1358, 7}, { 1351, 7}, { 1344, 8}, { 1336, 7}, -{ 1329, 7}, { 1322, 7}, { 1315, 7}, { 1308, 6}, { 1302, 7}, { 1295, 7}, { 1288, 6}, { 1282, 7}, -{ 1275, 6}, { 1269, 7}, { 1262, 6}, { 1256, 6}, { 1250, 7}, { 1243, 6}, { 1237, 6}, { 1231, 6}, -{ 1225, 6}, { 1219, 6}, { 1213, 6}, { 1207, 6}, { 1201, 5}, { 1196, 6}, { 1190, 6}, { 1184, 5}, -{ 1179, 6}, { 1173, 5}, { 1168, 6}, { 1162, 5}, { 1157, 5}, { 1152, 6}, { 1146, 5}, { 1141, 5}, -{ 1136, 5}, { 1131, 5}, { 1126, 5}, { 1121, 5}, { 1116, 5}, { 1111, 5}, { 1106, 5}, { 1101, 5}, -{ 1096, 5}, { 1091, 5}, { 1086, 4}, { 1082, 5}, { 1077, 5}, { 1072, 4}, { 1068, 5}, { 1063, 4}, -{ 1059, 5}, { 1054, 4}, { 1050, 4}, { 1046, 5}, { 1041, 4}, { 1037, 4}, { 1033, 5}, { 1028, 4}, -{ 1024, 4}, { 1020, 4}, { 1016, 4}, { 1012, 4}, { 1008, 4}, { 1004, 4}, { 1000, 4}, { 996, 4}, +{ 62500, 12500}, { 50000, 8334}, { 41666, 5952}, { 35714, 4464}, { 31250, 3473}, { 27777, 2777}, { 25000, 2273}, { 22727, 1894}, +{ 20833, 1603}, { 19230, 1373}, { 17857, 1191}, { 16666, 1041}, { 15625, 920}, { 14705, 817}, { 13888, 731}, { 13157, 657}, +{ 12500, 596}, { 11904, 541}, { 11363, 494}, { 10869, 453}, { 10416, 416}, { 10000, 385}, { 9615, 356}, { 9259, 331}, +{ 8928, 308}, { 8620, 287}, { 8333, 269}, { 8064, 252}, { 7812, 237}, { 7575, 223}, { 7352, 210}, { 7142, 198}, +{ 6944, 188}, { 6756, 178}, { 6578, 168}, { 6410, 160}, { 6250, 153}, { 6097, 145}, { 5952, 139}, { 5813, 132}, +{ 5681, 126}, { 5555, 121}, { 5434, 115}, { 5319, 111}, { 5208, 106}, { 5102, 102}, { 5000, 99}, { 4901, 94}, +{ 4807, 91}, { 4716, 87}, { 4629, 84}, { 4545, 81}, { 4464, 79}, { 4385, 75}, { 4310, 73}, { 4237, 71}, +{ 4166, 68}, { 4098, 66}, { 4032, 64}, { 3968, 62}, { 3906, 60}, { 3846, 59}, { 3787, 56}, { 3731, 55}, +{ 3676, 53}, { 3623, 52}, { 3571, 50}, { 3521, 49}, { 3472, 48}, { 3424, 46}, { 3378, 45}, { 3333, 44}, +{ 3289, 43}, { 3246, 41}, { 3205, 41}, { 3164, 39}, { 3125, 39}, { 3086, 38}, { 3048, 36}, { 3012, 36}, +{ 2976, 35}, { 2941, 35}, { 2906, 33}, { 2873, 33}, { 2840, 32}, { 2808, 31}, { 2777, 30}, { 2747, 30}, +{ 2717, 29}, { 2688, 29}, { 2659, 28}, { 2631, 27}, { 2604, 27}, { 2577, 26}, { 2551, 26}, { 2525, 25}, +{ 2500, 25}, { 2475, 25}, { 2450, 23}, { 2427, 24}, { 2403, 23}, { 2380, 22}, { 2358, 22}, { 2336, 22}, +{ 2314, 21}, { 2293, 21}, { 2272, 20}, { 2252, 20}, { 2232, 20}, { 2212, 20}, { 2192, 19}, { 2173, 18}, +{ 2155, 19}, { 2136, 18}, { 2118, 18}, { 2100, 17}, { 2083, 17}, { 2066, 17}, { 2049, 17}, { 2032, 16}, +{ 2016, 16}, { 2000, 16}, { 1984, 16}, { 1968, 15}, { 1953, 16}, { 1937, 14}, { 1923, 15}, { 1908, 15}, +{ 1893, 14}, { 1879, 14}, { 1865, 14}, { 1851, 13}, { 1838, 14}, { 1824, 13}, { 1811, 13}, { 1798, 13}, +{ 1785, 12}, { 1773, 13}, { 1760, 12}, { 1748, 12}, { 1736, 12}, { 1724, 12}, { 1712, 12}, { 1700, 11}, +{ 1689, 12}, { 1677, 11}, { 1666, 11}, { 1655, 11}, { 1644, 11}, { 1633, 10}, { 1623, 11}, { 1612, 10}, +{ 1602, 10}, { 1592, 10}, { 1582, 10}, { 1572, 10}, { 1562, 10}, { 1552, 9}, { 1543, 10}, { 1533, 9}, +{ 1524, 9}, { 1515, 9}, { 1506, 9}, { 1497, 9}, { 1488, 9}, { 1479, 9}, { 1470, 9}, { 1461, 8}, +{ 1453, 8}, { 1445, 9}, { 1436, 8}, { 1428, 8}, { 1420, 8}, { 1412, 8}, { 1404, 8}, { 1396, 8}, +{ 1388, 7}, { 1381, 8}, { 1373, 7}, { 1366, 8}, { 1358, 7}, { 1351, 7}, { 1344, 8}, { 1336, 7}, +{ 1329, 7}, { 1322, 7}, { 1315, 7}, { 1308, 6}, { 1302, 7}, { 1295, 7}, { 1288, 6}, { 1282, 7}, +{ 1275, 6}, { 1269, 7}, { 1262, 6}, { 1256, 6}, { 1250, 7}, { 1243, 6}, { 1237, 6}, { 1231, 6}, +{ 1225, 6}, { 1219, 6}, { 1213, 6}, { 1207, 6}, { 1201, 5}, { 1196, 6}, { 1190, 6}, { 1184, 5}, +{ 1179, 6}, { 1173, 5}, { 1168, 6}, { 1162, 5}, { 1157, 5}, { 1152, 6}, { 1146, 5}, { 1141, 5}, +{ 1136, 5}, { 1131, 5}, { 1126, 5}, { 1121, 5}, { 1116, 5}, { 1111, 5}, { 1106, 5}, { 1101, 5}, +{ 1096, 5}, { 1091, 5}, { 1086, 4}, { 1082, 5}, { 1077, 5}, { 1072, 4}, { 1068, 5}, { 1063, 4}, +{ 1059, 5}, { 1054, 4}, { 1050, 4}, { 1046, 5}, { 1041, 4}, { 1037, 4}, { 1033, 5}, { 1028, 4}, +{ 1024, 4}, { 1020, 4}, { 1016, 4}, { 1012, 4}, { 1008, 4}, { 1004, 4}, { 1000, 4}, { 996, 4}, { 992, 4}, { 988, 4}, { 984, 4}, { 980, 4}, { 976, 4}, { 972, 4}, { 968, 3}, { 965, 3} }; diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 9922eda141..43c779f352 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -283,7 +283,7 @@ ISR(TIMER1_COMPA_vect) { // Is there a 8us time left before the next interrupt triggers? if (OCR1A < TCNT1 + 16) { #ifdef DEBUG_STEPPER_TIMER_MISSED - // Verify whether the next planned timer interrupt has not been missed already. + // Verify whether the next planned timer interrupt has not been missed already. // This debugging test takes < 1.125us // This skews the profiling slightly as the fastest stepper timer // interrupt repeats at a 100us rate (10kHz). @@ -297,7 +297,7 @@ ISR(TIMER1_COMPA_vect) { } #endif // Fix the next interrupt to be executed after 8us from now. - OCR1A = TCNT1 + 16; + OCR1A = TCNT1 + 16; } } @@ -464,7 +464,7 @@ FORCE_INLINE void stepper_next_block() // Check limit switches. FORCE_INLINE void stepper_check_endstops() { - if(check_endstops) + if(check_endstops) { uint8_t _endstop_hit = endstop_hit; uint8_t _endstop = endstop; @@ -492,7 +492,7 @@ FORCE_INLINE void stepper_check_endstops() } #endif } else { // +direction - #if ( (defined(X_MAX_PIN) && (X_MAX_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_XMAXLIMIT) + #if ( (defined(X_MAX_PIN) && (X_MAX_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_XMAXLIMIT) #ifdef TMC2130_SG_HOMING // Stall guard homing turned on SET_BIT_TO(_endstop, X_AXIS + 4, (!READ(X_TMC2130_DIAG))); @@ -516,7 +516,7 @@ FORCE_INLINE void stepper_check_endstops() if ((((out_bits & (1< -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_YMINLIMIT) + #if ( (defined(Y_MIN_PIN) && (Y_MIN_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_YMINLIMIT) #ifdef TMC2130_SG_HOMING // Stall guard homing turned on SET_BIT_TO(_endstop, Y_AXIS, (!READ(Y_TMC2130_DIAG))); @@ -533,7 +533,7 @@ FORCE_INLINE void stepper_check_endstops() } #endif } else { // +direction - #if ( (defined(Y_MAX_PIN) && (Y_MAX_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_YMAXLIMIT) + #if ( (defined(Y_MAX_PIN) && (Y_MAX_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_YMAXLIMIT) #ifdef TMC2130_SG_HOMING // Stall guard homing turned on SET_BIT_TO(_endstop, Y_AXIS + 4, (!READ(Y_TMC2130_DIAG))); @@ -666,7 +666,7 @@ FORCE_INLINE void stepper_tick_lowres() STEP_NC_LO(Y_AXIS); #ifdef DEBUG_YSTEP_DUP_PIN STEP_NC_LO(Y_DUP_AXIS); -#endif //DEBUG_YSTEP_DUP_PIN +#endif //DEBUG_YSTEP_DUP_PIN } // Step in Z axis counter[Z_AXIS].lo += current_block->steps[Z_AXIS].lo; @@ -710,7 +710,7 @@ FORCE_INLINE void stepper_tick_highres() STEP_NC_HI(X_DUP_AXIS); #endif //DEBUG_XSTEP_DUP_PIN counter[X_AXIS].wide -= current_block->step_event_count.wide; - count_position[X_AXIS]+=count_direction[X_AXIS]; + count_position[X_AXIS]+=count_direction[X_AXIS]; STEP_NC_LO(X_AXIS); #ifdef DEBUG_XSTEP_DUP_PIN STEP_NC_LO(X_DUP_AXIS); @@ -728,7 +728,7 @@ FORCE_INLINE void stepper_tick_highres() STEP_NC_LO(Y_AXIS); #ifdef DEBUG_YSTEP_DUP_PIN STEP_NC_LO(Y_DUP_AXIS); -#endif //DEBUG_YSTEP_DUP_PIN +#endif //DEBUG_YSTEP_DUP_PIN } // Step in Z axis counter[Z_AXIS].wide += current_block->steps[Z_AXIS].wide; @@ -808,7 +808,7 @@ FORCE_INLINE void isr() { if (current_block == NULL) stepper_next_block(); - if (current_block != NULL) + if (current_block != NULL) { stepper_check_endstops(); if (current_block->flag & BLOCK_FLAG_DDA_LOWRES) @@ -1078,7 +1078,7 @@ void st_init() #endif #if defined(Y_DIR_PIN) && Y_DIR_PIN > -1 SET_OUTPUT(Y_DIR_PIN); - + #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_DIR_PIN) && (Y2_DIR_PIN > -1) SET_OUTPUT(Y2_DIR_PIN); #endif @@ -1107,7 +1107,7 @@ void st_init() #if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1 SET_OUTPUT(Y_ENABLE_PIN); if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH); - + #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_ENABLE_PIN) && (Y2_ENABLE_PIN > -1) SET_OUTPUT(Y2_ENABLE_PIN); if(!Y_ENABLE_ON) WRITE(Y2_ENABLE_PIN,HIGH); @@ -1350,7 +1350,7 @@ float st_get_position_mm(uint8_t axis) void quickStop() { DISABLE_STEPPER_DRIVER_INTERRUPT(); - while (blocks_queued()) plan_discard_current_block(); + while (blocks_queued()) plan_discard_current_block(); current_block = NULL; #ifdef LIN_ADVANCE nextAdvanceISR = ADV_NEVER; @@ -1523,13 +1523,13 @@ void microstep_init() #if defined(E1_MS1_PIN) && E1_MS1_PIN > -1 SET_OUTPUT(E1_MS1_PIN); - SET_OUTPUT(E1_MS2_PIN); + SET_OUTPUT(E1_MS2_PIN); #endif #if defined(X_MS1_PIN) && X_MS1_PIN > -1 const uint8_t microstep_modes[] = MICROSTEP_MODES; SET_OUTPUT(X_MS1_PIN); - SET_OUTPUT(X_MS2_PIN); + SET_OUTPUT(X_MS2_PIN); SET_OUTPUT(Y_MS1_PIN); SET_OUTPUT(Y_MS2_PIN); SET_OUTPUT(Z_MS1_PIN); diff --git a/Firmware/stepper.h b/Firmware/stepper.h index 72ea5294ab..c5c7cb6d31 100644 --- a/Firmware/stepper.h +++ b/Firmware/stepper.h @@ -19,7 +19,7 @@ */ #ifndef stepper_h -#define stepper_h +#define stepper_h #include "planner.h" diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 547d0709eb..0e95d6fe4b 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1,19 +1,19 @@ /* temperature.c - temperature control Part of Marlin - + Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -22,8 +22,8 @@ This firmware is a mashup between Sprinter and grbl. (https://github.com/kliment/Sprinter) (https://github.com/simen/grbl/tree) - - It has preliminary support for Matthew Roberts advance algorithm + + It has preliminary support for Matthew Roberts advance algorithm http://reprap.org/pipermail/reprap-dev/2011-May/003323.html */ @@ -127,7 +127,7 @@ int current_voltage_raw_bed = 0; int current_temperature_bed_raw = 0; float current_temperature_bed = 0.0; - + #ifdef PIDTEMP float _Kp, _Ki, _Kd; @@ -144,7 +144,7 @@ float current_temperature_bed = 0.0; pid_tuning_finished = false; } #endif //PIDTEMP - + unsigned char soft_pwm_bed; #ifdef BABYSTEPPING @@ -282,7 +282,7 @@ void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycle pid_cycle = 0; return; } - + SERIAL_ECHOLNPGM("PID Autotune start"); if (extruder<0) @@ -318,7 +318,7 @@ void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycle #endif if(heating == true && input > temp) { - if(_millis() - t2 > 5000) { + if(_millis() - t2 > 5000) { heating=false; if (extruder<0) { soft_pwm_bed = (bias - d) >> 1; @@ -384,7 +384,7 @@ void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycle pid_cycle++; min=temp; } - } + } } #ifndef MAX_OVERSHOOT_PID_AUTOTUNE #define MAX_OVERSHOOT_PID_AUTOTUNE 20 @@ -398,16 +398,16 @@ void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycle if(_millis() - temp_millis > 2000) { int p; if (extruder<0){ - p=soft_pwm_bed; + p=soft_pwm_bed; SERIAL_PROTOCOLPGM("B:"); }else{ - p=soft_pwm[extruder]; + p=soft_pwm[extruder]; SERIAL_PROTOCOLPGM("T:"); } - - SERIAL_PROTOCOL(input); + + SERIAL_PROTOCOL(input); SERIAL_PROTOCOLPGM(" @:"); - SERIAL_PROTOCOLLN(p); + SERIAL_PROTOCOLLN(p); if (safety_check_cycles == 0) { //save ambient temp temp_ambient = input; //SERIAL_ECHOPGM("Ambient T: "); @@ -415,7 +415,7 @@ void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycle safety_check_cycles++; } else if (safety_check_cycles < safety_check_cycles_count) { //delay - safety_check_cycles++; + safety_check_cycles++; } else if (safety_check_cycles == safety_check_cycles_count){ //check that temperature is rising safety_check_cycles++; @@ -424,7 +424,7 @@ void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycle //SERIAL_ECHOPGM("s. Difference between current and ambient T: "); //MYSERIAL.println(input - temp_ambient); - if (fabs(input - temp_ambient) < 5.0) { + if (fabs(input - temp_ambient) < 5.0) { temp_runaway_stop(false, (extruder<0)); pid_tuning_finished = true; return; @@ -453,14 +453,14 @@ void updatePID() // TODO: iState_sum_max and PID values should be synchronized for temp_mgr_isr #ifdef PIDTEMP for(uint_least8_t e = 0; e < EXTRUDERS; e++) { - iState_sum_max[e] = PID_INTEGRAL_DRIVE_MAX / cs.Ki; + iState_sum_max[e] = PID_INTEGRAL_DRIVE_MAX / cs.Ki; } #endif #ifdef PIDTEMPBED - temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / cs.bedKi; + temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / cs.bedKi; #endif } - + int getHeaterPower(int heater) { if (heater<0) return soft_pwm_bed; @@ -583,7 +583,7 @@ static float analog2temp(int raw, uint8_t e) { SERIAL_ERRORLNPGM(" - Invalid extruder number !"); kill(); return 0.0; - } + } #ifdef HEATER_0_USES_MAX6675 if (e == 0) { @@ -601,8 +601,8 @@ static float analog2temp(int raw, uint8_t e) { { if (PGM_RD_W((*tt)[i][0]) > raw) { - celsius = PGM_RD_W((*tt)[i-1][1]) + - (raw - PGM_RD_W((*tt)[i-1][0])) * + celsius = PGM_RD_W((*tt)[i-1][1]) + + (raw - PGM_RD_W((*tt)[i-1][0])) * (float)(PGM_RD_W((*tt)[i][1]) - PGM_RD_W((*tt)[i-1][1])) / (float)(PGM_RD_W((*tt)[i][0]) - PGM_RD_W((*tt)[i-1][0])); break; @@ -628,8 +628,8 @@ static float analog2tempBed(int raw) { { if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw) { - celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) + - (raw - PGM_RD_W(BEDTEMPTABLE[i-1][0])) * + celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) + + (raw - PGM_RD_W(BEDTEMPTABLE[i-1][0])) * (float)(PGM_RD_W(BEDTEMPTABLE[i][1]) - PGM_RD_W(BEDTEMPTABLE[i-1][1])) / (float)(PGM_RD_W(BEDTEMPTABLE[i][0]) - PGM_RD_W(BEDTEMPTABLE[i-1][0])); break; @@ -682,8 +682,8 @@ static float analog2tempAmbient(int raw) { if (PGM_RD_W(AMBIENTTEMPTABLE[i][0]) > raw) { - celsius = PGM_RD_W(AMBIENTTEMPTABLE[i-1][1]) + - (raw - PGM_RD_W(AMBIENTTEMPTABLE[i-1][0])) * + celsius = PGM_RD_W(AMBIENTTEMPTABLE[i-1][1]) + + (raw - PGM_RD_W(AMBIENTTEMPTABLE[i-1][0])) * (float)(PGM_RD_W(AMBIENTTEMPTABLE[i][1]) - PGM_RD_W(AMBIENTTEMPTABLE[i-1][1])) / (float)(PGM_RD_W(AMBIENTTEMPTABLE[i][0]) - PGM_RD_W(AMBIENTTEMPTABLE[i-1][0])); break; @@ -699,13 +699,13 @@ void soft_pwm_init() { #if MB(RUMBA) && ((TEMP_SENSOR_0==-1) || (TEMP_SENSOR_BED==-1)) //disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector - MCUCR=(1< -1) + #if defined(HEATER_0_PIN) && (HEATER_0_PIN > -1) SET_OUTPUT(HEATER_0_PIN); #endif - #if defined(HEATER_BED_PIN) && (HEATER_BED_PIN > -1) + #if defined(HEATER_BED_PIN) && (HEATER_BED_PIN > -1) SET_OUTPUT(HEATER_BED_PIN); - #endif - #if defined(FAN_PIN) && (FAN_PIN > -1) + #endif + #if defined(FAN_PIN) && (FAN_PIN > -1) SET_OUTPUT(FAN_PIN); #ifdef FAST_PWM_FAN setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 @@ -737,18 +737,18 @@ void soft_pwm_init() #ifndef SDSUPPORT SET_OUTPUT(SCK_PIN); WRITE(SCK_PIN,0); - + SET_OUTPUT(MOSI_PIN); WRITE(MOSI_PIN,1); - + SET_INPUT(MISO_PIN); WRITE(MISO_PIN,1); #endif /* Using pinMode and digitalWrite, as that was the only way I could get it to compile */ - + //Have to toggle SD card CS pin to low first, to enable firmware to talk with SD card pinMode(SS_PIN, OUTPUT); - digitalWrite(SS_PIN,0); + digitalWrite(SS_PIN,0); pinMode(MAX6675_SS, OUTPUT); digitalWrite(MAX6675_SS,1); #endif @@ -892,7 +892,7 @@ static void temp_runaway_check(uint8_t _heater_id, float _target_temperature, fl __preheat_errors[_heater_id] = 0; } - if (__preheat_errors[_heater_id] > ((_isbed) ? 3 : 5)) + if (__preheat_errors[_heater_id] > ((_isbed) ? 3 : 5)) set_temp_error((_isbed?TempErrorSource::bed:TempErrorSource::hotend), _heater_id, TempErrorType::preheat); __preheat_start[_heater_id] = _current_temperature; @@ -914,7 +914,7 @@ static void temp_runaway_check(uint8_t _heater_id, float _target_temperature, fl if (temp_runaway_check_active) - { + { // we are in range if ((_current_temperature > (_target_temperature - __hysteresis)) && (_current_temperature < (_target_temperature + __hysteresis))) { @@ -1044,47 +1044,47 @@ int max6675_temp = 2000; int read_max6675() { - if (_millis() - max6675_previous_millis < MAX6675_HEAT_INTERVAL) + if (_millis() - max6675_previous_millis < MAX6675_HEAT_INTERVAL) return max6675_temp; - + max6675_previous_millis = _millis(); max6675_temp = 0; - + #ifdef PRR PRR &= ~(1<> 3; } @@ -1140,7 +1140,7 @@ FORCE_INLINE static void soft_pwm_core() { soft_pwm_0 = soft_pwm[0]; if(soft_pwm_0 > 0) - { + { WRITE(HEATER_0_PIN,1); #ifdef HEATERS_PARALLEL WRITE(HEATER_1_PIN,1); @@ -1148,7 +1148,7 @@ FORCE_INLINE static void soft_pwm_core() } else WRITE(HEATER_0_PIN,0); } #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 - + #if 0 // @@DR vypnuto pro hw pwm bedu // tuhle prasarnu bude potreba poustet ve stanovenych intervalech, jinak nemam moc sanci zareagovat // teoreticky by se tato cast uz vubec nemusela poustet @@ -1166,7 +1166,7 @@ FORCE_INLINE static void soft_pwm_core() } #endif #endif - + #ifdef FAN_SOFT_PWM if ((pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1)) == 0) { @@ -1175,14 +1175,14 @@ FORCE_INLINE static void soft_pwm_core() } #endif if(soft_pwm_0 < pwm_count) - { + { WRITE(HEATER_0_PIN,0); #ifdef HEATERS_PARALLEL WRITE(HEATER_1_PIN,0); #endif } -#if 0 // @@DR +#if 0 // @@DR #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 if (soft_pwm_b < (pwm_count & ((1 << HEATER_BED_SOFT_PWM_BITS) - 1))){ //WRITE(HEATER_BED_PIN,0); @@ -1193,7 +1193,7 @@ FORCE_INLINE static void soft_pwm_core() #ifdef FAN_SOFT_PWM if (soft_pwm_fan < (pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1))) WRITE(FAN_PIN,0); #endif - + pwm_count += (1 << SOFT_PWM_SCALE); pwm_count &= 0x7f; @@ -1207,12 +1207,12 @@ FORCE_INLINE static void soft_pwm_core() #define MIN_STATE_TIME 16 // MIN_STATE_TIME * 65.5 = time in milliseconds #endif if (slow_pwm_count == 0) { - // EXTRUDER 0 + // EXTRUDER 0 soft_pwm_0 = soft_pwm[0]; if (soft_pwm_0 > 0) { - // turn ON heather only if the minimum time is up - if (state_timer_heater_0 == 0) { - // if change state set timer + // turn ON heather only if the minimum time is up + if (state_timer_heater_0 == 0) { + // if change state set timer if (state_heater_0 == 0) { state_timer_heater_0 = MIN_STATE_TIME; } @@ -1223,9 +1223,9 @@ FORCE_INLINE static void soft_pwm_core() #endif } } else { - // turn OFF heather only if the minimum time is up + // turn OFF heather only if the minimum time is up if (state_timer_heater_0 == 0) { - // if change state set timer + // if change state set timer if (state_heater_0 == 1) { state_timer_heater_0 = MIN_STATE_TIME; } @@ -1241,9 +1241,9 @@ FORCE_INLINE static void soft_pwm_core() // BED soft_pwm_b = soft_pwm_bed; if (soft_pwm_b > 0) { - // turn ON heather only if the minimum time is up - if (state_timer_heater_b == 0) { - // if change state set timer + // turn ON heather only if the minimum time is up + if (state_timer_heater_b == 0) { + // if change state set timer if (state_heater_b == 0) { state_timer_heater_b = MIN_STATE_TIME; } @@ -1251,9 +1251,9 @@ FORCE_INLINE static void soft_pwm_core() //WRITE(HEATER_BED_PIN, 1); } } else { - // turn OFF heather only if the minimum time is up + // turn OFF heather only if the minimum time is up if (state_timer_heater_b == 0) { - // if change state set timer + // if change state set timer if (state_heater_b == 1) { state_timer_heater_b = MIN_STATE_TIME; } @@ -1263,12 +1263,12 @@ FORCE_INLINE static void soft_pwm_core() } #endif } // if (slow_pwm_count == 0) - - // EXTRUDER 0 + + // EXTRUDER 0 if (soft_pwm_0 < slow_pwm_count) { - // turn OFF heather only if the minimum time is up - if (state_timer_heater_0 == 0) { - // if change state set timer + // turn OFF heather only if the minimum time is up + if (state_timer_heater_0 == 0) { + // if change state set timer if (state_heater_0 == 1) { state_timer_heater_0 = MIN_STATE_TIME; } @@ -1283,9 +1283,9 @@ FORCE_INLINE static void soft_pwm_core() #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 // BED if (soft_pwm_b < slow_pwm_count) { - // turn OFF heather only if the minimum time is up - if (state_timer_heater_b == 0) { - // if change state set timer + // turn OFF heather only if the minimum time is up + if (state_timer_heater_b == 0) { + // if change state set timer if (state_heater_b == 1) { state_timer_heater_b = MIN_STATE_TIME; } @@ -1294,7 +1294,7 @@ FORCE_INLINE static void soft_pwm_core() } } #endif - + #ifdef FAN_SOFT_PWM if ((pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1)) == 0) soft_pwm_fan = fanSpeedSoftPwm / (1 << (8 - FAN_SOFT_PWM_BITS)); @@ -1305,24 +1305,24 @@ FORCE_INLINE static void soft_pwm_core() pwm_count += (1 << SOFT_PWM_SCALE); pwm_count &= 0x7f; - + // increment slow_pwm_count only every 64 pwm_count circa 65.5ms if ((pwm_count % 64) == 0) { slow_pwm_count++; slow_pwm_count &= 0x7f; - + // Extruder 0 if (state_timer_heater_0 > 0) { state_timer_heater_0--; } #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 - // Bed - if (state_timer_heater_b > 0) + // Bed + if (state_timer_heater_b > 0) state_timer_heater_b--; #endif } //if ((pwm_count % 64) == 0) { - + #endif //ifndef SLOW_PWM_HEATERS } diff --git a/Firmware/temperature.h b/Firmware/temperature.h index e7f419a834..9849316d11 100755 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -19,7 +19,7 @@ */ #ifndef temperature_h -#define temperature_h +#define temperature_h #include "Marlin.h" #include "config.h" @@ -32,7 +32,7 @@ bool get_temp_error(); //return true if any thermal error is set // low level conversion routines // do not use these routines and variables outside of temperature.cpp -extern int target_temperature[EXTRUDERS]; +extern int target_temperature[EXTRUDERS]; extern float current_temperature[EXTRUDERS]; #ifdef SHOW_TEMP_ADC_VALUES extern int current_temperature_raw[EXTRUDERS]; @@ -95,16 +95,16 @@ void resetPID(uint8_t extruder); //deg=degreeCelsius // Doesn't save FLASH when FORCE_INLINE removed. -FORCE_INLINE float degHotend(uint8_t extruder) { +FORCE_INLINE float degHotend(uint8_t extruder) { return current_temperature[extruder]; }; #ifdef SHOW_TEMP_ADC_VALUES - FORCE_INLINE float rawHotendTemp(uint8_t extruder) { + FORCE_INLINE float rawHotendTemp(uint8_t extruder) { return current_temperature_raw[extruder]; }; - FORCE_INLINE float rawBedTemp() { + FORCE_INLINE float rawBedTemp() { return current_temperature_bed_raw; }; #endif @@ -114,25 +114,25 @@ FORCE_INLINE float degBed() { }; // Doesn't save FLASH when FORCE_INLINE removed. -FORCE_INLINE float degTargetHotend(uint8_t extruder) { +FORCE_INLINE float degTargetHotend(uint8_t extruder) { return target_temperature[extruder]; }; -FORCE_INLINE float degTargetBed() { +FORCE_INLINE float degTargetBed() { return target_temperature_bed; }; // Doesn't save FLASH when FORCE_INLINE removed. -FORCE_INLINE void setTargetHotend(const float &celsius) { +FORCE_INLINE void setTargetHotend(const float &celsius) { target_temperature[0] = celsius; resetPID(0); }; -FORCE_INLINE void setTargetBed(const float &celsius) { +FORCE_INLINE void setTargetBed(const float &celsius) { target_temperature_bed = celsius; }; -FORCE_INLINE bool isHeatingHotend(uint8_t extruder){ +FORCE_INLINE bool isHeatingHotend(uint8_t extruder){ return target_temperature[extruder] > current_temperature[extruder]; }; @@ -140,7 +140,7 @@ FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; }; -FORCE_INLINE bool isCoolingHotend(uint8_t extruder) { +FORCE_INLINE bool isCoolingHotend(uint8_t extruder) { return target_temperature[extruder] < current_temperature[extruder]; }; diff --git a/Firmware/thermistortables.h b/Firmware/thermistortables.h index c262025b50..484a412eff 100644 --- a/Firmware/thermistortables.h +++ b/Firmware/thermistortables.h @@ -565,7 +565,7 @@ const short temptable_10[][2] PROGMEM = { }; #endif -#if (THERMISTORHEATER_0 == 11) || (THERMISTORBED == 11) +#if (THERMISTORHEATER_0 == 11) || (THERMISTORBED == 11) // QU-BD silicone bed QWG-104F-3950 thermistor const short temptable_11[][2] PROGMEM = { @@ -817,7 +817,7 @@ const short temptable_51[][2] PROGMEM = { }; #endif -#if (THERMISTORHEATER_0 == 52) || (THERMISTORBED == 52) +#if (THERMISTORHEATER_0 == 52) || (THERMISTORBED == 52) // 200k ATC Semitec 204GT-2 (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!) // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance @@ -858,7 +858,7 @@ const short temptable_52[][2] PROGMEM = { }; #endif -#if (THERMISTORHEATER_0 == 55) || (THERMISTORBED == 55) +#if (THERMISTORHEATER_0 == 55) || (THERMISTORBED == 55) // 100k ATC Semitec 104GT-2 (Used on ParCan) (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!) // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance @@ -900,7 +900,7 @@ const short temptable_55[][2] PROGMEM = { #endif #if (THERMISTORHEATER_0 == 60) || (THERMISTORBED == 60) // Maker's Tool Works Kapton Bed Thermister -// ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=3950 +// ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=3950 // r0: 100000 // t0: 25 // r1: 0 (parallel with rTherm) @@ -983,7 +983,7 @@ const short temptable_60[][2] PROGMEM = { {1008*OVERSAMPLENR, 0}, }; #endif -#if (THERMISTORBED == 12) +#if (THERMISTORBED == 12) //100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) const short temptable_12[][2] PROGMEM = { {35*OVERSAMPLENR, 180}, //top rating 180C @@ -1020,7 +1020,7 @@ const short temptable_12[][2] PROGMEM = { #endif // Pt1000 and Pt100 handling -// +// // Rt=R0*(1+a*T+b*T*T) [for T>0] // a=3.9083E-3, b=-5.775E-7 @@ -1034,7 +1034,7 @@ const short temptable_12[][2] PROGMEM = { #if (THERMISTORHEATER_0 == 110) || (THERMISTORBED == 110) // Pt100 with 1k0 pullup const short temptable_110[][2] PROGMEM = { -// only few values are needed as the curve is very flat +// only few values are needed as the curve is very flat PtLine(0,100,1000) PtLine(50,100,1000) PtLine(100,100,1000) @@ -1046,7 +1046,7 @@ const short temptable_110[][2] PROGMEM = { #endif #if (THERMISTORHEATER_0 == 147) || (THERMISTORBED == 147) // Pt100 with 4k7 pullup const short temptable_147[][2] PROGMEM = { -// only few values are needed as the curve is very flat +// only few values are needed as the curve is very flat PtLine(0,100,4700) PtLine(50,100,4700) PtLine(100,100,4700) @@ -1193,7 +1193,7 @@ const short temptable_1010[][2] PROGMEM = { #endif #if (THERMISTORHEATER_0 == 1047) || (THERMISTORBED == 1047) // Pt1000 with 4k7 pullup const short temptable_1047[][2] PROGMEM = { -// only few values are needed as the curve is very flat +// only few values are needed as the curve is very flat PtLine(0,1000,4700) PtLine(50,1000,4700) PtLine(100,1000,4700) diff --git a/Firmware/timer02.c b/Firmware/timer02.c index 47f7d2a28b..446568dc96 100644 --- a/Firmware/timer02.c +++ b/Firmware/timer02.c @@ -16,11 +16,11 @@ void timer0_init(void) CRITICAL_SECTION_START; TCNT0 = 0; - // Fast PWM duty (0-255). + // Fast PWM duty (0-255). // Due to invert mode (following rows) the duty is set to 255, which means zero all the time (bed not heating) OCR0B = 255; // Set fast PWM mode and inverting mode. - TCCR0A = (1 << WGM01) | (1 << WGM00) | (1 << COM0B1) | (1 << COM0B0); + TCCR0A = (1 << WGM01) | (1 << WGM00) | (1 << COM0B1) | (1 << COM0B0); TCCR0B = (1 << CS01); // CLK/8 prescaling TIMSK0 |= (1 << TOIE0); // enable timer overflow interrupt @@ -119,7 +119,7 @@ unsigned long micros2(void) if ((TIFR & _BV(TOV2)) && (t < 255)) m++; #endif - SREG = oldSREG; + SREG = oldSREG; return ((m << 8) + t) * (64 / clockCyclesPerMicrosecond()); } diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index 05340622dc..464ca6ed09 100755 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -58,7 +58,7 @@ union ChopConfU { uint32_t hend : 4; // HEND hysteresis low value (chm = 0) or OFFSET sine wave offset (chm = 1) uint32_t fd : 1; uint32_t disfdcc : 1; // Fast decay mode - uint32_t rndtf : 1; // Random TOFF time + uint32_t rndtf : 1; // Random TOFF time uint32_t chm : 1; // Chopper mode uint32_t tbl : 2; // Blank time select uint32_t vsense : 1; // Sense resistor voltage based current scaling @@ -322,7 +322,7 @@ void tmc2130_init(TMCInitParams params) SET_OUTPUT(Y_TMC2130_CS); SET_OUTPUT(Z_TMC2130_CS); SET_OUTPUT(E0_TMC2130_CS); - + SET_INPUT(X_TMC2130_DIAG); SET_INPUT(Y_TMC2130_DIAG); SET_INPUT(Z_TMC2130_DIAG); @@ -331,7 +331,7 @@ void tmc2130_init(TMCInitParams params) WRITE(Y_TMC2130_DIAG,HIGH); WRITE(Z_TMC2130_DIAG,HIGH); WRITE(E0_TMC2130_DIAG,HIGH); - + for (uint_least8_t axis = 0; axis < E_AXIS; axis++) // X Y Z axes { tmc2130_XYZ_reg_init(axis); diff --git a/Firmware/twi.cpp b/Firmware/twi.cpp index 07e0f1e8e2..59d18cfcf8 100644 --- a/Firmware/twi.cpp +++ b/Firmware/twi.cpp @@ -33,11 +33,11 @@ void twi_init(void) // activate internal pullups for SDA SET_INPUT(SDA_PIN); WRITE(SDA_PIN, 1); - + // start with the SDA pulled low WRITE(SCL_PIN, 0); SET_OUTPUT(SCL_PIN); - + // clock 10 cycles to make sure that the sensor is not stuck in a register read. for (uint8_t i = 0; i < 10; i++) { WRITE(SCL_PIN, 1); @@ -64,7 +64,7 @@ void twi_disable(void) { // disable TWI hardware. TWCR = 0; - + // deactivate internal pullups for twi. WRITE(SDA_PIN, 0); WRITE(SCL_PIN, 0); @@ -124,13 +124,13 @@ uint8_t twi_check(uint8_t address) TWCR = _BV(TWEN) | _BV(TWINT) | _BV(TWSTA); if(twi_wait(TW_START)) return 1; - + // send address TWDR = TW_WRITE | (address << 1); TWCR = _BV(TWEN) | _BV(TWINT); if(twi_wait(TW_MT_SLA_ACK)) return 2; - + // send stop twi_stop(); return 0; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 9e1128f245..0b65b72066 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6982,7 +6982,7 @@ static uint8_t lcd_selftest_screen(TestScreen screen, uint8_t _progress, uint8_t lcd_update_enable(false); const char _indicator = (_progress >= _progress_scale) ? '-' : '|'; - if (_clear) + if (_clear) lcd_clear(); else lcd_home(); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 550b841c82..0095a84442 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -73,7 +73,7 @@ void lcd_load_filament_color_check(); extern void lcd_belttest(); extern bool lcd_selftest(); -void lcd_menu_statistics(); +void lcd_menu_statistics(); void lcd_status_screen(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") diff --git a/Firmware/variants/MK25-RAMBo10a.h b/Firmware/variants/MK25-RAMBo10a.h index cbf289b88b..e098a53873 100644 --- a/Firmware/variants/MK25-RAMBo10a.h +++ b/Firmware/variants/MK25-RAMBo10a.h @@ -134,15 +134,15 @@ #define DEBUG_DCODES //D codes #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -//#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_STARTMSGS //no startup messages //#define DEBUG_DISABLE_MINTEMP //mintemp error ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line @@ -227,12 +227,12 @@ #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) //#define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_EXFEED 2 diff --git a/Firmware/variants/MK25-RAMBo13a.h b/Firmware/variants/MK25-RAMBo13a.h index fe34623545..22126cbaff 100644 --- a/Firmware/variants/MK25-RAMBo13a.h +++ b/Firmware/variants/MK25-RAMBo13a.h @@ -135,15 +135,15 @@ #define DEBUG_DCODES //D codes #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -//#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_STARTMSGS //no startup messages //#define DEBUG_DISABLE_MINTEMP //mintemp error ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line @@ -228,12 +228,12 @@ #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) //#define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_EXFEED 2 diff --git a/Firmware/variants/MK25S-RAMBo10a.h b/Firmware/variants/MK25S-RAMBo10a.h index 3081946d3b..d3bd7da151 100644 --- a/Firmware/variants/MK25S-RAMBo10a.h +++ b/Firmware/variants/MK25S-RAMBo10a.h @@ -134,15 +134,15 @@ #define DEBUG_DCODES //D codes #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -//#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_STARTMSGS //no startup messages //#define DEBUG_DISABLE_MINTEMP //mintemp error ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line @@ -227,12 +227,12 @@ #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) //#define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_EXFEED 2 diff --git a/Firmware/variants/MK25S-RAMBo13a.h b/Firmware/variants/MK25S-RAMBo13a.h index 041422acb0..b8b8026588 100644 --- a/Firmware/variants/MK25S-RAMBo13a.h +++ b/Firmware/variants/MK25S-RAMBo13a.h @@ -135,15 +135,15 @@ #define DEBUG_DCODES //D codes #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -//#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_STARTMSGS //no startup messages //#define DEBUG_DISABLE_MINTEMP //mintemp error ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line @@ -228,12 +228,12 @@ #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) //#define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_EXFEED 2 diff --git a/Firmware/variants/MK3-E3DREVO.h b/Firmware/variants/MK3-E3DREVO.h index 6678808734..5694548a07 100644 --- a/Firmware/variants/MK3-E3DREVO.h +++ b/Firmware/variants/MK3-E3DREVO.h @@ -115,7 +115,7 @@ //Crash detection #define CRASHDET_TIMER 45 //seconds -#define CRASHDET_COUNTER_MAX 3 +#define CRASHDET_COUNTER_MAX 3 // New XYZ calibration #define NEW_XYZCAL @@ -147,7 +147,7 @@ #define FILAMENT_SENSOR_TYPE FSENSOR_PAT9125 #define FSENSOR_PROBING -// Backlash - +// Backlash - //#define BACKLASH_X //#define BACKLASH_Y @@ -175,15 +175,15 @@ #define DEBUG_DCODES //D codes #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -#define DEBUG_DISABLE_STARTMSGS //no startup messages +#define DEBUG_DISABLE_STARTMSGS //no startup messages //#define DEBUG_DISABLE_MINTEMP //mintemp error ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line @@ -361,12 +361,12 @@ #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) //#define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_EXFEED 2 @@ -645,7 +645,7 @@ // "dropsegments" steps long. All the above rules still need to apply. #define UVLO_TINY_Z_AXIS_SHIFT 0.16 // If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. -#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 +#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 #define HEATBED_V2 diff --git a/Firmware/variants/MK3-E3DREVO_HF_60W.h b/Firmware/variants/MK3-E3DREVO_HF_60W.h index 6d343a39d0..080c3acf21 100644 --- a/Firmware/variants/MK3-E3DREVO_HF_60W.h +++ b/Firmware/variants/MK3-E3DREVO_HF_60W.h @@ -115,7 +115,7 @@ //Crash detection #define CRASHDET_TIMER 45 //seconds -#define CRASHDET_COUNTER_MAX 3 +#define CRASHDET_COUNTER_MAX 3 // New XYZ calibration #define NEW_XYZCAL @@ -147,7 +147,7 @@ #define FILAMENT_SENSOR_TYPE FSENSOR_PAT9125 #define FSENSOR_PROBING -// Backlash - +// Backlash - //#define BACKLASH_X //#define BACKLASH_Y @@ -175,15 +175,15 @@ #define DEBUG_DCODES //D codes #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -#define DEBUG_DISABLE_STARTMSGS //no startup messages +#define DEBUG_DISABLE_STARTMSGS //no startup messages //#define DEBUG_DISABLE_MINTEMP //mintemp error ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line @@ -362,12 +362,12 @@ #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) //#define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_EXFEED 2 @@ -646,7 +646,7 @@ // "dropsegments" steps long. All the above rules still need to apply. #define UVLO_TINY_Z_AXIS_SHIFT 0.16 // If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. -#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 +#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 #define HEATBED_V2 diff --git a/Firmware/variants/MK3.h b/Firmware/variants/MK3.h index 4b479ba977..a06bc5baae 100644 --- a/Firmware/variants/MK3.h +++ b/Firmware/variants/MK3.h @@ -115,7 +115,7 @@ //Crash detection #define CRASHDET_TIMER 45 //seconds -#define CRASHDET_COUNTER_MAX 3 +#define CRASHDET_COUNTER_MAX 3 // New XYZ calibration #define NEW_XYZCAL @@ -147,7 +147,7 @@ #define FILAMENT_SENSOR_TYPE FSENSOR_PAT9125 #define FSENSOR_PROBING -// Backlash - +// Backlash - //#define BACKLASH_X //#define BACKLASH_Y @@ -175,15 +175,15 @@ #define DEBUG_DCODES //D codes #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -#define DEBUG_DISABLE_STARTMSGS //no startup messages +#define DEBUG_DISABLE_STARTMSGS //no startup messages //#define DEBUG_DISABLE_MINTEMP //mintemp error ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line @@ -364,12 +364,12 @@ #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) //#define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_EXFEED 2 @@ -647,8 +647,8 @@ // we just need to shift to the nearest fullstep, but we need a move which is at least // "dropsegments" steps long. All the above rules still need to apply. #define UVLO_TINY_Z_AXIS_SHIFT 0.16 -// If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. -#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 +// If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. +#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 #define HEATBED_V2 diff --git a/Firmware/variants/MK3S-E3DREVO.h b/Firmware/variants/MK3S-E3DREVO.h index 7580bb1889..de7ee36404 100644 --- a/Firmware/variants/MK3S-E3DREVO.h +++ b/Firmware/variants/MK3S-E3DREVO.h @@ -117,7 +117,7 @@ //Crash detection #define CRASHDET_TIMER 45 //seconds -#define CRASHDET_COUNTER_MAX 3 +#define CRASHDET_COUNTER_MAX 3 // New XYZ calibration #define NEW_XYZCAL @@ -149,7 +149,7 @@ #define FILAMENT_SENSOR_TYPE FSENSOR_IR_ANALOG #define FSENSOR_PROBING -// Backlash - +// Backlash - //#define BACKLASH_X //#define BACKLASH_Y @@ -177,15 +177,15 @@ #define DEBUG_DCODES //D codes #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -#define DEBUG_DISABLE_STARTMSGS //no startup messages +#define DEBUG_DISABLE_STARTMSGS //no startup messages //#define DEBUG_DISABLE_MINTEMP //mintemp error ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line @@ -365,12 +365,12 @@ #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) //#define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_EXFEED 2 @@ -649,7 +649,7 @@ // "dropsegments" steps long. All the above rules still need to apply. #define UVLO_TINY_Z_AXIS_SHIFT 0.16 // If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. -#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 +#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 #define HEATBED_V2 diff --git a/Firmware/variants/MK3S-E3DREVO_HF_60W.h b/Firmware/variants/MK3S-E3DREVO_HF_60W.h index 7b7b233e9f..da1f8f25f3 100644 --- a/Firmware/variants/MK3S-E3DREVO_HF_60W.h +++ b/Firmware/variants/MK3S-E3DREVO_HF_60W.h @@ -117,7 +117,7 @@ //Crash detection #define CRASHDET_TIMER 45 //seconds -#define CRASHDET_COUNTER_MAX 3 +#define CRASHDET_COUNTER_MAX 3 // New XYZ calibration #define NEW_XYZCAL @@ -149,7 +149,7 @@ #define FILAMENT_SENSOR_TYPE FSENSOR_IR_ANALOG #define FSENSOR_PROBING -// Backlash - +// Backlash - //#define BACKLASH_X //#define BACKLASH_Y @@ -177,15 +177,15 @@ #define DEBUG_DCODES //D codes #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -#define DEBUG_DISABLE_STARTMSGS //no startup messages +#define DEBUG_DISABLE_STARTMSGS //no startup messages //#define DEBUG_DISABLE_MINTEMP //mintemp error ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line @@ -366,12 +366,12 @@ #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) //#define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_EXFEED 2 @@ -650,7 +650,7 @@ // "dropsegments" steps long. All the above rules still need to apply. #define UVLO_TINY_Z_AXIS_SHIFT 0.16 // If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. -#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 +#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 #define HEATBED_V2 diff --git a/Firmware/variants/MK3S.h b/Firmware/variants/MK3S.h index dfafcc5c17..75c7831d16 100644 --- a/Firmware/variants/MK3S.h +++ b/Firmware/variants/MK3S.h @@ -117,7 +117,7 @@ //Crash detection #define CRASHDET_TIMER 45 //seconds -#define CRASHDET_COUNTER_MAX 3 +#define CRASHDET_COUNTER_MAX 3 // New XYZ calibration #define NEW_XYZCAL @@ -149,7 +149,7 @@ #define FILAMENT_SENSOR_TYPE FSENSOR_IR_ANALOG #define FSENSOR_PROBING -// Backlash - +// Backlash - //#define BACKLASH_X //#define BACKLASH_Y @@ -177,15 +177,15 @@ #define DEBUG_DCODES //D codes #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -#define DEBUG_DISABLE_STARTMSGS //no startup messages +#define DEBUG_DISABLE_STARTMSGS //no startup messages //#define DEBUG_DISABLE_MINTEMP //mintemp error ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line @@ -368,12 +368,12 @@ #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) //#define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_EXFEED 2 @@ -652,7 +652,7 @@ // "dropsegments" steps long. All the above rules still need to apply. #define UVLO_TINY_Z_AXIS_SHIFT 0.16 // If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. -#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 +#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 #define HEATBED_V2 diff --git a/Firmware/variants/obsolete/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/obsolete/1_75mm_MK2-RAMBo10a-E3Dv6full.h index d04fac5cc1..47a244d1f9 100644 --- a/Firmware/variants/obsolete/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/obsolete/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -155,12 +155,12 @@ CHANGE FILAMENT SETTINGS #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 50 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 50 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_ZFEED 15 @@ -346,7 +346,7 @@ THERMISTORS SETTINGS // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -396,7 +396,7 @@ THERMISTORS SETTINGS #define PINDA_STEP_T 10 #define PINDA_MAX_T 100 -#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define LONG_PRESS_TIME 1000 //time in ms for button long press #define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release #define DEFAULT_PID_TEMP 210 diff --git a/Firmware/variants/obsolete/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/obsolete/1_75mm_MK2-RAMBo13a-E3Dv6full.h index db50be693e..d475021dae 100644 --- a/Firmware/variants/obsolete/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/obsolete/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -154,12 +154,12 @@ CHANGE FILAMENT SETTINGS #define FILAMENTCHANGE_FINALRETRACT 0 #define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 50 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_FINALFEED 50 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 #define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) #define FILAMENTCHANGE_RFEED 400 #define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_ZFEED 15 @@ -345,7 +345,7 @@ THERMISTORS SETTINGS // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -395,7 +395,7 @@ THERMISTORS SETTINGS #define PINDA_STEP_T 10 #define PINDA_MAX_T 100 -#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define LONG_PRESS_TIME 1000 //time in ms for button long press #define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release #define DEFAULT_PID_TEMP 210 diff --git a/Firmware/vector_3.cpp b/Firmware/vector_3.cpp index 5f1c294ed5..719ca51ae3 100644 --- a/Firmware/vector_3.cpp +++ b/Firmware/vector_3.cpp @@ -33,29 +33,29 @@ vector_3 vector_3::cross(vector_3 left, vector_3 right) left.x * right.y - left.y * right.x); } -vector_3 vector_3::operator+(vector_3 v) +vector_3 vector_3::operator+(vector_3 v) { return vector_3((x + v.x), (y + v.y), (z + v.z)); } -vector_3 vector_3::operator-(vector_3 v) +vector_3 vector_3::operator-(vector_3 v) { return vector_3((x - v.x), (y - v.y), (z - v.z)); } -vector_3 vector_3::get_normal() +vector_3 vector_3::get_normal() { vector_3 normalized = vector_3(x, y, z); normalized.normalize(); return normalized; } -float vector_3::get_length() +float vector_3::get_length() { float length = sqrt((x * x) + (y * y) + (z * z)); return length; } - + void vector_3::normalize() { float length = get_length(); @@ -102,11 +102,11 @@ matrix_3x3 matrix_3x3::create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 //row_1.debug("row_1"); //row_2.debug("row_2"); matrix_3x3 new_matrix; - new_matrix.matrix[0] = row_0.x; new_matrix.matrix[1] = row_0.y; new_matrix.matrix[2] = row_0.z; - new_matrix.matrix[3] = row_1.x; new_matrix.matrix[4] = row_1.y; new_matrix.matrix[5] = row_1.z; - new_matrix.matrix[6] = row_2.x; new_matrix.matrix[7] = row_2.y; new_matrix.matrix[8] = row_2.z; + new_matrix.matrix[0] = row_0.x; new_matrix.matrix[1] = row_0.y; new_matrix.matrix[2] = row_0.z; + new_matrix.matrix[3] = row_1.x; new_matrix.matrix[4] = row_1.y; new_matrix.matrix[5] = row_1.z; + new_matrix.matrix[6] = row_2.x; new_matrix.matrix[7] = row_2.y; new_matrix.matrix[8] = row_2.z; //new_matrix.debug("new_matrix"); - + return new_matrix; } @@ -127,7 +127,7 @@ matrix_3x3 matrix_3x3::create_look_at(vector_3 target) // y_row.debug("y_row"); // z_row.debug("z_row"); - + // create the matrix already correctly transposed matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row); @@ -139,8 +139,8 @@ matrix_3x3 matrix_3x3::create_look_at(vector_3 target) matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) { matrix_3x3 new_matrix; - new_matrix.matrix[0] = original.matrix[0]; new_matrix.matrix[1] = original.matrix[3]; new_matrix.matrix[2] = original.matrix[6]; - new_matrix.matrix[3] = original.matrix[1]; new_matrix.matrix[4] = original.matrix[4]; new_matrix.matrix[5] = original.matrix[7]; + new_matrix.matrix[0] = original.matrix[0]; new_matrix.matrix[1] = original.matrix[3]; new_matrix.matrix[2] = original.matrix[6]; + new_matrix.matrix[3] = original.matrix[1]; new_matrix.matrix[4] = original.matrix[4]; new_matrix.matrix[5] = original.matrix[7]; new_matrix.matrix[6] = original.matrix[2]; new_matrix.matrix[7] = original.matrix[5]; new_matrix.matrix[8] = original.matrix[8]; return new_matrix; } diff --git a/Firmware/vector_3.h b/Firmware/vector_3.h index 0b9decafad..7afbfefd4f 100644 --- a/Firmware/vector_3.h +++ b/Firmware/vector_3.h @@ -38,7 +38,7 @@ struct vector_3 vector_3 get_normal(); void debug(char* title); - + void apply_rotation(matrix_3x3 matrix); }; diff --git a/Firmware/xflash_layout.h b/Firmware/xflash_layout.h index 48d947f695..ef06f6db3e 100644 --- a/Firmware/xflash_layout.h +++ b/Firmware/xflash_layout.h @@ -4,13 +4,13 @@ * @author leptun */ /** \ingroup xflash_layout */ - + //! This is the layout of the XFLASH (external SPI flash) in Prusa firmware (dynamically generated from doxygen). /** @defgroup xflash_layout XFLASH Layout - * - + * + --------------------------------------------------------------------------------- The XFLASH has the following alignment requirements: - Block erase of 64KB. This is what the second bootloader uses. If anything even starts writing to a block, the entire block is erased by the bootloader. It will cause loss of crash dump on firmware upload. Nothing more than that. @@ -18,19 +18,19 @@ - Sector erase of 4KB. Used by the xflash_dump. This is the minimum size for erasing and as such the dump is 4KB aligned as to not erase other stuff unintentionally. - Page write of 256B. Lower access can be used, but care must be used since the address wraps at the page boundary when writing. - Read has no alignment requirements. - + The following items are found in the xflash: - + ### 1. Languages (R) This is a variable size region that is built by the lang build scripts. More info can be found in those scripts. - + It is aligned at the beginning of xflash, offset 0. ### 2. MMU Firmware update files (64KB, R) This space is reserved for the two MMU firmware files: - The MMU firmware v2.0.0+. - The Bootloader self update file. - + It is aligned at the end of xflash, before xflash_dump ### 3. xflash_dump (12KB, RW) @@ -38,9 +38,9 @@ It composes of: - A header with some information such as crash reason and what info was dumped. - The dump itself. This is composed of the entire memory space from address 0 to the end of SRAM. So it includes also the registers (useless), the IO and extended IO (useful) and all RAM. - + Even though the dump needs around 9KB of storage, 12KB is used because of the sector erase size. - + It is aligned at the end of xflash. */ diff --git a/Firmware/xyzcal.cpp b/Firmware/xyzcal.cpp index 12c0f67b41..138a32755e 100644 --- a/Firmware/xyzcal.cpp +++ b/Firmware/xyzcal.cpp @@ -227,9 +227,9 @@ uint16_t xyzcal_calc_delay(uint16_t nd, uint16_t dd) if (del_us > 50) return del_us - 50; } -// uint16_t del_us = (uint16_t)(((float)1000000 / xyzcal_sm4_v) + 0.5); -// uint16_t del_us = (uint32_t)1000000 / xyzcal_sm4_v; -// uint16_t del_us = 100; +// uint16_t del_us = (uint16_t)(((float)1000000 / xyzcal_sm4_v) + 0.5); +// uint16_t del_us = (uint32_t)1000000 / xyzcal_sm4_v; +// uint16_t del_us = 100; // uint16_t del_us = (uint16_t)10000 / xyzcal_sm4_v; // v += (ac * del_us + 500) / 1000; // xyzcal_sm4_v += (xyzcal_sm4_ac * del_us) / 1000; @@ -281,7 +281,7 @@ bool xyzcal_spiral2(int16_t cx, int16_t cy, int16_t z0, int16_t dz, int16_t radi uint8_t k = 720 / (dad_max - dad_min); //delta calculation constant ad = 0; if (pad) ad = *pad % 720; - + //@size=214 DBG(_n("xyzcal_spiral2 cx=%d cy=%d z0=%d dz=%d radius=%d ad=%d\n"), cx, cy, z0, dz, radius, ad); // lcd_set_cursor(0, 4); @@ -461,7 +461,7 @@ void accelerate_1_step(uint8_t axes, int16_t acc, uint16_t &delay_us, uint16_t m else t1++; } - + //DBG(_n("%d "), t1); delayMicroseconds(t1); @@ -585,8 +585,8 @@ void __attribute__((noinline)) xyzcal_scan_pixels_32x32_Zhop(int16_t cx, int16_t accelerate(axes, dir, Z_ACCEL, current_delay_us, Z_MIN_DELAY, half_x); go_and_stop(axes, dir, Z_ACCEL, current_delay_us, length_x - half_x); - - + + z_trig = min_z; /// move up to un-trigger (surpress hysteresis) @@ -803,7 +803,7 @@ void sort(float *points, const uint8_t num_points){ SWAP(points[j], points[j + 1]); } } - + // DBG(_n("Sorted: ")); // for (uint8_t i = 0; i < num_points; ++i) // DBG(_n("%f "), points[i]); @@ -834,13 +834,13 @@ void dynamic_circle(uint8_t *matrix_32x32, float &x, float &y, float &r, uint8_t const constexpr uint8_t target_z = 32; ///< target z height of the circle const uint8_t blocks = num_points; float shifts_x[blocks]; - float shifts_y[blocks]; - float shifts_r[blocks]; + float shifts_y[blocks]; + float shifts_r[blocks]; // DBG(_n(" [%f, %f][%f] start circle\n"), x, y, r); for (int8_t i = iterations; i > 0; --i){ - + //@size=128B // DBG(_n(" [%f, %f][%f] circle\n"), x, y, r); @@ -903,7 +903,7 @@ uint8_t find_patterns(uint8_t *matrix32, uint16_t *pattern08, uint16_t *pattern1 row = r08; return match08; } - + col = c10; row = r10; return match10; diff --git a/MK404-build.sh b/MK404-build.sh index b574d12efe..8de0544ead 100755 --- a/MK404-build.sh +++ b/MK404-build.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/bash # This bash script is used to compile automatically and run the MK404 simulator -# +# # Supported OS: Linux64 bit # # Linux: @@ -8,7 +8,7 @@ # 1. Follow these instructions # 2. Open Ubuntu bash and get latest updates with 'sudo apt-get update' # 3. Install latest updates with 'sudo apt-get upgrade' -# +# # # Version: 1.0.0-Build_18 # Change log: @@ -91,7 +91,7 @@ echo "$(tput setaf 2)-u$(tput sgr0) Update MK404" echo "$(tput setaf 2)-x$(tput sgr0) Board memory size" echo "$(tput setaf 2)-y$(tput sgr0) Board flash size" echo "$(tput setaf 2)-?$(tput sgr0) Help" -echo +echo echo "Brief USAGE:" echo " $(tput setaf 2)./MK404-build.sh$(tput sgr0) [-c] [-f] [-g] [-m] [-n] [-p] [-u] [-v] [-x] [-h] [-?]" echo @@ -209,7 +209,7 @@ if [ ! -z $mk404_printer_flag ]; then if [ "$mk404_printer_flag" != "$MK404_PRINTER" ]; then echo "$(tput setaf 3)You defined a different printer type than the firmware!" echo "This can cause unexpected issues.$(tput sgr 0)" - echo + echo PS3="Select $(tput setaf 2)printer$(tput sgr 0) you want to use." select which in "$(tput setaf 2)$MK404_PRINTER$(tput sgr 0)" "$mk404_printer_flag"; do case $which in @@ -220,7 +220,7 @@ if [ ! -z $mk404_printer_flag ]; then $mk404_printer_flag) echo "Set $(tput setaf 3)$mk404_printer_flag$(tput sgr 0) as printer" echo "$(tput setaf 3)This firmware file isn't correct for this printer!!!$(tput sgr 0)" - echo + echo MK404_PRINTER=$mk404_printer_flag read -p "Press Enter to continue." break @@ -305,7 +305,7 @@ if [ $TARGET_OS == "linux" ]; then failures 2 fi else - failures 3 + failures 3 fi sleep 2 } @@ -347,7 +347,7 @@ fi } #### End: Check MK404 dependencies -#### Start: Set build environment +#### Start: Set build environment set_build_env_variables() { MK404_SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" @@ -569,7 +569,7 @@ set_build_env_variables output_useful_data get_MK404 -# +# cd $MK404_PATH check_for_updates diff --git a/cmake/Check_lang_size.cmake b/cmake/Check_lang_size.cmake index 5aba2fb1ec..143f1bacc6 100644 --- a/cmake/Check_lang_size.cmake +++ b/cmake/Check_lang_size.cmake @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.18) FILE(SIZE ${LANG_FILE} FILE_SIZE) get_filename_component(FILE_BASE ${LANG_FILE} NAME) MATH(EXPR PADDED_SIZE "((${FILE_SIZE}+256-1) / 256 * 256 )") -MATH(EXPR FREE_SPACE "(${LANG_MAX_SIZE}-${FILE_SIZE})") +MATH(EXPR FREE_SPACE "(${LANG_MAX_SIZE}-${FILE_SIZE})") if(${PADDED_SIZE} GREATER ${LANG_MAX_SIZE}) message(FATAL_ERROR "Language file ${FILE_BASE} (${PADDED_SIZE}b) exceeds maximum allowed size of ${LANG_MAX_SIZE} bytes - Aborting!") else() diff --git a/lang/Community_made_translations.md b/lang/Community_made_translations.md index ca19edd24b..941e097917 100644 --- a/lang/Community_made_translations.md +++ b/lang/Community_made_translations.md @@ -2,7 +2,7 @@ - **Dutch / Nederlands** - Maintainers: **@3d-gussner** and **@vintagepc** - - Co-maintainers: + - Co-maintainers: - Contributors: **@stelgenhof** - [X] **Active** since March 2021 - [X] **Maintained** since September 2019 diff --git a/lang/README.md b/lang/README.md index 5fd4875fb1..7287d491f5 100644 --- a/lang/README.md +++ b/lang/README.md @@ -51,7 +51,7 @@ This step is already performed for you when using ``build.sh`` or ``PF-build.sh` #### How to update `.pot` file -Run +Run python update-pot.py diff --git a/lang/lib/FontGen.py b/lang/lib/FontGen.py index 5e9f30ee57..9166e3bf17 100644 --- a/lang/lib/FontGen.py +++ b/lang/lib/FontGen.py @@ -149,14 +149,14 @@ def __init__(self, utf, charListIndex, alternate = None): def generateLineInTable(index, chars): pixels = chars[FONT_TABLE[index].charListIndex]["PIXELS"].split(',') - + # Generate the rows binary data rows = [] for i in range(8): rows.append(0) for j in range(5): rows[i] |= (1 << (5 - j - 1)) if pixels[j * 8 + i] == "0" else 0 - + # compress the rows data colByte = 0 compressedRows = [] @@ -175,9 +175,9 @@ def generateLineInTable(index, chars): def generateFont(): tree = ET.parse(os.path.join(sys.path[0], "Prusa.lcd")) root = tree.getroot() - + CharList = [Char.attrib for Char in root.iter("CHAR")] - + f = open(os.path.join(sys.path[0], "../../Firmware/FontTable.h"), "w", encoding='utf8') for index in range(len(FONT_TABLE)): f.write(generateLineInTable(index, CharList) + '\n') diff --git a/lang/lib/charset.py b/lang/lib/charset.py index f121563c9b..cdfd9f666e 100644 --- a/lang/lib/charset.py +++ b/lang/lib/charset.py @@ -168,4 +168,4 @@ def unicode_to_source(buf): for c in buf: out += INVERSE_CUSTOM_CHARS.get(c, c) return out - + diff --git a/lib/Catch2/.github/pull_request_template.md b/lib/Catch2/.github/pull_request_template.md index ea2b7bb5fa..17a55b4382 100644 --- a/lib/Catch2/.github/pull_request_template.md +++ b/lib/Catch2/.github/pull_request_template.md @@ -17,7 +17,7 @@ was that you have a large set of tests and found that this speeds them up. --> ## GitHub Issues -