|
@@ -100,16 +100,22 @@ void print_mem(uint32_t address, uint16_t count, uint8_t type, uint8_t countperl
|
|
#ifdef DEBUG_DCODE3
|
|
#ifdef DEBUG_DCODE3
|
|
#define EEPROM_SIZE 0x1000
|
|
#define EEPROM_SIZE 0x1000
|
|
/*!
|
|
/*!
|
|
- *
|
|
|
|
### 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.
|
|
-
|
|
|
|
- D3 [ A | C | X ]
|
|
|
|
-
|
|
|
|
- - `A` - Address (0x0000-0x0fff)
|
|
|
|
- - `C` - Count (0x0001-0x1000)
|
|
|
|
- - `X` - Data
|
|
|
|
- *
|
|
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D3 [ A | C | X ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `A` - Address (x0000-x0fff)
|
|
|
|
+ - `C` - Count (1-4096)
|
|
|
|
+ - `X` - Data (hex)
|
|
|
|
+
|
|
|
|
+ #### Notes
|
|
|
|
+ - The hex address needs to be lowercase without the 0 before the x
|
|
|
|
+ - Count is decimal
|
|
|
|
+ - The hex data needs to be lowercase
|
|
|
|
+
|
|
*/
|
|
*/
|
|
void dcode_3()
|
|
void dcode_3()
|
|
{
|
|
{
|
|
@@ -206,13 +212,13 @@ void dcode__1()
|
|
#ifdef DEBUG_DCODES
|
|
#ifdef DEBUG_DCODES
|
|
|
|
|
|
/*!
|
|
/*!
|
|
- *
|
|
|
|
### 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>
|
|
-
|
|
|
|
- D0 [ B ]
|
|
|
|
-
|
|
|
|
- - `B` - Bootloader
|
|
|
|
- *
|
|
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D0 [ B ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `B` - Bootloader
|
|
*/
|
|
*/
|
|
void dcode_0()
|
|
void dcode_0()
|
|
{
|
|
{
|
|
@@ -251,16 +257,22 @@ void dcode_1()
|
|
}
|
|
}
|
|
|
|
|
|
/*!
|
|
/*!
|
|
- *
|
|
|
|
- ### D2 - Read/Write RAM <a href="https://reprap.org/wiki/G-code#D2:_Read.2FWrite_RAM">D2: Read/Write RAM</a>
|
|
|
|
|
|
+ ### D2 - Read/Write RAM <a href="https://reprap.org/wiki/G-code#D2:_Read.2FWrite_RAM">D3: Read/Write RAM</a>
|
|
This command can be used without any additional parameters. It will read the entire RAM.
|
|
This command can be used without any additional parameters. It will read the entire RAM.
|
|
-
|
|
|
|
- D2 [ A | C | X ]
|
|
|
|
-
|
|
|
|
- - `A` - Address (0x0000-0x1fff)
|
|
|
|
- - `C` - Count (0x0001-0x2000)
|
|
|
|
- - `X` - Data
|
|
|
|
- *
|
|
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D2 [ A | C | X ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `A` - Address (x0000-x1fff)
|
|
|
|
+ - `C` - Count (1-8192)
|
|
|
|
+ - `X` - Data
|
|
|
|
+
|
|
|
|
+ #### Notes
|
|
|
|
+ - The hex address needs to be lowercase without the 0 before the x
|
|
|
|
+ - Count is decimal
|
|
|
|
+ - The hex data needs to be lowercase
|
|
|
|
+
|
|
*/
|
|
*/
|
|
void dcode_2()
|
|
void dcode_2()
|
|
{
|
|
{
|
|
@@ -306,17 +318,17 @@ void dcode_2()
|
|
}
|
|
}
|
|
|
|
|
|
/*!
|
|
/*!
|
|
- *
|
|
|
|
- ### 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.
|
|
-
|
|
|
|
- D4 [ P | F | V ]
|
|
|
|
-
|
|
|
|
- - `P` - Pin (0-255)
|
|
|
|
- - `F` - Function in/out (0/1)
|
|
|
|
- - `V` - Value (0/1)
|
|
|
|
- *
|
|
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D4 [ P | F | V ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `P` - Pin (0-255)
|
|
|
|
+ - `F` - Function in/out (0/1)
|
|
|
|
+ - `V` - Value (0/1)
|
|
*/
|
|
*/
|
|
void dcode_4()
|
|
void dcode_4()
|
|
{
|
|
{
|
|
@@ -351,18 +363,24 @@ void dcode_4()
|
|
#ifdef DEBUG_DCODE5
|
|
#ifdef DEBUG_DCODE5
|
|
|
|
|
|
/*!
|
|
/*!
|
|
- *
|
|
|
|
### 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.
|
|
-
|
|
|
|
- D5 [ A | C | X | E ]
|
|
|
|
-
|
|
|
|
- - `A` - Address (0x00000-0x3ffff)
|
|
|
|
- - `C` - Count (0x0001-0x2000)
|
|
|
|
- - `X` - Data
|
|
|
|
- - `E` - Erase
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D5 [ A | C | X | E ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `A` - Address (x00000-x3ffff)
|
|
|
|
+ - `C` - Count (1-8192)
|
|
|
|
+ - `X` - Data
|
|
|
|
+ - `E` - Erase
|
|
|
|
+
|
|
|
|
+ #### Notes
|
|
|
|
+ - The hex address needs to be lowercase without the 0 before the x
|
|
|
|
+ - Count is decimal
|
|
|
|
+ - The hex data needs to be lowercase
|
|
|
|
+
|
|
|
|
+ */
|
|
void dcode_5()
|
|
void dcode_5()
|
|
{
|
|
{
|
|
printf_P(PSTR("D5 - Read/Write FLASH\n"));
|
|
printf_P(PSTR("D5 - Read/Write FLASH\n"));
|
|
@@ -427,24 +445,18 @@ void dcode_5()
|
|
#ifdef DEBUG_DCODES
|
|
#ifdef DEBUG_DCODES
|
|
|
|
|
|
/*!
|
|
/*!
|
|
- *
|
|
|
|
### D6 - Read/Write external FLASH <a href="https://reprap.org/wiki/G-code#D6:_Read.2FWrite_external_FLASH">D6: Read/Write external Flash</a>
|
|
### D6 - Read/Write external FLASH <a href="https://reprap.org/wiki/G-code#D6:_Read.2FWrite_external_FLASH">D6: Read/Write external Flash</a>
|
|
-
|
|
|
|
Reserved
|
|
Reserved
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+ */
|
|
void dcode_6()
|
|
void dcode_6()
|
|
{
|
|
{
|
|
LOG("D6 - Read/Write external FLASH\n");
|
|
LOG("D6 - Read/Write external FLASH\n");
|
|
}
|
|
}
|
|
|
|
|
|
/*!
|
|
/*!
|
|
- *
|
|
|
|
### D7 - Read/Write Bootloader <a href="https://reprap.org/wiki/G-code#D7:_Read.2FWrite_Bootloader">D7: Read/Write Bootloader</a>
|
|
### D7 - Read/Write Bootloader <a href="https://reprap.org/wiki/G-code#D7:_Read.2FWrite_Bootloader">D7: Read/Write Bootloader</a>
|
|
-
|
|
|
|
Reserved
|
|
Reserved
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+ */
|
|
void dcode_7()
|
|
void dcode_7()
|
|
{
|
|
{
|
|
LOG("D7 - Read/Write Bootloader\n");
|
|
LOG("D7 - Read/Write Bootloader\n");
|
|
@@ -461,16 +473,16 @@ 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>
|
|
-
|
|
|
|
- D8 [ ? | ! | P | Z ]
|
|
|
|
-
|
|
|
|
- - `?` - Read PINDA temperature shift values
|
|
|
|
- - `!` - Reset PINDA temperature shift values to default
|
|
|
|
- - `P` - Pinda temperature [C]
|
|
|
|
- - `Z` - Z Offset [mm]
|
|
|
|
- *
|
|
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D8 [ ? | ! | P | Z ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `?` - Read PINDA temperature shift values
|
|
|
|
+ - `!` - Reset PINDA temperature shift values to default
|
|
|
|
+ - `P` - Pinda temperature [C]
|
|
|
|
+ - `Z` - Z Offset [mm]
|
|
*/
|
|
*/
|
|
void dcode_8()
|
|
void dcode_8()
|
|
{
|
|
{
|
|
@@ -514,21 +526,21 @@ 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>
|
|
-
|
|
|
|
- D9 [ I | V ]
|
|
|
|
-
|
|
|
|
- - `I` - ADC channel index
|
|
|
|
- - `0` - Heater 0 temperature
|
|
|
|
- - `1` - Heater 1 temperature
|
|
|
|
- - `2` - Bed temperature
|
|
|
|
- - `3` - PINDA temperature
|
|
|
|
- - `4` - PWR voltage
|
|
|
|
- - `5` - Ambient temperature
|
|
|
|
- - `6` - BED voltage
|
|
|
|
- - `V` Value to be written as simulated
|
|
|
|
- *
|
|
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D9 [ I | V ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `I` - ADC channel index
|
|
|
|
+ - `0` - Heater 0 temperature
|
|
|
|
+ - `1` - Heater 1 temperature
|
|
|
|
+ - `2` - Bed temperature
|
|
|
|
+ - `3` - PINDA temperature
|
|
|
|
+ - `4` - PWR voltage
|
|
|
|
+ - `5` - Ambient temperature
|
|
|
|
+ - `6` - BED voltage
|
|
|
|
+ - `V` Value to be written as simulated
|
|
*/
|
|
*/
|
|
const char* dcode_9_ADC_name(uint8_t i)
|
|
const char* dcode_9_ADC_name(uint8_t i)
|
|
{
|
|
{
|
|
@@ -604,11 +616,8 @@ void dcode_9()
|
|
}
|
|
}
|
|
|
|
|
|
/*!
|
|
/*!
|
|
- *
|
|
|
|
### D10 - Set XYZ calibration = OK <a href="https://reprap.org/wiki/G-code#D10:_Set_XYZ_calibration_.3D_OK">D10: Set XYZ calibration = OK</a>
|
|
### D10 - Set XYZ calibration = OK <a href="https://reprap.org/wiki/G-code#D10:_Set_XYZ_calibration_.3D_OK">D10: Set XYZ calibration = OK</a>
|
|
-
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+ */
|
|
void dcode_10()
|
|
void dcode_10()
|
|
{//Tell the printer that XYZ calibration went OK
|
|
{//Tell the printer that XYZ calibration went OK
|
|
LOG("D10 - XYZ calibration = OK\n");
|
|
LOG("D10 - XYZ calibration = OK\n");
|
|
@@ -616,11 +625,10 @@ void dcode_10()
|
|
}
|
|
}
|
|
|
|
|
|
/*!
|
|
/*!
|
|
- *
|
|
|
|
### D12 - Time <a href="https://reprap.org/wiki/G-code#D12:_Time">D12: Time</a>
|
|
### D12 - Time <a href="https://reprap.org/wiki/G-code#D12:_Time">D12: Time</a>
|
|
-
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+ Writes the actual time in the log file.
|
|
|
|
+ */
|
|
|
|
+
|
|
void dcode_12()
|
|
void dcode_12()
|
|
{//Time
|
|
{//Time
|
|
LOG("D12 - Time\n");
|
|
LOG("D12 - Time\n");
|
|
@@ -632,38 +640,61 @@ void dcode_12()
|
|
#include "planner.h"
|
|
#include "planner.h"
|
|
#include "tmc2130.h"
|
|
#include "tmc2130.h"
|
|
extern void st_synchronize();
|
|
extern void st_synchronize();
|
|
-/**
|
|
|
|
- * @brief D2130 Trinamic stepper controller
|
|
|
|
- * D2130<axis><command>[subcommand][value]
|
|
|
|
- * * Axis
|
|
|
|
- * * * 'X'
|
|
|
|
- * * * 'Y'
|
|
|
|
- * * * 'Z'
|
|
|
|
- * * * 'E'
|
|
|
|
- * * command
|
|
|
|
- * * * '0' current off
|
|
|
|
- * * * '1' current on
|
|
|
|
- * * * '+' single step
|
|
|
|
- * * * * value sereval steps
|
|
|
|
- * * * '-' dtto oposite direction
|
|
|
|
- * * * '?' read register
|
|
|
|
- * * * * "mres"
|
|
|
|
- * * * * "step"
|
|
|
|
- * * * * "mscnt"
|
|
|
|
- * * * * "mscuract"
|
|
|
|
- * * * * "wave"
|
|
|
|
- * * * '!' set register
|
|
|
|
- * * * * "mres"
|
|
|
|
- * * * * "step"
|
|
|
|
- * * * * "wave"
|
|
|
|
- * * * * *0, 180..250 meaning: off, 0.9..1.25, recommended value is 1.1
|
|
|
|
- * * * '@' home calibrate axis
|
|
|
|
- *
|
|
|
|
- * Example:
|
|
|
|
- * D2130E?wave //print extruder microstep linearity compensation curve
|
|
|
|
- * D2130E!wave0 //disable extruder linearity compensation curve, (sine curve is used)
|
|
|
|
- * D2130E!wave220 // (sin(x))^1.1 extruder microstep compensation curve used
|
|
|
|
- */
|
|
|
|
|
|
+ /*!
|
|
|
|
+ ### 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.
|
|
|
|
+
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D2130 [ Axis | Command | Subcommand | Value ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - Axis
|
|
|
|
+ - `X` - X stepper driver
|
|
|
|
+ - `Y` - Y stepper driver
|
|
|
|
+ - `Z` - Z stepper driver
|
|
|
|
+ - `E` - Extruder stepper driver
|
|
|
|
+ - Commands
|
|
|
|
+ - `0` - Current off
|
|
|
|
+ - `1` - Current on
|
|
|
|
+ - `+` - Single step
|
|
|
|
+ - `-` - Single step oposite direction
|
|
|
|
+ - `NNN` - Value sereval steps
|
|
|
|
+ - `?` - Read register
|
|
|
|
+ - Subcommands for read register
|
|
|
|
+ - `mres` - Micro step resolution. More information in datasheet '5.5.2 CHOPCONF – Chopper Configuration'
|
|
|
|
+ - `step` - Step
|
|
|
|
+ - `mscnt` - Microstep counter. More information in datasheet '5.5 Motor Driver Registers'
|
|
|
|
+ - `mscuract` - Actual microstep current for motor. More information in datasheet '5.5 Motor Driver Registers'
|
|
|
|
+ - `wave` - Microstep linearity compensation curve
|
|
|
|
+ - `!` - Set register
|
|
|
|
+ - Subcommands for set register
|
|
|
|
+ - `mres` - Micro step resolution
|
|
|
|
+ - `step` - Step
|
|
|
|
+ - `wave` - Microstep linearity compensation curve
|
|
|
|
+ - Values for set register
|
|
|
|
+ - `0, 180 --> 250` - Off
|
|
|
|
+ - `0.9 --> 1.25` - Valid values (recommended is 1.1)
|
|
|
|
+ - `@` - Home calibrate axis
|
|
|
|
+
|
|
|
|
+ Examples:
|
|
|
|
+
|
|
|
|
+ D2130E?wave
|
|
|
|
+
|
|
|
|
+ Print extruder microstep linearity compensation curve
|
|
|
|
+
|
|
|
|
+ D2130E!wave0
|
|
|
|
+
|
|
|
|
+ Disable extruder linearity compensation curve, (sine curve is used)
|
|
|
|
+
|
|
|
|
+ D2130E!wave220
|
|
|
|
+
|
|
|
|
+ (sin(x))^1.1 extruder microstep compensation curve used
|
|
|
|
+
|
|
|
|
+ Notes:
|
|
|
|
+ For more information see https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2130_datasheet.pdf
|
|
|
|
+ *
|
|
|
|
+ */
|
|
void dcode_2130()
|
|
void dcode_2130()
|
|
{
|
|
{
|
|
printf_P(PSTR("D2130 - TMC2130\n"));
|
|
printf_P(PSTR("D2130 - TMC2130\n"));
|
|
@@ -767,18 +798,18 @@ void dcode_2130()
|
|
|
|
|
|
#ifdef PAT9125
|
|
#ifdef PAT9125
|
|
/*!
|
|
/*!
|
|
- *
|
|
|
|
### 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>
|
|
-
|
|
|
|
- D9125 [ ? | ! | R | X | Y | L ]
|
|
|
|
-
|
|
|
|
- - `?` - Print values
|
|
|
|
- - `!` - Print values
|
|
|
|
- - `R` - Resolution. Not active in code
|
|
|
|
- - `X` - X values
|
|
|
|
- - `Y` - Y values
|
|
|
|
- - `L` - Activate filament sensor log
|
|
|
|
- *
|
|
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D9125 [ ? | ! | R | X | Y | L ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `?` - Print values
|
|
|
|
+ - `!` - Print values
|
|
|
|
+ - `R` - Resolution. Not active in code
|
|
|
|
+ - `X` - X values
|
|
|
|
+ - `Y` - Y values
|
|
|
|
+ - `L` - Activate filament sensor log
|
|
*/
|
|
*/
|
|
void dcode_9125()
|
|
void dcode_9125()
|
|
{
|
|
{
|