Remove White spaces

This commit is contained in:
3d-gussner 2024-05-20 19:09:03 +02:00
parent e110153ee2
commit 45a223a1f9
110 changed files with 993 additions and 995 deletions

View File

@ -20,13 +20,13 @@ Please, before you create a new bug report, please make sure you searched in ope
**Describe the bug** **Describe the bug**
A clear and concise description of what the bug is. A clear and concise description of what the bug is.
**To Reproduce** **To Reproduce**
Please describe steps to reproduce the behavior. Please describe steps to reproduce the behavior.
**Expected behavior** **Expected behavior**
A clear and concise description of what you expected to happen. A clear and concise description of what you expected to happen.
**G-code** **G-code**
Please attach a G-code. This will make it easier for us to replicate the error. Please attach a G-code. This will make it easier for us to replicate the error.

View File

@ -15,6 +15,6 @@ Enter what type of printer or upgrade the enhancement applies to.
**Is your enhancement related to a problem? Please describe.** **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 [...] A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like** **Describe the solution you'd like**
A clear and concise description of what you want to happen. A clear and concise description of what you want to happen.

View File

@ -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.** **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 [...] A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like** **Describe the solution you'd like**
A clear and concise description of what you want to happen. A clear and concise description of what you want to happen.

View File

@ -17,8 +17,8 @@ jobs:
# Don't ever mark PRs as stale. # Don't ever mark PRs as stale.
days-before-pr-stale: -1 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.' 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.' 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. # Don't act on things assigned to a milestone or assigned to someone.
exempt-all-milestones: true exempt-all-milestones: true
exempt-all-assignees: true exempt-all-assignees: true
enable-statistics: true enable-statistics: true

View File

@ -16,7 +16,7 @@ Help `./PF-build.sh -h`
# MK404 Simulator # MK404 Simulator
## MK404-build.sh ## MK404-build.sh
**MK404 is a community 3d printer simulator created by @vintagepc** **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) Please checkout and support his github repository [MK404](https://github.com/vintagepc/MK404) and the [MK404 Wiki](https://github.com/vintagepc/MK404/wiki)

View File

@ -15,7 +15,7 @@
void SendColors(byte red, byte grn, byte blu) void SendColors(byte red, byte grn, byte blu)
{ {
Wire.begin(); Wire.begin();
Wire.beginTransmission(0x09); Wire.beginTransmission(0x09);
Wire.write('o'); //to disable ongoing script, only needs to be used once Wire.write('o'); //to disable ongoing script, only needs to be used once
Wire.write('n'); Wire.write('n');

View File

@ -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_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->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)); 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 // 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)); 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 // steps per sq second need to be updated to agree with the units per sq second
reset_acceleration_rates(); reset_acceleration_rates();
#ifdef PIDTEMP #ifdef PIDTEMP
updatePID(); updatePID();
#endif//PIDTEMP #endif//PIDTEMP

View File

@ -54,7 +54,7 @@
/** /**
* Auto-report all at once with M155 S<seconds> C[bitmask] with single timer * Auto-report all at once with M155 S<seconds> C[bitmask] with single timer
* *
* bit 0 = Auto-report temperatures * bit 0 = Auto-report temperatures
* bit 1 = Auto-report fans * bit 1 = Auto-report fans
* bit 2 = Auto-report position * bit 2 = Auto-report position
@ -229,7 +229,7 @@
* limit is exceeded. * limit is exceeded.
*/ */
#define SDCARD_SORT_ALPHA //Alphabetical sorting of SD files menu #define SDCARD_SORT_ALPHA //Alphabetical sorting of SD files menu
// SD Card Sorting options // SD Card Sorting options
#ifdef SDCARD_SORT_ALPHA #ifdef SDCARD_SORT_ALPHA
#define SD_SORT_TIME 0 #define SD_SORT_TIME 0
@ -238,11 +238,11 @@
#define INSERTSORT #define INSERTSORT
// #define SORTING_DUMP // #define SORTING_DUMP
// #define SORTING_SPEEDTEST // #define SORTING_SPEEDTEST
#define SDSORT_LIMIT 100 // Maximum number of sorted items (10-256). #define SDSORT_LIMIT 100 // Maximum number of sorted items (10-256).
#define FOLDER_SORTING -1 // -1=above 0=none 1=below #define FOLDER_SORTING -1 // -1=above 0=none 1=below
#endif #endif
#if defined(SDCARD_SORT_ALPHA) #if defined(SDCARD_SORT_ALPHA)
#define HAS_FOLDER_SORTING (FOLDER_SORTING) #define HAS_FOLDER_SORTING (FOLDER_SORTING)
#endif #endif
@ -392,7 +392,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
/** /**
* Enable M120/M121 G-code commands * Enable M120/M121 G-code commands
* *
*/ */
//#define M120_M121_ENABLED //Be careful enabling and using these G-code commands. //#define M120_M121_ENABLED //Be careful enabling and using these G-code commands.

View File

@ -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 <a href="https://reprap.org/wiki/G-code#D3:_Read.2FWrite_EEPROM">D3: Read/Write EEPROM</a> ### D3 - Read/Write EEPROM <a href="https://reprap.org/wiki/G-code#D3:_Read.2FWrite_EEPROM">D3: Read/Write EEPROM</a>
This command can be used without any additional parameters. It will read the entire eeprom. This command can be used without any additional parameters. It will read the entire eeprom.
#### Usage #### Usage
D3 [ A | C | X ] D3 [ A | C | X ]
#### Parameters #### Parameters
- `A` - Address (x0000-x0fff) - `A` - Address (x0000-x0fff)
- `C` - Count (1-4096) - `C` - Count (1-4096)
- `X` - Data (hex) - `X` - Data (hex)
#### Notes #### Notes
- The hex address needs to be lowercase without the 0 before the x - 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 - The hex data needs to be lowercase
*/ */
void dcode_3() void dcode_3()
{ {
@ -203,9 +203,9 @@ extern float axis_steps_per_mm[NUM_AXIS];
/*! /*!
* *
### D-1 - Endless Loop <a href="https://reprap.org/wiki/G-code#G28:_Move_to_Origin_.28Home.29">D-1: Endless Loop</a> ### D-1 - Endless Loop <a href="https://reprap.org/wiki/G-code#G28:_Move_to_Origin_.28Home.29">D-1: Endless Loop</a>
D-1 D-1
* *
*/ */
void dcode__1() void dcode__1()
@ -220,9 +220,9 @@ void dcode__1()
/*! /*!
### D0 - Reset <a href="https://reprap.org/wiki/G-code#D0:_Reset">D0: Reset</a> ### D0 - Reset <a href="https://reprap.org/wiki/G-code#D0:_Reset">D0: Reset</a>
#### Usage #### Usage
D0 [ B ] D0 [ B ]
#### Parameters #### Parameters
- `B` - Bootloader - `B` - Bootloader
*/ */
@ -245,9 +245,9 @@ void dcode_0()
/*! /*!
* *
### D1 - Clear EEPROM and RESET <a href="https://reprap.org/wiki/G-code#D1:_Clear_EEPROM_and_RESET">D1: Clear EEPROM and RESET</a> ### D1 - Clear EEPROM and RESET <a href="https://reprap.org/wiki/G-code#D1:_Clear_EEPROM_and_RESET">D1: Clear EEPROM and RESET</a>
D1 D1
* *
*/ */
void dcode_1() void dcode_1()
@ -287,13 +287,13 @@ void dcode_2()
#ifdef DEBUG_DCODES #ifdef DEBUG_DCODES
/*! /*!
### D4 - Read/Write PIN <a href="https://reprap.org/wiki/G-code#D4:_Read.2FWrite_PIN">D4: Read/Write PIN</a> ### D4 - Read/Write PIN <a href="https://reprap.org/wiki/G-code#D4:_Read.2FWrite_PIN">D4: Read/Write PIN</a>
To read the digital value of a pin you need only to define the pin number. To read the digital value of a pin you need only to define the pin number.
#### Usage #### Usage
D4 [ P | F | V ] D4 [ P | F | V ]
#### Parameters #### Parameters
- `P` - Pin (0-255) - `P` - Pin (0-255)
- `F` - Function in/out (0/1) - `F` - Function in/out (0/1)
@ -335,20 +335,19 @@ void dcode_4()
### D5 - Read/Write FLASH <a href="https://reprap.org/wiki/G-code#D5:_Read.2FWrite_FLASH">D5: Read/Write Flash</a> ### D5 - Read/Write FLASH <a href="https://reprap.org/wiki/G-code#D5:_Read.2FWrite_FLASH">D5: Read/Write Flash</a>
This command can be used without any additional parameters. It will read the 1kb FLASH. This command can be used without any additional parameters. It will read the 1kb FLASH.
#### Usage #### Usage
D5 [ A | C | X | E ] D5 [ A | C | X | E ]
#### Parameters #### Parameters
- `A` - Address (x00000-x3ffff) - `A` - Address (x00000-x3ffff)
- `C` - Count (1-8192) - `C` - Count (1-8192)
- `X` - Data (hex) - `X` - Data (hex)
- `E` - Erase - `E` - Erase
#### Notes #### Notes
- The hex address needs to be lowercase without the 0 before the x - 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 - The hex data needs to be lowercase
*/ */
void dcode_5() void dcode_5()
{ {
@ -457,9 +456,9 @@ void dcode_7()
/*! /*!
### D8 - Read/Write PINDA <a href="https://reprap.org/wiki/G-code#D8:_Read.2FWrite_PINDA">D8: Read/Write PINDA</a> ### D8 - Read/Write PINDA <a href="https://reprap.org/wiki/G-code#D8:_Read.2FWrite_PINDA">D8: Read/Write PINDA</a>
#### Usage #### Usage
D8 [ ? | ! | P | Z ] D8 [ ? | ! | P | Z ]
#### Parameters #### Parameters
- `?` - Read PINDA temperature shift values - `?` - Read PINDA temperature shift values
- `!` - Reset PINDA temperature shift values to default - `!` - Reset PINDA temperature shift values to default
@ -510,11 +509,11 @@ void dcode_8()
/*! /*!
### D9 - Read ADC <a href="https://reprap.org/wiki/G-code#D9:_Read.2FWrite_ADC">D9: Read ADC</a> ### D9 - Read ADC <a href="https://reprap.org/wiki/G-code#D9:_Read.2FWrite_ADC">D9: Read ADC</a>
#### Usage #### Usage
D9 [ I | V ] D9 [ I | V ]
#### Parameters #### Parameters
- `I` - ADC channel index - `I` - ADC channel index
- `0` - Heater 0 temperature - `0` - Heater 0 temperature
- `1` - Heater 1 temperature - `1` - Heater 1 temperature
- `2` - Bed temperature - `2` - Bed temperature
@ -618,9 +617,9 @@ void dcode_12()
### D80 - Bed check <a href="https://reprap.org/wiki/G-code#D80:_Bed_check">D80: Bed check</a> ### D80 - Bed check <a href="https://reprap.org/wiki/G-code#D80:_Bed_check">D80: Bed check</a>
This command will log data to SD card file "mesh.txt". This command will log data to SD card file "mesh.txt".
#### Usage #### Usage
D80 [ E | F | G | H | I | J ] D80 [ E | F | G | H | I | J ]
#### Parameters #### Parameters
- `E` - Dimension X (default 40) - `E` - Dimension X (default 40)
- `F` - Dimention Y (default 40) - `F` - Dimention Y (default 40)
@ -658,9 +657,9 @@ void dcode_80()
### D81 - Bed analysis <a href="https://reprap.org/wiki/G-code#D81:_Bed_analysis">D80: Bed analysis</a> ### D81 - Bed analysis <a href="https://reprap.org/wiki/G-code#D81:_Bed_analysis">D80: Bed analysis</a>
This command will log data to SD card file "wldsd.txt". This command will log data to SD card file "wldsd.txt".
#### Usage #### Usage
D81 [ E | F | G | H | I | J ] D81 [ E | F | G | H | I | J ]
#### Parameters #### Parameters
- `E` - Dimension X (default 40) - `E` - Dimension X (default 40)
- `F` - Dimention Y (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("H")) { strchr_pointer+=1; points_y = code_value(); }
if (code_seen("I")) { strchr_pointer+=1; offset_x = code_value(); } if (code_seen("I")) { strchr_pointer+=1; offset_x = code_value(); }
if (code_seen("J")) { strchr_pointer+=1; offset_y = 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); bed_analysis(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
} }
#endif //HEATBED_ANALYSIS #endif //HEATBED_ANALYSIS
@ -713,11 +712,11 @@ extern void st_synchronize();
/*! /*!
### D2130 - Trinamic stepper controller <a href="https://reprap.org/wiki/G-code#D2130:_Trinamic_stepper_controller">D2130: Trinamic stepper controller</a> ### D2130 - Trinamic stepper controller <a href="https://reprap.org/wiki/G-code#D2130:_Trinamic_stepper_controller">D2130: Trinamic stepper controller</a>
@todo Please review by owner of the code. RepRap Wiki Gcode needs to be updated after review of owner as well. @todo Please review by owner of the code. RepRap Wiki Gcode needs to be updated after review of owner as well.
#### Usage #### Usage
D2130 [ Axis | Command | Subcommand | Value ] D2130 [ Axis | Command | Subcommand | Value ]
#### Parameters #### Parameters
- Axis - Axis
- `X` - X stepper driver - `X` - X stepper driver
@ -746,21 +745,21 @@ extern void st_synchronize();
- `0, 180 --> 250` - Off - `0, 180 --> 250` - Off
- `0.9 --> 1.25` - Valid values (recommended is 1.1) - `0.9 --> 1.25` - Valid values (recommended is 1.1)
- `@` - Home calibrate axis - `@` - Home calibrate axis
Examples: Examples:
D2130E?wave D2130E?wave
Print extruder microstep linearity compensation curve Print extruder microstep linearity compensation curve
D2130E!wave0 D2130E!wave0
Disable extruder linearity compensation curve, (sine curve is used) Disable extruder linearity compensation curve, (sine curve is used)
D2130E!wave220 D2130E!wave220
(sin(x))^1.1 extruder microstep compensation curve used (sin(x))^1.1 extruder microstep compensation curve used
Notes: Notes:
For more information see https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2130_datasheet.pdf 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 <a href="https://reprap.org/wiki/G-code#D9:_Read.2FWrite_ADC">D9125: PAT9125 filament sensor</a> ### D9125 - PAT9125 filament sensor <a href="https://reprap.org/wiki/G-code#D9:_Read.2FWrite_ADC">D9125: PAT9125 filament sensor</a>
#### Usage #### Usage
D9125 [ ? | ! | R | X | Y | L ] D9125 [ ? | ! | R | X | Y | L ]
#### Parameters #### Parameters
- `?` - Print values - `?` - Print values
- `!` - Print values - `!` - Print values

View File

@ -21,7 +21,7 @@ public:
}; };
/// Base class Filament sensor /// Base class Filament sensor
/// ///
/// Ideally, there could have been a nice class hierarchy of filament sensor types with common functionality /// Ideally, there could have been a nice class hierarchy of filament sensor types with common functionality
/// extracted into this base class. /// extracted into this base class.
/// But: /// But:
@ -37,43 +37,43 @@ public:
ready, ready,
error, error,
}; };
enum class SensorActionOnError : uint8_t { enum class SensorActionOnError : uint8_t {
_Continue = 0, _Continue = 0,
_Pause = 1, _Pause = 1,
_Undef = EEPROM_EMPTY_VALUE _Undef = EEPROM_EMPTY_VALUE
}; };
static void setEnabled(bool enabled); static void setEnabled(bool enabled);
void setAutoLoadEnabled(bool state, bool updateEEPROM = false); void setAutoLoadEnabled(bool state, bool updateEEPROM = false);
bool getAutoLoadEnabled() const { return autoLoadEnabled; } bool getAutoLoadEnabled() const { return autoLoadEnabled; }
void setRunoutEnabled(bool state, bool updateEEPROM = false); void setRunoutEnabled(bool state, bool updateEEPROM = false);
bool getRunoutEnabled() const { return runoutEnabled; } bool getRunoutEnabled() const { return runoutEnabled; }
void setActionOnError(SensorActionOnError state, bool updateEEPROM = false); void setActionOnError(SensorActionOnError state, bool updateEEPROM = false);
SensorActionOnError getActionOnError() const { return sensorActionOnError; } SensorActionOnError getActionOnError() const { return sensorActionOnError; }
bool getFilamentLoadEvent() const { return postponedLoadEvent; } bool getFilamentLoadEvent() const { return postponedLoadEvent; }
bool isError() const { return state == State::error; } bool isError() const { return state == State::error; }
bool isReady() const { return state == State::ready; } bool isReady() const { return state == State::ready; }
bool isEnabled() const { return state != State::disabled; } bool isEnabled() const { return state != State::disabled; }
protected: protected:
void settings_init_common(); void settings_init_common();
bool checkFilamentEvents(); bool checkFilamentEvents();
void triggerFilamentInserted(); void triggerFilamentInserted();
void triggerFilamentRemoved(); void triggerFilamentRemoved();
void filRunout(); void filRunout();
void triggerError(); void triggerError();
State state; State state;
bool autoLoadEnabled; bool autoLoadEnabled;
bool runoutEnabled; bool runoutEnabled;
@ -109,37 +109,37 @@ public:
void init(); void init();
bool update(); bool update();
void voltUpdate(uint16_t raw); void voltUpdate(uint16_t raw);
uint16_t __attribute__((noinline)) getVoltRaw(); uint16_t __attribute__((noinline)) getVoltRaw();
enum class SensorRevision : uint8_t { enum class SensorRevision : uint8_t {
_Old = 0, _Old = 0,
_Rev04 = 1, _Rev04 = 1,
_Undef = EEPROM_EMPTY_VALUE _Undef = EEPROM_EMPTY_VALUE
}; };
SensorRevision getSensorRevision() const { return sensorRevision; } SensorRevision getSensorRevision() const { return sensorRevision; }
const char* __attribute__((noinline)) getIRVersionText(); const char* __attribute__((noinline)) getIRVersionText();
void setSensorRevision(SensorRevision rev, bool updateEEPROM = false); 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_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_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_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_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 constexpr static uint16_t IRsensor_VMax_TRESHOLD = Voltage2Raw(5.F); // ~5V, raw value=16368
private: private:
SensorRevision sensorRevision; SensorRevision sensorRevision;
bool voltReady; // set by the adc ISR, therefore avoid accessing the variable directly but use getVoltReady() bool voltReady; // set by the adc ISR, therefore avoid accessing the variable directly but use getVoltReady()
bool getVoltReady()const; bool getVoltReady()const;
void clearVoltReady(); void clearVoltReady();
uint16_t voltRaw; // set by the adc ISR, therefore avoid accessing the variable directly but use getVoltRaw() uint16_t voltRaw; // set by the adc ISR, therefore avoid accessing the variable directly but use getVoltRaw()
bool checkVoltage(uint16_t raw); bool checkVoltage(uint16_t raw);
uint16_t minVolt = Voltage2Raw(6.F); uint16_t minVolt = Voltage2Raw(6.F);
uint16_t maxVolt = 0; uint16_t maxVolt = 0;
uint16_t nFSCheckCount; uint16_t nFSCheckCount;
@ -165,14 +165,14 @@ public:
#ifdef FSENSOR_PROBING #ifdef FSENSOR_PROBING
bool probeOtherType(); //checks if the wrong fsensor type is detected. bool probeOtherType(); //checks if the wrong fsensor type is detected.
#endif #endif
void setJamDetectionEnabled(bool state, bool updateEEPROM = false); void setJamDetectionEnabled(bool state, bool updateEEPROM = false);
bool getJamDetectionEnabled() const { return jamDetection; } bool getJamDetectionEnabled() const { return jamDetection; }
void stStep(bool rev) { //from stepper isr void stStep(bool rev) { //from stepper isr
stepCount += rev ? -1 : 1; stepCount += rev ? -1 : 1;
} }
void settings_init(); void settings_init();
private: private:
static constexpr uint16_t pollingPeriod = 10; //[ms] static constexpr uint16_t pollingPeriod = 10; //[ms]
@ -180,23 +180,23 @@ private:
ShortTimer pollingTimer; ShortTimer pollingTimer;
uint8_t filter; uint8_t filter;
uint8_t filterFilPresent; uint8_t filterFilPresent;
bool jamDetection; bool jamDetection;
int16_t oldPos; int16_t oldPos;
int16_t stepCount; int16_t stepCount;
int16_t chunkSteps; int16_t chunkSteps;
uint8_t jamErrCnt; uint8_t jamErrCnt;
constexpr void calcChunkSteps(float u) { constexpr void calcChunkSteps(float u) {
chunkSteps = (int16_t)(1.25 * u); //[mm] chunkSteps = (int16_t)(1.25 * u); //[mm]
} }
int16_t getStepCount(); int16_t getStepCount();
void resetStepCount(); void resetStepCount();
void filJam(); void filJam();
bool updatePAT9125(); bool updatePAT9125();
}; };
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125) #endif //(FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)

View File

@ -136,7 +136,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_y() ; #define disable_y() ;
#endif #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) #if defined(Z_AXIS_ALWAYS_ON)
#ifdef Z_DUAL_STEPPER_DRIVERS #ifdef Z_DUAL_STEPPER_DRIVERS
#define poweron_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); } #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(); 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. // but it keeps the background tasks running.
extern void delay_keep_alive(unsigned int ms); extern void delay_keep_alive(unsigned int ms);

View File

@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified 23 November 2006 by David A. Mellis Modified 23 November 2006 by David A. Mellis
Modified 28 September 2010 by Mark Sproul Modified 28 September 2010 by Mark Sproul
*/ */
@ -26,7 +26,7 @@
uint8_t selectedSerialPort = 0; uint8_t selectedSerialPort = 0;
#ifndef AT90USB #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 // 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) #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_RXENx);
sbi(M_UCSRxB, M_TXENx); sbi(M_UCSRxB, M_TXENx);
sbi(M_UCSRxB, M_RXCIEx); 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) { if (useU2X) {
UCSR1A = 1 << U2X1; UCSR1A = 1 << U2X1;
baud_setting = (F_CPU / 4 / baud - 1) / 2; 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) // assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
UBRR1H = baud_setting >> 8; UBRR1H = baud_setting >> 8;
UBRR1L = baud_setting; UBRR1L = baud_setting;
sbi(UCSR1B, RXEN1); sbi(UCSR1B, RXEN1);
sbi(UCSR1B, TXEN1); sbi(UCSR1B, TXEN1);
sbi(UCSR1B, RXCIE1); sbi(UCSR1B, RXCIE1);
@ -250,7 +250,7 @@ void MarlinSerial::print(double n, int digits)
void MarlinSerial::println(void) void MarlinSerial::println(void)
{ {
// print('\r'); // print('\r');
print('\n'); print('\n');
} }
/*void MarlinSerial::println(const String &s) /*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) 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; uint8_t i = 0;
if (n == 0) { if (n == 0) {
print('0'); print('0');
return; return;
} }
while (n > 0) { while (n > 0) {
buf[i++] = n % base; buf[i++] = n % base;
@ -330,8 +330,8 @@ void MarlinSerial::printNumber(unsigned long n, uint8_t base)
'A' + buf[i - 1] - 10)); 'A' + buf[i - 1] - 10));
} }
void MarlinSerial::printFloat(double number, uint8_t digits) void MarlinSerial::printFloat(double number, uint8_t digits)
{ {
// Handle negative numbers // Handle negative numbers
if (number < 0.0) if (number < 0.0)
{ {
@ -343,7 +343,7 @@ void MarlinSerial::printFloat(double number, uint8_t digits)
double rounding = 0.5; double rounding = 0.5;
for (uint8_t i=0; i<digits; ++i) for (uint8_t i=0; i<digits; ++i)
rounding /= 10.0; rounding /= 10.0;
number += rounding; number += rounding;
// Extract the integer part of the number and print it // Extract the integer part of the number and print it
@ -353,7 +353,7 @@ void MarlinSerial::printFloat(double number, uint8_t digits)
// Print the decimal point, but only if there are digits beyond // Print the decimal point, but only if there are digits beyond
if (digits > 0) if (digits > 0)
print('.'); print('.');
// Extract digits from the remainder one at a time // Extract digits from the remainder one at a time
while (digits-- > 0) while (digits-- > 0)
@ -361,8 +361,8 @@ void MarlinSerial::printFloat(double number, uint8_t digits)
remainder *= 10.0; remainder *= 10.0;
int toPrint = int(remainder); int toPrint = int(remainder);
print(toPrint); print(toPrint);
remainder -= toPrint; remainder -= toPrint;
} }
} }
// Preinstantiate Objects ////////////////////////////////////////////////////// // Preinstantiate Objects //////////////////////////////////////////////////////

View File

@ -23,7 +23,7 @@
#define MarlinSerial_h #define MarlinSerial_h
#include "Marlin.h" #include "Marlin.h"
#if !defined(SERIAL_PORT) #if !defined(SERIAL_PORT)
#define SERIAL_PORT 0 #define SERIAL_PORT 0
#endif #endif
@ -34,7 +34,7 @@
(SERIAL_PORT == 3 && defined(UBRR3H))) (SERIAL_PORT == 3 && defined(UBRR3H)))
#define HAS_UART #define HAS_UART
#endif #endif
// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor // 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) // requires two levels of indirection to expand macro values properly)
#if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary #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) #define SERIAL_REGNAME(registerbase,number,suffix) _REGNAME(registerbase, number, suffix)
#endif #endif
// Registers used by MarlinSerial class (these are expanded // Registers used by MarlinSerial class (these are expanded
// depending on selected serial port // 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_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_UCSRxB SERIAL_REGNAME(UCSR,SERIAL_PORT,B)
#define M_RXENx SERIAL_REGNAME(RXEN,SERIAL_PORT,) #define M_RXENx SERIAL_REGNAME(RXEN,SERIAL_PORT,)
#define M_TXENx SERIAL_REGNAME(TXEN,SERIAL_PORT,) #define M_TXENx SERIAL_REGNAME(TXEN,SERIAL_PORT,)
#define M_RXCIEx SERIAL_REGNAME(RXCIE,SERIAL_PORT,) #define M_RXCIEx SERIAL_REGNAME(RXCIE,SERIAL_PORT,)
#define M_UDREx SERIAL_REGNAME(UDRE,SERIAL_PORT,) #define M_UDREx SERIAL_REGNAME(UDRE,SERIAL_PORT,)
#define M_UDRx SERIAL_REGNAME(UDR,SERIAL_PORT,) #define M_UDRx SERIAL_REGNAME(UDR,SERIAL_PORT,)
#define M_UBRRxH SERIAL_REGNAME(UBRR,SERIAL_PORT,H) #define M_UBRRxH SERIAL_REGNAME(UBRR,SERIAL_PORT,H)
#define M_UBRRxL SERIAL_REGNAME(UBRR,SERIAL_PORT,L) #define M_UBRRxL SERIAL_REGNAME(UBRR,SERIAL_PORT,L)
#define M_RXCx SERIAL_REGNAME(RXC,SERIAL_PORT,) #define M_RXCx SERIAL_REGNAME(RXC,SERIAL_PORT,)
@ -97,7 +97,7 @@ class MarlinSerial //: public Stream
static int peek(void); static int peek(void);
static int read(void); static int read(void);
static void flush(void); static void flush(void);
static /*FORCE_INLINE*/ int available(void) static /*FORCE_INLINE*/ int available(void)
{ {
return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE; 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; UDR1 = c;
} }
} }
static void checkRx(void) static void checkRx(void)
{ {
if (selectedSerialPort == 0) { if (selectedSerialPort == 0) {
@ -177,15 +177,15 @@ class MarlinSerial //: public Stream
} }
} }
} }
private: private:
static void printNumber(unsigned long, uint8_t); static void printNumber(unsigned long, uint8_t);
static void printFloat(double, uint8_t); static void printFloat(double, uint8_t);
public: public:
static /*FORCE_INLINE*/ void write(const char *str) static /*FORCE_INLINE*/ void write(const char *str)
{ {
while (*str) while (*str)
@ -205,7 +205,7 @@ class MarlinSerial //: public Stream
write(s[i]); write(s[i]);
} }
}*/ }*/
static FORCE_INLINE void print(const char *str) static FORCE_INLINE void print(const char *str)
{ {
write(str); write(str);

View File

@ -341,9 +341,9 @@ class AutoReportFeatures {
uint8_t auto_report_period; uint8_t auto_report_period;
public: public:
LongTimer auto_report_timer; LongTimer auto_report_timer;
AutoReportFeatures():auto_report_period(0){ AutoReportFeatures():auto_report_period(0){
#if defined(AUTO_REPORT) #if defined(AUTO_REPORT)
arFunctionsActive.byte = 0xff; arFunctionsActive.byte = 0xff;
#else #else
arFunctionsActive.byte = 0; arFunctionsActive.byte = 0;
#endif //AUTO_REPORT #endif //AUTO_REPORT
@ -850,7 +850,7 @@ void lcd_splash()
} }
void factory_reset() void factory_reset()
{ {
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
if (!READ(BTN_ENC)) if (!READ(BTN_ENC))
@ -1296,12 +1296,12 @@ void setup()
SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE); SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
//lcd_update_enable(false); // why do we need this?? - andre //lcd_update_enable(false); // why do we need this?? - andre
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate) // 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(); 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 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(); previous_settings_retrieved = Config_RetrieveSettings();
} }
else { //printer version was changed so use default settings else { //printer version was changed so use default settings
Config_ResetDefault(); Config_ResetDefault();
} }
@ -1535,22 +1535,22 @@ void setup()
check_if_fw_is_on_right_printer(); check_if_fw_is_on_right_printer();
#endif //defined(FILAMENT_SENSOR) && defined(FSENSOR_PROBING) #endif //defined(FILAMENT_SENSOR) && defined(FSENSOR_PROBING)
#if 0 #if 0
show_fw_version_warnings(); show_fw_version_warnings();
#endif #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 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 //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)); lcd_show_fullscreen_message_and_wait_P(_T(MSG_CHANGED_MOTHERBOARD));
eeprom_write_word_notify((uint16_t*)EEPROM_BOARD_TYPE, MOTHERBOARD); eeprom_write_word_notify((uint16_t*)EEPROM_BOARD_TYPE, MOTHERBOARD);
break; break;
case(0b10): case(0b10):
lcd_show_fullscreen_message_and_wait_P(_T(MSG_CHANGED_PRINTER)); lcd_show_fullscreen_message_and_wait_P(_T(MSG_CHANGED_PRINTER));
eeprom_write_word_notify((uint16_t*)EEPROM_PRINTER_TYPE, PRINTER_TYPE); eeprom_write_word_notify((uint16_t*)EEPROM_PRINTER_TYPE, PRINTER_TYPE);
break; break;
case(0b11): case(0b11):
lcd_show_fullscreen_message_and_wait_P(_T(MSG_CHANGED_BOTH)); 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_PRINTER_TYPE, PRINTER_TYPE);
eeprom_write_word_notify((uint16_t*)EEPROM_BOARD_TYPE, MOTHERBOARD); 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)); 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){ if (uvlo_auto_recovery_ready){
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
puts_P(_N("Automatic recovery!")); puts_P(_N("Automatic recovery!"));
#endif //DEBUG_UVLO_AUTOMATIC_RECOVER #endif //DEBUG_UVLO_AUTOMATIC_RECOVER
recover_print(1); recover_print(1);
} else { } else {
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
puts_P(_N("Normal recovery!")); puts_P(_N("Normal recovery!"));
#endif //DEBUG_UVLO_AUTOMATIC_RECOVER #endif //DEBUG_UVLO_AUTOMATIC_RECOVER
if (saved_printing_type == PowerPanic::PRINT_TYPE_HOST) { if (saved_printing_type == PowerPanic::PRINT_TYPE_HOST) {
recover_print(0); recover_print(0);
@ -1802,7 +1802,7 @@ void loop()
{ {
//we read byte-by byte //we read byte-by byte
serial_read_stream(); serial_read_stream();
} }
else else
#endif #endif
{ {
@ -1869,7 +1869,7 @@ void loop()
sei(); 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(); cli();
*ptr ++ = CMDBUFFER_CURRENT_TYPE_TO_BE_REMOVED; *ptr ++ = CMDBUFFER_CURRENT_TYPE_TO_BE_REMOVED;
// and one for each command to previous block in the planner queue. // and one for each command to previous block in the planner queue.
@ -2125,7 +2125,7 @@ inline void gcode_M900() {
bool check_commands() { bool check_commands() {
bool end_command_found = false; bool end_command_found = false;
while (buflen) while (buflen)
{ {
if ((code_seen_P(MSG_M84)) || (code_seen_P(PSTR("M 84")))) end_command_found = true; 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; cmdbuffer_front_already_processed = false;
} }
return end_command_found; return end_command_found;
} }
/// @brief Safely move Z-axis by distance delta (mm) /// @brief Safely move Z-axis by distance delta (mm)
@ -2374,7 +2374,7 @@ void homeaxis(uint8_t axis, uint8_t cnt)
{ {
#ifdef TMC2130 #ifdef TMC2130
FORCE_HIGH_POWER_START; FORCE_HIGH_POWER_START;
#endif #endif
int axis_home_dir = home_dir(axis); int axis_home_dir = home_dir(axis);
current_position[axis] = 0; current_position[axis] = 0;
plan_set_position_curposXYZE(); plan_set_position_curposXYZE();
@ -2406,7 +2406,7 @@ void homeaxis(uint8_t axis, uint8_t cnt)
axis_known_position[axis] = true; axis_known_position[axis] = true;
#ifdef TMC2130 #ifdef TMC2130
FORCE_HIGH_POWER_END; FORCE_HIGH_POWER_END;
#endif #endif
} }
enable_endstops(endstops_enabled); 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 */ #endif /* QUICK_HOME */
#ifdef TMC2130 #ifdef TMC2130
if(home_x) if(home_x)
{ {
if (!calib) if (!calib)
@ -3168,7 +3168,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
#endif // TMC2130 #endif // TMC2130
FORCE_BL_ON_START; FORCE_BL_ON_START;
// Only Z calibration? // Only Z calibration?
if (!onlyZ) if (!onlyZ)
{ {
@ -3210,7 +3210,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
if (lcd_calibrate_z_end_stop_manual(onlyZ)) if (lcd_calibrate_z_end_stop_manual(onlyZ))
{ {
#endif //TMC2130 #endif //TMC2130
lcd_show_fullscreen_message_and_wait_P(_T(MSG_CONFIRM_NOZZLE_CLEAN)); lcd_show_fullscreen_message_and_wait_P(_T(MSG_CONFIRM_NOZZLE_CLEAN));
if(onlyZ){ if(onlyZ){
lcd_display_message_fullscreen_P(_T(MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1)); 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_display_message_fullscreen_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1));
lcd_puts_at_P(0,3,_n("1/4")); lcd_puts_at_P(0,3,_n("1/4"));
} }
bool endstops_enabled = enable_endstops(false); bool endstops_enabled = enable_endstops(false);
raise_z(-1); raise_z(-1);
@ -3315,7 +3315,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40); plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40);
st_synchronize(); st_synchronize();
// if (result >= 0) babystep_apply(); // if (result >= 0) babystep_apply();
#endif //HEATBED_V2 #endif //HEATBED_V2
} }
//#endif //NEW_XYZCAL //#endif //NEW_XYZCAL
@ -3738,7 +3738,7 @@ static void gcode_PRUSA_BadRAMBoFanTest(){
if( tach1max < tachMeasure ) if( tach1max < tachMeasure )
tach1max = tachMeasure; tach1max = tachMeasure;
//printf_P(PSTR("TACH_1: %d: capacitor check time=%lu us\n"), (int)tach1cntr, 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); //printf_P(PSTR("TACH_1: max=%lu us\n"), tach1max);
SERIAL_PROTOCOLPGM("RAMBo FAN "); SERIAL_PROTOCOLPGM("RAMBo FAN ");
if( tach1max > 500 ){ if( tach1max > 500 ){
@ -4383,7 +4383,7 @@ void process_commands()
- `S` - Time to wait, in seconds - `S` - Time to wait, in seconds
*/ */
case 4: case 4:
codenum = 0; codenum = 0;
if(code_seen('P')) codenum = code_value(); // milliseconds to wait if(code_seen('P')) codenum = code_value(); // milliseconds to wait
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
@ -4410,7 +4410,7 @@ void process_commands()
### G10 - Retract <a href="https://reprap.org/wiki/G-code#G10:_Retract">G10: Retract</a> ### G10 - Retract <a href="https://reprap.org/wiki/G-code#G10:_Retract">G10: Retract</a>
Retracts filament according to settings of `M207` Retracts filament according to settings of `M207`
*/ */
case 10: case 10:
#if EXTRUDERS > 1 #if EXTRUDERS > 1
retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1); // checks for swap retract argument retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1); // checks for swap retract argument
retract(true,retracted_swap[active_extruder]); retract(true,retracted_swap[active_extruder]);
@ -4424,7 +4424,7 @@ void process_commands()
### G11 - Retract recover <a href="https://reprap.org/wiki/G-code#G11:_Unretract">G11: Unretract</a> ### G11 - Retract recover <a href="https://reprap.org/wiki/G-code#G11:_Unretract">G11: Unretract</a>
Unretracts/recovers filament according to settings of `M208` Unretracts/recovers filament according to settings of `M208`
*/ */
case 11: case 11:
#if EXTRUDERS > 1 #if EXTRUDERS > 1
retract(false,retracted_swap[active_extruder]); retract(false,retracted_swap[active_extruder]);
#else #else
@ -4438,7 +4438,7 @@ void process_commands()
### G21 - Sets Units to Millimters <a href="https://reprap.org/wiki/G-code#G21:_Set_Units_to_Millimeters">G21: Set Units to Millimeters</a> ### G21 - Sets Units to Millimters <a href="https://reprap.org/wiki/G-code#G21:_Set_Units_to_Millimeters">G21: Set Units to Millimeters</a>
Units are in millimeters. Prusa doesn't support inches. Units are in millimeters. Prusa doesn't support inches.
*/ */
case 21: case 21:
break; //Doing nothing. This is just to prevent serial UNKOWN warnings. 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 - `W` - Suppress mesh bed leveling if `X`, `Y` or `Z` are not provided
- `C` - Calibrate X and Y origin (home) - Only on MK3/s - `C` - Calibrate X and Y origin (home) - Only on MK3/s
*/ */
case 28: case 28:
{ {
long home_x_value = 0; long home_x_value = 0;
long home_y_value = 0; long home_y_value = 0;
@ -4489,7 +4489,7 @@ void process_commands()
See `G81` See `G81`
*/ */
case 29: case 29:
{ {
#if Z_MIN_PIN == -1 #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." #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 <a href="https://reprap.org/wiki/G-code#G30:_Single_Z-Probe">G30: Single Z-Probe</a> ### G30 - Single Z Probe <a href="https://reprap.org/wiki/G-code#G30:_Single_Z-Probe">G30: Single Z-Probe</a>
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code. In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
*/ */
case 30: case 30:
{ {
st_synchronize(); st_synchronize();
// TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly // 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 <a href="https://reprap.org/wiki/G-code#G31:_Dock_Z_Probe_sled">G31: Dock Z Probe sled</a> ### G31 - Dock the sled <a href="https://reprap.org/wiki/G-code#G31:_Dock_Z_Probe_sled">G31: Dock Z Probe sled</a>
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code. 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); dock_sled(true);
break; break;
@ -4672,7 +4672,7 @@ void process_commands()
### G32 - Undock the sled <a href="https://reprap.org/wiki/G-code#G32:_Undock_Z_Probe_sled">G32: Undock Z Probe sled</a> ### G32 - Undock the sled <a href="https://reprap.org/wiki/G-code#G32:_Undock_Z_Probe_sled">G32: Undock Z Probe sled</a>
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code. 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); dock_sled(false);
break; break;
#endif // Z_PROBE_SLED #endif // Z_PROBE_SLED
@ -4685,7 +4685,7 @@ void process_commands()
Sensor must be over the bed. Sensor must be over the bed.
The maximum travel distance before an error is triggered is 10mm. The maximum travel distance before an error is triggered is 10mm.
*/ */
case 30: case 30:
{ {
st_synchronize(); st_synchronize();
homing_flag = true; homing_flag = true;
@ -4703,7 +4703,7 @@ void process_commands()
homing_flag = false; homing_flag = false;
} }
break; break;
/*! /*!
### G75 - Print temperature interpolation <a href="https://reprap.org/wiki/G-code#G75:_Print_temperature_interpolation">G75: Print temperature interpolation</a> ### G75 - Print temperature interpolation <a href="https://reprap.org/wiki/G-code#G75:_Print_temperature_interpolation">G75: Print temperature interpolation</a>
Show/print PINDA temperature interpolating. Show/print PINDA temperature interpolating.
@ -4738,7 +4738,7 @@ void process_commands()
echo PINDA temperature -- Z shift (mm): 0.--- echo PINDA temperature -- Z shift (mm): 0.---
``` ```
*/ */
case 76: case 76:
{ {
#ifdef PINDA_THERMISTOR #ifdef PINDA_THERMISTOR
if (!has_temperature_compensation()) if (!has_temperature_compensation())
@ -4917,12 +4917,12 @@ void process_commands()
current_position[Z_AXIS] = PINDA_PREHEAT_Z; current_position[Z_AXIS] = PINDA_PREHEAT_Z;
plan_buffer_line_curposXYZE(3000 / 60); plan_buffer_line_curposXYZE(3000 / 60);
st_synchronize(); st_synchronize();
while (fabs(degBed() - PINDA_MIN_T) > 1) { while (fabs(degBed() - PINDA_MIN_T) > 1) {
delay_keep_alive(1000); delay_keep_alive(1000);
serialecho_temperatures(); serialecho_temperatures();
} }
//enquecommand_P(PSTR("M190 S50")); //enquecommand_P(PSTR("M190 S50"));
for (int i = 0; i < PINDA_HEAT_T; i++) { for (int i = 0; i < PINDA_HEAT_T; i++) {
delay_keep_alive(1000); delay_keep_alive(1000);
@ -4937,7 +4937,7 @@ void process_commands()
current_position[Y_AXIS] = BED_Y0; current_position[Y_AXIS] = BED_Y0;
plan_buffer_line_curposXYZE(3000 / 60); plan_buffer_line_curposXYZE(3000 / 60);
st_synchronize(); st_synchronize();
find_bed_induction_sensor_point_z(-1.f); find_bed_induction_sensor_point_z(-1.f);
zero_z = current_position[Z_AXIS]; 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); 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); eeprom_update_word_notify((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + i, z_shift);
} }
custom_message_type = CustomMsg::Status; custom_message_type = CustomMsg::Status;
@ -4989,9 +4989,9 @@ void process_commands()
lcd_show_fullscreen_message_and_wait_P(_T(MSG_PINDA_CALIBRATION_DONE)); lcd_show_fullscreen_message_and_wait_P(_T(MSG_PINDA_CALIBRATION_DONE));
eeprom_update_byte_notify((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 1); eeprom_update_byte_notify((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 1);
lcd_update_enable(true); lcd_update_enable(true);
lcd_update(2); lcd_update(2);
#endif //PINDA_THERMISTOR #endif //PINDA_THERMISTOR
} }
break; break;
@ -5323,7 +5323,7 @@ void process_commands()
/*! /*!
### M22 - Release SD card <a href="https://reprap.org/wiki/G-code#M22:_Release_SD_card">M22: Release SD card</a> ### M22 - Release SD card <a href="https://reprap.org/wiki/G-code#M22:_Release_SD_card">M22: Release SD card</a>
*/ */
case 22: case 22:
card.release(); card.release();
break; break;
@ -5334,7 +5334,7 @@ void process_commands()
M23 [filename] M23 [filename]
*/ */
case 23: case 23:
card.openFileReadFilteredGcode(strchr_pointer + 4, true); card.openFileReadFilteredGcode(strchr_pointer + 4, true);
break; break;
@ -5381,7 +5381,7 @@ void process_commands()
#### Parameters #### Parameters
- `S` - Index in bytes - `S` - Index in bytes
*/ */
case 26: case 26:
if(card.mounted && code_seen('S')) { if(card.mounted && code_seen('S')) {
long index = code_value_long(); long index = code_value_long();
card.setIndex(index); card.setIndex(index);
@ -5407,7 +5407,7 @@ void process_commands()
/*! /*!
### M28 - Start SD write <a href="https://reprap.org/wiki/G-code#M28:_Begin_write_to_SD_card">M28: Begin write to SD card</a> ### M28 - Start SD write <a href="https://reprap.org/wiki/G-code#M28:_Begin_write_to_SD_card">M28: Begin write to SD card</a>
*/ */
case 28: case 28:
card.openFileWrite(strchr_pointer+4); card.openFileWrite(strchr_pointer+4);
break; break;
@ -5494,7 +5494,7 @@ void process_commands()
M928 [filename] M928 [filename]
*/ */
case 928: case 928:
card.openLogFile(strchr_pointer+5); card.openLogFile(strchr_pointer+5);
break; break;
@ -5621,10 +5621,10 @@ void process_commands()
SERIAL_PROTOCOL('.'); SERIAL_PROTOCOL('.');
SERIAL_PROTOCOLLN(uint8_t(ip[3])); SERIAL_PROTOCOLLN(uint8_t(ip[3]));
} else { } else {
SERIAL_PROTOCOLPGM("?Toshiba FlashAir GetIP failed\n"); SERIAL_PROTOCOLPGM("?Toshiba FlashAir GetIP failed\n");
} }
} else { } else {
SERIAL_PROTOCOLLNPGM("n/a"); SERIAL_PROTOCOLLNPGM("n/a");
} }
break; break;
} }
@ -5677,7 +5677,7 @@ void process_commands()
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
#ifdef Z_PROBE_REPEATABILITY_TEST #ifdef Z_PROBE_REPEATABILITY_TEST
/*! /*!
### M48 - Z-Probe repeatability measurement function <a href="https://reprap.org/wiki/G-code#M48:_Measure_Z-Probe_repeatability">M48: Measure Z-Probe repeatability</a> ### M48 - Z-Probe repeatability measurement function <a href="https://reprap.org/wiki/G-code#M48:_Measure_Z-Probe_repeatability">M48: Measure Z-Probe repeatability</a>
@ -5703,14 +5703,14 @@ void process_commands()
#error "You must have a Z_MIN endstop in order to enable calculation of Z-Probe repeatability." #error "You must have a Z_MIN endstop in order to enable calculation of Z-Probe repeatability."
#endif #endif
double sum=0.0; double sum=0.0;
double mean=0.0; double mean=0.0;
double sigma=0.0; double sigma=0.0;
double sample_set[50]; double sample_set[50];
int verbose_level=1, n=0, j, n_samples = 10, n_legs=0; int verbose_level=1, n=0, j, n_samples = 10, n_legs=0;
double X_current, Y_current, Z_current; double X_current, Y_current, Z_current;
double X_probe_location, Y_probe_location, Z_start_location, ext_position; double X_probe_location, Y_probe_location, Z_start_location, ext_position;
if (code_seen('V')) { if (code_seen('V')) {
verbose_level = code_value(); verbose_level = code_value();
if (verbose_level<0 || verbose_level>4 ) { if (verbose_level<0 || verbose_level>4 ) {
@ -5756,7 +5756,7 @@ void process_commands()
if (code_seen('L') || code_seen('l') ) { if (code_seen('L') || code_seen('l') ) {
n_legs = code_value(); n_legs = code_value();
if ( n_legs==1 ) if ( n_legs==1 )
n_legs = 2; n_legs = 2;
if ( n_legs<0 || n_legs>15 ) { if ( n_legs<0 || n_legs>15 ) {
SERIAL_PROTOCOLPGM("?Specified number of legs in movement not plausable.\n"); 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 // 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. // 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"); SERIAL_PROTOCOL("Positioning probe for the test.\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,
@ -5869,7 +5869,7 @@ void process_commands()
// //
// Get the current mean for the data points we have so far // Get the current mean for the data points we have so far
// //
sum=0.0; sum=0.0;
for( j=0; j<=n; j++) { for( j=0; j<=n; j++) {
sum = sum + sample_set[j]; sum = sum + sample_set[j];
} }
@ -5879,7 +5879,7 @@ void process_commands()
// data points we have so far // data points we have so far
// //
sum=0.0; sum=0.0;
for( j=0; j<=n; j++) { for( j=0; j<=n; j++) {
sum = sum + (sample_set[j]-mean) * (sample_set[j]-mean); sum = sum + (sample_set[j]-mean) * (sample_set[j]-mean);
} }
@ -5901,10 +5901,10 @@ void process_commands()
SERIAL_PROTOCOL_F(sigma,6); SERIAL_PROTOCOL_F(sigma,6);
} }
if (verbose_level > 0) if (verbose_level > 0)
SERIAL_PROTOCOLPGM("\n"); 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); current_position[E_AXIS], homing_feedrate[Z_AXIS]/60);
st_synchronize(); st_synchronize();
@ -6112,7 +6112,7 @@ Sigma_Exit:
### M112 - Emergency stop <a href="https://reprap.org/wiki/G-code#M112:_Full_.28Emergency.29_Stop">M112: Full (Emergency) Stop</a> ### M112 - Emergency stop <a href="https://reprap.org/wiki/G-code#M112:_Full_.28Emergency.29_Stop">M112: Full (Emergency) Stop</a>
It is processed much earlier as to bypass the cmdqueue. It is processed much earlier as to bypass the cmdqueue.
*/ */
case 112: case 112:
kill(MSG_M112_KILL); kill(MSG_M112_KILL);
break; break;
@ -6125,7 +6125,7 @@ Sigma_Exit:
#### Parameters #### Parameters
- `S` - Target temperature - `S` - Target temperature
*/ */
case 140: case 140:
if (code_seen('S')) setTargetBed(code_value()); if (code_seen('S')) setTargetBed(code_value());
break; break;
@ -6258,24 +6258,24 @@ Sigma_Exit:
If no parameter is supplied, waits for heating or cooling to previously set temperature. 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 #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
{ {
bool CooldownNoWait = false; bool CooldownNoWait = false;
LCD_MESSAGERPGM(_T(MSG_BED_HEATING)); LCD_MESSAGERPGM(_T(MSG_BED_HEATING));
heating_status = HeatingStatus::BED_HEATING; heating_status = HeatingStatus::BED_HEATING;
prusa_statistics(1); prusa_statistics(1);
if (code_seen('S')) if (code_seen('S'))
{ {
setTargetBed(code_value()); setTargetBed(code_value());
CooldownNoWait = true; CooldownNoWait = true;
} }
else if (code_seen('R')) else if (code_seen('R'))
{ {
setTargetBed(code_value()); setTargetBed(code_value());
} }
codenum = _millis(); codenum = _millis();
cancel_heatup = false; cancel_heatup = false;
target_direction = isHeatingBed(); // true if heating, false if cooling target_direction = isHeatingBed(); // true if heating, false if cooling
@ -6469,7 +6469,7 @@ Sigma_Exit:
#### Parameters #### Parameters
- `S` - specifies the time in seconds. If a value of 0 is specified, the timer is disabled. - `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')) { if (code_seen('S')) {
safetytimer_inactive_time = code_value() * 1000; safetytimer_inactive_time = code_value() * 1000;
safetyTimer.start(); safetyTimer.start();
@ -6977,7 +6977,7 @@ Sigma_Exit:
- `Z` - Maximum Z jerk (units/s) - `Z` - Maximum Z jerk (units/s)
- `E` - Maximum E jerk (units/s) - `E` - Maximum E jerk (units/s)
*/ */
case 205: case 205:
{ {
if(code_seen('S')) cs.minimumfeedrate = code_value(); if(code_seen('S')) cs.minimumfeedrate = code_value();
if(code_seen('T')) cs.mintravelfeedrate = code_value(); if(code_seen('T')) cs.mintravelfeedrate = code_value();
@ -7081,7 +7081,7 @@ Sigma_Exit:
{ {
switch(code_value_uint8()) switch(code_value_uint8())
{ {
case 0: case 0:
{ {
cs.autoretract_enabled=false; cs.autoretract_enabled=false;
retracted[0]=false; retracted[0]=false;
@ -7092,7 +7092,7 @@ Sigma_Exit:
retracted[2]=false; retracted[2]=false;
#endif #endif
}break; }break;
case 1: case 1:
{ {
cs.autoretract_enabled=true; cs.autoretract_enabled=true;
retracted[0]=false; retracted[0]=false;
@ -7437,7 +7437,7 @@ Sigma_Exit:
chdkActive = true; chdkActive = true;
#else #else
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1 #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
const uint8_t NUM_PULSES=16; const uint8_t NUM_PULSES=16;
const float PULSE_LENGTH=0.01524; const float PULSE_LENGTH=0.01524;
@ -8019,7 +8019,7 @@ Sigma_Exit:
bool bIsActive=false; bool bIsActive=false;
strLabel[7] = '\0'; // null terminate. strLabel[7] = '\0'; // null terminate.
size_t max_sheets = sizeof(EEPROM_Sheets_base->s)/sizeof(EEPROM_Sheets_base->s[0]); size_t max_sheets = sizeof(EEPROM_Sheets_base->s)/sizeof(EEPROM_Sheets_base->s[0]);
if (code_seen('S')) { if (code_seen('S')) {
iSel = code_value_uint8(); iSel = code_value_uint8();
if (iSel>=max_sheets) if (iSel>=max_sheets)
@ -8028,11 +8028,11 @@ Sigma_Exit:
SERIAL_PROTOCOL(max_sheets-1); SERIAL_PROTOCOL(max_sheets-1);
SERIAL_PROTOCOLLN(""); SERIAL_PROTOCOLLN("");
break; // invalid sheet ID break; // invalid sheet ID
} }
} else { } else {
iSel = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); iSel = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet));
} }
if (code_seen('Z')){ if (code_seen('Z')){
z_val = code_value(); z_val = code_value();
zraw = z_val*cs.axis_steps_per_mm[Z_AXIS]; zraw = z_val*cs.axis_steps_per_mm[Z_AXIS];
@ -8040,7 +8040,7 @@ Sigma_Exit:
{ {
SERIAL_PROTOCOLLNPGM(" Z VALUE OUT OF RANGE"); SERIAL_PROTOCOLLNPGM(" Z VALUE OUT OF RANGE");
break; break;
} }
eeprom_update_word_notify(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[iSel].z_offset)),zraw); eeprom_update_word_notify(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[iSel].z_offset)),zraw);
} }
else else
@ -8048,14 +8048,14 @@ Sigma_Exit:
zraw = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[iSel].z_offset))); zraw = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[iSel].z_offset)));
z_val = ((float)zraw/cs.axis_steps_per_mm[Z_AXIS]); z_val = ((float)zraw/cs.axis_steps_per_mm[Z_AXIS]);
} }
if (code_seen('L')) if (code_seen('L'))
{ {
char *src = strchr_pointer + 1; char *src = strchr_pointer + 1;
while (*src == ' ') ++src; while (*src == ' ') ++src;
if (*src != '\0') 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)); eeprom_update_block_notify(strLabel,EEPROM_Sheets_base->s[iSel].name,sizeof(Sheet::name));
} }
@ -8063,7 +8063,7 @@ Sigma_Exit:
{ {
eeprom_read_block(strLabel, EEPROM_Sheets_base->s[iSel].name, sizeof(Sheet::name)); eeprom_read_block(strLabel, EEPROM_Sheets_base->s[iSel].name, sizeof(Sheet::name));
} }
if (code_seen('B')) if (code_seen('B'))
{ {
iBedC = code_value_uint8(); iBedC = code_value_uint8();
@ -8073,7 +8073,7 @@ Sigma_Exit:
{ {
iBedC = eeprom_read_byte(&EEPROM_Sheets_base->s[iSel].bed_temp); iBedC = eeprom_read_byte(&EEPROM_Sheets_base->s[iSel].bed_temp);
} }
if (code_seen('P')) if (code_seen('P'))
{ {
iPindaC = code_value_uint8(); iPindaC = code_value_uint8();
@ -8083,7 +8083,7 @@ Sigma_Exit:
{ {
iPindaC = eeprom_read_byte(&EEPROM_Sheets_base->s[iSel].pinda_temp); iPindaC = eeprom_read_byte(&EEPROM_Sheets_base->s[iSel].pinda_temp);
} }
if (code_seen('A')) if (code_seen('A'))
{ {
bIsActive |= code_value_uint8() || (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == iSel); bIsActive |= code_value_uint8() || (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == iSel);
@ -8097,13 +8097,13 @@ Sigma_Exit:
{ {
bIsActive = (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == iSel); bIsActive = (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == iSel);
} }
SERIAL_PROTOCOLPGM("Sheet "); SERIAL_PROTOCOLPGM("Sheet ");
SERIAL_PROTOCOL((int)iSel); SERIAL_PROTOCOL((int)iSel);
if (!eeprom_is_sheet_initialized(iSel)) if (!eeprom_is_sheet_initialized(iSel))
SERIAL_PROTOCOLLNPGM(" NOT INITIALIZED"); SERIAL_PROTOCOLLNPGM(" NOT INITIALIZED");
SERIAL_PROTOCOLPGM(" Z"); SERIAL_PROTOCOLPGM(" Z");
SERIAL_PROTOCOL_F(z_val,4); SERIAL_PROTOCOL_F(z_val,4);
SERIAL_PROTOCOLPGM(" R"); SERIAL_PROTOCOLPGM(" R");
@ -8130,7 +8130,7 @@ Sigma_Exit:
#### Parameters #### Parameters
- `S` - Target temperature - `S` - Target temperature
*/ */
case 860: case 860:
{ {
int set_target_pinda = 0; int set_target_pinda = 0;
@ -8454,7 +8454,7 @@ Sigma_Exit:
- `Z` - Z stepper driver holding current value - `Z` - Z stepper driver holding current value
- `E` - Extruder 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++) { for (uint8_t axis = 0; axis < NUM_AXIS; axis++) {
if (code_seen(axis_codes[axis])) { if (code_seen(axis_codes[axis])) {
@ -8478,7 +8478,7 @@ Sigma_Exit:
- `Z` - Z stepper driver running current value - `Z` - Z stepper driver running current value
- `E` - Extruder 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++) { for (uint8_t axis = 0; axis < NUM_AXIS; axis++) {
if (code_seen(axis_codes[axis])) { if (code_seen(axis_codes[axis])) {
@ -8552,8 +8552,8 @@ Sigma_Exit:
} }
if (tmc2130_mode != newMode if (tmc2130_mode != newMode
#ifdef PSU_Delta #ifdef PSU_Delta
|| !bEnableForce_z || !bEnableForce_z
#endif #endif
) )
{ {
@ -8657,10 +8657,10 @@ Sigma_Exit:
- `B` - Second extruder new resolution - `B` - Second extruder new resolution
- `S` - All axes new resolution - `S` - All axes new resolution
*/ */
case 350: case 350:
{ {
#ifdef TMC2130 #ifdef TMC2130
for (uint_least8_t i=0; i<NUM_AXIS; i++) for (uint_least8_t i=0; i<NUM_AXIS; i++)
{ {
if(code_seen(axis_codes[i])) if(code_seen(axis_codes[i]))
{ {
@ -8988,7 +8988,7 @@ Sigma_Exit:
/*! /*!
#### End of M-Commands #### End of M-Commands
*/ */
default: default:
printf_P(MSG_UNKNOWN_CODE, 'M', cmdbuffer + bufindr + CMDHDRSIZE); printf_P(MSG_UNKNOWN_CODE, 'M', cmdbuffer + bufindr + CMDHDRSIZE);
} }
// printf_P(_N("END M-CODE=%u\n"), mcode_in_progress); // printf_P(_N("END M-CODE=%u\n"), mcode_in_progress);
@ -9325,7 +9325,7 @@ Sigma_Exit:
*/ */
case 81: case 81:
dcode_81(); break; dcode_81(); break;
#endif //HEATBED_ANALYSIS #endif //HEATBED_ANALYSIS
#ifdef DEBUG_DCODES #ifdef DEBUG_DCODES
@ -9463,17 +9463,17 @@ void update_currents() {
float current_high[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; float current_high[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
float current_low[3] = DEFAULT_PWM_MOTOR_CURRENT; float current_low[3] = DEFAULT_PWM_MOTOR_CURRENT;
float tmp_motor[3]; float tmp_motor[3];
//SERIAL_ECHOLNPGM("Currents updated: "); //SERIAL_ECHOLNPGM("Currents updated: ");
if (destination[Z_AXIS] < Z_SILENT) { if (destination[Z_AXIS] < Z_SILENT) {
//SERIAL_ECHOLNPGM("LOW"); //SERIAL_ECHOLNPGM("LOW");
for (uint8_t i = 0; i < 3; i++) { for (uint8_t i = 0; i < 3; i++) {
st_current_set(i, current_low[i]); st_current_set(i, current_low[i]);
/*MYSERIAL.print(int(i)); /*MYSERIAL.print(int(i));
SERIAL_ECHOPGM(": "); SERIAL_ECHOPGM(": ");
MYSERIAL.println(current_low[i]);*/ MYSERIAL.println(current_low[i]);*/
} }
} }
else if (destination[Z_AXIS] > Z_HIGH_POWER) { else if (destination[Z_AXIS] > Z_HIGH_POWER) {
//SERIAL_ECHOLNPGM("HIGH"); //SERIAL_ECHOLNPGM("HIGH");
@ -9482,13 +9482,13 @@ void update_currents() {
/*MYSERIAL.print(int(i)); /*MYSERIAL.print(int(i));
SERIAL_ECHOPGM(": "); SERIAL_ECHOPGM(": ");
MYSERIAL.println(current_high[i]);*/ MYSERIAL.println(current_high[i]);*/
} }
} }
else { else {
for (uint8_t i = 0; i < 3; i++) { 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)); 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; 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)); /*MYSERIAL.print(int(i));
SERIAL_ECHOPGM(": "); SERIAL_ECHOPGM(": ");
MYSERIAL.println(tmp_motor[i]);*/ 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 static int killCount = 0; // make the inactivity button a bit less responsive
const int KILL_DELAY = 10000; const int KILL_DELAY = 10000;
#endif #endif
if(buflen < (BUFSIZE-1)){ if(buflen < (BUFSIZE-1)){
get_command(); get_command();
} }
@ -10169,12 +10169,12 @@ void check_babystep()
s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)), s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),
babystep_z); babystep_z);
lcd_show_fullscreen_message_and_wait_P(PSTR("Z live adjust out of range. Setting to 0. Click to continue.")); 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 #ifdef HEATBED_ANALYSIS
void d_setup() void d_setup()
{ {
pinMode(D_DATACLOCK, INPUT_PULLUP); pinMode(D_DATACLOCK, INPUT_PULLUP);
pinMode(D_DATA, INPUT_PULLUP); pinMode(D_DATA, INPUT_PULLUP);
pinMode(D_REQUIRE, OUTPUT); 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); //strcat(data_wldsd, numb_wldsd);
//MYSERIAL.println(data_wldsd); //MYSERIAL.println(data_wldsd);
//delay(1000); //delay(1000);
//delay(3000); //delay(3000);
//t1 = millis(); //t1 = millis();
//while (digitalRead(D_DATACLOCK) == LOW) {} //while (digitalRead(D_DATACLOCK) == LOW) {}
//while (digitalRead(D_DATACLOCK) == HIGH) {} //while (digitalRead(D_DATACLOCK) == HIGH) {}
memset(digit, 0, sizeof(digit)); memset(digit, 0, sizeof(digit));
//cli(); //cli();
digitalWrite(D_REQUIRE, LOW); digitalWrite(D_REQUIRE, LOW);
for (int i = 0; i<13; i++) for (int i = 0; i<13; i++)
{ {
//t1 = millis(); //t1 = millis();
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
{ {
while (digitalRead(D_DATACLOCK) == LOW) {} while (digitalRead(D_DATACLOCK) == LOW) {}
while (digitalRead(D_DATACLOCK) == HIGH) {} while (digitalRead(D_DATACLOCK) == HIGH) {}
//printf_P(PSTR("Done %d\n"), j); //printf_P(PSTR("Done %d\n"), j);
bitWrite(digit[i], j, digitalRead(D_DATA)); 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'; mergeOutput[0] = '\0';
output = 0; output = 0;
for (int r = 5; r <= 10; r++) //Merge digits for (int r = 5; r <= 10; r++) //Merge digits
{ {
sprintf(str, "%d", digit[r]); sprintf(str, "%d", digit[r]);
strcat(mergeOutput, str); strcat(mergeOutput, str);
} }
output = atof(mergeOutput); output = atof(mergeOutput);
if (digit[4] == 8) //Handle sign 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 *= 0.1;
} }
//output = d_ReadData(); //output = d_ReadData();
//row[ix] = current_position[Z_AXIS]; //row[ix] = current_position[Z_AXIS];
//row[ix] = d_ReadData(); //row[ix] = d_ReadData();
row[ix] = output; row[ix] = output;
if (iy % 2 == 1 ? ix == 0 : ix == x_points_num - 1) { 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! // Push the commands to the front of the message queue in the reverse order!
// There shall be always enough space reserved for these commands. // There shall be always enough space reserved for these commands.
repeatcommand_front(); // repeat G80 with all its parameters repeatcommand_front(); // repeat G80 with all its parameters
enquecommand_front_P(G28W); enquecommand_front_P(G28W);
enquecommand_front_P((PSTR("G1 Z5"))); enquecommand_front_P((PSTR("G1 Z5")));
return; 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); //strcat(data_wldsd, numb_wldsd);
//MYSERIAL.println(data_wldsd); //MYSERIAL.println(data_wldsd);
//_delay(1000); //_delay(1000);
//_delay(3000); //_delay(3000);
//t1 = _millis(); //t1 = _millis();
//while (digitalRead(D_DATACLOCK) == LOW) {} //while (digitalRead(D_DATACLOCK) == LOW) {}
//while (digitalRead(D_DATACLOCK) == HIGH) {} //while (digitalRead(D_DATACLOCK) == HIGH) {}
memset(digit, 0, sizeof(digit)); memset(digit, 0, sizeof(digit));
//cli(); //cli();
digitalWrite(D_REQUIRE, LOW); digitalWrite(D_REQUIRE, LOW);
for (int i = 0; i<13; i++) for (int i = 0; i<13; i++)
{ {
//t1 = _millis(); //t1 = _millis();
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
{ {
while (digitalRead(D_DATACLOCK) == LOW) {} while (digitalRead(D_DATACLOCK) == LOW) {}
while (digitalRead(D_DATACLOCK) == HIGH) {} while (digitalRead(D_DATACLOCK) == HIGH) {}
bitWrite(digit[i], j, digitalRead(D_DATA)); 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'; mergeOutput[0] = '\0';
output = 0; output = 0;
for (int r = 5; r <= 10; r++) //Merge digits for (int r = 5; r <= 10; r++) //Merge digits
{ {
sprintf(str, "%d", digit[r]); sprintf(str, "%d", digit[r]);
strcat(mergeOutput, str); strcat(mergeOutput, str);
} }
output = atof(mergeOutput); output = atof(mergeOutput);
if (digit[4] == 8) //Handle sign 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 *= 0.1;
} }
//output = d_ReadData(); //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, ";"); //strcat(data_wldsd, ";");
card.write_command(data_wldsd); card.write_command(data_wldsd);
//row[ix] = d_ReadData(); //row[ix] = d_ReadData();
row[ix] = output; // current_position[Z_AXIS]; row[ix] = output; // current_position[Z_AXIS];
if (iy % 2 == 1 ? ix == 0 : ix == x_points_num - 1) { 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; current_position[E_AXIS] -= default_retraction;
} }
plan_buffer_line_curposXYZE(400); plan_buffer_line_curposXYZE(400);
current_position[X_AXIS] = PINDA_PREHEAT_X; current_position[X_AXIS] = PINDA_PREHEAT_X;
current_position[Y_AXIS] = PINDA_PREHEAT_Y; current_position[Y_AXIS] = PINDA_PREHEAT_Y;
current_position[Z_AXIS] = PINDA_PREHEAT_Z; current_position[Z_AXIS] = PINDA_PREHEAT_Z;
@ -10621,7 +10621,7 @@ static void temp_compensation_start() {
custom_message_state = PINDA_HEAT_T - i; 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 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); else lcd_update(1);
} }
custom_message_type = CustomMsg::Status; custom_message_type = CustomMsg::Status;
custom_message_state = 0; custom_message_state = 0;
} }
@ -10645,7 +10645,7 @@ static void temp_compensation_apply() {
st_synchronize(); st_synchronize();
plan_set_z_position(current_position[Z_AXIS]); plan_set_z_position(current_position[Z_AXIS]);
} }
else { else {
//we have no temp compensation data //we have no temp compensation data
} }
} }
@ -10854,7 +10854,7 @@ void save_print_file_state() {
if (cmdbuffer[_bufindr] == CMDBUFFER_CURRENT_TYPE_SDCARD) { if (cmdbuffer[_bufindr] == CMDBUFFER_CURRENT_TYPE_SDCARD) {
sdlen_single.lohi.lo = cmdbuffer[_bufindr + 1]; sdlen_single.lohi.lo = cmdbuffer[_bufindr + 1];
sdlen_single.lohi.hi = cmdbuffer[_bufindr + 2]; sdlen_single.lohi.hi = cmdbuffer[_bufindr + 2];
} }
SERIAL_ECHOPGM("Buffer line (from buffer): "); SERIAL_ECHOPGM("Buffer line (from buffer): ");
MYSERIAL.print(int(iline), DEC); MYSERIAL.print(int(iline), DEC);
SERIAL_ECHOPGM(", type: "); SERIAL_ECHOPGM(", type: ");
@ -10892,7 +10892,7 @@ void restore_print_file_state() {
card.sdprinting = true; card.sdprinting = true;
} else if (saved_printing_type == PowerPanic::PRINT_TYPE_HOST) { //was usb printing } 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 gcode_LastN = saved_sdpos; //saved_sdpos was reused for storing line number when usb printing
serial_count = 0; serial_count = 0;
FlushSerialRequestResend(); FlushSerialRequestResend();
} else { } else {
//not sd printing nor usb printing //not sd printing nor usb printing
@ -11266,7 +11266,7 @@ void M600_wait_for_user() {
manage_heater(); manage_heater();
manage_inactivity(true); manage_inactivity(true);
if (wait_for_user_state != 2) sound_wait_for_user(); if (wait_for_user_state != 2) sound_wait_for_user();
switch (wait_for_user_state) { switch (wait_for_user_state) {
case 0: //nozzle is hot, waiting for user to press the knob to unload filament case 0: //nozzle is hot, waiting for user to press the knob to unload filament
delay_keep_alive(4); delay_keep_alive(4);
@ -11281,7 +11281,7 @@ void M600_wait_for_user() {
break; break;
case 1: //nozzle target temperature is set to zero, waiting for user to start nozzle preheat case 1: //nozzle target temperature is set to zero, waiting for user to start nozzle preheat
delay_keep_alive(4); delay_keep_alive(4);
if (lcd_clicked()) { if (lcd_clicked()) {
setTargetHotend(saved_extruder_temperature); setTargetHotend(saved_extruder_temperature);
lcd_wait_for_heater(); lcd_wait_for_heater();

View File

@ -132,7 +132,7 @@ static void lcd_connect_printer() {
int i = 0; int i = 0;
int t = 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, 1, PSTR("monitoring or hold"));
lcd_puts_at_P(0, 2, PSTR("the knob to continue")); lcd_puts_at_P(0, 2, PSTR("the knob to continue"));
while (no_response) { while (no_response) {
@ -145,7 +145,7 @@ static void lcd_connect_printer() {
t = 0; t = 0;
} }
if (READ(BTN_ENC)) { //if button is not pressed if (READ(BTN_ENC)) { //if button is not pressed
i = 0; i = 0;
lcd_puts_at_P(0, 3, PSTR(" ")); lcd_puts_at_P(0, 3, PSTR(" "));
} }
if (i != 0) if (i != 0)
@ -232,7 +232,7 @@ void prusa_statistics(uint8_t _message) {
const uint8_t _fil_nr = 0; const uint8_t _fil_nr = 0;
if (!farm_mode) if (!farm_mode)
return; return;
switch (_message) { switch (_message) {
case 0: // default message case 0: // default message
if (busy_state == PAUSED_FOR_USER) { if (busy_state == PAUSED_FOR_USER) {
@ -389,7 +389,7 @@ void prusa_statistics_update_from_lcd_update() {
} }
void farm_mode_init() { 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) { if (farm_mode) {
no_response = true; //we need confirmation by recieving PRUSA thx no_response = true; //we need confirmation by recieving PRUSA thx
prusa_statistics(8); prusa_statistics(8);
@ -410,7 +410,7 @@ void farm_mode_init() {
bool farm_prusa_code_seen() { bool farm_prusa_code_seen() {
if (!farm_mode) if (!farm_mode)
return false; return false;
if (code_seen_P(PSTR("PRN"))) { // PRUSA PRN if (code_seen_P(PSTR("PRN"))) { // PRUSA PRN
printf_P(_N("%u"), status_number); printf_P(_N("%u"), status_number);
} }
@ -441,7 +441,7 @@ bool farm_prusa_code_seen() {
else { else {
return false; return false;
} }
return true; return true;
} }

View File

@ -767,7 +767,7 @@ uint8_t Sd2Card::waitStartBlock(void) {
return false; return false;
} }
// Toshiba FlashAir support, copied from // Toshiba FlashAir support, copied from
// https://flashair-developers.com/en/documents/tutorials/arduino/ // https://flashair-developers.com/en/documents/tutorials/arduino/
// However, the official website was closed in September 2019. // However, the official website was closed in September 2019.
// There is an archived website (written in Japanese). // 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); error(SD_CARD_ERROR_CMD48);
goto fail; goto fail;
} }
// wait for start block token. // wait for start block token.
if (!waitStartBlock()) { if (!waitStartBlock()) {
goto fail; 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) { for (i = 0; i < count; ++i) {
dst[i] = spiRec(); dst[i] = spiRec();
} }
// skip dummy bytes and 16-bit crc. // skip dummy bytes and 16-bit crc.
for (; i < 514; ++i) { for (; i < 514; ++i) {
spiRec(); 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 * \return The value one, true, is returned for success and
* the value zero, false, is returned for failure. * 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 addr, uint16_t count, uint8_t* dst) {
uint32_t offset = addr & 0x1FF; uint32_t offset = addr & 0x1FF;
if (offset + count > 512) count = 512 - offset; if (offset + count > 512) count = 512 - offset;
if (count == 0) return true; if (count == 0) return true;
uint32_t arg = uint32_t arg =
(((uint32_t)mio & 0x1) << 31) | (((uint32_t)mio & 0x1) << 31) |
(mio ? (((uint32_t)func & 0x7) << 28) : (((uint32_t)func & 0xF) << 27)) | (mio ? (((uint32_t)func & 0x7) << 28) : (((uint32_t)func & 0xF) << 27)) |
((addr & 0x1FFFF) << 9) | ((addr & 0x1FFFF) << 9) |
((count - 1) & 0x1FF); ((count - 1) & 0x1FF);
return readExt(arg, dst, count); return readExt(arg, dst, count);
} }

View File

@ -174,7 +174,7 @@ class Sd2Card {
/** /**
* Read a card's CID register. The CID contains card identification * Read a card's CID register. The CID contains card identification
* information such as Manufacturer ID, Product name, Product serial * 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. * \param[out] cid pointer to area for returned data.
* *
@ -243,4 +243,4 @@ class Sd2Card {
#endif // Sd2Card_h #endif // Sd2Card_h
#endif #endif

View File

@ -1115,7 +1115,7 @@ int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
int16_t n; int16_t n;
// if not a directory file or miss-positioned return an error // if not a directory file or miss-positioned return an error
if (!isDir() || (0X1F & curPosition_)) return -1; 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 we have a longFilename buffer, mark it as invalid. If we find a long filename it will be filled automaticly.
if (longFilename != NULL) if (longFilename != NULL)
{ {

View File

@ -281,7 +281,7 @@ class SdBaseFile {
static void printFatDate(uint16_t fatDate); static void printFatDate(uint16_t fatDate);
static void printFatTime( uint16_t fatTime); static void printFatTime( uint16_t fatTime);
bool printName(); bool printName();
protected: protected:
int16_t read(); int16_t read();
int16_t read(void* buf, uint16_t nbyte); int16_t read(void* buf, uint16_t nbyte);
public: public:

View File

@ -468,29 +468,29 @@ uint32_t const FAT32MASK = 0X0FFFFFFF;
* \brief FAT short directory entry * \brief FAT short directory entry
* *
* Short means short 8.3 name, not the entry size. * 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 * 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): * 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). * inclusive (1980-2107).
* *
* Bits 5-8: Month of year, 1 = January, valid value range 1-12 inclusive. * 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. * 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 * 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). * 16-bit word, bit 15 is the MSB of the 16-bit word).
* *
* Bits 11-15: Hours, valid value range 0-23 inclusive. * Bits 11-15: Hours, valid value range 0-23 inclusive.
* *
* Bits 5-10: Minutes, valid value range 0-59 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). * 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. * The valid time range is from Midnight 00:00:00 to 23:59:58.
*/ */
struct directoryEntry { struct directoryEntry {
@ -548,7 +548,7 @@ struct directoryEntry {
* *
* directoryVFATEntries are found in the same list as normal directoryEntry. * directoryVFATEntries are found in the same list as normal directoryEntry.
* But have the attribute field set to DIR_ATT_LONG_NAME. * But have the attribute field set to DIR_ATT_LONG_NAME.
* *
* Long filenames are saved in multiple directoryVFATEntries. * Long filenames are saved in multiple directoryVFATEntries.
* Each entry containing 13 UTF-16 characters. * Each entry containing 13 UTF-16 characters.
*/ */

View File

@ -45,7 +45,7 @@ int SdFatUtil::FreeRam() {
#endif // __arm #endif // __arm
void SdFatUtil::set_stack_guard() void SdFatUtil::set_stack_guard()
{ {
uint32_t *stack_guard; uint32_t *stack_guard;
stack_guard = (uint32_t*)(&__bss_end + STACK_GUARD_MARGIN); stack_guard = (uint32_t*)(&__bss_end + STACK_GUARD_MARGIN);

View File

@ -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, // 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 // 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. // 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, // 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. // 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! // the same applies to gfXBegin, codesize dropped another 100B!
const uint8_t *blockBuffBegin = gfBlockBuffBegin(); const uint8_t *blockBuffBegin = gfBlockBuffBegin();
uint8_t consecutiveCommentLines = 0; uint8_t consecutiveCommentLines = 0;
while( *rdPtr == ';' ){ while( *rdPtr == ';' ){
for(;;){ for(;;){
@ -104,8 +104,8 @@ int16_t SdFile::readFilteredGcode(){
//while( *(++gfReadPtr) != '\n' ); // skip until a newline is found - suboptimal code! //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? // 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! // 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 // 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. // - 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! // 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 // 11c62: sbci r19, 0xFF ; 255
// 11c64: ld r22, Z // 11c64: ld r22, Z
// 11c66: cpi r22, 0x0A ; 10 // 11c66: cpi r22, 0x0A ; 10
// 11c68: brne .-12 ; 0x11c5e <get_command()+0x524> // 11c68: brne .-12 ; 0x11c5e <get_command()+0x524>
// Still, even that was suboptimal as the compiler seems not to understand the usage of ld r22, Z+ (the plus is important) // 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) // aka automatic increment of the Z register (R30:R31 pair)
@ -153,7 +153,7 @@ emit_char:
{ {
gfUpdateCurrentPosition( rdPtr - start + 1 ); gfUpdateCurrentPosition( rdPtr - start + 1 );
int16_t rv = *rdPtr++; int16_t rv = *rdPtr++;
if( curPosition_ >= fileSize_ ){ if( curPosition_ >= fileSize_ ){
// past the end of file // past the end of file
goto eof_or_fail; 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 // 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 // -> should be 8 instructions... and not the horrible loop shifting 4 bytes at once
// still need to get some work on this // still need to get some work on this
gfBlock = vol_->rootDirStart() + (curPosition_ >> 9); gfBlock = vol_->rootDirStart() + (curPosition_ >> 9);
} else { } else {
uint8_t blockOfCluster = vol_->blockOfCluster(curPosition_); uint8_t blockOfCluster = vol_->blockOfCluster(curPosition_);
if (gfOffset == 0 && blockOfCluster == 0) { if (gfOffset == 0 && blockOfCluster == 0) {

View File

@ -35,19 +35,19 @@
*/ */
class SdFile : public SdBaseFile/*, public Print*/ { class SdFile : public SdBaseFile/*, public Print*/ {
// GCode filtering vars and methods - due to optimization reasons not wrapped in a separate class // 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 // 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 // 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) // to update gfReadPtr inside readFilteredGcode from a local copy (see explanation of this trick in readFilteredGcode)
const uint8_t *gfReadPtr; 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 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; uint16_t gfOffset;
const uint8_t *gfBlockBuffBegin()const; const uint8_t *gfBlockBuffBegin()const;
void gfReset(); void gfReset();
bool gfEnsureBlock(); bool gfEnsureBlock();
bool gfComputeNextFileBlock(); bool gfComputeNextFileBlock();
void gfUpdateCurrentPosition(uint16_t inc); void gfUpdateCurrentPosition(uint16_t inc);
@ -59,7 +59,7 @@ public:
#else #else
void write(uint8_t b); void write(uint8_t b);
#endif #endif
bool openFilteredGcode(SdBaseFile* dirFile, const char* path); bool openFilteredGcode(SdBaseFile* dirFile, const char* path);
int16_t readFilteredGcode(); int16_t readFilteredGcode();
bool seekSetFilteredGcode(uint32_t pos); bool seekSetFilteredGcode(uint32_t pos);

View File

@ -41,7 +41,7 @@
detach() - Stops an attached servos from pulsing its i/o pin. detach() - Stops an attached servos from pulsing its i/o pin.
*/ */
#include "Configuration.h" #include "Configuration.h"
#ifdef NUM_SERVOS #ifdef NUM_SERVOS
#include <avr/interrupt.h> #include <avr/interrupt.h>

View File

@ -11,12 +11,12 @@
static const char duplicate_Tcode_ignored[] PROGMEM = "Duplicate T-code ignored."; static const char duplicate_Tcode_ignored[] PROGMEM = "Duplicate T-code ignored.";
inline bool IsInvalidTCode(char *const s, uint8_t i) { inline bool IsInvalidTCode(char *const s, uint8_t i) {
return ((s[i] < '0' || s[i] > '4') && s[i] != '?' && s[i] != 'x' && s[i] != 'c'); return ((s[i] < '0' || s[i] > '4') && s[i] != '?' && s[i] != 'x' && s[i] != 'c');
} }
inline void TCodeInvalid() { inline void TCodeInvalid() {
SERIAL_ECHOLNPGM("Invalid T code."); SERIAL_ECHOLNPGM("Invalid T code.");
} }
void TCodes(char *const strchr_pointer, const uint8_t codeValue) { 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 } else { // Process T0 ... T4
if (MMU2::mmu2.Enabled()) { 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 // don't execute the same T-code twice in a row
puts_P(duplicate_Tcode_ignored); puts_P(duplicate_Tcode_ignored);
} else { } else {

View File

@ -45,7 +45,7 @@ void force_bl_on(bool section_start)
void backlight_wake(const uint8_t flashNo) void backlight_wake(const uint8_t flashNo)
{ {
if (!backlightSupport) return; if (!backlightSupport) return;
if (flashNo) if (flashNo)
{ {
uint8_t backlightMode_bck = backlightMode; uint8_t backlightMode_bck = backlightMode;
@ -71,7 +71,7 @@ void backlight_save() //saves all backlight data to eeprom.
void backlight_update() void backlight_update()
{ {
if (!backlightSupport) return; if (!backlightSupport) return;
if (backlightMode == BACKLIGHT_MODE_AUTO) if (backlightMode == BACKLIGHT_MODE_AUTO)
{ {
if (backlightTimer.expired((uint32_t)backlightTimer_period * 1000ul)) analogWrite(LCD_BL_PIN, backlightLevel_LOW); if (backlightTimer.expired((uint32_t)backlightTimer_period * 1000ul)) analogWrite(LCD_BL_PIN, backlightLevel_LOW);

View File

@ -35,20 +35,20 @@ CardReader::CardReader()
lastnr=0; lastnr=0;
//power to SD reader //power to SD reader
#if SDPOWER > -1 #if SDPOWER > -1
SET_OUTPUT(SDPOWER); SET_OUTPUT(SDPOWER);
WRITE(SDPOWER,HIGH); WRITE(SDPOWER,HIGH);
#endif //SDPOWER #endif //SDPOWER
autostart_atmillis.start(); // reset timer autostart_atmillis.start(); // reset timer
} }
char *createFilename(char *buffer,const dir_t &p) //buffer>12characters char *createFilename(char *buffer,const dir_t &p) //buffer>12characters
{ {
char *pos=buffer; 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 (p.name[i] == ' ')continue;
if (i == 8) if (i == 8)
{ {
*pos++='.'; *pos++='.';
} }
@ -74,7 +74,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
_incrementer() {recursionCnt++;} _incrementer() {recursionCnt++;}
~_incrementer() {recursionCnt--;} ~_incrementer() {recursionCnt--;}
} recursionCntIncrementer; } recursionCntIncrementer;
dir_t p; dir_t p;
uint8_t cnt = 0; uint8_t cnt = 0;
// Read the next entry from a directory // 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); // Serial.print(path);
// Get a new directory object using the full path // Get a new directory object using the full path
// and dive recursively into it. // and dive recursively into it.
if (lsParams.LFN) if (lsParams.LFN)
printf_P(PSTR("DIR_ENTER: %s \"%s\"\n"), path, longFilename[0] ? longFilename : lfilename); printf_P(PSTR("DIR_ENTER: %s \"%s\"\n"), path, longFilename[0] ? longFilename : lfilename);
SdFile dir; SdFile dir;
if (!dir.open(parent, lfilename, O_READ)) { if (!dir.open(parent, lfilename, O_READ)) {
//SERIAL_ECHO_START(); //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); lsDive(path, dir, NULL, lsAction, lsParams);
// close() is done automatically by destructor of SdFile // close() is done automatically by destructor of SdFile
if (lsParams.LFN) if (lsParams.LFN)
puts_P(PSTR("DIR_EXIT")); puts_P(PSTR("DIR_EXIT"));
} }
@ -126,15 +126,15 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
case LS_Count: case LS_Count:
nrFiles++; nrFiles++;
break; break;
case LS_SerialPrint: case LS_SerialPrint:
createFilename(filename, p); createFilename(filename, p);
SERIAL_PROTOCOL(prepend); SERIAL_PROTOCOL(prepend);
SERIAL_PROTOCOL(filename); SERIAL_PROTOCOL(filename);
MYSERIAL.write(' '); MYSERIAL.write(' ');
SERIAL_PROTOCOL(p.fileSize); SERIAL_PROTOCOL(p.fileSize);
if (lsParams.timestamp) if (lsParams.timestamp)
{ {
crmodDate = p.lastWriteDate; 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); printf_P(PSTR(" %#lx"), ((uint32_t)crmodDate << 16) | crmodTime);
} }
if (lsParams.LFN) if (lsParams.LFN)
printf_P(PSTR(" \"%s\""), LONGEST_FILENAME); printf_P(PSTR(" \"%s\""), LONGEST_FILENAME);
SERIAL_PROTOCOLLN(); SERIAL_PROTOCOLLN();
manage_heater(); manage_heater();
break; break;
case LS_GetFilename: case LS_GetFilename:
//SERIAL_ECHOPGM("File: "); //SERIAL_ECHOPGM("File: ");
createFilename(filename, p); createFilename(filename, p);
@ -219,12 +219,12 @@ void CardReader::mount(bool doPresort/* = true*/)
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNRPGM(_n("volume.init failed"));////MSG_SD_VOL_INIT_FAIL 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_ERROR_START;
SERIAL_ERRORLNRPGM(_n("openRoot failed"));////MSG_SD_OPENROOT_FAIL SERIAL_ERRORLNRPGM(_n("openRoot failed"));////MSG_SD_OPENROOT_FAIL
} }
else else
{ {
mounted = true; mounted = true;
SERIAL_ECHO_START; SERIAL_ECHO_START;
@ -276,7 +276,7 @@ void CardReader::openLogFile(const char* name)
} }
void CardReader::getDirName(char* name, uint8_t level) void CardReader::getDirName(char* name, uint8_t level)
{ {
workDirParents[level].getFilename(name); workDirParents[level].getFilename(name);
} }
@ -291,7 +291,7 @@ void CardReader::getAbsFilename(char *t)
for(uint8_t i=0;i<workDirDepth;i++) for(uint8_t i=0;i<workDirDepth;i++)
{ {
workDirParents[i].getFilename(t); //SDBaseFile.getfilename! workDirParents[i].getFilename(t); //SDBaseFile.getfilename!
while(*t!=0 && cnt< MAXPATHNAMELENGTH) while(*t!=0 && cnt< MAXPATHNAMELENGTH)
{t++;cnt++;} //crawl counter forward. {t++;cnt++;} //crawl counter forward.
} }
if(cnt < MAXPATHNAMELENGTH - FILENAME_LENGTH) if(cnt < MAXPATHNAMELENGTH - FILENAME_LENGTH)
@ -386,7 +386,7 @@ static const char ofWritingToFile[] PROGMEM = "Writing to file: ";
void CardReader::openFileReadFilteredGcode(const char* name, bool replace_current/* = false*/){ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_current/* = false*/){
if(!mounted) if(!mounted)
return; return;
if(file.isOpen()){ //replacing current file by new file, or subfile call if(file.isOpen()){ //replacing current file by new file, or subfile call
if(!replace_current){ if(!replace_current){
if((int)file_subcall_ctr>(int)SD_PROCEDURE_DEPTH-1){ if((int)file_subcall_ctr>(int)SD_PROCEDURE_DEPTH-1){
@ -396,15 +396,15 @@ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_curren
kill(ofKill); kill(ofKill);
return; return;
} }
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHORPGM(ofSubroutineCallTgt); SERIAL_ECHORPGM(ofSubroutineCallTgt);
SERIAL_ECHO(name); SERIAL_ECHO(name);
SERIAL_ECHORPGM(ofParent); SERIAL_ECHORPGM(ofParent);
//store current filename and position //store current filename and position
getAbsFilename(filenames[file_subcall_ctr]); getAbsFilename(filenames[file_subcall_ctr]);
SERIAL_ECHO(filenames[file_subcall_ctr]); SERIAL_ECHO(filenames[file_subcall_ctr]);
SERIAL_ECHORPGM(ofPos); SERIAL_ECHORPGM(ofPos);
SERIAL_ECHOLN(sdpos); SERIAL_ECHOLN(sdpos);
@ -423,11 +423,11 @@ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_curren
SERIAL_ECHOLN(name); SERIAL_ECHOLN(name);
} }
sdprinting = false; sdprinting = false;
const char *fname=name; const char *fname=name;
if (!diveSubfolder(fname)) if (!diveSubfolder(fname))
return; return;
if (file.openFilteredGcode(curDir, fname)) { if (file.openFilteredGcode(curDir, fname)) {
getfilename(0, fname); getfilename(0, fname);
filesize = file.fileSize(); filesize = file.fileSize();
@ -436,7 +436,7 @@ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_curren
SERIAL_PROTOCOLRPGM(ofSize);////MSG_SD_SIZE SERIAL_PROTOCOLRPGM(ofSize);////MSG_SD_SIZE
SERIAL_PROTOCOLLN(filesize); SERIAL_PROTOCOLLN(filesize);
sdpos = 0; sdpos = 0;
SERIAL_PROTOCOLLNRPGM(ofFileSelected);////MSG_SD_FILE_SELECTED SERIAL_PROTOCOLLNRPGM(ofFileSelected);////MSG_SD_FILE_SELECTED
lcd_setstatuspgm(ofFileSelected); lcd_setstatuspgm(ofFileSelected);
scrollstuff = 0; scrollstuff = 0;
@ -463,15 +463,15 @@ void CardReader::openFileWrite(const char* name)
kill(ofKill); kill(ofKill);
return; return;
} }
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHORPGM(ofSubroutineCallTgt); SERIAL_ECHORPGM(ofSubroutineCallTgt);
SERIAL_ECHO(name); SERIAL_ECHO(name);
SERIAL_ECHORPGM(ofParent); SERIAL_ECHORPGM(ofParent);
//store current filename and position //store current filename and position
getAbsFilename(filenames[file_subcall_ctr]); getAbsFilename(filenames[file_subcall_ctr]);
SERIAL_ECHO(filenames[file_subcall_ctr]); SERIAL_ECHO(filenames[file_subcall_ctr]);
SERIAL_ECHORPGM(ofPos); SERIAL_ECHORPGM(ofPos);
SERIAL_ECHOLN(sdpos); SERIAL_ECHOLN(sdpos);
@ -488,11 +488,11 @@ void CardReader::openFileWrite(const char* name)
SERIAL_ECHOLN(name); SERIAL_ECHOLN(name);
} }
sdprinting = false; sdprinting = false;
const char *fname=name; const char *fname=name;
if (!diveSubfolder(fname)) if (!diveSubfolder(fname))
return; return;
//write //write
if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)){ if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)){
SERIAL_PROTOCOLRPGM(MSG_SD_OPEN_FILE_FAIL); 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 SERIAL_PROTOCOLRPGM(ofWritingToFile);////MSG_SD_WRITE_TO_FILE
printAbsFilenameFast(); printAbsFilenameFast();
SERIAL_PROTOCOLLN(); SERIAL_PROTOCOLLN();
SERIAL_PROTOCOLLNRPGM(ofFileSelected);////MSG_SD_FILE_SELECTED SERIAL_PROTOCOLLNRPGM(ofFileSelected);////MSG_SD_FILE_SELECTED
lcd_setstatuspgm(ofFileSelected); lcd_setstatuspgm(ofFileSelected);
scrollstuff = 0; scrollstuff = 0;
@ -521,7 +521,7 @@ void CardReader::removeFile(const char* name)
if (!diveSubfolder(fname)) if (!diveSubfolder(fname))
return; return;
if (file.remove(curDir, fname)) if (file.remove(curDir, fname))
{ {
SERIAL_PROTOCOLPGM("File deleted:"); SERIAL_PROTOCOLPGM("File deleted:");
SERIAL_PROTOCOLLN(fname); SERIAL_PROTOCOLLN(fname);
@ -536,7 +536,7 @@ void CardReader::removeFile(const char* name)
SERIAL_PROTOCOL(fname); SERIAL_PROTOCOL(fname);
SERIAL_PROTOCOLLN('.'); SERIAL_PROTOCOLLN('.');
} }
} }
uint32_t CardReader::getFileSize() uint32_t CardReader::getFileSize()
@ -562,7 +562,7 @@ void CardReader::getStatus(bool arg_P)
} }
else else
SERIAL_PROTOCOLLN(LONGEST_FILENAME); SERIAL_PROTOCOLLN(LONGEST_FILENAME);
SERIAL_PROTOCOLRPGM(_N("SD printing byte "));////MSG_SD_PRINTING_BYTE SERIAL_PROTOCOLRPGM(_N("SD printing byte "));////MSG_SD_PRINTING_BYTE
SERIAL_PROTOCOL(sdpos); SERIAL_PROTOCOL(sdpos);
SERIAL_PROTOCOL('/'); SERIAL_PROTOCOL('/');
@ -605,7 +605,7 @@ void CardReader::checkautostart(bool force)
{ {
// The SD start is delayed because otherwise the serial cannot answer // The SD start is delayed because otherwise the serial cannot answer
// fast enough to make contact with the host software. // fast enough to make contact with the host software.
static bool autostart_stilltocheck = true; static bool autostart_stilltocheck = true;
if(!force) if(!force)
{ {
if(!autostart_stilltocheck) if(!autostart_stilltocheck)
@ -620,7 +620,7 @@ void CardReader::checkautostart(bool force)
if(!mounted) //fail if(!mounted) //fail
return; return;
} }
char autoname[30]; char autoname[30];
sprintf_P(autoname, PSTR("auto%i.g"), lastnr); sprintf_P(autoname, PSTR("auto%i.g"), lastnr);
for(int8_t i=0;i<(int8_t)strlen(autoname);i++) for(int8_t i=0;i<(int8_t)strlen(autoname);i++)
@ -628,9 +628,9 @@ void CardReader::checkautostart(bool force)
dir_t p; dir_t p;
root.rewind(); root.rewind();
bool found=false; 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++) for(int8_t i=0;i<(int8_t)strlen((char*)p.name);i++)
p.name[i]=tolower(p.name[i]); p.name[i]=tolower(p.name[i]);
@ -657,17 +657,17 @@ void CardReader::closefile(bool store_location)
{ {
file.sync(); file.sync();
file.close(); file.close();
saving = false; saving = false;
logging = false; logging = false;
if(store_location) if(store_location)
{ {
//future: store printer state, filename and position for continuing a stopped print //future: store printer state, filename and position for continuing a stopped print
// so one can unplug the printer and continue printing the next day. // so one can unplug the printer and continue printing the next day.
} }
} }
void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/) 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; nrFiles=nr;
curDir->rewind(); curDir->rewind();
lsDive("",*curDir,match, LS_GetFilename); lsDive("",*curDir,match, LS_GetFilename);
} }
void CardReader::getfilename_simple(uint16_t entry, const char * const match/*=NULL*/) 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 newfile;
SdFile *parent=&root; SdFile *parent=&root;
if(workDir.isOpen()) if(workDir.isOpen())
parent=&workDir; parent=&workDir;
if(!newfile.open(*parent,relpath, O_READ) || ((workDirDepth + 1) >= MAX_DIR_DEPTH)) if(!newfile.open(*parent,relpath, O_READ) || ((workDirDepth + 1) >= MAX_DIR_DEPTH))
{ {
SERIAL_ECHO_START; SERIAL_ECHO_START;
@ -789,7 +789,7 @@ void CardReader::getfilename_afterMaxSorting(uint16_t entry, const char * const
void CardReader::presort() { void CardReader::presort() {
// Throw away old sort index // Throw away old sort index
flush_presort(); flush_presort();
if (IS_SD_INSERTED == false) return; //sorting is not used in farm mode if (IS_SD_INSERTED == false) return; //sorting is not used in farm mode
uint8_t sdSort = eeprom_read_byte((uint8_t*)EEPROM_SD_SORT); uint8_t sdSort = eeprom_read_byte((uint8_t*)EEPROM_SD_SORT);
@ -808,7 +808,7 @@ void CardReader::presort() {
} }
sort_count = fileCnt; sort_count = fileCnt;
// Init sort order. // Init sort order.
for (uint16_t i = 0; i < fileCnt; i++) { for (uint16_t i = 0; i < fileCnt; i++) {
if (!IS_SD_INSERTED) return; if (!IS_SD_INSERTED) return;
@ -867,14 +867,14 @@ void CardReader::presort() {
uint16_t j = i; uint16_t j = i;
for (; j > 0; --j){ for (; j > 0; --j){
if (!IS_SD_INSERTED) return; if (!IS_SD_INSERTED) return;
#ifdef SORTING_DUMP #ifdef SORTING_DUMP
for (uint16_t z = 0; z < fileCnt; z++){ for (uint16_t z = 0; z < fileCnt; z++){
printf_P(PSTR("%2u "), sort_entries[z]); printf_P(PSTR("%2u "), sort_entries[z]);
} }
MYSERIAL.println(); MYSERIAL.println();
#endif #endif
manage_heater(); manage_heater();
const uint16_t o2 = sort_entries[j - 1]; const uint16_t o2 = sort_entries[j - 1];
@ -894,7 +894,7 @@ void CardReader::presort() {
} else { } else {
#ifdef SORTING_DUMP #ifdef SORTING_DUMP
puts_P(PSTR("shift")); puts_P(PSTR("shift"));
#endif #endif
sort_entries[j] = o2; sort_entries[j] = o2;
} }
} }
@ -957,7 +957,7 @@ void CardReader::presort() {
#ifdef SORTING_DUMP #ifdef SORTING_DUMP
puts_P(PSTR("swap")); puts_P(PSTR("swap"));
#endif #endif
sort_entries[j] = o2; sort_entries[j] = o2;
sort_entries[j + 1] = o1; sort_entries[j + 1] = o1;
didSwap = true; didSwap = true;
@ -966,11 +966,11 @@ void CardReader::presort() {
if (!didSwap) break; if (!didSwap) break;
} //end of bubble sort loop } //end of bubble sort loop
#endif #endif
#ifdef SORTING_SPEEDTEST #ifdef SORTING_SPEEDTEST
printf_P(PSTR("sortingSpeedtestTimer:%lu\n"), sortingSpeedtestTimer.elapsed()); printf_P(PSTR("sortingSpeedtestTimer:%lu\n"), sortingSpeedtestTimer.elapsed());
#endif //SORTING_SPEEDTEST #endif //SORTING_SPEEDTEST
#ifdef SORTING_DUMP #ifdef SORTING_DUMP
for (uint16_t z = 0; z < fileCnt; z++) for (uint16_t z = 0; z < fileCnt; z++)
printf_P(PSTR("%2u "), sort_entries[z]); printf_P(PSTR("%2u "), sort_entries[z]);

View File

@ -12,7 +12,7 @@ class CardReader
{ {
public: public:
CardReader(); CardReader();
enum LsAction : uint8_t enum LsAction : uint8_t
{ {
LS_SerialPrint, LS_SerialPrint,
@ -26,14 +26,14 @@ public:
inline ls_param():LFN(0), timestamp(0) { } inline ls_param():LFN(0), timestamp(0) { }
inline ls_param(bool LFN, bool timestamp):LFN(LFN), timestamp(timestamp) { } inline ls_param(bool LFN, bool timestamp):LFN(LFN), timestamp(timestamp) { }
} __attribute__((packed)); } __attribute__((packed));
void mount(bool doPresort = true); void mount(bool doPresort = true);
void write_command(char *buf); void write_command(char *buf);
void write_command_no_newline(char *buf); void write_command_no_newline(char *buf);
//files auto[0-9].g on the sd card are performed in a row //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 //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 openFileWrite(const char* name);
void openFileReadFilteredGcode(const char* name, bool replace_current = false); void openFileReadFilteredGcode(const char* name, bool replace_current = false);
void openLogFile(const char* name); void openLogFile(const char* name);
@ -49,12 +49,11 @@ public:
void getfilename_simple(uint16_t entry, const char * const match = NULL); void getfilename_simple(uint16_t entry, const char * const match = NULL);
void getfilename_next(uint32_t position, const char * const match = NULL); void getfilename_next(uint32_t position, const char * const match = NULL);
uint16_t getnrfilenames(); uint16_t getnrfilenames();
void getAbsFilename(char *t); void getAbsFilename(char *t);
void printAbsFilenameFast(); void printAbsFilenameFast();
void getDirName(char* name, uint8_t level); void getDirName(char* name, uint8_t level);
uint8_t getWorkDirDepth(); uint8_t getWorkDirDepth();
void ls(ls_param params); void ls(ls_param params);
bool chdir(const char * relpath, bool doPresort); bool chdir(const char * relpath, bool doPresort);
@ -90,7 +89,7 @@ public:
public: public:
bool saving; bool saving;
bool logging; bool logging;
bool sdprinting ; bool sdprinting;
bool mounted; bool mounted;
char filename[FILENAME_LENGTH]; char filename[FILENAME_LENGTH];
// There are scenarios when simple modification time is not enough (on MS Windows) // 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) #define IS_SD_PRINTING (card.sdprinting)
#if (SDCARDDETECT > -1) #if (SDCARDDETECT > -1)
# ifdef SDCARDDETECTINVERTED # ifdef SDCARDDETECTINVERTED
# define IS_SD_INSERTED (READ(SDCARDDETECT)!=0) # define IS_SD_INSERTED (READ(SDCARDDETECT)!=0)
# else # else
# define IS_SD_INSERTED (READ(SDCARDDETECT)==0) # define IS_SD_INSERTED (READ(SDCARDDETECT)==0)

View File

@ -108,7 +108,7 @@ void cmdqueue_reset()
//commands are removed from command queue after process_command() function is finished //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) //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 //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? // 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() void repeatcommand_front()
{ {
cmdbuffer_front_already_processed = true; cmdbuffer_front_already_processed = true;
} }
void get_command() void get_command()
{ {
@ -369,7 +369,7 @@ void get_command()
// start of serial line processing loop // 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 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 #ifdef ENABLE_MEATPACK
// MeatPack Changes // MeatPack Changes
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -596,9 +596,9 @@ void get_command()
{ {
// This is either an empty line, or a line with just a comment. // 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 // 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 // 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 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 // 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 comment_mode = false; //for new command
serial_count = 0; //clear buffer serial_count = 0; //clear buffer
if(card.eof()) break; if(card.eof()) break;
// The following line will reserve buffer space if available. // The following line will reserve buffer space if available.

View File

@ -4,9 +4,9 @@
#include "Marlin.h" #include "Marlin.h"
// String circular buffer. Commands may be pushed to the buffer from both sides: // 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. // 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 #define CMDBUFFER_CURRENT_TYPE_UNKNOWN 0
// Command in cmdbuffer was sent over USB. // Command in cmdbuffer was sent over USB.
#define CMDBUFFER_CURRENT_TYPE_USB 1 #define CMDBUFFER_CURRENT_TYPE_USB 1
@ -16,8 +16,8 @@
#define CMDBUFFER_CURRENT_TYPE_UI 3 #define CMDBUFFER_CURRENT_TYPE_UI 3
// Command in cmdbuffer was generated by another G-code. // Command in cmdbuffer was generated by another G-code.
#define CMDBUFFER_CURRENT_TYPE_CHAINED 4 #define CMDBUFFER_CURRENT_TYPE_CHAINED 4
// Command has been processed and its SD card length has been possibly pushed // Command has been processed and its SD card length has been possibly pushed
// to the planner queue, but not yet removed from the cmdqueue. // to the planner queue, but not yet removed from the cmdqueue.
// This is a temporary state to reduce stepper interrupt locking time. // This is a temporary state to reduce stepper interrupt locking time.
#define CMDBUFFER_CURRENT_TYPE_TO_BE_REMOVED 5 #define CMDBUFFER_CURRENT_TYPE_TO_BE_REMOVED 5
//Command in cmdbuffer was sent over USB and contains line number //Command in cmdbuffer was sent over USB and contains line number

View File

@ -65,7 +65,7 @@
#define LANG_SIZE_RESERVED 0x3500 // reserved space for secondary language (13568 bytes). #define LANG_SIZE_RESERVED 0x3500 // reserved space for secondary language (13568 bytes).
// 0x3D00 Maximum 15616 bytes as it depends on xflash_layout.h // 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) #if (LANG_SIZE_RESERVED % 256)
#error "LANG_SIZE_RESERVED should be a multiple of a page size" #error "LANG_SIZE_RESERVED should be a multiple of a page size"

View File

@ -32,7 +32,7 @@ void eeprom_init()
int last_babystep = eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z); int last_babystep = eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z);
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[0].z_offset)), last_babystep); eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[0].z_offset)), last_babystep);
} }
// initialize the sheet names in eeprom // initialize the sheet names in eeprom
for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); i++) { for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); i++) {
SheetName sheetName; SheetName sheetName;

View File

@ -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 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 fan_edge_counter[1] += 2; //we are currently counting all edges so lets count two edges for one pulse
} }
} }
EICRB ^= (1 << 6); //change edge EICRB ^= (1 << 6); //change edge
} }
#endif //(defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1)) #endif //(defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))

View File

@ -62,7 +62,7 @@
/// Write to a pin wrapper, non critical. /// 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 /// 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. /// 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) #define WRITE_NC(IO, v) _WRITE_NC(IO, v)
/// toggle a pin wrapper /// toggle a pin wrapper
@ -2067,7 +2067,7 @@ pins
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 #ifndef AT90USBxx_TEENSYPP_ASSIGNMENTS // Use traditional Marlin pin assignments
#define DIO0_PIN PINA0 #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 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 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 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 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. The pins 46 and 47 are not supported by Teensyduino, but are supported below.

View File

@ -93,7 +93,7 @@ bool lay1cal_load_filament(uint8_t filament)
//! @brief Print intro line //! @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 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 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) void lay1cal_intro_line(bool extraPurgeNeeded, float layer_height, float extrusion_width)
{ {
static const char cmd_intro_mmu_3[] PROGMEM = "G1 X55 E29 F1073"; static const char cmd_intro_mmu_3[] PROGMEM = "G1 X55 E29 F1073";

View File

@ -11,7 +11,7 @@
// Doing this at higher frequency than the bed "loudspeaker" can handle makes the click barely audible. // Doing this at higher frequency than the bed "loudspeaker" can handle makes the click barely audible.
// Technically: // Technically:
// timer0 is set to fast PWM mode at 62.5kHz (timer0 is linked to the bed heating pin) (zero prescaler) // 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: // since it would burn the heatbed's MOSFET:
// 16MHz/256 levels of PWM duty gives us 62.5kHz // 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 // 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) // 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: // 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. // 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 // 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 // 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, // 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. // - 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 // 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. // 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, // 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! // 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 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, ///< 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 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, ///< 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 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 /// increment slowCounter by 1
/// but use less bits of soft PWM - something like soft_pwm_bed >> 2 /// 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 /// 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; static const uint8_t slowInc = 1;
ISR(TIMER0_OVF_vect) // timer compare interrupt service routine ISR(TIMER0_OVF_vect) // timer compare interrupt service routine
@ -177,6 +177,6 @@ ISR(TIMER0_OVF_vect) // timer compare interrupt service routine
TCNT0 = 128; TCNT0 = 128;
OCR0B = 255; OCR0B = 255;
TCCR0B = (1 << CS01); // change prescaler to 8, i.e. 7.8kHz TCCR0B = (1 << CS01); // change prescaler to 8, i.e. 7.8kHz
break; break;
} }
} }

View File

@ -248,7 +248,7 @@ const char* lang_get_name_by_code(uint16_t code)
#endif // COMMUNITY_LANG_GROUP1_RO #endif // COMMUNITY_LANG_GROUP1_RO
//Use the 3 lines below as a template and replace 'QR' and 'New language' //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 // case LANG_CODE_QR: return _n("New language"); //community contribution
//#endif // COMMUNITY_LANG_GROUP1_QR //#endif // COMMUNITY_LANG_GROUP1_QR
#endif // COMMUNITY_LANGUAGE_SUPPORT #endif // COMMUNITY_LANGUAGE_SUPPORT

View File

@ -43,7 +43,7 @@
/** @brief lang_table_header_t structure - (size= 16byte) */ /** @brief lang_table_header_t structure - (size= 16byte) */
typedef struct typedef struct
{ {
uint32_t magic; //+0 uint32_t magic; //+0
uint16_t size; //+4 uint16_t size; //+4
uint16_t count; //+6 uint16_t count; //+6
uint16_t checksum; //+8 uint16_t checksum; //+8

View File

@ -118,7 +118,7 @@ void lcd_escape_write(uint8_t chr);
#endif #endif
static void lcd_pulseEnable(void) static void lcd_pulseEnable(void)
{ {
WRITE(LCD_PINS_ENABLE,HIGH); WRITE(LCD_PINS_ENABLE,HIGH);
_delay_us(1); // enable pulse must be >450ns _delay_us(1); // enable pulse must be >450ns
WRITE(LCD_PINS_ENABLE,LOW); 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_D5, value & 0x20);
WRITE(LCD_PINS_D6, value & 0x40); WRITE(LCD_PINS_D6, value & 0x40);
WRITE(LCD_PINS_D7, value & 0x80); WRITE(LCD_PINS_D7, value & 0x80);
lcd_pulseEnable(); lcd_pulseEnable();
} }
@ -199,7 +199,7 @@ static void lcd_begin(uint8_t clear)
// finally, set # lines, font size, etc.0 // finally, set # lines, font size, etc.0
lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); lcd_command(LCD_FUNCTIONSET | lcd_displayfunction);
// turn the display on with no cursor or blinking default // turn the display on with no cursor or blinking default
lcd_displaycontrol = LCD_CURSOROFF | LCD_BLINKOFF; lcd_displaycontrol = LCD_CURSOROFF | LCD_BLINKOFF;
lcd_display(); lcd_display();
// clear it off // clear it off
if (clear) lcd_clear(); if (clear) lcd_clear();
@ -207,7 +207,7 @@ static void lcd_begin(uint8_t clear)
lcd_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT; lcd_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
// set the entry mode // set the entry mode
lcd_command(LCD_ENTRYMODESET | lcd_displaymode); lcd_command(LCD_ENTRYMODESET | lcd_displaymode);
#ifdef VT100 #ifdef VT100
lcd_escape[0] = 0; lcd_escape[0] = 0;
#endif #endif
@ -235,12 +235,12 @@ void lcd_init(void)
SET_OUTPUT(LCD_PINS_D5); SET_OUTPUT(LCD_PINS_D5);
SET_OUTPUT(LCD_PINS_D6); SET_OUTPUT(LCD_PINS_D6);
SET_OUTPUT(LCD_PINS_D7); SET_OUTPUT(LCD_PINS_D7);
#ifdef LCD_8BIT #ifdef LCD_8BIT
lcd_displayfunction |= LCD_8BITMODE; lcd_displayfunction |= LCD_8BITMODE;
#endif #endif
lcd_displayfunction |= LCD_2LINE; lcd_displayfunction |= LCD_2LINE;
_delay_us(50000); _delay_us(50000);
lcd_begin(1); //first time init lcd_begin(1); //first time init
fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream 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. // 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. // 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: // 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 // colbyte data0 data1 data2 data3
// a b c d e // a b c d e
// //
// ** ** ** b7 b6 b5 b4 a0 // ** ** ** b7 b6 b5 b4 a0
// ** ** ** b3 b2 b1 b0 a1 // ** ** ** b3 b2 b1 b0 a1
// ** ** ** c7 c6 c5 c4 a2 // ** ** ** 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 // ** ** ** d3 d2 d1 d0 a5
// ** ** ** e7 e6 e5 e4 a6 // ** ** ** e7 e6 e5 e4 a6
// ** ** ** e3 e2 e1 e0 a7 // ** ** ** e3 e2 e1 e0 a7
// //
// The bits marked as ** in the unpacked data are don't care and they will contain garbage. // The bits marked as ** in the unpacked data are don't care and they will contain garbage.
uint8_t temp; uint8_t temp;
@ -414,7 +414,7 @@ void lcd_createChar_P(uint8_t location, const CustomCharacter *char_p)
__asm__ __volatile__ ( __asm__ __volatile__ (
// load colByte // load colByte
"lpm %1, Z+" "\n\t" "lpm %1, Z+" "\n\t"
// begin for loop // begin for loop
"ldi %0, 8" "\n\t" "ldi %0, 8" "\n\t"
"mov __zero_reg__, %0" "\n\t" // use zero_reg as loop counter "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 // end for loop
"dec __zero_reg__" "\n\t" "dec __zero_reg__" "\n\t"
"brne forBegin_%=" "\n\t" "brne forBegin_%=" "\n\t"
: "=&d" (temp), "=&r" (colByte) : "=&d" (temp), "=&r" (colByte)
: "z" (char_p), "e" (charmap) : "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) 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; uint8_t i = 0;
if (n == 0) if (n == 0)
{ {
lcd_print('0'); lcd_print('0');
return; return;
} }
while (n > 0) while (n > 0)
{ {
buf[i++] = n % base; buf[i++] = n % base;
@ -869,7 +869,7 @@ void lcd_buttons_update(void)
uint8_t enc_bits = 0; uint8_t enc_bits = 0;
if (!READ(BTN_EN1)) enc_bits |= _BV(0); if (!READ(BTN_EN1)) enc_bits |= _BV(0);
if (!READ(BTN_EN2)) enc_bits |= _BV(1); if (!READ(BTN_EN2)) enc_bits |= _BV(1);
if (enc_bits != enc_bits_old) if (enc_bits != enc_bits_old)
{ {
int8_t newDiff = pgm_read_byte(&encrot_table[(enc_bits_old << 2) | enc_bits]); 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 #endif // DEBUG_CUSTOM_CHARACTERS
lcd_custom_characters[i] = 0x7F; lcd_custom_characters[i] = 0x7F;
} }
} }
#ifdef DEBUG_CUSTOM_CHARACTERS #ifdef DEBUG_CUSTOM_CHARACTERS
printf_P(PSTR("frame start:")); printf_P(PSTR("frame start:"));
for (uint8_t i = 0; i < 8; i++) { for (uint8_t i = 0; i < 8; i++) {

View File

@ -326,7 +326,7 @@ void FORCE_INLINE mp_handle_cmd(const MeatPack_Command c) {
break; break;
} }
mp_echo_config_state(); mp_echo_config_state();
} }
//========================================================================== //==========================================================================

View File

@ -22,7 +22,7 @@
* objects with high curvature, especially at high speeds. There is also the issue of the limited * 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- * 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. * ware like OctoPrint would also suffer this same micro-stuttering and poor print quality issue.
* *
*/ */
#include <stdint.h> #include <stdint.h>
#include "Configuration.h" #include "Configuration.h"

View File

@ -110,7 +110,7 @@ void menu_back_no_reset(void)
{ {
if (menu_depth > 0) if (menu_depth > 0)
{ {
menu_depth--; menu_depth--;
menu_goto(menu_stack[menu_depth].menu, menu_stack[menu_depth].position, false); 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; lcd_draw_update = 2;
menu_item++; menu_item++;
//prevent the rest of the menu items from rendering or getting clicked //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_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 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 //! @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. //! for displaying large values of extruder positions, which caused text overflow in the previous implementation.
//! //!
//! @param str string label to print //! @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: //! Implementation comments:
//! The text needs to come with a colon ":", this function does not append it anymore. //! The text needs to come with a colon ":", this function does not append it anymore.
//! That resulted in a much shorter implementation (234628B -> 234476B) //! That resulted in a much shorter implementation (234628B -> 234476B)
//! There are similar functions around which may be shortened in a similar way //! There are similar functions around which may be shortened in a similar way
void menu_draw_float31(const char* str, float val) 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 //! @brief Draw up to 14 chars of text and a float number in format +1.234
//! //!
//! @param str string label to print //! @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: //! Implementation comments:
//! This function uses similar optimization principles as menu_draw_float31 //! This function uses similar optimization principles as menu_draw_float31
//! (i.e. str must include a ':' at its end) //! (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)); 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); lcd_set_cursor(0, menu_row);
menu_draw_P(menu_selection_mark(), str, cur_val); 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(); lcd_clear();
progressbar_block_count = 0; progressbar_block_count = 0;
progressbar_total = total; progressbar_total = total;
lcd_set_cursor(0, 1); lcd_set_cursor(0, 1);
lcd_print_pad_P(title, LCD_WIDTH); lcd_print_pad_P(title, LCD_WIDTH);
lcd_set_cursor(0, 2); lcd_set_cursor(0, 2);

View File

@ -10,7 +10,7 @@
//Function pointer to menu functions. //Function pointer to menu functions.
typedef void (*menu_func_t)(void); typedef void (*menu_func_t)(void);
typedef struct typedef struct
{ {
menu_func_t menu; menu_func_t menu;
int8_t position; int8_t position;

View File

@ -262,26 +262,26 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
for (uint8_t i = 0; i < npts; ++i) { for (uint8_t i = 0; i < npts; ++i) {
// First for the residuum in the x axis: // First for the residuum in the x axis:
if (r != 1 && c != 1) { if (r != 1 && c != 1) {
float a = float a =
(r == 0) ? 1.f : (r == 0) ? 1.f :
((r == 2) ? (-s1 * measured_pts[2 * i]) : ((r == 2) ? (-s1 * measured_pts[2 * i]) :
(-c2 * measured_pts[2 * i + 1])); (-c2 * measured_pts[2 * i + 1]));
float b = float b =
(c == 0) ? 1.f : (c == 0) ? 1.f :
((c == 2) ? (-s1 * measured_pts[2 * i]) : ((c == 2) ? (-s1 * measured_pts[2 * i]) :
(-c2 * measured_pts[2 * i + 1])); (-c2 * measured_pts[2 * i + 1]));
float w = point_weight_x(i, measured_pts[2 * i + 1]); float w = point_weight_x(i, measured_pts[2 * i + 1]);
acc += a * b * w; 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 // The first row of the points have a low weight, because their position may not be known
// with a sufficient accuracy. // with a sufficient accuracy.
if (r != 0 && c != 0) { if (r != 0 && c != 0) {
float a = float a =
(r == 1) ? 1.f : (r == 1) ? 1.f :
((r == 2) ? ( c1 * measured_pts[2 * i]) : ((r == 2) ? ( c1 * measured_pts[2 * i]) :
(-s2 * measured_pts[2 * i + 1])); (-s2 * measured_pts[2 * i + 1]));
float b = float b =
(c == 1) ? 1.f : (c == 1) ? 1.f :
((c == 2) ? ( c1 * measured_pts[2 * i]) : ((c == 2) ? ( c1 * measured_pts[2 * i]) :
(-s2 * measured_pts[2 * i + 1])); (-s2 * measured_pts[2 * i + 1]));
@ -295,7 +295,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
acc = 0.f; acc = 0.f;
for (uint8_t i = 0; i < npts; ++i) { for (uint8_t i = 0; i < npts; ++i) {
{ {
float j = float j =
(r == 0) ? 1.f : (r == 0) ? 1.f :
((r == 1) ? 0.f : ((r == 1) ? 0.f :
((r == 2) ? (-s1 * measured_pts[2 * i]) : ((r == 2) ? (-s1 * measured_pts[2 * i]) :
@ -305,7 +305,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
acc += j * fx * w; acc += j * fx * w;
} }
{ {
float j = float j =
(r == 0) ? 0.f : (r == 0) ? 0.f :
((r == 1) ? 1.f : ((r == 1) ? 1.f :
((r == 2) ? ( c1 * measured_pts[2 * i]) : ((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) { if (err > BED_CALIBRATION_POINT_OFFSET_MAX_EUCLIDIAN) {
result = BED_SKEW_OFFSET_DETECTION_FITTING_FAILED; result = BED_SKEW_OFFSET_DETECTION_FITTING_FAILED;
#ifdef SUPPORT_VERBOSITY #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 #endif // SUPPORT_VERBOSITY
} }
} }
@ -684,7 +684,7 @@ void reset_bed_offset_and_skew()
bool is_bed_z_jitter_data_valid() 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 // 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 // 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) { for (int8_t i = 0; i < 8; ++i) {
if (eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + i * 2)) != 0x0FFFF) if (eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + i * 2)) != 0x0FFFF)
return true; return true;
@ -947,11 +947,11 @@ bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int
#endif //SUPPORT_VERBOSITY #endif //SUPPORT_VERBOSITY
) )
{ {
bool high_deviation_occured = false; bool high_deviation_occured = false;
bedPWMDisabled = 1; bedPWMDisabled = 1;
#ifdef TMC2130 #ifdef TMC2130
bool bHighPowerForced = false; bool bHighPowerForced = false;
if (tmc2130_mode == TMC2130_MODE_SILENT) if (tmc2130_mode == TMC2130_MODE_SILENT)
{ {
FORCE_HIGH_POWER_START; FORCE_HIGH_POWER_START;
bHighPowerForced = true; bHighPowerForced = true;
@ -985,7 +985,7 @@ bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int
#endif //TMC2130 #endif //TMC2130
for (uint8_t i = 0; i < n_iter; ++ i) for (uint8_t i = 0; i < n_iter; ++ i)
{ {
current_position[Z_AXIS] += high_deviation_occured ? 0.5 : 0.2; current_position[Z_AXIS] += high_deviation_occured ? 0.5 : 0.2;
float z_bckp = current_position[Z_AXIS]; float z_bckp = current_position[Z_AXIS];
go_to_current(homing_feedrate[Z_AXIS]/60); 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(); 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])); //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) { 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); raise_z(0.5);
current_position[Z_AXIS] = minimum_z; current_position[Z_AXIS] = minimum_z;
go_to_current(homing_feedrate[Z_AXIS]/(4*60)); 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[%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); //printf_P(PSTR("Z- measurement deviation from avg value %f um\n"), dz);
if (dz > 0.05) { //deviation > 50um 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")); //printf_P(PSTR("high dev. first occurence\n"));
delay_keep_alive(500); //damping 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 //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; high_deviation_occured = true;
i = -1; i = -1;
z = 0; z = 0;
} }
else { 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. // 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(); update_current_position_xyz();
enable_z_endstop(false); enable_z_endstop(false);
for (int8_t iter = 0; iter < 2; ++iter) { for (int8_t iter = 0; iter < 2; ++iter) {
/*SERIAL_ECHOPGM("iter: "); /*SERIAL_ECHOPGM("iter: ");
MYSERIAL.println(iter); MYSERIAL.println(iter);
@ -1227,7 +1227,7 @@ BedSkewOffsetDetectionResultType find_bed_induction_sensor_point_xy(int
invert_z_endstop(true); invert_z_endstop(true);
for (int iteration = 0; iteration < 8; iteration++) { for (int iteration = 0; iteration < 8; iteration++) {
found = false; found = false;
enable_z_endstop(true); enable_z_endstop(true);
go_xy(init_x_position + 16.0f, current_position[Y_AXIS], feedrate / 5); go_xy(init_x_position + 16.0f, current_position[Y_AXIS], feedrate / 5);
update_current_position_xyz(); update_current_position_xyz();
@ -1253,7 +1253,7 @@ BedSkewOffsetDetectionResultType find_bed_induction_sensor_point_xy(int
current_position[X_AXIS] = 0.5f * (a + b); current_position[X_AXIS] = 0.5f * (a + b);
go_xy(current_position[X_AXIS], init_y_position, feedrate / 5); go_xy(current_position[X_AXIS], init_y_position, feedrate / 5);
found = true; found = true;
// Search in the Y direction along a cross. // Search in the Y direction along a cross.
found = false; found = false;
enable_z_endstop(true); enable_z_endstop(true);
@ -1329,7 +1329,7 @@ BedSkewOffsetDetectionResultType find_bed_induction_sensor_point_xy(int
break; break;
} }
} }
enable_z_endstop(false); enable_z_endstop(false);
invert_z_endstop(false); invert_z_endstop(false);
return found; return found;
@ -1817,7 +1817,7 @@ canceled:
#define IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_RADIUS (8.f) #define IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_RADIUS (8.f)
#define IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_STEP_FINE_Y (0.1f) #define IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_STEP_FINE_Y (0.1f)
inline bool improve_bed_induction_sensor_point3(int verbosity_level) inline bool improve_bed_induction_sensor_point3(int verbosity_level)
{ {
float center_old_x = current_position[X_AXIS]; float center_old_x = current_position[X_AXIS];
float center_old_y = current_position[Y_AXIS]; float center_old_y = current_position[Y_AXIS];
float a, b; 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) 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. // Don't let the manage_inactivity() function remove power from the motors.
refresh_cmd_timeout(); refresh_cmd_timeout();
@ -2203,13 +2203,13 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
float *vec_y = vec_x + 2; float *vec_y = vec_x + 2;
float *cntr = vec_y + 2; float *cntr = vec_y + 2;
memset(pts, 0, sizeof(float) * 7 * 7); memset(pts, 0, sizeof(float) * 7 * 7);
uint8_t iteration = 0; uint8_t iteration = 0;
BedSkewOffsetDetectionResultType result; BedSkewOffsetDetectionResultType result;
// SERIAL_ECHOLNPGM("find_bed_offset_and_skew verbosity level: "); // SERIAL_ECHOLNPGM("find_bed_offset_and_skew verbosity level: ");
// SERIAL_ECHO(int(verbosity_level)); // SERIAL_ECHO(int(verbosity_level));
// SERIAL_ECHOPGM(""); // SERIAL_ECHOPGM("");
#ifdef NEW_XYZCAL #ifdef NEW_XYZCAL
{ {
#else //NEW_XYZCAL #else //NEW_XYZCAL
@ -2221,7 +2221,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
#ifdef SUPPORT_VERBOSITY #ifdef SUPPORT_VERBOSITY
if (verbosity_level >= 20) { if (verbosity_level >= 20) {
SERIAL_ECHOLNPGM("Vectors: "); SERIAL_ECHOLNPGM("Vectors: ");
SERIAL_ECHOPGM("vec_x[0]:"); SERIAL_ECHOPGM("vec_x[0]:");
MYSERIAL.print(vec_x[0], 5); MYSERIAL.print(vec_x[0], 5);
SERIAL_ECHOLNPGM(""); SERIAL_ECHOLNPGM("");
@ -2290,7 +2290,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
else { else {
// if first iteration failed, count corrected point coordinates as initial // if first iteration failed, count corrected point coordinates as initial
// Use the corrected coordinate, which is a result of find_bed_offset_and_skew(). // 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[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]; 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 NEW_XYZCAL
#ifndef HEATBED_V2 #ifndef HEATBED_V2
if (k == 0 || k == 1) { if (k == 0 || k == 1) {
// Improve the position of the 1st row sensor points by a zig-zag movement. // Improve the position of the 1st row sensor points by a zig-zag movement.
find_bed_induction_sensor_point_z(); 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[0] += (current_position[X_AXIS]/(iteration + 1)); //count average
pt[1] = (pt[1] * iteration) / (iteration + 1); pt[1] = (pt[1] * iteration) / (iteration + 1);
pt[1] += (current_position[Y_AXIS] / (iteration + 1)); pt[1] += (current_position[Y_AXIS] / (iteration + 1));
//pt[0] += current_position[X_AXIS]; //pt[0] += current_position[X_AXIS];
//if(iteration > 0) pt[0] = pt[0] / 2; //if(iteration > 0) pt[0] = pt[0] / 2;
//pt[1] += current_position[Y_AXIS]; //pt[1] += current_position[Y_AXIS];
//if (iteration > 0) pt[1] = pt[1] / 2; //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")); DBG(_n("All 4 calibration points found.\n"));
delay_keep_alive(0); //manage_heater, reset watchdog, manage inactivity delay_keep_alive(0); //manage_heater, reset watchdog, manage inactivity
#ifdef SUPPORT_VERBOSITY #ifdef SUPPORT_VERBOSITY
if (verbosity_level >= 20) { if (verbosity_level >= 20) {
// Test the positions. Are the positions reproducible? Now the calibration is active in the planner. // 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); 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 delay_keep_alive(0); //manage_heater, reset watchdog, manage inactivity
if (result >= 0) { if (result >= 0) {
DBG(_n("Calibration success.\n")); DBG(_n("Calibration success.\n"));
world2machine_update(vec_x, vec_y, cntr); world2machine_update(vec_x, vec_y, cntr);
@ -2500,7 +2500,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
} }
iteration++; iteration++;
} }
return result; return result;
} }
#ifndef NEW_XYZCAL #ifndef NEW_XYZCAL
@ -2903,7 +2903,7 @@ bool sample_mesh_and_store_reference()
kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
} }
// Get cords of measuring point // Get cords of measuring point
mbl.set_z(ix, iy, current_position[Z_AXIS]); mbl.set_z(ix, iy, current_position[Z_AXIS]);
} }
{ {
@ -3060,11 +3060,11 @@ void babystep_load()
if (calibration_status_get(CALIBRATION_STATUS_LIVE_ADJUST)) if (calibration_status_get(CALIBRATION_STATUS_LIVE_ADJUST))
{ {
check_babystep(); //checking if babystep is in allowed range, otherwise setting babystep to 0 check_babystep(); //checking if babystep is in allowed range, otherwise setting babystep to 0
// End of G80: Apply the baby stepping value. // End of G80: Apply the baby stepping value.
babystepLoadZ = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base-> babystepLoadZ = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->
s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset))); s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)));
#if 0 #if 0
SERIAL_ECHO("Z baby step: "); SERIAL_ECHO("Z baby step: ");
SERIAL_ECHO(babystepLoadZ); SERIAL_ECHO(babystepLoadZ);
@ -3091,7 +3091,7 @@ void babystep_undo()
void babystep_reset() void babystep_reset()
{ {
babystepLoadZ = 0; babystepLoadZ = 0;
} }
void count_xyz_details(float (&distanceMin)[2]) { 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); 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 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 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) //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) { bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy) {
//"human readable" heatbed plan //"human readable" heatbed plan

View File

@ -133,7 +133,7 @@ inline bool world2machine_clamp(float &x, float &y)
tmpx = X_MAX_POS; tmpx = X_MAX_POS;
clamped = true; clamped = true;
} }
if (tmpy < Y_MIN_POS) { if (tmpy < Y_MIN_POS) {
tmpy = Y_MIN_POS; tmpy = Y_MIN_POS;
clamped = true; clamped = true;
@ -169,7 +169,7 @@ enum BedSkewOffsetDetectionResultType {
BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND = -1, //!< Point not found. BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND = -1, //!< Point not found.
BED_SKEW_OFFSET_DETECTION_FITTING_FAILED = -2, //!< Fitting failed BED_SKEW_OFFSET_DETECTION_FITTING_FAILED = -2, //!< Fitting failed
BED_SKEW_OFFSET_DETECTION_POINT_SCAN_FAILED = -3, //!< Point scan failed, try again BED_SKEW_OFFSET_DETECTION_POINT_SCAN_FAILED = -3, //!< Point scan failed, try again
// Detection finished with success. // Detection finished with success.
BED_SKEW_OFFSET_DETECTION_PERFECT = 0, //!< Perfect. BED_SKEW_OFFSET_DETECTION_PERFECT = 0, //!< Perfect.
BED_SKEW_OFFSET_DETECTION_SKEW_MILD = 1, //!< Mildly skewed. 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. // Useful for visualizing the behavior of the bed induction detector.
extern bool scan_bed_induction_points(int8_t verbosity_level); 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 // 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. // after power panic, when it is expected, that the baby step has been already applied.
extern void babystep_load(); extern void babystep_load();

View File

@ -14,7 +14,7 @@ void mesh_bed_leveling::reset() {
float mesh_bed_leveling::get_z(float x, float y) { float mesh_bed_leveling::get_z(float x, float y) {
int i, j; int i, j;
float s, t; float s, t;
i = int(floor((x - (BED_X0 + X_PROBE_OFFSET_FROM_EXTRUDER)) / x_mesh_density)); i = int(floor((x - (BED_X0 + X_PROBE_OFFSET_FROM_EXTRUDER)) / x_mesh_density));
if (i < 0) { if (i < 0) {
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; t = (y - get_y(j)) / y_mesh_density;
} }
float si = 1.f-s; float si = 1.f-s;
float z0 = si * z_values[j ][i] + s * z_values[j ][i+1]; 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]; 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])) if (!isnan(z_values[j][i]))
continue; continue;
float x = get_x(i); 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][idx0] * (x - x1) * (x - x2) / ((x0 - x1) * (x0 - x2)) +
z_values[j][idx1] * (x - x0) * (x - x2) / ((x1 - x0) * (x1 - 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)); 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])) if (!isnan(z_values[j][i]))
continue; continue;
float y = get_y(j); 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[idx0][i] * (y - y1) * (y - y2) / ((y0 - y1) * (y0 - y2)) +
z_values[idx1][i] * (y - y0) * (y - y2) / ((y1 - y0) * (y1 - 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)); z_values[idx2][i] * (y - y0) * (y - y1) / ((y2 - y0) * (y2 - y1));

View File

@ -7,9 +7,9 @@ class mesh_bed_leveling {
public: public:
uint8_t active; uint8_t active;
float z_values[MESH_NUM_Y_POINTS][MESH_NUM_X_POINTS]; float z_values[MESH_NUM_Y_POINTS][MESH_NUM_X_POINTS];
mesh_bed_leveling() { reset(); } mesh_bed_leveling() { reset(); }
void reset(); void reset();
static float get_x(int i) { return BED_X(i) + X_PROBE_OFFSET_FROM_EXTRUDER; } static float get_x(int i) { return BED_X(i) + X_PROBE_OFFSET_FROM_EXTRUDER; }

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/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/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 wget https://raw.githubusercontent.com/prusa3d/Prusa-Error-Codes/master/04_MMU/error-codes.yaml --output-document=error-codes.yaml

View File

@ -124,10 +124,10 @@ static const constexpr uint16_t errorCodes[] PROGMEM = {
ERR_ELECTRICAL_MMU_MCU_ERROR, ERR_ELECTRICAL_MMU_MCU_ERROR,
ERR_CONNECT_MMU_NOT_RESPONDING, ERR_CONNECT_MMU_NOT_RESPONDING,
ERR_CONNECT_COMMUNICATION_ERROR, ERR_CONNECT_COMMUNICATION_ERROR,
ERR_SYSTEM_FILAMENT_ALREADY_LOADED, ERR_SYSTEM_FILAMENT_ALREADY_LOADED,
ERR_SYSTEM_INVALID_TOOL, ERR_SYSTEM_INVALID_TOOL,
ERR_SYSTEM_QUEUE_FULL, ERR_SYSTEM_QUEUE_FULL,
ERR_SYSTEM_FW_UPDATE_NEEDED, ERR_SYSTEM_FW_UPDATE_NEEDED,
ERR_SYSTEM_FW_RUNTIME_ERROR, ERR_SYSTEM_FW_RUNTIME_ERROR,
ERR_SYSTEM_UNLOAD_MANUALLY, ERR_SYSTEM_UNLOAD_MANUALLY,
ERR_SYSTEM_FILAMENT_EJECTED, ERR_SYSTEM_FILAMENT_EJECTED,

View File

@ -67,17 +67,17 @@ uint8_t PrusaErrorCodeIndex(ErrorCode ec) {
case ErrorCode::STALLED_PULLEY: case ErrorCode::STALLED_PULLEY:
case ErrorCode::MOVE_PULLEY_FAILED: case ErrorCode::MOVE_PULLEY_FAILED:
return FindErrorIndex(ERR_MECHANICAL_PULLEY_CANNOT_MOVE); return FindErrorIndex(ERR_MECHANICAL_PULLEY_CANNOT_MOVE);
case ErrorCode::HOMING_SELECTOR_FAILED: case ErrorCode::HOMING_SELECTOR_FAILED:
return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_HOME); return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_HOME);
case ErrorCode::MOVE_SELECTOR_FAILED: case ErrorCode::MOVE_SELECTOR_FAILED:
return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_MOVE); return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_MOVE);
case ErrorCode::HOMING_IDLER_FAILED: case ErrorCode::HOMING_IDLER_FAILED:
return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_HOME); return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_HOME);
case ErrorCode::MOVE_IDLER_FAILED: case ErrorCode::MOVE_IDLER_FAILED:
return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_MOVE); return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_MOVE);
case ErrorCode::MMU_NOT_RESPONDING: case ErrorCode::MMU_NOT_RESPONDING:
return FindErrorIndex(ERR_CONNECT_MMU_NOT_RESPONDING); return FindErrorIndex(ERR_CONNECT_MMU_NOT_RESPONDING);
case ErrorCode::PROTOCOL_ERROR: case ErrorCode::PROTOCOL_ERROR:
@ -98,7 +98,7 @@ uint8_t PrusaErrorCodeIndex(ErrorCode ec) {
return FindErrorIndex(ERR_ELECTRICAL_MMU_MCU_ERROR); return FindErrorIndex(ERR_ELECTRICAL_MMU_MCU_ERROR);
default: break; default: break;
} }
// Electrical issues which can be detected somehow. // 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 // 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. // and to keep the code size down.
@ -199,7 +199,7 @@ Buttons ButtonPressed(ErrorCode ec) {
Buttons ButtonAvailable(ErrorCode ec) { Buttons ButtonAvailable(ErrorCode ec) {
uint8_t ei = PrusaErrorCodeIndex(ec); uint8_t ei = PrusaErrorCodeIndex(ec);
// The list of responses which occur in mmu error dialogs // 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) // Return button index or perform some action on the MK3 by itself (like Reset MMU)
// Based on Prusa-Error-Codes errors_list.h // Based on Prusa-Error-Codes errors_list.h
@ -266,23 +266,23 @@ Buttons ButtonAvailable(ErrorCode ec) {
break; break;
} }
break; break;
case ERR_TEMPERATURE_TMC_PULLEY_OVERHEAT_ERROR: case ERR_TEMPERATURE_TMC_PULLEY_OVERHEAT_ERROR:
case ERR_TEMPERATURE_TMC_SELECTOR_OVERHEAT_ERROR: case ERR_TEMPERATURE_TMC_SELECTOR_OVERHEAT_ERROR:
case ERR_TEMPERATURE_TMC_IDLER_OVERHEAT_ERROR: case ERR_TEMPERATURE_TMC_IDLER_OVERHEAT_ERROR:
case ERR_ELECTRICAL_TMC_PULLEY_DRIVER_ERROR: case ERR_ELECTRICAL_TMC_PULLEY_DRIVER_ERROR:
case ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_ERROR: case ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_ERROR:
case ERR_ELECTRICAL_TMC_IDLER_DRIVER_ERROR: case ERR_ELECTRICAL_TMC_IDLER_DRIVER_ERROR:
case ERR_ELECTRICAL_TMC_PULLEY_DRIVER_RESET: case ERR_ELECTRICAL_TMC_PULLEY_DRIVER_RESET:
case ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_RESET: case ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_RESET:
case ERR_ELECTRICAL_TMC_IDLER_DRIVER_RESET: case ERR_ELECTRICAL_TMC_IDLER_DRIVER_RESET:
case ERR_ELECTRICAL_TMC_PULLEY_UNDERVOLTAGE_ERROR: case ERR_ELECTRICAL_TMC_PULLEY_UNDERVOLTAGE_ERROR:
case ERR_ELECTRICAL_TMC_SELECTOR_UNDERVOLTAGE_ERROR: case ERR_ELECTRICAL_TMC_SELECTOR_UNDERVOLTAGE_ERROR:
case ERR_ELECTRICAL_TMC_IDLER_UNDERVOLTAGE_ERROR: case ERR_ELECTRICAL_TMC_IDLER_UNDERVOLTAGE_ERROR:
case ERR_ELECTRICAL_TMC_PULLEY_DRIVER_SHORTED: case ERR_ELECTRICAL_TMC_PULLEY_DRIVER_SHORTED:
case ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_SHORTED: case ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_SHORTED:
case ERR_ELECTRICAL_TMC_IDLER_DRIVER_SHORTED: case ERR_ELECTRICAL_TMC_IDLER_DRIVER_SHORTED:
@ -323,7 +323,7 @@ Buttons ButtonAvailable(ErrorCode ec) {
break; break;
} }
break; break;
case ERR_SYSTEM_INVALID_TOOL: case ERR_SYSTEM_INVALID_TOOL:
switch (buttonSelectedOperation) { switch (buttonSelectedOperation) {
case ButtonOperations::StopPrint: // "Stop print" case ButtonOperations::StopPrint: // "Stop print"
@ -338,7 +338,7 @@ Buttons ButtonAvailable(ErrorCode ec) {
default: default:
break; break;
} }
return Buttons::NoButton; return Buttons::NoButton;
} }

View File

@ -157,7 +157,7 @@ static uint8_t ReportErrorHookMonitor(uint8_t ei) {
//! | | //! | |
//! |>(left) | //! |>(left) |
//! ---------------------- //! ----------------------
//! Three choices //! Three choices
//! |>(left)>(mid)>(righ)| //! |>(left)>(mid)>(righ)|
//! ---------------------- //! ----------------------
//! Two choices //! Two choices
@ -236,7 +236,7 @@ bool TuneMenuEntered() {
void ReportErrorHook(CommandInProgress /*cip*/, ErrorCode ec, uint8_t /*es*/) { void ReportErrorHook(CommandInProgress /*cip*/, ErrorCode ec, uint8_t /*es*/) {
if (putErrorScreenToSleep) return; if (putErrorScreenToSleep) return;
if (mmu2.MMUCurrentErrorCode() == ErrorCode::OK && mmu2.MMULastErrorSource() == MMU2::ErrorSourceMMU) { if (mmu2.MMUCurrentErrorCode() == ErrorCode::OK && mmu2.MMULastErrorSource() == MMU2::ErrorSourceMMU) {
// If the error code suddenly changes to OK, that means // If the error code suddenly changes to OK, that means
// a button was pushed on the MMU and the LCD should // 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. // To save the print, make the Tune button unresponsive for now.
return; return;
} }
putErrorScreenToSleep = true; putErrorScreenToSleep = true;
menu_submenu(tuneIdlerStallguardThresholdMenu); menu_submenu(tuneIdlerStallguardThresholdMenu);
} }

View File

@ -24,13 +24,13 @@
#include "stepper.h" #include "stepper.h"
#include "planner.h" #include "planner.h"
// The arc is approximated by generating a huge number of tiny, linear segments. The length of each // 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. // 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) 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]; float start_position[4];
memcpy(start_position, position, sizeof(start_position)); memcpy(start_position, position, sizeof(start_position));
float r_axis_x = -offset[X_AXIS]; // Radius vector from center to current location float r_axis_x = -offset[X_AXIS]; // Radius vector from center to current location
float r_axis_y = -offset[Y_AXIS]; float r_axis_y = -offset[Y_AXIS];
float center_axis_x = start_position[X_AXIS] - r_axis_x; 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 // calculating here
const float millimeters_of_travel_arc = hypot(angular_travel_total * radius, fabs(travel_z)); const float millimeters_of_travel_arc = hypot(angular_travel_total * radius, fabs(travel_z));
if (millimeters_of_travel_arc < 0.001) { return; } if (millimeters_of_travel_arc < 0.001) { return; }
// Calculate the number of arc segments // Calculate the number of arc segments
unsigned short segments = static_cast<unsigned short>(ceil(millimeters_of_travel_arc / mm_per_arc_segment)); unsigned short segments = static_cast<unsigned short>(ceil(millimeters_of_travel_arc / mm_per_arc_segment));

View File

@ -4,7 +4,7 @@
Copyright (c) 2009-2011 Simen Svale Skogsrud Copyright (c) 2009-2011 Simen Svale Skogsrud
Copyright (c) 2011 Sungeun K. Jeon Copyright (c) 2011 Sungeun K. Jeon
Grbl is free software: you can redistribute it and/or modify Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
@ -22,7 +22,7 @@
#ifndef motion_control_h #ifndef motion_control_h
#define 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 // 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 // the direction of helical travel, radius == circle radius, isclockwise boolean. Used
// for vector transformation direction. // for vector transformation direction.

View File

@ -13,7 +13,7 @@
#define OPTIBOOT_MAJVER 6 #define OPTIBOOT_MAJVER 6
#define OPTIBOOT_CUSTOMVER 0 #define OPTIBOOT_CUSTOMVER 0
#define OPTIBOOT_MINVER 2 #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; optiboot_version = 256*(OPTIBOOT_MAJVER + OPTIBOOT_CUSTOMVER) + OPTIBOOT_MINVER;
#if 0 #if 0

View File

@ -54,7 +54,7 @@ const PROGMEM uint8_t pat9125_init_bank0[] = {
PAT9125_RES_Y, PAT9125_YRES, PAT9125_RES_Y, PAT9125_YRES,
// Set data format and sensor orientation. // 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)), 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. // Now continues the magic sequence from the PAT912EL Application Note: Firmware Guides for Tracking Optimization.
0x5e, 0x08, 0x5e, 0x08,
0x20, 0x64, 0x20, 0x64,
@ -136,22 +136,22 @@ uint8_t pat9125_init(void)
pat9125_wr_reg(PAT9125_CONFIG, 0x97); pat9125_wr_reg(PAT9125_CONFIG, 0x97);
// Wait until the sensor reboots. // Wait until the sensor reboots.
_delay_ms(1); _delay_ms(1);
//Write init sequence in bank0. MUST ALREADY BE IN bank0. //Write init sequence in bank0. MUST ALREADY BE IN bank0.
if (!pat9125_wr_seq(pat9125_init_bank0)) if (!pat9125_wr_seq(pat9125_init_bank0))
return 0; return 0;
_delay_ms(10); // not sure why this is here. But I'll allow it. _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. // Switch to bank1, not allowed to perform pat9125_wr_reg_verify on this register.
pat9125_wr_reg(PAT9125_BANK_SELECTION, 0x01); pat9125_wr_reg(PAT9125_BANK_SELECTION, 0x01);
//Write init sequence in bank1. MUST ALREADY BE IN bank1. //Write init sequence in bank1. MUST ALREADY BE IN bank1.
if (!pat9125_wr_seq(pat9125_init_bank1)) if (!pat9125_wr_seq(pat9125_init_bank1))
return 0; return 0;
// Switch to bank0, not allowed to perform pat9125_wr_reg_verify on this register. // Switch to bank0, not allowed to perform pat9125_wr_reg_verify on this register.
pat9125_wr_reg(PAT9125_BANK_SELECTION, 0x00); pat9125_wr_reg(PAT9125_BANK_SELECTION, 0x00);
// Enable write protect. // Enable write protect.
pat9125_wr_reg(PAT9125_WP, 0x00); //prevents writing to registers over 0x09 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 #else //PAT9125_NEW_INIT
// Disable write protect. // Disable write protect.
pat9125_wr_reg(PAT9125_WP, 0x5a); //allows writing to all registers pat9125_wr_reg(PAT9125_WP, 0x5a); //allows writing to all registers
pat9125_wr_reg(PAT9125_RES_X, PAT9125_XRES); pat9125_wr_reg(PAT9125_RES_X, PAT9125_XRES);
pat9125_wr_reg(PAT9125_RES_Y, PAT9125_YRES); 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_X=%u\n"), pat9125_rd_reg(PAT9125_RES_X));
printf_P(PSTR("PAT9125_RES_Y=%u\n"), pat9125_rd_reg(PAT9125_RES_Y)); 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))); 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. // Enable write protect.
pat9125_wr_reg(PAT9125_WP, 0x00); //prevents writing to registers over 0x09 pat9125_wr_reg(PAT9125_WP, 0x00); //prevents writing to registers over 0x09
#endif //PAT9125_NEW_INIT #endif //PAT9125_NEW_INIT

View File

@ -119,7 +119,7 @@
#define SDCARDDETECT 15 #define SDCARDDETECT 15
#define TACH_0 79 // !!! changed from 81 (EINY03) #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) #define IR_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8)

View File

@ -101,7 +101,7 @@
#define SDCARDDETECT 72 #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. // 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. // Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop.

View File

@ -1,53 +1,53 @@
/* /*
planner.c - buffers movement commands and manages the acceleration profile plan planner.c - buffers movement commands and manages the acceleration profile plan
Part of Grbl Part of Grbl
Copyright (c) 2009-2011 Simen Svale Skogsrud Copyright (c) 2009-2011 Simen Svale Skogsrud
Grbl is free software: you can redistribute it and/or modify Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Grbl is distributed in the hope that it will be useful, Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>. along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* The ring buffer implementation gleaned from the wiring_serial library by David A. Mellis. */ /* 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'): Reasoning behind the mathematics in this module (in the key of 'Mathematica'):
s == speed, a == acceleration, t == time, d == distance s == speed, a == acceleration, t == time, d == distance
Basic definitions: 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] Travel[s_, a_, t_] := Integrate[Speed[s, a, t], t]
Distance to reach a specific speed with a constant acceleration: Distance to reach a specific speed with a constant acceleration:
Solve[{Speed[s, a, t] == m, Travel[s, a, t] == d}, d, t] Solve[{Speed[s, a, t] == m, Travel[s, a, t] == d}, d, t]
d -> (m^2 - s^2)/(2 a) --> estimate_acceleration_distance() d -> (m^2 - s^2)/(2 a) --> estimate_acceleration_distance()
Speed after a given distance of travel with constant acceleration: Speed after a given distance of travel with constant acceleration:
Solve[{Speed[s, a, t] == m, Travel[s, a, t] == d}, m, t] 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] DestinationSpeed[s_, a_, d_] := Sqrt[2 a d + s^2]
When to start braking (di) to reach a specified destionation speed (s2) after accelerating When to start braking (di) to reach a specified destionation speed (s2) after accelerating
from initial speed s1 without ever stopping at a plateau: from initial speed s1 without ever stopping at a plateau:
Solve[{DestinationSpeed[s1, a, di] == DestinationSpeed[s2, a, d - di]}, di] Solve[{DestinationSpeed[s1, a, di] == DestinationSpeed[s2, a, d - di]}, di]
di -> (2 a d - s1^2 + s2^2)/(4 a) --> intersection_distance() 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) 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 volatile uint8_t block_buffer_tail; // Index of the block to process now
#ifdef PLANNER_DIAGNOSTICS #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; static uint8_t g_cntr_planner_queue_min = 0;
#endif /* PLANNER_DIAGNOSTICS */ #endif /* PLANNER_DIAGNOSTICS */
@ -155,7 +155,7 @@ static inline uint8_t prev_block_index(uint8_t block_index) {
//=============================functions ============================ //=============================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: // given acceleration:
FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float 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 // 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 // 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) // 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) { if (acceleration!=0) {
return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/ 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 #define MINIMAL_STEP_RATE 120
// Calculates trapezoid parameters so that the entry- and exit-speed is compensated by the provided factors. // 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. // These two lines are the only floating point calculations performed in this routine.
// initial_rate, final_rate in Hz. // 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 // Avoid negative numbers
if (final_rate_sqr >= initial_rate_sqr) { if (final_rate_sqr >= initial_rate_sqr) {
// accelerate_steps = ceil(intersection_distance(initial_rate, final_rate, acceleration, block->step_event_count)); // 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); // (2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/(4.0*acceleration);
#if 0 #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; 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; 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. // 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); // assert(decceleration < 0);
return sqrt(target_velocity*target_velocity-2*decceleration*distance); 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: // 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: // so that:
// a. The junction jerk is within the set limit // 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. // acceleration.
// 2. Go over every block in chronological order and dial down junction speed reduction values if // 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 // a. The speed increase within one block would require faster accelleration than the one, true
// constant acceleration. // constant acceleration.
// //
// When these stages are complete all blocks have an entry_factor that will allow all speed changes to // 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 // be performed using only the one, true constant acceleration, and where no junction jerk is jerkier than
// the set limit. Finally it will: // the set limit. Finally it will:
// //
// 3. Recalculate trapezoids for all blocks. // 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: // Following sources may be used to optimize the 8-bit AVR code:
// http://www.mikrocontroller.net/articles/AVR_Arithmetik // http://www.mikrocontroller.net/articles/AVR_Arithmetik
// http://darcy.rsgc.on.ca/ACES/ICE4M/FixedPoint/avrfix.pdf // 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://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/gcc/Fixed-Point.html
// https://gcc.gnu.org/onlinedocs/gccint/Fixed-point-fractional-library-routines.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://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://mekonik.wordpress.com/2009/03/18/arduino-avr-gcc-multiplication/
// https://github.com/rekka/avrmultiplication // https://github.com/rekka/avrmultiplication
// //
// https://people.ece.cornell.edu/land/courses/ece4760/Math/Floating_point/ // 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/
// https://courses.cit.cornell.edu/ee476/Math/GCC644/fixedPt/multASM.S // 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 // Reverse pass
// Make a local copy of block_buffer_tail, because the interrupt can alter it // 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() void check_axes_activity()
{ {
uint8_t x_active = 0; uint8_t x_active = 0;
uint8_t y_active = 0; uint8_t y_active = 0;
uint8_t z_active = 0; uint8_t z_active = 0;
uint8_t e_active = 0; uint8_t e_active = 0;
uint8_t tail_fan_speed = fanSpeed; 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]); current_position[Z_AXIS] -= mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS]);
else { else {
float t = float(step_events_completed) / float(current_block->step_event_count); 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_x / cs.axis_steps_per_mm[X_AXIS],
current_block->steps_y / cs.axis_steps_per_mm[Y_AXIS], current_block->steps_y / cs.axis_steps_per_mm[Y_AXIS],
current_block->steps_z / cs.axis_steps_per_mm[Z_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]); 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 // 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. // 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) 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. // Rest here until there is room in the buffer.
if (block_buffer_tail == next_buffer_head) { if (block_buffer_tail == next_buffer_head) {
do { do {
manage_heater(); manage_heater();
// Vojtech: Don't disable motors inside the planner! // Vojtech: Don't disable motors inside the planner!
manage_inactivity(false); manage_inactivity(false);
lcd_update(0); lcd_update(0);
} while (block_buffer_tail == next_buffer_head); } 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)); memcpy(block->gcode_start_position, gcode_start_position, sizeof(block_t::gcode_start_position));
else else
memcpy(block->gcode_start_position, current_position, sizeof(block_t::gcode_start_position)); 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) // Save the index of this segment (when a single G0/1/2/3 command plans multiple segments)
block->segment_idx = segment_idx; 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 dx = target[X_AXIS] - position[X_AXIS];
int32_t dy = target[Y_AXIS] - position[Y_AXIS]; int32_t dy = target[Y_AXIS] - position[Y_AXIS];
int32_t dz = target[Z_AXIS] - position[Z_AXIS]; int32_t dz = target[Z_AXIS] - position[Z_AXIS];
#ifdef PREVENT_DANGEROUS_EXTRUDE #ifdef PREVENT_DANGEROUS_EXTRUDE
if(de) 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_ECHO_START;
SERIAL_ECHOLNRPGM(_n(" cold extrusion prevented"));////MSG_ERR_COLD_EXTRUDE_STOP SERIAL_ECHOLNRPGM(_n(" cold extrusion prevented"));////MSG_ERR_COLD_EXTRUDE_STOP
} }
#ifdef PREVENT_LENGTHY_EXTRUDE #ifdef PREVENT_LENGTHY_EXTRUDE
if(labs(de) > cs.axis_steps_per_mm[E_AXIS]*EXTRUDE_MAXLENGTH) 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 // Bail if this is a zero-length block
if (block->step_event_count.wide <= dropsegments) if (block->step_event_count.wide <= dropsegments)
{ {
#ifdef PLANNER_DIAGNOSTICS #ifdef PLANNER_DIAGNOSTICS
planner_update_queue_min_counter(); planner_update_queue_min_counter();
#endif /* PLANNER_DIAGNOSTICS */ #endif /* PLANNER_DIAGNOSTICS */
return; return;
} }
block->fan_speed = fanSpeed; block->fan_speed = fanSpeed;
@ -917,15 +917,15 @@ block->steps[Y_AXIS].wide = labs(dx - dy);
else else
{ {
if(feed_rate<cs.minimumfeedrate) feed_rate=cs.minimumfeedrate; if(feed_rate<cs.minimumfeedrate) feed_rate=cs.minimumfeedrate;
} }
/* This part of the code calculates the total length of the movement. /* This part of the code calculates the total length of the movement.
For cartesian bots, the X_AXIS is the real X movement and same for Y_AXIS. For cartesian bots, the X_AXIS is the real X movement and same for Y_AXIS.
But for corexy bots, that is not true. The "X_AXIS" and "Y_AXIS" motors (that should be named to A_AXIS But for corexy bots, that is not true. The "X_AXIS" and "Y_AXIS" motors (that should be named to A_AXIS
and B_AXIS) cannot be used for X and Y length, because A=X+Y and B=X-Y. and B_AXIS) cannot be used for X and Y length, because A=X+Y and B=X-Y.
So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head. So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
Having the real displacement of the head, we can calculate the total movement length and apply the desired speed. Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
*/ */
#ifndef COREXY #ifndef COREXY
float delta_mm[4]; float delta_mm[4];
delta_mm[X_AXIS] = dx / cs.axis_steps_per_mm[X_AXIS]; delta_mm[X_AXIS] = dx / cs.axis_steps_per_mm[X_AXIS];
@ -942,16 +942,16 @@ Having the real displacement of the head, we can calculate the total movement le
if ( block->steps[X_AXIS].wide <=dropsegments && block->steps[Y_AXIS].wide <=dropsegments && block->steps[Z_AXIS].wide <=dropsegments ) if ( block->steps[X_AXIS].wide <=dropsegments && block->steps[Y_AXIS].wide <=dropsegments && block->steps[Z_AXIS].wide <=dropsegments )
{ {
block->millimeters = fabs(delta_mm[E_AXIS]); block->millimeters = fabs(delta_mm[E_AXIS]);
} }
else else
{ {
#ifndef COREXY #ifndef COREXY
block->millimeters = sqrt(square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])); block->millimeters = sqrt(square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS]));
#else #else
block->millimeters = sqrt(square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS])); 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. // Calculate speed in mm/second for each axis. No divide by zero due to previous checks.
float inverse_second = feed_rate * inverse_millimeters; 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) if( speed_factor < 1.0)
{ {
for(unsigned char i=0; i < 4; i++) 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 #ifdef LIN_ADVANCE
float e_D_ratio = 0; float e_D_ratio = 0;
#endif #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->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. // 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; 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; v_entry *= v_factor;
} }
// Calculate the jerk depending on whether the axis is coasting in the same direction or reversing a direction. // 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_exit > v_entry) ?
((v_entry > 0.f || v_exit < 0.f) ? ((v_entry > 0.f || v_exit < 0.f) ?
// coasting // coasting
(v_exit - v_entry) : (v_exit - v_entry) :
// axis reversal // axis reversal
max(v_exit, - v_entry)) : max(v_exit, - v_entry)) :
// 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[Z_AXIS] = z;
position_float[E_AXIS] = e; position_float[E_AXIS] = e;
#endif #endif
// Recalculate the trapezoids to maximize speed at the segment transitions while respecting // Recalculate the trapezoids to maximize speed at the segment transitions while respecting
// the machine limits (maximum acceleration and maximum jerk). // the machine limits (maximum acceleration and maximum jerk).
// This runs asynchronously with the stepper interrupt controller, which may // 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[X_AXIS] = lround(x*cs.axis_steps_per_mm[X_AXIS]);
position[Y_AXIS] = lround(y*cs.axis_steps_per_mm[Y_AXIS]); position[Y_AXIS] = lround(y*cs.axis_steps_per_mm[Y_AXIS]);
#ifdef MESH_BED_LEVELING #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+mbl.get_z(x, y))*cs.axis_steps_per_mm[Z_AXIS]) :
lround(z*cs.axis_steps_per_mm[Z_AXIS]); lround(z*cs.axis_steps_per_mm[Z_AXIS]);
#else #else
@ -1350,7 +1350,7 @@ void plan_set_e_position(const float &e)
#ifdef LIN_ADVANCE #ifdef LIN_ADVANCE
position_float[E_AXIS] = e; position_float[E_AXIS] = e;
#endif #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]); st_set_e_position(position[E_AXIS]);
} }
@ -1422,7 +1422,7 @@ uint16_t planner_calc_sd_length()
while (_block_buffer_head != _block_buffer_tail) while (_block_buffer_head != _block_buffer_tail)
{ {
sdlen += block_buffer[_block_buffer_tail].sdlen; 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; return sdlen;
} }

View File

@ -18,7 +18,7 @@
along with Grbl. If not, see <http://www.gnu.org/licenses/>. along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/ */
// 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. // this file from any other module.
#ifndef planner_h #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. // the source g-code and may never actually be reached if acceleration management is active.
typedef struct { typedef struct {
// Fields used by the bresenham algorithm for tracing the line // 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). // 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. // 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 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 initial_rate; // The jerk-adjusted step rate at start of block
uint32_t final_rate; // The minimal rate at exit uint32_t final_rate; // The minimal rate at exit
uint32_t acceleration_steps_per_s2; // acceleration steps/sec^2 uint32_t acceleration_steps_per_s2; // acceleration steps/sec^2
uint8_t fan_speed; // Print fan speed, ranges from 0 to 255 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; extern matrix_3x3 plan_bed_level_matrix;
#endif // #ifdef ENABLE_AUTO_BED_LEVELING #endif // #ifdef ENABLE_AUTO_BED_LEVELING
// Initialize the motion plan subsystem // Initialize the motion plan subsystem
void plan_init(); 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. // millimaters. Feed rate specifies the speed of the motion.
#ifdef ENABLE_AUTO_BED_LEVELING #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(); vector_3 plan_get_position();
#else #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], ... /// plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], ...
/// saves almost 5KB. /// saves almost 5KB.
/// The performance penalty is negligible, since these planned lines are usually maintenance moves with the extruder. /// 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 // 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 uint32_t max_acceleration_steps_per_s2[NUM_AXIS];
extern long position[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. // Index of the next block to be pushed into the planner queue.
extern volatile uint8_t block_buffer_head; extern volatile uint8_t block_buffer_head;
// Index of the first block in the planner queue. // 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. // or which is first to be processed by the stepper routine.
extern volatile uint8_t block_buffer_tail; extern volatile uint8_t block_buffer_tail;
// Called when the current block is no longer needed. Discards the block and makes the memory // Called when the current block is no longer needed. Discards the block and makes the memory
// available for new blocks. // available for new blocks.
FORCE_INLINE void plan_discard_current_block() FORCE_INLINE void plan_discard_current_block()
{ {
if (block_buffer_head != block_buffer_tail) { 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 // Mark this block as busy, so its velocities and acceperations will be no more recalculated
// by the planner routine. // by the planner routine.
// Returns NULL if buffer empty // 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) { if (block_buffer_head == block_buffer_tail) {
return(NULL); return(NULL);
} }
block_t *block = &block_buffer[block_buffer_tail]; block_t *block = &block_buffer[block_buffer_tail];
block->busy = true; 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 // Returns true if the buffer has a queued block, false otherwise
FORCE_INLINE bool blocks_queued() { FORCE_INLINE bool blocks_queued() {
return (block_buffer_head != block_buffer_tail); return (block_buffer_head != block_buffer_tail);
} }
//return the nr of buffered moves //return the nr of buffered moves
@ -250,7 +250,7 @@ FORCE_INLINE uint8_t moves_planned() {
FORCE_INLINE bool planner_queue_full() { FORCE_INLINE bool planner_queue_full() {
uint8_t next_block_index = block_buffer_head; uint8_t next_block_index = block_buffer_head;
if (++ next_block_index == BLOCK_BUFFER_SIZE) if (++ next_block_index == BLOCK_BUFFER_SIZE)
next_block_index = 0; next_block_index = 0;
return block_buffer_tail == next_block_index; return block_buffer_tail == next_block_index;
} }

View File

@ -16,5 +16,5 @@ enum PrintType : uint8_t {
} // namespace PowerPanic } // namespace PowerPanic
void uvlo_(); void uvlo_();
void recover_print(uint8_t automatic); void recover_print(uint8_t automatic);
void setup_uvlo_interrupt(); void setup_uvlo_interrupt();

View File

@ -327,7 +327,7 @@ void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy )
Licensing: Licensing:
This code is distributed under the GNU LGPL license. This code is distributed under the GNU LGPL license.
Modified: 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, Charles Lawson, Richard Hanson, David Kincaid, Fred Krogh,
Basic Linear Algebra Subprograms for Fortran Usage, Basic Linear Algebra Subprograms for Fortran Usage,
Algorithm 539, Algorithm 539,
ACM Transactions on Mathematical Software, ACM Transactions on Mathematical Software,
Volume 5, Number 3, September 1979, pages 308-323. Volume 5, Number 3, September 1979, pages 308-323.
Parameters: Parameters:
@ -448,7 +448,7 @@ double ddot ( int n, double dx[], int incx, double dy[], int incy )
Licensing: Licensing:
This code is distributed under the GNU LGPL license. This code is distributed under the GNU LGPL license.
Modified: 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, Charles Lawson, Richard Hanson, David Kincaid, Fred Krogh,
Basic Linear Algebra Subprograms for Fortran Usage, Basic Linear Algebra Subprograms for Fortran Usage,
Algorithm 539, Algorithm 539,
ACM Transactions on Mathematical Software, ACM Transactions on Mathematical Software,
Volume 5, Number 3, September 1979, pages 308-323. Volume 5, Number 3, September 1979, pages 308-323.
Parameters: 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 ) for ( i = m; i < n; i = i + 5 )
{ {
dtemp = dtemp + dx[i ] * dy[i ] dtemp = dtemp + dx[i ] * dy[i ]
+ dx[i+1] * dy[i+1] + dx[i+1] * dy[i+1]
+ dx[i+2] * dy[i+2] + dx[i+2] * dy[i+2]
+ dx[i+3] * dy[i+3] + dx[i+3] * dy[i+3]
+ dx[i+4] * dy[i+4]; + dx[i+4] * dy[i+4];
} }
} }
@ -568,7 +568,7 @@ double dnrm2 ( int n, double x[], int incx )
Licensing: Licensing:
This code is distributed under the GNU LGPL license. This code is distributed under the GNU LGPL license.
Modified: 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[] ) int jpvt[], double qraux[] )
/******************************************************************************/ /******************************************************************************/
@ -673,7 +673,7 @@ void dqrank ( double a[], int lda, int m, int n, double tol, int *kr,
Licensing: Licensing:
This code is distributed under the GNU LGPL license. This code is distributed under the GNU LGPL license.
Modified: 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 ) double work[], int job )
/******************************************************************************/ /******************************************************************************/
@ -775,7 +775,7 @@ void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[],
Licensing: Licensing:
This code is distributed under the GNU LGPL license. This code is distributed under the GNU LGPL license.
Modified: 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++ ) 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]; / 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 ); 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 ) 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: Licensing:
This code is distributed under the GNU LGPL license. This code is distributed under the GNU LGPL license.
Modified: 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[] ) 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: Licensing:
This code is distributed under the GNU LGPL license. This code is distributed under the GNU LGPL license.
Modified: 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 ) 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: Licensing:
This code is distributed under the GNU LGPL license. This code is distributed under the GNU LGPL license.
Modified: Modified:
@ -1617,14 +1617,14 @@ int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[],
if ( cr ) 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]; / a[j-1+(j-1)*lda];
daxpy ( n-j+1, t, a+j-1+(j-1)*lda, 1, rsd+j-1, 1 ); daxpy ( n-j+1, t, a+j-1+(j-1)*lda, 1, rsd+j-1, 1 );
} }
if ( cab ) 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]; / a[j-1+(j-1)*lda];
daxpy ( n-j+1, t, a+j-1+(j-1)*lda, 1, ab+j-1, 1 ); 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: Licensing:
This code is distributed under the GNU LGPL license. This code is distributed under the GNU LGPL license.
Modified: Modified:
@ -1739,7 +1739,7 @@ void dswap ( int n, double x[], int incx, double y[], int incy )
Licensing: Licensing:
This code is distributed under the GNU LGPL license. This code is distributed under the GNU LGPL license.
Modified: 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, Charles Lawson, Richard Hanson, David Kincaid, Fred Krogh,
Basic Linear Algebra Subprograms for Fortran Usage, Basic Linear Algebra Subprograms for Fortran Usage,
Algorithm 539, Algorithm 539,
ACM Transactions on Mathematical Software, ACM Transactions on Mathematical Software,
Volume 5, Number 3, September 1979, pages 308-323. Volume 5, Number 3, September 1979, pages 308-323.
Parameters: Parameters:
@ -1920,7 +1920,7 @@ double *qr_solve ( int m, int n, double a[], double b[] )
free ( a_qr ); free ( a_qr );
free ( jpvt ); free ( jpvt );
free ( qraux ); free ( qraux );
free ( r ); free ( r );
return x; return x;

View File

@ -5,15 +5,15 @@
void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy ); 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 ddot ( int n, double dx[], int incx, double dy[], int incy );
double dnrm2 ( int n, double x[], int incx ); 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[] ); 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 ); 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 ); 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[] ); 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 ); double qy[], double qty[], double b[], double rsd[], double ab[], int job );
void dscal ( int n, double sa, double x[], int incx ); void dscal ( int n, double sa, double x[], int incx );
void dswap ( int n, double x[], int incx, double y[], int incy ); void dswap ( int n, double x[], int incx, double y[], int incy );

View File

@ -106,7 +106,7 @@ uint8_t sm4_get_dir_bits(void)
if (portL & 2) dir_bits |= 2; if (portL & 2) dir_bits |= 2;
if (portL & 4) dir_bits |= 4; if (portL & 4) dir_bits |= 4;
if (portL & 64) dir_bits |= 8; if (portL & 64) dir_bits |= 8;
dir_bits ^= dir_mask; dir_bits ^= dir_mask;
#endif #endif
return dir_bits; 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 & 4) portL |= 4; //set Z direction bit
if (dir_bits & 8) portL |= 64; //set E direction bit if (dir_bits & 8) portL |= 64; //set E direction bit
#elif ((MOTHERBOARD == BOARD_EINSY_1_0a)) #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 & 1) portL |= 1; //set X direction bit
if (dir_bits & 2) portL |= 2; //set Y direction bit if (dir_bits & 2) portL |= 2; //set Y direction bit
if (dir_bits & 4) portL |= 4; //set Z direction bit if (dir_bits & 4) portL |= 4; //set Z direction bit

View File

@ -22,12 +22,12 @@ typedef enum : uint8_t {
e_SOUND_TYPE_BlindAlert e_SOUND_TYPE_BlindAlert
} eSOUND_TYPE; } eSOUND_TYPE;
typedef enum : uint8_t { typedef enum : uint8_t {
e_SOUND_CLASS_Echo, e_SOUND_CLASS_Echo,
e_SOUND_CLASS_Prompt, e_SOUND_CLASS_Prompt,
e_SOUND_CLASS_Confirm, e_SOUND_CLASS_Confirm,
e_SOUND_CLASS_Warning, e_SOUND_CLASS_Warning,
e_SOUND_CLASS_Alert e_SOUND_CLASS_Alert
} eSOUND_CLASS; } eSOUND_CLASS;
extern eSOUND_MODE eSoundMode; extern eSOUND_MODE eSoundMode;

View File

@ -3,72 +3,72 @@
#if F_CPU == 16000000 #if F_CPU == 16000000
const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\ 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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} { 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 = {\ 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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}, { 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} { 992, 4}, { 988, 4}, { 984, 4}, { 980, 4}, { 976, 4}, { 972, 4}, { 968, 3}, { 965, 3}
}; };

View File

@ -283,7 +283,7 @@ ISR(TIMER1_COMPA_vect) {
// Is there a 8us time left before the next interrupt triggers? // Is there a 8us time left before the next interrupt triggers?
if (OCR1A < TCNT1 + 16) { if (OCR1A < TCNT1 + 16) {
#ifdef DEBUG_STEPPER_TIMER_MISSED #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 debugging test takes < 1.125us
// This skews the profiling slightly as the fastest stepper timer // This skews the profiling slightly as the fastest stepper timer
// interrupt repeats at a 100us rate (10kHz). // interrupt repeats at a 100us rate (10kHz).
@ -297,7 +297,7 @@ ISR(TIMER1_COMPA_vect) {
} }
#endif #endif
// Fix the next interrupt to be executed after 8us from now. // 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. // Check limit switches.
FORCE_INLINE void stepper_check_endstops() FORCE_INLINE void stepper_check_endstops()
{ {
if(check_endstops) if(check_endstops)
{ {
uint8_t _endstop_hit = endstop_hit; uint8_t _endstop_hit = endstop_hit;
uint8_t _endstop = endstop; uint8_t _endstop = endstop;
@ -492,7 +492,7 @@ FORCE_INLINE void stepper_check_endstops()
} }
#endif #endif
} else { // +direction } 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 #ifdef TMC2130_SG_HOMING
// Stall guard homing turned on // Stall guard homing turned on
SET_BIT_TO(_endstop, X_AXIS + 4, (!READ(X_TMC2130_DIAG))); 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<<X_AXIS)) != 0)&&(out_bits & (1<<Y_AXIS)) == 0)) // -Y occurs for -A and +B if ((((out_bits & (1<<X_AXIS)) != 0)&&(out_bits & (1<<Y_AXIS)) == 0)) // -Y occurs for -A and +B
#endif #endif
{ {
#if ( (defined(Y_MIN_PIN) && (Y_MIN_PIN > -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 #ifdef TMC2130_SG_HOMING
// Stall guard homing turned on // Stall guard homing turned on
SET_BIT_TO(_endstop, Y_AXIS, (!READ(Y_TMC2130_DIAG))); SET_BIT_TO(_endstop, Y_AXIS, (!READ(Y_TMC2130_DIAG)));
@ -533,7 +533,7 @@ FORCE_INLINE void stepper_check_endstops()
} }
#endif #endif
} else { // +direction } 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 #ifdef TMC2130_SG_HOMING
// Stall guard homing turned on // Stall guard homing turned on
SET_BIT_TO(_endstop, Y_AXIS + 4, (!READ(Y_TMC2130_DIAG))); 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); STEP_NC_LO(Y_AXIS);
#ifdef DEBUG_YSTEP_DUP_PIN #ifdef DEBUG_YSTEP_DUP_PIN
STEP_NC_LO(Y_DUP_AXIS); STEP_NC_LO(Y_DUP_AXIS);
#endif //DEBUG_YSTEP_DUP_PIN #endif //DEBUG_YSTEP_DUP_PIN
} }
// Step in Z axis // Step in Z axis
counter[Z_AXIS].lo += current_block->steps[Z_AXIS].lo; 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); STEP_NC_HI(X_DUP_AXIS);
#endif //DEBUG_XSTEP_DUP_PIN #endif //DEBUG_XSTEP_DUP_PIN
counter[X_AXIS].wide -= current_block->step_event_count.wide; 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); STEP_NC_LO(X_AXIS);
#ifdef DEBUG_XSTEP_DUP_PIN #ifdef DEBUG_XSTEP_DUP_PIN
STEP_NC_LO(X_DUP_AXIS); STEP_NC_LO(X_DUP_AXIS);
@ -728,7 +728,7 @@ FORCE_INLINE void stepper_tick_highres()
STEP_NC_LO(Y_AXIS); STEP_NC_LO(Y_AXIS);
#ifdef DEBUG_YSTEP_DUP_PIN #ifdef DEBUG_YSTEP_DUP_PIN
STEP_NC_LO(Y_DUP_AXIS); STEP_NC_LO(Y_DUP_AXIS);
#endif //DEBUG_YSTEP_DUP_PIN #endif //DEBUG_YSTEP_DUP_PIN
} }
// Step in Z axis // Step in Z axis
counter[Z_AXIS].wide += current_block->steps[Z_AXIS].wide; counter[Z_AXIS].wide += current_block->steps[Z_AXIS].wide;
@ -808,7 +808,7 @@ FORCE_INLINE void isr() {
if (current_block == NULL) if (current_block == NULL)
stepper_next_block(); stepper_next_block();
if (current_block != NULL) if (current_block != NULL)
{ {
stepper_check_endstops(); stepper_check_endstops();
if (current_block->flag & BLOCK_FLAG_DDA_LOWRES) if (current_block->flag & BLOCK_FLAG_DDA_LOWRES)
@ -1078,7 +1078,7 @@ void st_init()
#endif #endif
#if defined(Y_DIR_PIN) && Y_DIR_PIN > -1 #if defined(Y_DIR_PIN) && Y_DIR_PIN > -1
SET_OUTPUT(Y_DIR_PIN); SET_OUTPUT(Y_DIR_PIN);
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_DIR_PIN) && (Y2_DIR_PIN > -1) #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_DIR_PIN) && (Y2_DIR_PIN > -1)
SET_OUTPUT(Y2_DIR_PIN); SET_OUTPUT(Y2_DIR_PIN);
#endif #endif
@ -1107,7 +1107,7 @@ void st_init()
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1 #if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
SET_OUTPUT(Y_ENABLE_PIN); SET_OUTPUT(Y_ENABLE_PIN);
if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH); if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_ENABLE_PIN) && (Y2_ENABLE_PIN > -1) #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_ENABLE_PIN) && (Y2_ENABLE_PIN > -1)
SET_OUTPUT(Y2_ENABLE_PIN); SET_OUTPUT(Y2_ENABLE_PIN);
if(!Y_ENABLE_ON) WRITE(Y2_ENABLE_PIN,HIGH); if(!Y_ENABLE_ON) WRITE(Y2_ENABLE_PIN,HIGH);
@ -1350,7 +1350,7 @@ float st_get_position_mm(uint8_t axis)
void quickStop() void quickStop()
{ {
DISABLE_STEPPER_DRIVER_INTERRUPT(); DISABLE_STEPPER_DRIVER_INTERRUPT();
while (blocks_queued()) plan_discard_current_block(); while (blocks_queued()) plan_discard_current_block();
current_block = NULL; current_block = NULL;
#ifdef LIN_ADVANCE #ifdef LIN_ADVANCE
nextAdvanceISR = ADV_NEVER; nextAdvanceISR = ADV_NEVER;
@ -1523,13 +1523,13 @@ void microstep_init()
#if defined(E1_MS1_PIN) && E1_MS1_PIN > -1 #if defined(E1_MS1_PIN) && E1_MS1_PIN > -1
SET_OUTPUT(E1_MS1_PIN); SET_OUTPUT(E1_MS1_PIN);
SET_OUTPUT(E1_MS2_PIN); SET_OUTPUT(E1_MS2_PIN);
#endif #endif
#if defined(X_MS1_PIN) && X_MS1_PIN > -1 #if defined(X_MS1_PIN) && X_MS1_PIN > -1
const uint8_t microstep_modes[] = MICROSTEP_MODES; const uint8_t microstep_modes[] = MICROSTEP_MODES;
SET_OUTPUT(X_MS1_PIN); SET_OUTPUT(X_MS1_PIN);
SET_OUTPUT(X_MS2_PIN); SET_OUTPUT(X_MS2_PIN);
SET_OUTPUT(Y_MS1_PIN); SET_OUTPUT(Y_MS1_PIN);
SET_OUTPUT(Y_MS2_PIN); SET_OUTPUT(Y_MS2_PIN);
SET_OUTPUT(Z_MS1_PIN); SET_OUTPUT(Z_MS1_PIN);

View File

@ -19,7 +19,7 @@
*/ */
#ifndef stepper_h #ifndef stepper_h
#define stepper_h #define stepper_h
#include "planner.h" #include "planner.h"

View File

@ -1,19 +1,19 @@
/* /*
temperature.c - temperature control temperature.c - temperature control
Part of Marlin Part of Marlin
Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -22,8 +22,8 @@
This firmware is a mashup between Sprinter and grbl. This firmware is a mashup between Sprinter and grbl.
(https://github.com/kliment/Sprinter) (https://github.com/kliment/Sprinter)
(https://github.com/simen/grbl/tree) (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 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; int current_temperature_bed_raw = 0;
float current_temperature_bed = 0.0; float current_temperature_bed = 0.0;
#ifdef PIDTEMP #ifdef PIDTEMP
float _Kp, _Ki, _Kd; float _Kp, _Ki, _Kd;
@ -144,7 +144,7 @@ float current_temperature_bed = 0.0;
pid_tuning_finished = false; pid_tuning_finished = false;
} }
#endif //PIDTEMP #endif //PIDTEMP
unsigned char soft_pwm_bed; unsigned char soft_pwm_bed;
#ifdef BABYSTEPPING #ifdef BABYSTEPPING
@ -282,7 +282,7 @@ void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycle
pid_cycle = 0; pid_cycle = 0;
return; return;
} }
SERIAL_ECHOLNPGM("PID Autotune start"); SERIAL_ECHOLNPGM("PID Autotune start");
if (extruder<0) if (extruder<0)
@ -318,7 +318,7 @@ void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycle
#endif #endif
if(heating == true && input > temp) { if(heating == true && input > temp) {
if(_millis() - t2 > 5000) { if(_millis() - t2 > 5000) {
heating=false; heating=false;
if (extruder<0) { if (extruder<0) {
soft_pwm_bed = (bias - d) >> 1; soft_pwm_bed = (bias - d) >> 1;
@ -384,7 +384,7 @@ void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycle
pid_cycle++; pid_cycle++;
min=temp; min=temp;
} }
} }
} }
#ifndef MAX_OVERSHOOT_PID_AUTOTUNE #ifndef MAX_OVERSHOOT_PID_AUTOTUNE
#define MAX_OVERSHOOT_PID_AUTOTUNE 20 #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) { if(_millis() - temp_millis > 2000) {
int p; int p;
if (extruder<0){ if (extruder<0){
p=soft_pwm_bed; p=soft_pwm_bed;
SERIAL_PROTOCOLPGM("B:"); SERIAL_PROTOCOLPGM("B:");
}else{ }else{
p=soft_pwm[extruder]; p=soft_pwm[extruder];
SERIAL_PROTOCOLPGM("T:"); SERIAL_PROTOCOLPGM("T:");
} }
SERIAL_PROTOCOL(input); SERIAL_PROTOCOL(input);
SERIAL_PROTOCOLPGM(" @:"); SERIAL_PROTOCOLPGM(" @:");
SERIAL_PROTOCOLLN(p); SERIAL_PROTOCOLLN(p);
if (safety_check_cycles == 0) { //save ambient temp if (safety_check_cycles == 0) { //save ambient temp
temp_ambient = input; temp_ambient = input;
//SERIAL_ECHOPGM("Ambient T: "); //SERIAL_ECHOPGM("Ambient T: ");
@ -415,7 +415,7 @@ void __attribute__((noinline)) PID_autotune(float temp, int extruder, int ncycle
safety_check_cycles++; safety_check_cycles++;
} }
else if (safety_check_cycles < safety_check_cycles_count) { //delay 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 else if (safety_check_cycles == safety_check_cycles_count){ //check that temperature is rising
safety_check_cycles++; 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: "); //SERIAL_ECHOPGM("s. Difference between current and ambient T: ");
//MYSERIAL.println(input - temp_ambient); //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)); temp_runaway_stop(false, (extruder<0));
pid_tuning_finished = true; pid_tuning_finished = true;
return; return;
@ -453,14 +453,14 @@ void updatePID()
// TODO: iState_sum_max and PID values should be synchronized for temp_mgr_isr // TODO: iState_sum_max and PID values should be synchronized for temp_mgr_isr
#ifdef PIDTEMP #ifdef PIDTEMP
for(uint_least8_t e = 0; e < EXTRUDERS; e++) { 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 #endif
#ifdef PIDTEMPBED #ifdef PIDTEMPBED
temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / cs.bedKi; temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / cs.bedKi;
#endif #endif
} }
int getHeaterPower(int heater) { int getHeaterPower(int heater) {
if (heater<0) if (heater<0)
return soft_pwm_bed; return soft_pwm_bed;
@ -583,7 +583,7 @@ static float analog2temp(int raw, uint8_t e) {
SERIAL_ERRORLNPGM(" - Invalid extruder number !"); SERIAL_ERRORLNPGM(" - Invalid extruder number !");
kill(); kill();
return 0.0; return 0.0;
} }
#ifdef HEATER_0_USES_MAX6675 #ifdef HEATER_0_USES_MAX6675
if (e == 0) if (e == 0)
{ {
@ -601,8 +601,8 @@ static float analog2temp(int raw, uint8_t e) {
{ {
if (PGM_RD_W((*tt)[i][0]) > raw) if (PGM_RD_W((*tt)[i][0]) > raw)
{ {
celsius = PGM_RD_W((*tt)[i-1][1]) + celsius = PGM_RD_W((*tt)[i-1][1]) +
(raw - PGM_RD_W((*tt)[i-1][0])) * (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][1]) - PGM_RD_W((*tt)[i-1][1])) /
(float)(PGM_RD_W((*tt)[i][0]) - PGM_RD_W((*tt)[i-1][0])); (float)(PGM_RD_W((*tt)[i][0]) - PGM_RD_W((*tt)[i-1][0]));
break; break;
@ -628,8 +628,8 @@ static float analog2tempBed(int raw) {
{ {
if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw) if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw)
{ {
celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) + celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) +
(raw - PGM_RD_W(BEDTEMPTABLE[i-1][0])) * (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][1]) - PGM_RD_W(BEDTEMPTABLE[i-1][1])) /
(float)(PGM_RD_W(BEDTEMPTABLE[i][0]) - PGM_RD_W(BEDTEMPTABLE[i-1][0])); (float)(PGM_RD_W(BEDTEMPTABLE[i][0]) - PGM_RD_W(BEDTEMPTABLE[i-1][0]));
break; break;
@ -682,8 +682,8 @@ static float analog2tempAmbient(int raw)
{ {
if (PGM_RD_W(AMBIENTTEMPTABLE[i][0]) > raw) if (PGM_RD_W(AMBIENTTEMPTABLE[i][0]) > raw)
{ {
celsius = PGM_RD_W(AMBIENTTEMPTABLE[i-1][1]) + celsius = PGM_RD_W(AMBIENTTEMPTABLE[i-1][1]) +
(raw - PGM_RD_W(AMBIENTTEMPTABLE[i-1][0])) * (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][1]) - PGM_RD_W(AMBIENTTEMPTABLE[i-1][1])) /
(float)(PGM_RD_W(AMBIENTTEMPTABLE[i][0]) - PGM_RD_W(AMBIENTTEMPTABLE[i-1][0])); (float)(PGM_RD_W(AMBIENTTEMPTABLE[i][0]) - PGM_RD_W(AMBIENTTEMPTABLE[i-1][0]));
break; break;
@ -699,13 +699,13 @@ void soft_pwm_init()
{ {
#if MB(RUMBA) && ((TEMP_SENSOR_0==-1) || (TEMP_SENSOR_BED==-1)) #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 //disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
MCUCR=(1<<JTD); MCUCR=(1<<JTD);
MCUCR=(1<<JTD); MCUCR=(1<<JTD);
#endif #endif
// Finish init of mult extruder arrays // Finish init of mult extruder arrays
for(int e = 0; e < EXTRUDERS; e++) { for(int e = 0; e < EXTRUDERS; e++) {
// populate with the first value // populate with the first value
maxttemp[e] = maxttemp[0]; maxttemp[e] = maxttemp[0];
#ifdef PIDTEMP #ifdef PIDTEMP
iState_sum_min[e] = 0.0; iState_sum_min[e] = 0.0;
@ -717,13 +717,13 @@ void soft_pwm_init()
#endif //PIDTEMPBED #endif //PIDTEMPBED
} }
#if defined(HEATER_0_PIN) && (HEATER_0_PIN > -1) #if defined(HEATER_0_PIN) && (HEATER_0_PIN > -1)
SET_OUTPUT(HEATER_0_PIN); SET_OUTPUT(HEATER_0_PIN);
#endif #endif
#if defined(HEATER_BED_PIN) && (HEATER_BED_PIN > -1) #if defined(HEATER_BED_PIN) && (HEATER_BED_PIN > -1)
SET_OUTPUT(HEATER_BED_PIN); SET_OUTPUT(HEATER_BED_PIN);
#endif #endif
#if defined(FAN_PIN) && (FAN_PIN > -1) #if defined(FAN_PIN) && (FAN_PIN > -1)
SET_OUTPUT(FAN_PIN); SET_OUTPUT(FAN_PIN);
#ifdef FAST_PWM_FAN #ifdef FAST_PWM_FAN
setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
@ -737,18 +737,18 @@ void soft_pwm_init()
#ifndef SDSUPPORT #ifndef SDSUPPORT
SET_OUTPUT(SCK_PIN); SET_OUTPUT(SCK_PIN);
WRITE(SCK_PIN,0); WRITE(SCK_PIN,0);
SET_OUTPUT(MOSI_PIN); SET_OUTPUT(MOSI_PIN);
WRITE(MOSI_PIN,1); WRITE(MOSI_PIN,1);
SET_INPUT(MISO_PIN); SET_INPUT(MISO_PIN);
WRITE(MISO_PIN,1); WRITE(MISO_PIN,1);
#endif #endif
/* Using pinMode and digitalWrite, as that was the only way I could get it to compile */ /* 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 //Have to toggle SD card CS pin to low first, to enable firmware to talk with SD card
pinMode(SS_PIN, OUTPUT); pinMode(SS_PIN, OUTPUT);
digitalWrite(SS_PIN,0); digitalWrite(SS_PIN,0);
pinMode(MAX6675_SS, OUTPUT); pinMode(MAX6675_SS, OUTPUT);
digitalWrite(MAX6675_SS,1); digitalWrite(MAX6675_SS,1);
#endif #endif
@ -892,7 +892,7 @@ static void temp_runaway_check(uint8_t _heater_id, float _target_temperature, fl
__preheat_errors[_heater_id] = 0; __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); set_temp_error((_isbed?TempErrorSource::bed:TempErrorSource::hotend), _heater_id, TempErrorType::preheat);
__preheat_start[_heater_id] = _current_temperature; __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) if (temp_runaway_check_active)
{ {
// we are in range // we are in range
if ((_current_temperature > (_target_temperature - __hysteresis)) && (_current_temperature < (_target_temperature + __hysteresis))) if ((_current_temperature > (_target_temperature - __hysteresis)) && (_current_temperature < (_target_temperature + __hysteresis)))
{ {
@ -1044,47 +1044,47 @@ int max6675_temp = 2000;
int read_max6675() int read_max6675()
{ {
if (_millis() - max6675_previous_millis < MAX6675_HEAT_INTERVAL) if (_millis() - max6675_previous_millis < MAX6675_HEAT_INTERVAL)
return max6675_temp; return max6675_temp;
max6675_previous_millis = _millis(); max6675_previous_millis = _millis();
max6675_temp = 0; max6675_temp = 0;
#ifdef PRR #ifdef PRR
PRR &= ~(1<<PRSPI); PRR &= ~(1<<PRSPI);
#elif defined PRR0 #elif defined PRR0
PRR0 &= ~(1<<PRSPI); PRR0 &= ~(1<<PRSPI);
#endif #endif
SPCR = (1<<MSTR) | (1<<SPE) | (1<<SPR0); SPCR = (1<<MSTR) | (1<<SPE) | (1<<SPR0);
// enable TT_MAX6675 // enable TT_MAX6675
WRITE(MAX6675_SS, 0); WRITE(MAX6675_SS, 0);
// ensure 100ns delay - a bit extra is fine // ensure 100ns delay - a bit extra is fine
asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz
asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz
// read MSB // read MSB
SPDR = 0; SPDR = 0;
for (;(SPSR & (1<<SPIF)) == 0;); for (;(SPSR & (1<<SPIF)) == 0;);
max6675_temp = SPDR; max6675_temp = SPDR;
max6675_temp <<= 8; max6675_temp <<= 8;
// read LSB // read LSB
SPDR = 0; SPDR = 0;
for (;(SPSR & (1<<SPIF)) == 0;); for (;(SPSR & (1<<SPIF)) == 0;);
max6675_temp |= SPDR; max6675_temp |= SPDR;
// disable TT_MAX6675 // disable TT_MAX6675
WRITE(MAX6675_SS, 1); WRITE(MAX6675_SS, 1);
if (max6675_temp & 4) if (max6675_temp & 4)
{ {
// thermocouple open // thermocouple open
max6675_temp = 2000; max6675_temp = 2000;
} }
else else
{ {
max6675_temp = max6675_temp >> 3; max6675_temp = max6675_temp >> 3;
} }
@ -1140,7 +1140,7 @@ FORCE_INLINE static void soft_pwm_core()
{ {
soft_pwm_0 = soft_pwm[0]; soft_pwm_0 = soft_pwm[0];
if(soft_pwm_0 > 0) if(soft_pwm_0 > 0)
{ {
WRITE(HEATER_0_PIN,1); WRITE(HEATER_0_PIN,1);
#ifdef HEATERS_PARALLEL #ifdef HEATERS_PARALLEL
WRITE(HEATER_1_PIN,1); WRITE(HEATER_1_PIN,1);
@ -1148,7 +1148,7 @@ FORCE_INLINE static void soft_pwm_core()
} else WRITE(HEATER_0_PIN,0); } else WRITE(HEATER_0_PIN,0);
} }
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
#if 0 // @@DR vypnuto pro hw pwm bedu #if 0 // @@DR vypnuto pro hw pwm bedu
// tuhle prasarnu bude potreba poustet ve stanovenych intervalech, jinak nemam moc sanci zareagovat // tuhle prasarnu bude potreba poustet ve stanovenych intervalech, jinak nemam moc sanci zareagovat
// teoreticky by se tato cast uz vubec nemusela poustet // teoreticky by se tato cast uz vubec nemusela poustet
@ -1166,7 +1166,7 @@ FORCE_INLINE static void soft_pwm_core()
} }
#endif #endif
#endif #endif
#ifdef FAN_SOFT_PWM #ifdef FAN_SOFT_PWM
if ((pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1)) == 0) if ((pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1)) == 0)
{ {
@ -1175,14 +1175,14 @@ FORCE_INLINE static void soft_pwm_core()
} }
#endif #endif
if(soft_pwm_0 < pwm_count) if(soft_pwm_0 < pwm_count)
{ {
WRITE(HEATER_0_PIN,0); WRITE(HEATER_0_PIN,0);
#ifdef HEATERS_PARALLEL #ifdef HEATERS_PARALLEL
WRITE(HEATER_1_PIN,0); WRITE(HEATER_1_PIN,0);
#endif #endif
} }
#if 0 // @@DR #if 0 // @@DR
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
if (soft_pwm_b < (pwm_count & ((1 << HEATER_BED_SOFT_PWM_BITS) - 1))){ if (soft_pwm_b < (pwm_count & ((1 << HEATER_BED_SOFT_PWM_BITS) - 1))){
//WRITE(HEATER_BED_PIN,0); //WRITE(HEATER_BED_PIN,0);
@ -1193,7 +1193,7 @@ FORCE_INLINE static void soft_pwm_core()
#ifdef FAN_SOFT_PWM #ifdef FAN_SOFT_PWM
if (soft_pwm_fan < (pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1))) WRITE(FAN_PIN,0); if (soft_pwm_fan < (pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1))) WRITE(FAN_PIN,0);
#endif #endif
pwm_count += (1 << SOFT_PWM_SCALE); pwm_count += (1 << SOFT_PWM_SCALE);
pwm_count &= 0x7f; 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 #define MIN_STATE_TIME 16 // MIN_STATE_TIME * 65.5 = time in milliseconds
#endif #endif
if (slow_pwm_count == 0) { if (slow_pwm_count == 0) {
// EXTRUDER 0 // EXTRUDER 0
soft_pwm_0 = soft_pwm[0]; soft_pwm_0 = soft_pwm[0];
if (soft_pwm_0 > 0) { if (soft_pwm_0 > 0) {
// turn ON heather only if the minimum time is up // turn ON heather only if the minimum time is up
if (state_timer_heater_0 == 0) { if (state_timer_heater_0 == 0) {
// if change state set timer // if change state set timer
if (state_heater_0 == 0) { if (state_heater_0 == 0) {
state_timer_heater_0 = MIN_STATE_TIME; state_timer_heater_0 = MIN_STATE_TIME;
} }
@ -1223,9 +1223,9 @@ FORCE_INLINE static void soft_pwm_core()
#endif #endif
} }
} else { } 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 (state_timer_heater_0 == 0) {
// if change state set timer // if change state set timer
if (state_heater_0 == 1) { if (state_heater_0 == 1) {
state_timer_heater_0 = MIN_STATE_TIME; state_timer_heater_0 = MIN_STATE_TIME;
} }
@ -1241,9 +1241,9 @@ FORCE_INLINE static void soft_pwm_core()
// BED // BED
soft_pwm_b = soft_pwm_bed; soft_pwm_b = soft_pwm_bed;
if (soft_pwm_b > 0) { if (soft_pwm_b > 0) {
// turn ON heather only if the minimum time is up // turn ON heather only if the minimum time is up
if (state_timer_heater_b == 0) { if (state_timer_heater_b == 0) {
// if change state set timer // if change state set timer
if (state_heater_b == 0) { if (state_heater_b == 0) {
state_timer_heater_b = MIN_STATE_TIME; state_timer_heater_b = MIN_STATE_TIME;
} }
@ -1251,9 +1251,9 @@ FORCE_INLINE static void soft_pwm_core()
//WRITE(HEATER_BED_PIN, 1); //WRITE(HEATER_BED_PIN, 1);
} }
} else { } 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 (state_timer_heater_b == 0) {
// if change state set timer // if change state set timer
if (state_heater_b == 1) { if (state_heater_b == 1) {
state_timer_heater_b = MIN_STATE_TIME; state_timer_heater_b = MIN_STATE_TIME;
} }
@ -1263,12 +1263,12 @@ FORCE_INLINE static void soft_pwm_core()
} }
#endif #endif
} // if (slow_pwm_count == 0) } // if (slow_pwm_count == 0)
// EXTRUDER 0 // EXTRUDER 0
if (soft_pwm_0 < slow_pwm_count) { if (soft_pwm_0 < slow_pwm_count) {
// 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 (state_timer_heater_0 == 0) {
// if change state set timer // if change state set timer
if (state_heater_0 == 1) { if (state_heater_0 == 1) {
state_timer_heater_0 = MIN_STATE_TIME; 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 #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
// BED // BED
if (soft_pwm_b < slow_pwm_count) { if (soft_pwm_b < slow_pwm_count) {
// 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 (state_timer_heater_b == 0) {
// if change state set timer // if change state set timer
if (state_heater_b == 1) { if (state_heater_b == 1) {
state_timer_heater_b = MIN_STATE_TIME; state_timer_heater_b = MIN_STATE_TIME;
} }
@ -1294,7 +1294,7 @@ FORCE_INLINE static void soft_pwm_core()
} }
} }
#endif #endif
#ifdef FAN_SOFT_PWM #ifdef FAN_SOFT_PWM
if ((pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1)) == 0) if ((pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1)) == 0)
soft_pwm_fan = fanSpeedSoftPwm / (1 << (8 - FAN_SOFT_PWM_BITS)); 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 += (1 << SOFT_PWM_SCALE);
pwm_count &= 0x7f; pwm_count &= 0x7f;
// increment slow_pwm_count only every 64 pwm_count circa 65.5ms // increment slow_pwm_count only every 64 pwm_count circa 65.5ms
if ((pwm_count % 64) == 0) { if ((pwm_count % 64) == 0) {
slow_pwm_count++; slow_pwm_count++;
slow_pwm_count &= 0x7f; slow_pwm_count &= 0x7f;
// Extruder 0 // Extruder 0
if (state_timer_heater_0 > 0) { if (state_timer_heater_0 > 0) {
state_timer_heater_0--; state_timer_heater_0--;
} }
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
// Bed // Bed
if (state_timer_heater_b > 0) if (state_timer_heater_b > 0)
state_timer_heater_b--; state_timer_heater_b--;
#endif #endif
} //if ((pwm_count % 64) == 0) { } //if ((pwm_count % 64) == 0) {
#endif //ifndef SLOW_PWM_HEATERS #endif //ifndef SLOW_PWM_HEATERS
} }

View File

@ -19,7 +19,7 @@
*/ */
#ifndef temperature_h #ifndef temperature_h
#define temperature_h #define temperature_h
#include "Marlin.h" #include "Marlin.h"
#include "config.h" #include "config.h"
@ -32,7 +32,7 @@ bool get_temp_error(); //return true if any thermal error is set
// low level conversion routines // low level conversion routines
// do not use these routines and variables outside of temperature.cpp // 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]; extern float current_temperature[EXTRUDERS];
#ifdef SHOW_TEMP_ADC_VALUES #ifdef SHOW_TEMP_ADC_VALUES
extern int current_temperature_raw[EXTRUDERS]; extern int current_temperature_raw[EXTRUDERS];
@ -95,16 +95,16 @@ void resetPID(uint8_t extruder);
//deg=degreeCelsius //deg=degreeCelsius
// Doesn't save FLASH when FORCE_INLINE removed. // 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]; return current_temperature[extruder];
}; };
#ifdef SHOW_TEMP_ADC_VALUES #ifdef SHOW_TEMP_ADC_VALUES
FORCE_INLINE float rawHotendTemp(uint8_t extruder) { FORCE_INLINE float rawHotendTemp(uint8_t extruder) {
return current_temperature_raw[extruder]; return current_temperature_raw[extruder];
}; };
FORCE_INLINE float rawBedTemp() { FORCE_INLINE float rawBedTemp() {
return current_temperature_bed_raw; return current_temperature_bed_raw;
}; };
#endif #endif
@ -114,25 +114,25 @@ FORCE_INLINE float degBed() {
}; };
// Doesn't save FLASH when FORCE_INLINE removed. // 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]; return target_temperature[extruder];
}; };
FORCE_INLINE float degTargetBed() { FORCE_INLINE float degTargetBed() {
return target_temperature_bed; return target_temperature_bed;
}; };
// Doesn't save FLASH when FORCE_INLINE removed. // 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; target_temperature[0] = celsius;
resetPID(0); resetPID(0);
}; };
FORCE_INLINE void setTargetBed(const float &celsius) { FORCE_INLINE void setTargetBed(const float &celsius) {
target_temperature_bed = 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]; return target_temperature[extruder] > current_temperature[extruder];
}; };
@ -140,7 +140,7 @@ FORCE_INLINE bool isHeatingBed() {
return target_temperature_bed > current_temperature_bed; 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]; return target_temperature[extruder] < current_temperature[extruder];
}; };

View File

@ -565,7 +565,7 @@ const short temptable_10[][2] PROGMEM = {
}; };
#endif #endif
#if (THERMISTORHEATER_0 == 11) || (THERMISTORBED == 11) #if (THERMISTORHEATER_0 == 11) || (THERMISTORBED == 11)
// QU-BD silicone bed QWG-104F-3950 thermistor // QU-BD silicone bed QWG-104F-3950 thermistor
const short temptable_11[][2] PROGMEM = { const short temptable_11[][2] PROGMEM = {
@ -817,7 +817,7 @@ const short temptable_51[][2] PROGMEM = {
}; };
#endif #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!) // 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 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
// Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
@ -858,7 +858,7 @@ const short temptable_52[][2] PROGMEM = {
}; };
#endif #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!) // 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 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
// Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
@ -900,7 +900,7 @@ const short temptable_55[][2] PROGMEM = {
#endif #endif
#if (THERMISTORHEATER_0 == 60) || (THERMISTORBED == 60) // Maker's Tool Works Kapton Bed Thermister #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 // r0: 100000
// t0: 25 // t0: 25
// r1: 0 (parallel with rTherm) // r1: 0 (parallel with rTherm)
@ -983,7 +983,7 @@ const short temptable_60[][2] PROGMEM = {
{1008*OVERSAMPLENR, 0}, {1008*OVERSAMPLENR, 0},
}; };
#endif #endif
#if (THERMISTORBED == 12) #if (THERMISTORBED == 12)
//100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) //100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
const short temptable_12[][2] PROGMEM = { const short temptable_12[][2] PROGMEM = {
{35*OVERSAMPLENR, 180}, //top rating 180C {35*OVERSAMPLENR, 180}, //top rating 180C
@ -1020,7 +1020,7 @@ const short temptable_12[][2] PROGMEM = {
#endif #endif
// Pt1000 and Pt100 handling // Pt1000 and Pt100 handling
// //
// Rt=R0*(1+a*T+b*T*T) [for T>0] // Rt=R0*(1+a*T+b*T*T) [for T>0]
// a=3.9083E-3, b=-5.775E-7 // 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 #if (THERMISTORHEATER_0 == 110) || (THERMISTORBED == 110) // Pt100 with 1k0 pullup
const short temptable_110[][2] PROGMEM = { 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(0,100,1000)
PtLine(50,100,1000) PtLine(50,100,1000)
PtLine(100,100,1000) PtLine(100,100,1000)
@ -1046,7 +1046,7 @@ const short temptable_110[][2] PROGMEM = {
#endif #endif
#if (THERMISTORHEATER_0 == 147) || (THERMISTORBED == 147) // Pt100 with 4k7 pullup #if (THERMISTORHEATER_0 == 147) || (THERMISTORBED == 147) // Pt100 with 4k7 pullup
const short temptable_147[][2] PROGMEM = { 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(0,100,4700)
PtLine(50,100,4700) PtLine(50,100,4700)
PtLine(100,100,4700) PtLine(100,100,4700)
@ -1193,7 +1193,7 @@ const short temptable_1010[][2] PROGMEM = {
#endif #endif
#if (THERMISTORHEATER_0 == 1047) || (THERMISTORBED == 1047) // Pt1000 with 4k7 pullup #if (THERMISTORHEATER_0 == 1047) || (THERMISTORBED == 1047) // Pt1000 with 4k7 pullup
const short temptable_1047[][2] PROGMEM = { 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(0,1000,4700)
PtLine(50,1000,4700) PtLine(50,1000,4700)
PtLine(100,1000,4700) PtLine(100,1000,4700)

View File

@ -16,11 +16,11 @@ void timer0_init(void)
CRITICAL_SECTION_START; CRITICAL_SECTION_START;
TCNT0 = 0; 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) // Due to invert mode (following rows) the duty is set to 255, which means zero all the time (bed not heating)
OCR0B = 255; OCR0B = 255;
// Set fast PWM mode and inverting mode. // 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 TCCR0B = (1 << CS01); // CLK/8 prescaling
TIMSK0 |= (1 << TOIE0); // enable timer overflow interrupt TIMSK0 |= (1 << TOIE0); // enable timer overflow interrupt
@ -119,7 +119,7 @@ unsigned long micros2(void)
if ((TIFR & _BV(TOV2)) && (t < 255)) if ((TIFR & _BV(TOV2)) && (t < 255))
m++; m++;
#endif #endif
SREG = oldSREG; SREG = oldSREG;
return ((m << 8) + t) * (64 / clockCyclesPerMicrosecond()); return ((m << 8) + t) * (64 / clockCyclesPerMicrosecond());
} }

View File

@ -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 hend : 4; // HEND hysteresis low value (chm = 0) or OFFSET sine wave offset (chm = 1)
uint32_t fd : 1; uint32_t fd : 1;
uint32_t disfdcc : 1; // Fast decay mode 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 chm : 1; // Chopper mode
uint32_t tbl : 2; // Blank time select uint32_t tbl : 2; // Blank time select
uint32_t vsense : 1; // Sense resistor voltage based current scaling 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(Y_TMC2130_CS);
SET_OUTPUT(Z_TMC2130_CS); SET_OUTPUT(Z_TMC2130_CS);
SET_OUTPUT(E0_TMC2130_CS); SET_OUTPUT(E0_TMC2130_CS);
SET_INPUT(X_TMC2130_DIAG); SET_INPUT(X_TMC2130_DIAG);
SET_INPUT(Y_TMC2130_DIAG); SET_INPUT(Y_TMC2130_DIAG);
SET_INPUT(Z_TMC2130_DIAG); SET_INPUT(Z_TMC2130_DIAG);
@ -331,7 +331,7 @@ void tmc2130_init(TMCInitParams params)
WRITE(Y_TMC2130_DIAG,HIGH); WRITE(Y_TMC2130_DIAG,HIGH);
WRITE(Z_TMC2130_DIAG,HIGH); WRITE(Z_TMC2130_DIAG,HIGH);
WRITE(E0_TMC2130_DIAG,HIGH); WRITE(E0_TMC2130_DIAG,HIGH);
for (uint_least8_t axis = 0; axis < E_AXIS; axis++) // X Y Z axes for (uint_least8_t axis = 0; axis < E_AXIS; axis++) // X Y Z axes
{ {
tmc2130_XYZ_reg_init(axis); tmc2130_XYZ_reg_init(axis);

View File

@ -33,11 +33,11 @@ void twi_init(void)
// activate internal pullups for SDA // activate internal pullups for SDA
SET_INPUT(SDA_PIN); SET_INPUT(SDA_PIN);
WRITE(SDA_PIN, 1); WRITE(SDA_PIN, 1);
// start with the SDA pulled low // start with the SDA pulled low
WRITE(SCL_PIN, 0); WRITE(SCL_PIN, 0);
SET_OUTPUT(SCL_PIN); SET_OUTPUT(SCL_PIN);
// clock 10 cycles to make sure that the sensor is not stuck in a register read. // clock 10 cycles to make sure that the sensor is not stuck in a register read.
for (uint8_t i = 0; i < 10; i++) { for (uint8_t i = 0; i < 10; i++) {
WRITE(SCL_PIN, 1); WRITE(SCL_PIN, 1);
@ -64,7 +64,7 @@ void twi_disable(void)
{ {
// disable TWI hardware. // disable TWI hardware.
TWCR = 0; TWCR = 0;
// deactivate internal pullups for twi. // deactivate internal pullups for twi.
WRITE(SDA_PIN, 0); WRITE(SDA_PIN, 0);
WRITE(SCL_PIN, 0); WRITE(SCL_PIN, 0);
@ -124,13 +124,13 @@ uint8_t twi_check(uint8_t address)
TWCR = _BV(TWEN) | _BV(TWINT) | _BV(TWSTA); TWCR = _BV(TWEN) | _BV(TWINT) | _BV(TWSTA);
if(twi_wait(TW_START)) if(twi_wait(TW_START))
return 1; return 1;
// send address // send address
TWDR = TW_WRITE | (address << 1); TWDR = TW_WRITE | (address << 1);
TWCR = _BV(TWEN) | _BV(TWINT); TWCR = _BV(TWEN) | _BV(TWINT);
if(twi_wait(TW_MT_SLA_ACK)) if(twi_wait(TW_MT_SLA_ACK))
return 2; return 2;
// send stop // send stop
twi_stop(); twi_stop();
return 0; return 0;

View File

@ -6982,7 +6982,7 @@ static uint8_t lcd_selftest_screen(TestScreen screen, uint8_t _progress, uint8_t
lcd_update_enable(false); lcd_update_enable(false);
const char _indicator = (_progress >= _progress_scale) ? '-' : '|'; const char _indicator = (_progress >= _progress_scale) ? '-' : '|';
if (_clear) if (_clear)
lcd_clear(); lcd_clear();
else else
lcd_home(); lcd_home();

View File

@ -73,7 +73,7 @@ void lcd_load_filament_color_check();
extern void lcd_belttest(); extern void lcd_belttest();
extern bool lcd_selftest(); 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_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()") void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")

View File

@ -134,15 +134,15 @@
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable //#define DEBUG_RESUME_PRINT //Resume/save print debug enable
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max 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_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
@ -227,12 +227,12 @@
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_RFEED 7000 / 60
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2

View File

@ -135,15 +135,15 @@
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable //#define DEBUG_RESUME_PRINT //Resume/save print debug enable
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max 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_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
@ -228,12 +228,12 @@
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_RFEED 7000 / 60
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2

View File

@ -134,15 +134,15 @@
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable //#define DEBUG_RESUME_PRINT //Resume/save print debug enable
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max 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_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
@ -227,12 +227,12 @@
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_RFEED 7000 / 60
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2

View File

@ -135,15 +135,15 @@
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable //#define DEBUG_RESUME_PRINT //Resume/save print debug enable
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max 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_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
@ -228,12 +228,12 @@
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_RFEED 7000 / 60
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2

View File

@ -115,7 +115,7 @@
//Crash detection //Crash detection
#define CRASHDET_TIMER 45 //seconds #define CRASHDET_TIMER 45 //seconds
#define CRASHDET_COUNTER_MAX 3 #define CRASHDET_COUNTER_MAX 3
// New XYZ calibration // New XYZ calibration
#define NEW_XYZCAL #define NEW_XYZCAL
@ -147,7 +147,7 @@
#define FILAMENT_SENSOR_TYPE FSENSOR_PAT9125 #define FILAMENT_SENSOR_TYPE FSENSOR_PAT9125
#define FSENSOR_PROBING #define FSENSOR_PROBING
// Backlash - // Backlash -
//#define BACKLASH_X //#define BACKLASH_X
//#define BACKLASH_Y //#define BACKLASH_Y
@ -175,15 +175,15 @@
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable //#define DEBUG_RESUME_PRINT //Resume/save print debug enable
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max 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_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
@ -361,12 +361,12 @@
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_RFEED 7000 / 60
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2
@ -645,7 +645,7 @@
// "dropsegments" steps long. All the above rules still need to apply. // "dropsegments" steps long. All the above rules still need to apply.
#define UVLO_TINY_Z_AXIS_SHIFT 0.16 #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. // 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 #define HEATBED_V2

View File

@ -115,7 +115,7 @@
//Crash detection //Crash detection
#define CRASHDET_TIMER 45 //seconds #define CRASHDET_TIMER 45 //seconds
#define CRASHDET_COUNTER_MAX 3 #define CRASHDET_COUNTER_MAX 3
// New XYZ calibration // New XYZ calibration
#define NEW_XYZCAL #define NEW_XYZCAL
@ -147,7 +147,7 @@
#define FILAMENT_SENSOR_TYPE FSENSOR_PAT9125 #define FILAMENT_SENSOR_TYPE FSENSOR_PAT9125
#define FSENSOR_PROBING #define FSENSOR_PROBING
// Backlash - // Backlash -
//#define BACKLASH_X //#define BACKLASH_X
//#define BACKLASH_Y //#define BACKLASH_Y
@ -175,15 +175,15 @@
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable //#define DEBUG_RESUME_PRINT //Resume/save print debug enable
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max 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_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
@ -362,12 +362,12 @@
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_RFEED 7000 / 60
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2
@ -646,7 +646,7 @@
// "dropsegments" steps long. All the above rules still need to apply. // "dropsegments" steps long. All the above rules still need to apply.
#define UVLO_TINY_Z_AXIS_SHIFT 0.16 #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. // 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 #define HEATBED_V2

View File

@ -115,7 +115,7 @@
//Crash detection //Crash detection
#define CRASHDET_TIMER 45 //seconds #define CRASHDET_TIMER 45 //seconds
#define CRASHDET_COUNTER_MAX 3 #define CRASHDET_COUNTER_MAX 3
// New XYZ calibration // New XYZ calibration
#define NEW_XYZCAL #define NEW_XYZCAL
@ -147,7 +147,7 @@
#define FILAMENT_SENSOR_TYPE FSENSOR_PAT9125 #define FILAMENT_SENSOR_TYPE FSENSOR_PAT9125
#define FSENSOR_PROBING #define FSENSOR_PROBING
// Backlash - // Backlash -
//#define BACKLASH_X //#define BACKLASH_X
//#define BACKLASH_Y //#define BACKLASH_Y
@ -175,15 +175,15 @@
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable //#define DEBUG_RESUME_PRINT //Resume/save print debug enable
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max 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_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
@ -364,12 +364,12 @@
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_RFEED 7000 / 60
#define FILAMENTCHANGE_EXFEED 2 #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 // 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. // "dropsegments" steps long. All the above rules still need to apply.
#define UVLO_TINY_Z_AXIS_SHIFT 0.16 #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. // 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 #define HEATBED_V2

View File

@ -117,7 +117,7 @@
//Crash detection //Crash detection
#define CRASHDET_TIMER 45 //seconds #define CRASHDET_TIMER 45 //seconds
#define CRASHDET_COUNTER_MAX 3 #define CRASHDET_COUNTER_MAX 3
// New XYZ calibration // New XYZ calibration
#define NEW_XYZCAL #define NEW_XYZCAL
@ -149,7 +149,7 @@
#define FILAMENT_SENSOR_TYPE FSENSOR_IR_ANALOG #define FILAMENT_SENSOR_TYPE FSENSOR_IR_ANALOG
#define FSENSOR_PROBING #define FSENSOR_PROBING
// Backlash - // Backlash -
//#define BACKLASH_X //#define BACKLASH_X
//#define BACKLASH_Y //#define BACKLASH_Y
@ -177,15 +177,15 @@
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable //#define DEBUG_RESUME_PRINT //Resume/save print debug enable
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max 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_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
@ -365,12 +365,12 @@
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_RFEED 7000 / 60
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2
@ -649,7 +649,7 @@
// "dropsegments" steps long. All the above rules still need to apply. // "dropsegments" steps long. All the above rules still need to apply.
#define UVLO_TINY_Z_AXIS_SHIFT 0.16 #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. // 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 #define HEATBED_V2

View File

@ -117,7 +117,7 @@
//Crash detection //Crash detection
#define CRASHDET_TIMER 45 //seconds #define CRASHDET_TIMER 45 //seconds
#define CRASHDET_COUNTER_MAX 3 #define CRASHDET_COUNTER_MAX 3
// New XYZ calibration // New XYZ calibration
#define NEW_XYZCAL #define NEW_XYZCAL
@ -149,7 +149,7 @@
#define FILAMENT_SENSOR_TYPE FSENSOR_IR_ANALOG #define FILAMENT_SENSOR_TYPE FSENSOR_IR_ANALOG
#define FSENSOR_PROBING #define FSENSOR_PROBING
// Backlash - // Backlash -
//#define BACKLASH_X //#define BACKLASH_X
//#define BACKLASH_Y //#define BACKLASH_Y
@ -177,15 +177,15 @@
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable //#define DEBUG_RESUME_PRINT //Resume/save print debug enable
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max 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_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
@ -366,12 +366,12 @@
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_RFEED 7000 / 60
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2
@ -650,7 +650,7 @@
// "dropsegments" steps long. All the above rules still need to apply. // "dropsegments" steps long. All the above rules still need to apply.
#define UVLO_TINY_Z_AXIS_SHIFT 0.16 #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. // 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 #define HEATBED_V2

View File

@ -117,7 +117,7 @@
//Crash detection //Crash detection
#define CRASHDET_TIMER 45 //seconds #define CRASHDET_TIMER 45 //seconds
#define CRASHDET_COUNTER_MAX 3 #define CRASHDET_COUNTER_MAX 3
// New XYZ calibration // New XYZ calibration
#define NEW_XYZCAL #define NEW_XYZCAL
@ -149,7 +149,7 @@
#define FILAMENT_SENSOR_TYPE FSENSOR_IR_ANALOG #define FILAMENT_SENSOR_TYPE FSENSOR_IR_ANALOG
#define FSENSOR_PROBING #define FSENSOR_PROBING
// Backlash - // Backlash -
//#define BACKLASH_X //#define BACKLASH_X
//#define BACKLASH_Y //#define BACKLASH_Y
@ -177,15 +177,15 @@
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable //#define DEBUG_RESUME_PRINT //Resume/save print debug enable
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored //#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored //#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max 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_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored //#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line //#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
@ -368,12 +368,12 @@
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_RFEED 7000 / 60 #define FILAMENTCHANGE_RFEED 7000 / 60
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2
@ -652,7 +652,7 @@
// "dropsegments" steps long. All the above rules still need to apply. // "dropsegments" steps long. All the above rules still need to apply.
#define UVLO_TINY_Z_AXIS_SHIFT 0.16 #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. // 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 #define HEATBED_V2

View File

@ -155,12 +155,12 @@ CHANGE FILAMENT SETTINGS
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2
#define FILAMENTCHANGE_ZFEED 15 #define FILAMENTCHANGE_ZFEED 15
@ -346,7 +346,7 @@ THERMISTORS SETTINGS
// 10 is 100k RS thermistor 198-961 (4.7k pullup) // 10 is 100k RS thermistor 198-961 (4.7k pullup)
// 11 is 100k beta 3950 1% thermistor (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) // 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 // 20 is the PT100 circuit found in the Ultimainboard V2.x
// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // 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_STEP_T 10
#define PINDA_MAX_T 100 #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 BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release
#define DEFAULT_PID_TEMP 210 #define DEFAULT_PID_TEMP 210

View File

@ -154,12 +154,12 @@ CHANGE FILAMENT SETTINGS
#define FILAMENTCHANGE_FINALRETRACT 0 #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_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_RECFEED 5
#define FILAMENTCHANGE_XYFEED 50 #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_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 400
#define FILAMENTCHANGE_EXFEED 2 #define FILAMENTCHANGE_EXFEED 2
#define FILAMENTCHANGE_ZFEED 15 #define FILAMENTCHANGE_ZFEED 15
@ -345,7 +345,7 @@ THERMISTORS SETTINGS
// 10 is 100k RS thermistor 198-961 (4.7k pullup) // 10 is 100k RS thermistor 198-961 (4.7k pullup)
// 11 is 100k beta 3950 1% thermistor (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) // 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 // 20 is the PT100 circuit found in the Ultimainboard V2.x
// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // 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_STEP_T 10
#define PINDA_MAX_T 100 #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 BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release
#define DEFAULT_PID_TEMP 210 #define DEFAULT_PID_TEMP 210

View File

@ -33,29 +33,29 @@ vector_3 vector_3::cross(vector_3 left, vector_3 right)
left.x * right.y - left.y * right.x); 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)); 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)); 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); vector_3 normalized = vector_3(x, y, z);
normalized.normalize(); normalized.normalize();
return normalized; return normalized;
} }
float vector_3::get_length() float vector_3::get_length()
{ {
float length = sqrt((x * x) + (y * y) + (z * z)); float length = sqrt((x * x) + (y * y) + (z * z));
return length; return length;
} }
void vector_3::normalize() void vector_3::normalize()
{ {
float length = get_length(); 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_1.debug("row_1");
//row_2.debug("row_2"); //row_2.debug("row_2");
matrix_3x3 new_matrix; 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[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[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[6] = row_2.x; new_matrix.matrix[7] = row_2.y; new_matrix.matrix[8] = row_2.z;
//new_matrix.debug("new_matrix"); //new_matrix.debug("new_matrix");
return new_matrix; return new_matrix;
} }
@ -127,7 +127,7 @@ matrix_3x3 matrix_3x3::create_look_at(vector_3 target)
// y_row.debug("y_row"); // y_row.debug("y_row");
// z_row.debug("z_row"); // z_row.debug("z_row");
// create the matrix already correctly transposed // create the matrix already correctly transposed
matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row); 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 matrix_3x3::transpose(matrix_3x3 original)
{ {
matrix_3x3 new_matrix; 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[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[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]; new_matrix.matrix[6] = original.matrix[2]; new_matrix.matrix[7] = original.matrix[5]; new_matrix.matrix[8] = original.matrix[8];
return new_matrix; return new_matrix;
} }

View File

@ -38,7 +38,7 @@ struct vector_3
vector_3 get_normal(); vector_3 get_normal();
void debug(char* title); void debug(char* title);
void apply_rotation(matrix_3x3 matrix); void apply_rotation(matrix_3x3 matrix);
}; };

View File

@ -4,13 +4,13 @@
* @author leptun * @author leptun
*/ */
/** \ingroup xflash_layout */ /** \ingroup xflash_layout */
//! This is the layout of the XFLASH (external SPI flash) in Prusa firmware (dynamically generated from doxygen). //! This is the layout of the XFLASH (external SPI flash) in Prusa firmware (dynamically generated from doxygen).
/** @defgroup xflash_layout XFLASH Layout /** @defgroup xflash_layout XFLASH Layout
* *
--------------------------------------------------------------------------------- ---------------------------------------------------------------------------------
The XFLASH has the following alignment requirements: 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. - 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. - 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. - 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. - Read has no alignment requirements.
The following items are found in the xflash: The following items are found in the xflash:
### 1. Languages (R) ### 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. 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. It is aligned at the beginning of xflash, offset 0.
### 2. MMU Firmware update files (64KB, R) ### 2. MMU Firmware update files (64KB, R)
This space is reserved for the two MMU firmware files: This space is reserved for the two MMU firmware files:
- The MMU firmware v2.0.0+. - The MMU firmware v2.0.0+.
- The Bootloader self update file. - The Bootloader self update file.
It is aligned at the end of xflash, before xflash_dump It is aligned at the end of xflash, before xflash_dump
### 3. xflash_dump (12KB, RW) ### 3. xflash_dump (12KB, RW)
@ -38,9 +38,9 @@
It composes of: It composes of:
- A header with some information such as crash reason and what info was dumped. - 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. - 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. 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. It is aligned at the end of xflash.
*/ */

View File

@ -227,9 +227,9 @@ uint16_t xyzcal_calc_delay(uint16_t nd, uint16_t dd)
if (del_us > 50) return del_us - 50; 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 = (uint16_t)(((float)1000000 / xyzcal_sm4_v) + 0.5);
// uint16_t del_us = (uint32_t)1000000 / xyzcal_sm4_v; // uint16_t del_us = (uint32_t)1000000 / xyzcal_sm4_v;
// uint16_t del_us = 100; // uint16_t del_us = 100;
// uint16_t del_us = (uint16_t)10000 / xyzcal_sm4_v; // uint16_t del_us = (uint16_t)10000 / xyzcal_sm4_v;
// v += (ac * del_us + 500) / 1000; // v += (ac * del_us + 500) / 1000;
// xyzcal_sm4_v += (xyzcal_sm4_ac * del_us) / 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 uint8_t k = 720 / (dad_max - dad_min); //delta calculation constant
ad = 0; ad = 0;
if (pad) ad = *pad % 720; if (pad) ad = *pad % 720;
//@size=214 //@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); 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); // 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 else
t1++; t1++;
} }
//DBG(_n("%d "), t1); //DBG(_n("%d "), t1);
delayMicroseconds(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); 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); go_and_stop(axes, dir, Z_ACCEL, current_delay_us, length_x - half_x);
z_trig = min_z; z_trig = min_z;
/// move up to un-trigger (surpress hysteresis) /// 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]); SWAP(points[j], points[j + 1]);
} }
} }
// DBG(_n("Sorted: ")); // DBG(_n("Sorted: "));
// for (uint8_t i = 0; i < num_points; ++i) // for (uint8_t i = 0; i < num_points; ++i)
// DBG(_n("%f "), 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 constexpr uint8_t target_z = 32; ///< target z height of the circle
const uint8_t blocks = num_points; const uint8_t blocks = num_points;
float shifts_x[blocks]; float shifts_x[blocks];
float shifts_y[blocks]; float shifts_y[blocks];
float shifts_r[blocks]; float shifts_r[blocks];
// DBG(_n(" [%f, %f][%f] start circle\n"), x, y, r); // DBG(_n(" [%f, %f][%f] start circle\n"), x, y, r);
for (int8_t i = iterations; i > 0; --i){ for (int8_t i = iterations; i > 0; --i){
//@size=128B //@size=128B
// DBG(_n(" [%f, %f][%f] circle\n"), x, y, r); // 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; row = r08;
return match08; return match08;
} }
col = c10; col = c10;
row = r10; row = r10;
return match10; return match10;

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# This bash script is used to compile automatically and run the MK404 simulator # This bash script is used to compile automatically and run the MK404 simulator
# #
# Supported OS: Linux64 bit # Supported OS: Linux64 bit
# #
# Linux: # Linux:
@ -8,7 +8,7 @@
# 1. Follow these instructions # 1. Follow these instructions
# 2. Open Ubuntu bash and get latest updates with 'sudo apt-get update' # 2. Open Ubuntu bash and get latest updates with 'sudo apt-get update'
# 3. Install latest updates with 'sudo apt-get upgrade' # 3. Install latest updates with 'sudo apt-get upgrade'
# #
# #
# Version: 1.0.0-Build_18 # Version: 1.0.0-Build_18
# Change log: # 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)-x$(tput sgr0) Board memory size"
echo "$(tput setaf 2)-y$(tput sgr0) Board flash size" echo "$(tput setaf 2)-y$(tput sgr0) Board flash size"
echo "$(tput setaf 2)-?$(tput sgr0) Help" echo "$(tput setaf 2)-?$(tput sgr0) Help"
echo echo
echo "Brief USAGE:" echo "Brief USAGE:"
echo " $(tput setaf 2)./MK404-build.sh$(tput sgr0) [-c] [-f] [-g] [-m] [-n] [-p] [-u] [-v] [-x] [-h] [-?]" echo " $(tput setaf 2)./MK404-build.sh$(tput sgr0) [-c] [-f] [-g] [-m] [-n] [-p] [-u] [-v] [-x] [-h] [-?]"
echo echo
@ -209,7 +209,7 @@ if [ ! -z $mk404_printer_flag ]; then
if [ "$mk404_printer_flag" != "$MK404_PRINTER" ]; then if [ "$mk404_printer_flag" != "$MK404_PRINTER" ]; then
echo "$(tput setaf 3)You defined a different printer type than the firmware!" echo "$(tput setaf 3)You defined a different printer type than the firmware!"
echo "This can cause unexpected issues.$(tput sgr 0)" echo "This can cause unexpected issues.$(tput sgr 0)"
echo echo
PS3="Select $(tput setaf 2)printer$(tput sgr 0) you want to use." 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 select which in "$(tput setaf 2)$MK404_PRINTER$(tput sgr 0)" "$mk404_printer_flag"; do
case $which in case $which in
@ -220,7 +220,7 @@ if [ ! -z $mk404_printer_flag ]; then
$mk404_printer_flag) $mk404_printer_flag)
echo "Set $(tput setaf 3)$mk404_printer_flag$(tput sgr 0) as printer" 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 "$(tput setaf 3)This firmware file isn't correct for this printer!!!$(tput sgr 0)"
echo echo
MK404_PRINTER=$mk404_printer_flag MK404_PRINTER=$mk404_printer_flag
read -p "Press Enter to continue." read -p "Press Enter to continue."
break break
@ -305,7 +305,7 @@ if [ $TARGET_OS == "linux" ]; then
failures 2 failures 2
fi fi
else else
failures 3 failures 3
fi fi
sleep 2 sleep 2
} }
@ -347,7 +347,7 @@ fi
} }
#### End: Check MK404 dependencies #### End: Check MK404 dependencies
#### Start: Set build environment #### Start: Set build environment
set_build_env_variables() set_build_env_variables()
{ {
MK404_SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" MK404_SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
@ -569,7 +569,7 @@ set_build_env_variables
output_useful_data output_useful_data
get_MK404 get_MK404
# #
cd $MK404_PATH cd $MK404_PATH
check_for_updates check_for_updates

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.18)
FILE(SIZE ${LANG_FILE} FILE_SIZE) FILE(SIZE ${LANG_FILE} FILE_SIZE)
get_filename_component(FILE_BASE ${LANG_FILE} NAME) get_filename_component(FILE_BASE ${LANG_FILE} NAME)
MATH(EXPR PADDED_SIZE "((${FILE_SIZE}+256-1) / 256 * 256 )") 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}) 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!") message(FATAL_ERROR "Language file ${FILE_BASE} (${PADDED_SIZE}b) exceeds maximum allowed size of ${LANG_MAX_SIZE} bytes - Aborting!")
else() else()

View File

@ -2,7 +2,7 @@
- **Dutch / Nederlands** - **Dutch / Nederlands**
- Maintainers: **@3d-gussner** and **@vintagepc** - Maintainers: **@3d-gussner** and **@vintagepc**
- Co-maintainers: - Co-maintainers:
- Contributors: **@stelgenhof** - Contributors: **@stelgenhof**
- [X] **Active** since March 2021 - [X] **Active** since March 2021
- [X] **Maintained** since September 2019 - [X] **Maintained** since September 2019

View File

@ -51,7 +51,7 @@ This step is already performed for you when using ``build.sh`` or ``PF-build.sh`
#### How to update `.pot` file #### How to update `.pot` file
Run Run
python update-pot.py python update-pot.py

View File

@ -149,14 +149,14 @@ INVERSE_CUSTOM_CHARS = {v: k for k, v in CUSTOM_CHARS.items()}
def generateLineInTable(index, chars): def generateLineInTable(index, chars):
pixels = chars[FONT_TABLE[index].charListIndex]["PIXELS"].split(',') pixels = chars[FONT_TABLE[index].charListIndex]["PIXELS"].split(',')
# Generate the rows binary data # Generate the rows binary data
rows = [] rows = []
for i in range(8): for i in range(8):
rows.append(0) rows.append(0)
for j in range(5): for j in range(5):
rows[i] |= (1 << (5 - j - 1)) if pixels[j * 8 + i] == "0" else 0 rows[i] |= (1 << (5 - j - 1)) if pixels[j * 8 + i] == "0" else 0
# compress the rows data # compress the rows data
colByte = 0 colByte = 0
compressedRows = [] compressedRows = []
@ -175,9 +175,9 @@ def generateLineInTable(index, chars):
def generateFont(): def generateFont():
tree = ET.parse(os.path.join(sys.path[0], "Prusa.lcd")) tree = ET.parse(os.path.join(sys.path[0], "Prusa.lcd"))
root = tree.getroot() root = tree.getroot()
CharList = [Char.attrib for Char in root.iter("CHAR")] CharList = [Char.attrib for Char in root.iter("CHAR")]
f = open(os.path.join(sys.path[0], "../../Firmware/FontTable.h"), "w", encoding='utf8') f = open(os.path.join(sys.path[0], "../../Firmware/FontTable.h"), "w", encoding='utf8')
for index in range(len(FONT_TABLE)): for index in range(len(FONT_TABLE)):
f.write(generateLineInTable(index, CharList) + '\n') f.write(generateLineInTable(index, CharList) + '\n')

View File

@ -168,4 +168,4 @@ def unicode_to_source(buf):
for c in buf: for c in buf:
out += INVERSE_CUSTOM_CHARS.get(c, c) out += INVERSE_CUSTOM_CHARS.get(c, c)
return out return out

View File

@ -17,7 +17,7 @@ was that you have a large set of tests and found that this speeds them up.
--> -->
## GitHub Issues ## GitHub Issues
<!-- <!--
If this PR was motivated by some existing issues, reference them here. If this PR was motivated by some existing issues, reference them here.
If it is a simple bug-fix, please also add a line like 'Closes #123' If it is a simple bug-fix, please also add a line like 'Closes #123'

View File

@ -151,7 +151,7 @@ if (NOT_SUBPROJECT)
DESTINATION DESTINATION
${CATCH_CMAKE_CONFIG_DESTINATION} ${CATCH_CMAKE_CONFIG_DESTINATION}
) )
# Install debugger helpers # Install debugger helpers
install( install(
FILES FILES

View File

@ -21,5 +21,5 @@
"CATCH_ENABLE_CONFIGURE_TESTS": "ON" "CATCH_ENABLE_CONFIGURE_TESTS": "ON"
} }
} }
] ]
} }

Some files were not shown because too many files have changed in this diff Show More