mirror of
https://github.com/synthetos/g2.git
synced 2026-09-25 16:33:38 +08:00
Merge branch 'dev-168-gquintic' into dev-307-spring-comp
# Conflicts: # g2core/config_app.cpp # g2core/temperature.cpp
This commit is contained in:
@@ -9,203 +9,139 @@ G2 [Edge](https://github.com/synthetos/g2/tree/edge) is the branch for beta test
|
||||
That said, Edge is for the adventurous. It is not guaranteed to be stable, but we do our best to achieve this. For production uses we recommend using the [Master branch](https://github.com/synthetos/g2/tree/master).
|
||||
|
||||
|
||||
## Firmware Build 100 `{fb:100.xx}`
|
||||
## Firmware Build 101 `{fb:101.xx}`
|
||||
### Feature Enhancements
|
||||
The fb:100 release is a major change from the fb:089 and earlier branches. It represents about a year of development and has many major feature enhancements summarized below. These are described in more detail in the rest of this readme and the linked wiki pages.
|
||||
- New Gcode and CNC features
|
||||
- 3d printing support, including [Marlin Compatibility](https://github.com/synthetos/g2/wiki/Marlin-Compatibility)
|
||||
- GPIO system enhancements
|
||||
- Planner enhancements and other operating improvements for high-speed operation
|
||||
- Intital support for new processors, including the ARM M7
|
||||
|
||||
The fb:101 release is a mostly internal change from the fb:100 branches. Here are the highlights, more detailed on each item are further below:
|
||||
- Updated motion execution at the segment (smallest) level to be linear velocity instead of constant velocity, resulting in notably smoother motion and more faithful execution of the jerk limitations. (Incidentally, the sound of the motors is also slightly quieter and more "natural.")
|
||||
- Updated JT (Junction integration Time, a.k.a. "cornering") handling to be more optimized, and to treat the last move as a corner to a move with no active axes. This allows a non-zero stopping velocity based on the allowed jerk and active JT value.
|
||||
- Probing enhancements.
|
||||
- Added support for gQuintic (rev B) and fixed issues with gQuadratic board support. (This mostly happened in Motate.)
|
||||
- Temperature control enhancements
|
||||
- Temperature inputs are configured differently at compile time. (Ongoing.)
|
||||
- PID control has been adjusted to PID+FF (Proportional, Integral, and Derivative, with Feed Forward). In this case, the feed forward is a multiplier of the difference between the current temperature and the ambient temperature. Since there is no temperature sensor for ambient temperature at the moment, it uses an idealized room temperature of 21ºC.
|
||||
- More complete support for TMC2130 by adding more JSON controls for live feedback and configuration.
|
||||
- Initial support for Core XY kinematics.
|
||||
- Boards are in more control of the planner settings.
|
||||
- Experimental setting to have traverse (G0) use the 'high jerk' axis settings.
|
||||
- Outputs are now configured at board initialization (and later) to honor the settings more faithfully. This includes setting the pin high or low as soon as possible.
|
||||
|
||||
### Project Changes
|
||||
The project is now called g2core (even if the repo remains g2). As of this release the g2core code base is split from the TinyG code base. TinyG will continue to be supported for the Xmega 8-bit platform, and new features will be added, specifically as related to continued support for CNC milling applications. The g2core project will focus on various ARM platforms, as it currently does, and add functions that are not possible in the 8-bit platform.
|
||||
|
||||
In this release the Motate hardware abstraction layer has been split into a separate project and is included in g2core as a git submodule. This release also provides better support for cross platform / cross target compilation. A summary of project changes is provided below, with details in this readme and linked wiki pages.
|
||||
- Motate submodule
|
||||
- Cross platform / cross target support
|
||||
- Multiple processor support - ARM M3, M4, M7 cores
|
||||
- Device tree / multiple motor types
|
||||
- Simplified host-to-board communication protocol (line mode)
|
||||
- NodeJS host module for host-to-board communications
|
||||
|
||||
### More To Come
|
||||
The fb:100 release is the base for number of other enhancements in the works and planned, including:
|
||||
- Further enhancements to GPIO system
|
||||
- Additional JSON processing and UI support
|
||||
- Enhancements to 3d printer support, including a simplified g2 printer dialect
|
||||
|
||||
## Changelog for Edge Branch
|
||||
|
||||
### Edge branch, Build 100.xx
|
||||
### Edge branch, Build 101.xx
|
||||
|
||||
Build 100.xx has a number of changes, mostly related to extending Gcode support and supporting 3D printing using g2core. These include temperature controls, auto-bed leveling, planner performance improvements and active JSON comments in Gcode.
|
||||
|
||||
Communications has advanced to support a linemode protocol to greatly simplify host communications and flow control for very rapid Gcode streams. Please read the Communications pages for details. Also see the NodeJS communications module docs if you are building a UI or host controller.
|
||||
|
||||
Build 100.xx also significantly advances the project structure to support multiple processor architectures, hardware configurations and machine configurations in the same code base. Motate has been cleaved off into its own subproject. We recommend carefully reading the Dev pages if you are coding or compiling.
|
||||
This build is primarily focused on support for the new boards based on the Atmel SamS70 family, as well as refining the motion control and long awaited feature enhancements. This list will be added to as development proceed.s
|
||||
|
||||
#### Functional Changes:
|
||||
- **Gcode and CNC Changes**
|
||||
- Included `G10 L1`, `G10 L10`, `G43`, `G49` tool length offset and added 16 slot tool table (deferred until build 100.12)
|
||||
- Included `G10 L20` offset mode
|
||||
- Extended `G38.2` probing to also include `G38.3`, `G38.4`, `G38.5`
|
||||
- Homing can now be set to a non-zero switch. Homing will set to the travel value of the positive or negative switch, as determined by the search direction. This allows homing to home to a maximum - for example - and set the homed location to the non-zero switch.
|
||||
- [100.13] Fixes for dwells mixed with gcode moves.
|
||||
- [100.13] Minor planner refactoring to better handle commands and gcode mixed. (Forward-planning now looks past commands.)
|
||||
- [100.13] *Experimental!* Optioan `TRAVERSE_AT_HIGH_JERK` (defaults to off, set to 1 in a settings file to enable) will make traverse moves (`G0`) use the high-jerk settings instead of the normal jerk settings. This applies to all axes universally.
|
||||
|
||||
- **Planner and Motion Changes**
|
||||
- Junction Integration Time - the [`{jt:...}`](https://github.com/synthetos/g2/wiki/Configuring-0.99-System-Groups#jt-junction-integration-time) parameter is now the way to set cornering velocity limits. Cornering now obeys full jerk limitation instead of the centripetal acceleration heuristic, making it much more accurate and more true to the jerk limits set for the machine. JT is a normalized scaled factor that is nominally set to 1.000. Set to less than 1 for slower cornering (less aggressive), greater than 1 (but probably less than 2) for more aggressive cornering. This parameter replaces Junction Acceleration `{ja:...}` and the axis Junction Deviation commands - e.g. `{xjd:0.01}`.
|
||||
- Deprecated `{ja:...}` global parameter. Will return error.
|
||||
- Deprecated `{_jd:...}` per-axis parameter. Will return error.
|
||||
*Note: Click the header next to the arrow to expand and display the details.*
|
||||
|
||||
<details><summary><strong>Linear-Velocity Segment Execution</strong></summary>
|
||||
|
||||
- **3D Printing Support**
|
||||
- Planner improvements to handle extreme cases found in some 3DP slicer outputs
|
||||
- Added automatic bed leveling [{tram:t}](https://github.com/synthetos/g2/wiki/Configuring-0.99-3D-Printing-Extensions#tramt-tram-command) using 3 point probe and coordinate rotation
|
||||
- Added [`{he1:n}`, `{he2:n}`, `{he3:n}`](https://github.com/synthetos/g2/wiki/Configuring-0.99-3D-Printing-Extensions#heater-groups) heater control groups
|
||||
- Added `{pid1:n}`, `{pid2:n}`, `{pid3:n}` ADC PID groups
|
||||
- Note: The semantics of `{he:...}` and `{pid:...}` are still in development and may change.
|
||||
- The overall motion is still jerk-controlled and the computation of motion remains largely the same (although slightly simplified). At the smallest level above raw steps (what we call "segments," which are nominally 0.25ms to 1ms in duration) we previously executed the steps at a constant velocity. We now execute them with a linear change from a start velocity to an end velocity. This results in smoother motion that is more faithful to the planned jerk constraints.
|
||||
- This changed the way the forward differences are used to compute the segment speeds as well. Previously, we were computing the curve at the midpoint (time-wise) of each segment in order to get the median velocity. Now that we want the start and end velocity of each segment we only compute the end (time-wise) of each segment, and use that again later as the start-point of the next segment.
|
||||
</details>
|
||||
|
||||
<details><summary><strong>Probing enhancements</strong></summary>
|
||||
|
||||
- **[GPIO Changes](https://github.com/synthetos/g2/wiki/Digital-IO)**
|
||||
- Changed configuration for [`{di1:n}` ... `{di12:n}`](https://github.com/synthetos/g2/wiki/Digital-IO#digital-inputs) somewhat
|
||||
- Added [`{do1:n}` ... `{do12:n}`](https://github.com/synthetos/g2/wiki/Digital-IO#digital-outputs) digital output controls for controlling general outputs such as fans
|
||||
- Added [`{out1:n}` ... `{out12:n}`](https://github.com/synthetos/g2/wiki/Digital-IO#digital-outputs) digital output state readers for reading the condition of do's
|
||||
- Added `{"prbs":true}` to store the current position as if it were to position of a succesful probe.
|
||||
- Added `{"prbr":true}` to enable and `{"prbr":false}` to enable and disable (respectively) the JSON `{prb:{...}}` report after a probe.
|
||||
</details>
|
||||
|
||||
<details><summary><strong>gQuintic support</strong></summary>
|
||||
|
||||
- **Active JSON comments** - i.e. JSON called from Gcode
|
||||
- Added `M100 ({...})` active comment. Currently only supports temperature setting command.
|
||||
- Added `M101 ({...})` "wait-on-event" active comment. Currently only supports temperature wait command.
|
||||
- Additional note: `M101` will only wait on values that return `true` or `false`, and will only work if given `true` or `false`.
|
||||
- Valid example:
|
||||
```
|
||||
M101 ({in1: true})
|
||||
```
|
||||
- Using `0` or `1`, or anything except `true` or `false` will *not* work.
|
||||
- Support for the gQuintic rev B was added. Support for rev D will come shortly.
|
||||
</details>
|
||||
|
||||
<details><summary><strong>Temperature control enhancements</strong></summary>
|
||||
|
||||
- **System and Communications**
|
||||
- [100.13] **Important:** USB will only expose one virtal serial port by default.
|
||||
- This can be overridden in the settings file with:
|
||||
- Added the following settings defines:
|
||||
- `HAS_TEMPERATURE_SENSOR_1`, `HAS_TEMPERATURE_SENSOR_2`, and `HAS_TEMPERATURE_SENSOR_3`
|
||||
- `EXTRUDER_1_OUTPUT_PIN`, `EXTRUDER_2_OUTPUT_PIN`, and `BED_OUTPUT_PIN`
|
||||
- Added `BED_OUTPUT_INIT` in order to control configuration of the Bed output pin settings.
|
||||
- Defaults to `{kNormal, fet_pin3_freq}`.
|
||||
- `EXTRUDER_1_FAN_PIN` for control of the temperature-enabled fan on extruder 1. (Only available on extruder 1 at the moment.)
|
||||
- (*Experimental*) Analog input is now interpreted through one of various `ADCCircuit` objects.
|
||||
- Three are provided currently: `ADCCircuitSimplePullup`, `ADCCircuitDifferentialPullup`, `ADCCircuitRawResistance`
|
||||
- `Thermistor` and `PT100` objects no longer take the pullup value in their constructor, but instead take a pointer to an `ADCCircuit` object.
|
||||
- `Thermistor` and `PT100` objects no longer assume an `ADCPin` is used, but now take the type that conforms to the `ADCPin` interface as a template argument.
|
||||
- **TODO:** Make more of these configurable at runtime. Separate the ADC input from the consumer, and allow other things than temperature to read it.
|
||||
- PID+FF control adds feed-forward (FF) to adjust the output to a reasonable minimum based on heat loss dues to room temperature.
|
||||
- This can be effectively disabled, making the controller a PID controller, by setting the F value to `0.0`.
|
||||
- **Warning** setting this value too high can cause thermal runaway. Set this value conservatively (low), since there's currently no ambient temperature, and the actual heat loss may be less than computed. This will be magnified by another heater (such as that on a heat bed of a 3D printer) in close proximity.
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary><strong>TMC2130 JSON controls</strong></summary>
|
||||
|
||||
- Added the following setting keys to the motors (`1` - `6`):
|
||||
- `ts` - *(R)* get the value of the `TSTEP` register
|
||||
- `pth` - *(R/W)* get/set the value of the `TPWMTHRS` register
|
||||
- `cth` - *(R/W)* get/set the value of the `TCOOLTHRS` register
|
||||
- `hth` - *(R/W)* get/set the value of the `THIGH` register
|
||||
- `sgt` - *(R/W)* get/set the value of the `sgt` value of the `COOLCONF` register
|
||||
- `sgr` - *(R)* get the `SG_RESULT` value of the `DRV_STATUS` register
|
||||
- `csa` - *(R)* get the `CS_ACTUAL` value of the `DRV_STATUS` register
|
||||
- `sgs` - *(R)* get the `stallGuard` value of the `DRV_STATUS` register
|
||||
- `tbl` - *(R/W)* get/set the `TBL` value of the `CHOPCONF` register
|
||||
- `pgrd` - *(R/W)* get/set the `PWM_GRAD` value of the `PWMCONF` register
|
||||
- `pamp` - *(R/W)* get/set the `PWM_AMPL` value of the `PWMCONF` register
|
||||
- `hend` - *(R/W)* get/set the `HEND_OFFSET` value of the `CHOPCONF` register
|
||||
- `hsrt` - *(R/W)* get/set the `HSTRT/TFD012` value of the `CHOPCONF` register
|
||||
- `smin` - *(R/W)* get/set the `semin` value of the `COOLCONF` register
|
||||
- `smax` - *(R/W)* get/set the `semax` value of the `COOLCONF` register
|
||||
- `sup` - *(R/W)* get/set the `seup` value of the `COOLCONF` register
|
||||
- `sdn` - *(R/W)* get/set the `sedn` value of the `COOLCONF` register
|
||||
- Note that all gets retrieve the last cached value.
|
||||
</details>
|
||||
|
||||
<details><summary><strong>Core XY Kinematics Support</strong></summary>
|
||||
|
||||
- Enabled at compile-time by setting the `KINEMATICS` define to `KINE_CORE_XY`
|
||||
- The default (and only other valid value) for `KINEMATICS` is `KINE_CARTESIAN`
|
||||
- Note that the X and Y axes must have the same settings, or the behavior is undefined.
|
||||
- For the sake of motor mapping, the values `AXIS_COREXY_A` and `AXIS_COREXY_B` have been created.
|
||||
- Example usage:
|
||||
```c++
|
||||
#define M1_MOTOR_MAP AXIS_COREXY_A // 1ma
|
||||
#define M2_MOTOR_MAP AXIS_COREXY_B // 2ma
|
||||
```
|
||||
</details>
|
||||
|
||||
<details><summary><strong>Planner settings control from board files</strong></summary>
|
||||
|
||||
- The defines `PLANNER_BUFFER_POOL_SIZE` and `MIN_SEGMENT_MS` are now set in the `board/*/hardware.h` files.
|
||||
- `PLANNER_BUFFER_POOL_SIZE` sets the size of the planner buffer array.
|
||||
- Default value if not defined: `48`
|
||||
- `MIN_SEGMENT_MS` sets the minimum segment time (in milliseconds) and several other settings that are comuted based on it.
|
||||
- Default values if not defined: `0.75`
|
||||
- A few of the computed values are shown:
|
||||
```c++
|
||||
// Valid options are 1 or 2 only!
|
||||
#define USB_SERIAL_PORTS_EXPOSED 1
|
||||
#define NOM_SEGMENT_MS ((float)MIN_SEGMENT_MS*2.0) // nominal segment ms (at LEAST MIN_SEGMENT_MS * 2)
|
||||
#define MIN_BLOCK_MS ((float)MIN_SEGMENT_MS*2.0) // minimum block (whole move) milliseconds
|
||||
```
|
||||
- [100.13] Refactored XIO to handle `!`, `%`, `~`, and JSON commends intermixed with gcode better.
|
||||
- [100.13] Fixes to USB connection, initialization, and DMA operation for Sam3X-base machines.
|
||||
- Added `Linemode` communication protocol, and provide guidance to use linemode for much simpler and more reliable application-level flow control
|
||||
- Footer format has changed. Checksum is no longer supported and has been removed
|
||||
- Added `ENQ/ACK handshake`. If the host sends an ASCII `ENQ (0x05)` the board should respond with an `ACK (0x06)`. This is provided to facilitate low-level communications startup and automated testing
|
||||
- Added [`{fbs:n}`](https://github.com/synthetos/g2/wiki/Configuring-0.99-System-Groups#fbsn-firmware-build-string) as a read-only parameter to report the git commit used during compilation
|
||||
- Added [`{fbc:n}`](https://github.com/synthetos/g2/wiki/Configuring-0.99-System-Groups#fbcn-firmware-build-config-file) as a read-only parameter to report the configuration file used during compilation
|
||||
- Changes to [`{ej:1}`](https://github.com/synthetos/g2/wiki/Configuring-0.99-System-Groups#ej-enable-json-mode) Enable JSON parameter. JSON and text mode are now "sticky". Auto mode (old style) is also available
|
||||
- Added [`{Nsu:..}`](https://github.com/synthetos/g2/wiki/Configuring-0.99-Motors#1su-steps-per-unit) to directly set motor N's steps-per-unit value
|
||||
- Changes to [Status Codes](https://github.com/synthetos/g2/wiki/Status-Codes) (...or see error.h for source)
|
||||
- [Power Management](https://github.com/synthetos/g2/wiki/Power-Management) commands have been updated as of fb:100.11. Notably `{me:n}` and `{md:n}` are no longer valid commands - use `{me:0}` and `{md:0}` instead. Read the link for more changes.
|
||||
- Additional [`stat`](https://github.com/synthetos/g2/wiki/Status-Reports#stat-values) machine states
|
||||
- Removed `{cv:n}` configuration version tag
|
||||
- Removed `{js:...}` JSON syntax. Responses are now always Strict. Accepts Strict or Relaxed on input
|
||||
- Removed `{ec:...}` Expand CR to CRLF
|
||||
- Removed `{ee:...}` Echo command
|
||||
- Removed `{baud:...}` Set baud rate command
|
||||
- Removed `{ml:...}` Minimum line segment hidden parameter
|
||||
- Removed `{ma:...}` Minimum arc segment hidden parameter
|
||||
- Removed `{ms:...}` Minimum segment time hidden parameter
|
||||
- Exception reports now provide more information about the nature and location of the exception
|
||||
- Removed code for embedded tests. These were a holdover from the TinyGv8 codebase and were not functional in g2. The code is now removed from the project.
|
||||
</details>
|
||||
|
||||
<details><summary><strong>Experimental traverse at high jerk</strong></summary>
|
||||
|
||||
- **[Project Structure and Motate](https://github.com/synthetos/g2/wiki/Project-Structure-and-Motate)**
|
||||
- Motate underpinnings and project structure have changed significantly to support multiple processor architectures, boards, and machine configurations cleanly in the same project. If this affects you please read up on the wiki.
|
||||
- The new define `TRAVERSE_AT_HIGH_JERK` can be set to `true`, making traverse (`G0`) moves (including `E`-only moves in Marlin-flavored gcode mode) will use the jerk-high (`jh`) settings.
|
||||
- If set to `false` or undefined `G0` moves will continue to use the jerk-max (`jm`) settings that feed (`G1`) moves use.
|
||||
</details>
|
||||
|
||||
<details><summary><strong>PID+FF - added feed forward</strong></summary>
|
||||
|
||||
- **NodeJS g2core Communcications Module**
|
||||
- A pre-release of the NodeJS g2core communications module that uses Linemode protocol is available here. This will be superseded with the official release
|
||||
- There is a new JSON value `f` in each `pid`*`n`* object (read-only, for reporting) as well as an `f` setting in the `he`*`n`* objects (for control).
|
||||
- This is controlled in the settings file via `H`*`n`*`_DEFAULT_F`, such as `H1_DEFAULT_F`. Default value is `0.0`.
|
||||
- This is a value that is multiplied to by current temp - 21 and added to the current computed output.
|
||||
- **Warning!** Setting this value too high can result in thermal runaway. Set it conservatively (low) or disable it completely if in doubt.
|
||||
- Set the `he`*`n`*`f` value to `0.0` to effectively disable feed-forward.
|
||||
|
||||
</details>
|
||||
|
||||
- **Automated Regression Testing**
|
||||
- A simple Python functional and regression test suite is available in [Githup/Synthetos/tg_pytest](https://github.com/synthetos/tg_pytest). Please feel free to use and extend, but be aware that we are not offering much support for this. If you are familiar with Python and JSON the Readme should have everything you need.
|
||||
<details><summary><strong>Output setting as soon as possible</strong></summary>
|
||||
|
||||
|
||||
#### Known Issues
|
||||
- Communications bug for high-speed transmission
|
||||
|
||||
|
||||
## Earlier Edges
|
||||
|
||||
### Edge branch, build 083.07
|
||||
These changes are primarily fixes applied after testing
|
||||
- Fixes to spindle speed settings (082.11)
|
||||
- Fixes to build environments for Linux and other platforms
|
||||
- Fixes for reporting error in inches mode
|
||||
|
||||
### Edge branch, build 082.10
|
||||
- **[Digital IO (GPIO)](Digital-IO-(GPIO))** introduces major changes to the way switches and other inputs are handled. The digital inputs are completed, the digital outputs have not been. In short, inputs are now just numbered inputs that are mapped to axes, functions, and motion behaviors (feedholds).
|
||||
- **Your configurations will need to change to accommodate these changes.** See settings/settings_shapeoko2.h for an example of setup and use - pay particular attention to `axis settings` and the new `inputs` section.
|
||||
- Typing `$`, `$x`, `$di`, `$in` at the command line is also informative. Of course, all these commands are available as JSON, but in text mode you get the human readable annotations.
|
||||
- These changes also rev the firmware version to 0.98 from 0.97, as a new configuration wiki page will need to be generated (not started yet).
|
||||
- {lim:0}, {lim:1} was added to allow a limit override to backing off switches when a limit is tripped
|
||||
- See also [Alarm Processing](Alarm-Processing), which is intimately related to these changes.
|
||||
|
||||
- **[Alarm processing](Alarm-Processing)** has been significantly updated. There are now 3 alarm states:
|
||||
- [ALARM](Alarm-Processing#alarm) - used to support soft and hard limits, safety interlock behaviors (door open), and other conditions.
|
||||
- [SHUTDOWN](Alarm-Processing#shutdown) - used to support external ESTOP functions (the controller doe NOT do ESTOP - read the SHUTDOWN section as to why.
|
||||
- [PANIC](Alarm-Processing#panic) - shuts down the machine immediately if there is an assertion failure or some other unrecoverable error
|
||||
- [CLEAR](Alarm-Processing#clear) describes how to clear alarm states.
|
||||
|
||||
- **[Job Exception Handling](Job-Exception-Handling)** has been refined. A new Job Kill has been introduced which is different than a queue flush (%), as these are actually 2 very different use cases.
|
||||
|
||||
- **Homing** changes. Homing input switches are now configured differently.
|
||||
- The switch configurations have been removed from the axes and moved to the digital IO inputs.
|
||||
- Two new parameters have been added to the axis configs. All other parameters remain the same.
|
||||
- {xhd:1} - homing direction - 0=search-to-negative, 1=search-to-positive
|
||||
- {xhi:N} - homing input - 0=disable axis for homing, 1-N=enable homing for this input (switch)
|
||||
- Note that setting the homing input to a non-zero value (1) enables homing for this axis, and (2) overrides whatever settings for that input for the duration of homing. So it's possible to set di1 (Xmin) as a limit switch and a homing switch. When not in homing it will be used as a limit switch.
|
||||
|
||||
- **Safety Interlock** added
|
||||
- An input configured for interlock will invoke a feedhold when the interlock becomes diseangaged and restart movement when re-engaged.
|
||||
- {saf:0}, {saf:1} was added to enable or disable the interlock system.
|
||||
- There are optional settings for spindle and coolant actions on feedhold. See below
|
||||
|
||||
- **Spindle Changes** Expect updates to spindle behaviors in future branches. Here's where it is now:
|
||||
- The spindle can be paused on feedhold with the Spindle-pause-on-hold global setting {spph:1}. For now we recommend not using this {spph:0} as there is not yet a delay in spindle restart.
|
||||
- Spindle enable and direction polarity can now be set using the {spep: } and {spdp: } commands.
|
||||
- Spindle enable and direction state can be returned using {spe:n} and {spd:n}, and these can be configured in status reports
|
||||
- Spindle speed can be returned using {sps:n} and can be configured in status reports
|
||||
|
||||
- **Coolant Changes** Expect coolant changes in future branches, in particular to accommodate changes in the digital outputs.
|
||||
- The coolant can be paused on feedhold with the Coolant-pause-on-hold global setting {coph:0}.
|
||||
- Flood and mist coolant polarity can now be set using the {cofp: } and {comp: } commands.
|
||||
- Flood and mist coolant state can be returned using {cof:n} and {com:n}, and these can be configured in status reports
|
||||
- In v9 the flood (M8) and mist (M7) commands are operative, but map the same pin. M9 clears them both, as expected. These should both be set to the same polarity for proper operation. On a Due or a platform with more output pins these can be separated - the code is written for this possibility. The changes should be limited to the pin mapping layers.
|
||||
|
||||
- **Power Management** is fully working, as far as we can tell. See $1pm for settings
|
||||
|
||||
- **Arc Changes** have been added. Please note any issues immediately. This is still under test.
|
||||
- Fixed bug on very large arcs
|
||||
- Fixed bug on G18 rotation direction
|
||||
- Added P parameter to allow for arcs > 360 degree rotation
|
||||
|
||||
- **G10 L20** was added for easier offset setting
|
||||
|
||||
- **Bug Fixes**
|
||||
- Fixed some units mode display errors for G20 mode (inches)
|
||||
|
||||
- **Still To Go**
|
||||
- SD card persistence
|
||||
- Spindle restart dwell
|
||||
- Digital output generalization and changes
|
||||
- Still needs rigorous testing for very fast feedhold/resume and flush cycles
|
||||
|
||||
### Edge branch, build 071.02
|
||||
|
||||
* **No Persistence**. Most ARM chips (including the ATSAM3X8C on v9 and ATSAM3X8E on the Arduino Due) do not have persistence. This is the main reason the v9 has a microSD slot. But this has not been programmed yet. So your options are to either load the board each time you fire it up or reset it, or to build yourself a profile and compile your own settings as the defaults.
|
||||
|
||||
* **Still working on feedhold.** The serial communications runs a native USB on the ARM instead of through an FTDI USB-to-Serial adapter. We are still shing some bugs out of the single character commands such as feedhold (!), queue flush (%) and cycle start (~).
|
||||
|
||||
* **Power Management needs work.** It doesn't always shut the motors off at the end of a cycle.
|
||||
|
||||
* **Different Behaviors**. There are some behaviors that are different.
|
||||
* Feedhold / queue flush on v8 works with !%~ in one line. In g2 it requires a newline. Use !\n%\n This is due to using a USB stack that is partly on the chip and not being able to get at the individual characters that far upstream. This will probably not change in v9.
|
||||
- At board initialization, the output value on each of the `out` objects is set to whatever the pin is configured to be "inactive." This is based on the settings file `DO`*n*`_MODE` setting.
|
||||
- For example, if `DO10_MODE == IO_ACTIVE_LOW` then the pin at `DO10` is initialized as `HIGH` at board setup. This happen even before the `main()` function starts, shortly after the GPIO clocks are enabled for each port.
|
||||
</details>
|
||||
|
||||
@@ -171,8 +171,10 @@ pin_number kGRBL_CommonEnablePinNumber = -1;
|
||||
|
||||
// g2ref extensions
|
||||
// These first 5 may replace the Spindle and Coolant pins, above
|
||||
pin_number kOutput1_PinNumber = 130; // DO_1: Extruder1_PWM
|
||||
pin_number kOutput2_PinNumber = 131; // DO_2: Extruder2_PWM
|
||||
pin_number kHeaterOutput1_PinNumber = -1; // DO_1: Extruder1_PWM
|
||||
pin_number kHeaterOutput2_PinNumber = -1; // DO_2: Extruder2_PWM
|
||||
pin_number kOutput1_PinNumber = 130; // DO_1:
|
||||
pin_number kOutput2_PinNumber = 131; // DO_2:
|
||||
pin_number kOutput3_PinNumber = 132; // DO_3: Fan1A_PWM
|
||||
pin_number kOutput4_PinNumber = 133; // DO_4: Fan1B_PWM
|
||||
pin_number kOutput5_PinNumber = 134; // DO_5: Fan2A_PWM
|
||||
@@ -183,7 +185,8 @@ pin_number kOutput8_PinNumber = -1; // 137; // See Coolant Enable
|
||||
pin_number kOutput9_PinNumber = 138; // <unassigned, available out>
|
||||
pin_number kOutput10_PinNumber = 139; // DO_10: Fan2B_PWM
|
||||
|
||||
pin_number kOutput11_PinNumber = 140; // DO_11: Heated Bed FET
|
||||
pin_number kHeaterOutput11_PinNumber = -1; // DO_11: Heated Bed FET
|
||||
pin_number kOutput11_PinNumber = 140; // DO_11:
|
||||
pin_number kOutput12_PinNumber = 141; // DO_12: Indicator_LED
|
||||
pin_number kOutput13_PinNumber = -1; // 142;
|
||||
pin_number kOutput14_PinNumber = -1; // 143;
|
||||
|
||||
@@ -99,13 +99,13 @@ stat_t hardware_periodic()
|
||||
{
|
||||
#if EXPERIMENTAL_NEOPIXEL_SUPPORT == 1
|
||||
float x_pos = cm_get_work_position(ACTIVE_MODEL, AXIS_X);
|
||||
if (fabs(LEDs::old_x_pos - x_pos) > 0.01) {
|
||||
if (std::abs(LEDs::old_x_pos - x_pos) > 0.01) {
|
||||
LEDs::old_x_pos = x_pos;
|
||||
|
||||
float led_pos = x_pos * ((float)(LEDs::rgbw_leds.count-1) / 40);
|
||||
|
||||
for (uint8_t pixel = 0; pixel < LEDs::rgbw_leds.count; pixel++) {
|
||||
float value = fabs(led_pos - (float)pixel);
|
||||
float value = std::abs(led_pos - (float)pixel);
|
||||
if (value < 1.001) {
|
||||
value = 1.0 - value;
|
||||
if (LEDs::display_color[pixel].red < value) {
|
||||
|
||||
@@ -176,8 +176,10 @@ pin_number kGRBL_CommonEnablePinNumber = -1;
|
||||
|
||||
// g2ref extensions
|
||||
// These first 5 may replace the Spindle and Coolant pins, above
|
||||
pin_number kOutput1_PinNumber = 130; // DO_1: Extruder1_PWM
|
||||
pin_number kOutput2_PinNumber = 131; // DO_2: Extruder2_PWM
|
||||
pin_number kHeaterOutput1_PinNumber = -1; // DO_1: Extruder1_PWM
|
||||
pin_number kHeaterOutput2_PinNumber = -1; // DO_2: Extruder2_PWM
|
||||
pin_number kOutput1_PinNumber = 130; // DO_1:
|
||||
pin_number kOutput2_PinNumber = 131; // DO_2:
|
||||
pin_number kOutput3_PinNumber = 132; // DO_3: Fan1A_PWM
|
||||
pin_number kOutput4_PinNumber = 133; // DO_4: Fan1B_PWM
|
||||
pin_number kOutput5_PinNumber = 134; // DO_5: Fan2A_PWM
|
||||
@@ -188,7 +190,8 @@ pin_number kOutput8_PinNumber = 137; // See Coolant Enable
|
||||
pin_number kOutput9_PinNumber = 138; // SAFE signal
|
||||
pin_number kOutput10_PinNumber = 139; // DO_10: Fan2B_PWM
|
||||
|
||||
pin_number kOutput11_PinNumber = 140; // DO_11: Heated Bed FET
|
||||
pin_number kHeaterOutput11_PinNumber = -1; // DO_11: Heated Bed FET
|
||||
pin_number kOutput11_PinNumber = 140; // DO_11:
|
||||
pin_number kOutput12_PinNumber = 141; // DO_12: Indicator_LED
|
||||
pin_number kOutput13_PinNumber = -1; // 142;
|
||||
pin_number kOutput14_PinNumber = -1; // 143;
|
||||
|
||||
@@ -24,6 +24,12 @@ ifeq ("$(BOARD)","gquintic-c")
|
||||
DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE}
|
||||
endif
|
||||
|
||||
ifeq ("$(BOARD)","gquintic-d")
|
||||
BASE_BOARD=gquintic
|
||||
DEVICE_DEFINES += MOTATE_BOARD="gquintic-d"
|
||||
DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE}
|
||||
endif
|
||||
|
||||
|
||||
##########
|
||||
# The general gquintic BASE_BOARD.
|
||||
|
||||
Executable
+215
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* gquintic-c-pinout.h - board pinout specification
|
||||
* This file is part of the g2core project
|
||||
*
|
||||
* Copyright (c) 2017 Robert Giseburt
|
||||
* Copyright (c) 2017 Alden S. Hart Jr.
|
||||
*
|
||||
* This file is part of the Motate Library.
|
||||
*
|
||||
* This file ("the software") is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2 as published by the
|
||||
* Free Software Foundation. You should have received a copy of the GNU General Public
|
||||
* License, version 2 along with the software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, you may use this file as part of a software library without
|
||||
* restriction. Specifically, if other files instantiate templates or use macros or
|
||||
* inline functions from this file, or you compile this file and link it with other
|
||||
* files to produce an executable, this file does not by itself cause the resulting
|
||||
* executable to be covered by the GNU General Public License. This exception does not
|
||||
* however invalidate any other reasons why the executable file might be covered by the
|
||||
* GNU General Public License.
|
||||
*
|
||||
* THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY
|
||||
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef gquintic_a_pinout_h
|
||||
#define gquintic_a_pinout_h
|
||||
|
||||
/*
|
||||
* USAGE NOTES
|
||||
*
|
||||
* Read this first:
|
||||
* https://github.com/synthetos/g2/wiki/Adding-and-Revising-Boards
|
||||
*
|
||||
* USAGE:
|
||||
*
|
||||
* This file is lays out all the pin capabilities of the SAM3X8C organized by pin number.
|
||||
* Each pin has its associated functions listed at the bottom of the file, and is essentially
|
||||
* immutable for each processor.
|
||||
*
|
||||
* To use, assign Motate pin numbers to the first value in the _MAKE_MOTATE_PIN() macro.
|
||||
* ALL PINS MUST BE ASSIGNED A NUMBER, even if they are not used. There will NOT be a
|
||||
* code-size or speed penalty for unused pins, but the WILL be a compiler-failure for
|
||||
* unassigned pins. This new restriction allows for simplification of linkages deep in
|
||||
* Motate.
|
||||
*/
|
||||
/* See motate_pin_assignments.h for pin names to be used int he rest of the G2 code.
|
||||
* EXAMPLES:
|
||||
*
|
||||
* *** Vanilla pin example ***
|
||||
*
|
||||
* _MAKE_MOTATE_PIN(4, A, 'A', 27); // SPI0_SCKPinNumber
|
||||
*
|
||||
* This assigns Motate pin 4 to Port A, pin 27 (A27)
|
||||
* Look in motate_pin_assignments.h to see that this is kSPI_SCKPinNumber
|
||||
*
|
||||
* ** Other pin functions ***
|
||||
*
|
||||
* Please look in <Motate>/platform/atmel_sam/motate_chip_pin_functions.h
|
||||
*/
|
||||
|
||||
|
||||
#include <MotateTimers.h>
|
||||
|
||||
// We don't have all of the inputs, so we have to indicate as much:
|
||||
#define INPUT1_AVAILABLE 1
|
||||
#define INPUT2_AVAILABLE 1
|
||||
#define INPUT3_AVAILABLE 1
|
||||
#define INPUT4_AVAILABLE 1
|
||||
#define INPUT5_AVAILABLE 1
|
||||
#define INPUT6_AVAILABLE 1
|
||||
#define INPUT7_AVAILABLE 1
|
||||
#define INPUT8_AVAILABLE 1
|
||||
#define INPUT9_AVAILABLE 1
|
||||
#define INPUT10_AVAILABLE 1
|
||||
#define INPUT11_AVAILABLE 0
|
||||
#define INPUT12_AVAILABLE 0
|
||||
#define INPUT13_AVAILABLE 0
|
||||
|
||||
#define XIO_HAS_USB 1
|
||||
#define XIO_HAS_UART 1
|
||||
#define XIO_HAS_SPI 0
|
||||
#define XIO_HAS_I2C 0
|
||||
|
||||
#define TEMPERATURE_OUTPUT_ON 1 // NO ADC yet
|
||||
|
||||
// Some pins, if the PWM capability is turned on, it will cause timer conflicts.
|
||||
// So we have to explicitly enable them as PWM pins.
|
||||
// Generated with:
|
||||
// perl -e 'for($i=1;$i<14;$i++) { print "#define OUTPUT${i}_PWM 0\n";}'
|
||||
//#define OUTPUT1_PWM 1 // TC 0,1 - Fet 1
|
||||
//#define OUTPUT2_PWM 1 // PWM 0,1 - Fet 2
|
||||
#define OUTPUT1_PWM 0 // Used by EX1
|
||||
#define OUTPUT2_PWM 0 // Used by EX2
|
||||
#define OUTPUT3_PWM 1 // TC 1,0 - Fan 1
|
||||
#define OUTPUT4_PWM 1 // TC 1,1 - Fan 2
|
||||
#define OUTPUT5_PWM 1 // TC 2,0 - Fan 3
|
||||
#define OUTPUT6_PWM 1 // PWM 1,0
|
||||
#define OUTPUT7_PWM 1 // PWM 0,3
|
||||
#define OUTPUT8_PWM 1 // PWM 0,2
|
||||
#define OUTPUT9_PWM 0 // PWM 0,2
|
||||
#define OUTPUT10_PWM 1 // PWM 1,2
|
||||
#define OUTPUT11_PWM 0 // Used by Heatbed
|
||||
//#define OUTPUT11_PWM 1 // PWM 1,3 - Fet 3
|
||||
#define OUTPUT12_PWM 0 // Unused
|
||||
#define OUTPUT13_PWM 0 // Unused
|
||||
|
||||
namespace Motate {
|
||||
|
||||
// Unused:
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
_MAKE_MOTATE_PIN(kLED_RGBWPixelPinNumber, 'A', 0); //
|
||||
_MAKE_MOTATE_PIN(kHeaterOutput1_PinNumber, 'A', 1); // TC 0,1
|
||||
_MAKE_MOTATE_PIN(kHeaterOutput2_PinNumber, 'A', 2); // PWM 0,1
|
||||
_MAKE_MOTATE_PIN(kI2C1_SDAPinNumber, 'A', 3); //
|
||||
_MAKE_MOTATE_PIN(kI2C1_SCLPinNumber, 'A', 4); //
|
||||
_MAKE_MOTATE_PIN(kHeaterOutput11_PinNumber, 'A', 5); // PWM 1,3
|
||||
_MAKE_MOTATE_PIN(kExternalClock1_PinNumber, 'A', 6); // CPU_CLK
|
||||
_MAKE_MOTATE_PIN(kOutput7_PinNumber, 'A', 7); // PWM 0,3
|
||||
_MAKE_MOTATE_PIN(kSerial_RTSPinNumber, 'A', 8); //
|
||||
_MAKE_MOTATE_PIN(kSerial_RXPinNumber, 'A', 9); //
|
||||
_MAKE_MOTATE_PIN(kSerial_TXPinNumber, 'A', 10); //
|
||||
_MAKE_MOTATE_PIN(kSocket2_EnablePinNumber, 'A', 11); //
|
||||
_MAKE_MOTATE_PIN(kOutput6_PinNumber, 'A', 12); // PWM 1,0
|
||||
_MAKE_MOTATE_PIN(kOutput8_PinNumber, 'A', 13); // PWM 0,2
|
||||
_MAKE_MOTATE_PIN(kSocket1_StepPinNumber, 'A', 14); //
|
||||
_MAKE_MOTATE_PIN(kOutput3_PinNumber, 'A', 15); // TC 1,0
|
||||
_MAKE_MOTATE_PIN(kOutput4_PinNumber, 'A', 16); // TC 1,1
|
||||
_MAKE_MOTATE_PIN(kADC4_PinNumber, 'A', 17); // AFEC0,6
|
||||
_MAKE_MOTATE_PIN(kADC3_PinNumber, 'A', 18); // AFEC0,7
|
||||
_MAKE_MOTATE_PIN(kADC2_PinNumber, 'A', 19); // AFEC0,8
|
||||
_MAKE_MOTATE_PIN(kADC1_PinNumber, 'A', 20); // AFEC0,9
|
||||
_MAKE_MOTATE_PIN(kUnassigned1, 'A', 21); // AFEC0,1
|
||||
_MAKE_MOTATE_PIN(kSocket1_EnablePinNumber, 'A', 22); //
|
||||
//_MAKE_MOTATE_PIN(kOutput10_PinNumber, 'A', 23); // PWM 1,2
|
||||
_MAKE_MOTATE_PIN(kServo1_PinNumber, 'A', 23); //
|
||||
_MAKE_MOTATE_PIN(kSocket3_EnablePinNumber, 'A', 24); //
|
||||
_MAKE_MOTATE_PIN(kSocket2_DirPinNumber, 'A', 25); //
|
||||
_MAKE_MOTATE_PIN(kOutput5_PinNumber, 'A', 26); // TC 2,0
|
||||
_MAKE_MOTATE_PIN(kSocket3_DirPinNumber, 'A', 27); // On Timer 2!
|
||||
_MAKE_MOTATE_PIN(kUnassigned2, 'A', 28); // DIAG1
|
||||
_MAKE_MOTATE_PIN(kUnassigned3, 'A', 29); // NO PHYSICAL PIN
|
||||
_MAKE_MOTATE_PIN(kInput1_PinNumber, 'A', 30); //
|
||||
_MAKE_MOTATE_PIN(kInput4_PinNumber, 'A', 31); //
|
||||
|
||||
_MAKE_MOTATE_PIN(kSerial_CTSPinNumber, 'B', 0); //
|
||||
_MAKE_MOTATE_PIN(kUnassigned9, 'B', 1); // AFEC1,0
|
||||
_MAKE_MOTATE_PIN(kSocket1_SPISlaveSelectPinNumber, 'B', 2); //
|
||||
_MAKE_MOTATE_PIN(kOutputSAFE_PinNumber, 'B', 3); //
|
||||
//_MAKE_MOTATE_PIN( , 'B', 4); // TDI
|
||||
//_MAKE_MOTATE_PIN( , 'B', 5); // TRACESDO
|
||||
//_MAKE_MOTATE_PIN( , 'B', 6); // SWDIO
|
||||
//_MAKE_MOTATE_PIN( , 'B', 7); // SWDCLK
|
||||
//_MAKE_MOTATE_PIN( , 'B', 8); // XOUT
|
||||
//_MAKE_MOTATE_PIN( , 'B', 9); // XIN
|
||||
//_MAKE_MOTATE_PIN( , 'B', 10); // USB_D-
|
||||
//_MAKE_MOTATE_PIN( , 'B', 11); // USB_D+
|
||||
//_MAKE_MOTATE_PIN( , 'B', 12); // ERASE
|
||||
_MAKE_MOTATE_PIN(kLED_USBRXPinNumber, 'B', 13); // LED_1 (Heartbeat) - PWM2
|
||||
_MAKE_MOTATE_PIN(kUnassigned6, 'B', 14); // NOT CONNECTED
|
||||
|
||||
|
||||
//_MAKE_MOTATE_PIN( 'D', 0); // USB_VBUS
|
||||
_MAKE_MOTATE_PIN(kInput9_PinNumber, 'D', 1); //
|
||||
_MAKE_MOTATE_PIN(kInput10_PinNumber, 'D', 2); //
|
||||
_MAKE_MOTATE_PIN(kInput8_PinNumber, 'D', 3); //
|
||||
_MAKE_MOTATE_PIN(kInput7_PinNumber, 'D', 4); //
|
||||
_MAKE_MOTATE_PIN(kInput6_PinNumber, 'D', 5); //
|
||||
_MAKE_MOTATE_PIN(kInput5_PinNumber, 'D', 6); //
|
||||
_MAKE_MOTATE_PIN(kInput3_PinNumber, 'D', 7); //
|
||||
_MAKE_MOTATE_PIN(kInput2_PinNumber, 'D', 8); // ]
|
||||
_MAKE_MOTATE_PIN(kTMC2130_DIAG0_pinNumber, 'D', 9); // DIAG0
|
||||
_MAKE_MOTATE_PIN(kUnassigned4, 'D', 10); //
|
||||
_MAKE_MOTATE_PIN(kSocket5_StepPinNumber, 'D', 11); //
|
||||
_MAKE_MOTATE_PIN(kSocket3_SPISlaveSelectPinNumber, 'D', 12); //
|
||||
_MAKE_MOTATE_PIN(kSocket5_DirPinNumber, 'D', 13); //
|
||||
_MAKE_MOTATE_PIN(kSocket5_EnablePinNumber, 'D', 14); //
|
||||
_MAKE_MOTATE_PIN(kUnassigned5, 'D', 15); //
|
||||
_MAKE_MOTATE_PIN(kSocket4_StepPinNumber, 'D', 16); //
|
||||
_MAKE_MOTATE_PIN(kSocket4_DirPinNumber, 'D', 17); //
|
||||
_MAKE_MOTATE_PIN(kSocket3_StepPinNumber, 'D', 18); //
|
||||
_MAKE_MOTATE_PIN(kSocket1_DirPinNumber, 'D', 19); //
|
||||
_MAKE_MOTATE_PIN(kSPI0_MISOPinNumber, 'D', 20); //
|
||||
_MAKE_MOTATE_PIN(kSPI0_MOSIPinNumber, 'D', 21); //
|
||||
_MAKE_MOTATE_PIN(kSPI0_SCKPinNumber, 'D', 22); //
|
||||
_MAKE_MOTATE_PIN(kUnassigned7, 'D', 23); // NO PHYSICAL PIN
|
||||
_MAKE_MOTATE_PIN(kSocket2_StepPinNumber, 'D', 24); //
|
||||
_MAKE_MOTATE_PIN(kSocket2_SPISlaveSelectPinNumber, 'D', 25); //
|
||||
_MAKE_MOTATE_PIN(kOutput9_PinNumber, 'D', 26); // PWM 2
|
||||
_MAKE_MOTATE_PIN(kSocket4_SPISlaveSelectPinNumber, 'D', 27); //
|
||||
_MAKE_MOTATE_PIN(kSocket4_EnablePinNumber, 'D', 28); //
|
||||
_MAKE_MOTATE_PIN(kUnassigned8, 'D', 29); // NO PHYSICAL PIN
|
||||
_MAKE_MOTATE_PIN(kADC3_Neg_PinNumber, 'D', 30); // AFEC0,0 - was INTERRUPT_OUT
|
||||
_MAKE_MOTATE_PIN(kUnassigned10, 'D', 31); //
|
||||
|
||||
} // namespace Motate
|
||||
|
||||
// We then allow each chip-type to have it's onw function definitions
|
||||
// that will refer to these pin assignments.
|
||||
#include "motate_chip_pin_functions.h"
|
||||
|
||||
#endif
|
||||
|
||||
// gquintic_a_pinout_h
|
||||
@@ -202,6 +202,7 @@ pin_number kOutput14_PinNumber = -1; // 143;
|
||||
pin_number kOutput15_PinNumber = -1; // 144;
|
||||
pin_number kOutput16_PinNumber = -1; // 145;
|
||||
|
||||
// For rev-c where we use the differential
|
||||
pin_number kADC1_Pos_PinNumber = 150; // Extruder1_ADC
|
||||
pin_number kADC1_Neg_PinNumber = 151; // Extruder1_ADC
|
||||
pin_number kADC2_Pos_PinNumber = 152; // Extruder2_ADC
|
||||
@@ -209,6 +210,12 @@ pin_number kADC2_Neg_PinNumber = 153; // Extruder2_ADC
|
||||
pin_number kADC3_Pos_PinNumber = 154; // Heated bed thermistor ADC
|
||||
pin_number kADC3_Neg_PinNumber = 155; // Heated bed thermistor ADC
|
||||
|
||||
// for rev-d where we don't
|
||||
pin_number kADC1_PinNumber = 150; // Extruder1_ADC
|
||||
pin_number kADC2_PinNumber = 151; // Extruder2_ADC
|
||||
pin_number kADC3_PinNumber = 152; // Heated bed thermistor ADC
|
||||
pin_number kADC4_PinNumber = 153; // unused ADC
|
||||
|
||||
pin_number kExternalClock1_PinNumber = 170; // External pins for exporting a clock signal (for Trinamics)
|
||||
|
||||
pin_number kServo1_PinNumber = 171; //
|
||||
|
||||
@@ -178,8 +178,10 @@ pin_number kGRBL_CommonEnablePinNumber = -1;
|
||||
|
||||
// g2ref extensions
|
||||
// These first 5 may replace the Spindle and Coolant pins, above
|
||||
pin_number kOutput1_PinNumber = 130; // DO_1: Extruder1_PWM
|
||||
pin_number kOutput2_PinNumber = 131; // DO_2: Extruder2_PWM
|
||||
pin_number kHeaterOutput1_PinNumber = 130; // DO_1: Extruder1_PWM
|
||||
pin_number kHeaterOutput2_PinNumber = 131; // DO_2: Extruder2_PWM
|
||||
pin_number kOutput1_PinNumber = -1; // DO_1:
|
||||
pin_number kOutput2_PinNumber = -1; // DO_2:
|
||||
pin_number kOutput3_PinNumber = 132; // DO_3: Fan1A_PWM
|
||||
pin_number kOutput4_PinNumber = 133; // DO_4: Fan1B_PWM
|
||||
pin_number kOutput5_PinNumber = 134; // DO_5: Fan2A_PWM
|
||||
@@ -190,7 +192,8 @@ pin_number kOutput8_PinNumber = 137; // See Coolant Enable
|
||||
pin_number kOutput9_PinNumber = 138; // SAFE signal
|
||||
pin_number kOutput10_PinNumber = 139; // DO_10: Fan2B_PWM
|
||||
|
||||
pin_number kOutput11_PinNumber = 140; // DO_11: Heated Bed FET
|
||||
pin_number kHeaterOutput11_PinNumber = 140; // DO_11: Heated Bed FET
|
||||
pin_number kOutput11_PinNumber = -1; // DO_11:
|
||||
pin_number kOutput12_PinNumber = 141; // DO_12: Indicator_LED
|
||||
pin_number kOutput13_PinNumber = -1; // 142;
|
||||
pin_number kOutput14_PinNumber = -1; // 143;
|
||||
|
||||
@@ -121,7 +121,7 @@ _MAKE_MOTATE_PIN(kUnassigned2, 'A', 1); // nc
|
||||
_MAKE_MOTATE_PIN(kSocket4_VrefPinNumber, 'A', 2); // M4_Vref
|
||||
_MAKE_MOTATE_PIN(kUnassigned3, 'A', 3); // nc
|
||||
_MAKE_MOTATE_PIN(kADC3_PinNumber, 'A', 4); // BED_ADC
|
||||
_MAKE_MOTATE_PIN(kOutput1_PinNumber, 'A', 5); // DO_1 (Extruder1_PWM)
|
||||
_MAKE_MOTATE_PIN(kHeaterOutput1_PinNumber, 'A', 5); // DO_1 (Extruder1_PWM)
|
||||
_MAKE_MOTATE_PIN(kOutput3_PinNumber, 'A', 6); // DO_3 (Fan1B_PWM)
|
||||
_MAKE_MOTATE_PIN(kOutputSAFE_PinNumber, 'A', 7); // DO_9 (SAFE_PULSES - output from MCU)
|
||||
_MAKE_MOTATE_PIN(kSerial_RXPinNumber, 'A', 8); // UART_RX
|
||||
@@ -171,7 +171,7 @@ _MAKE_MOTATE_PIN(kSocket2_Microstep_2PinNumber, 'B', 20); // M2_MS2
|
||||
_MAKE_MOTATE_PIN(kSocket2_Microstep_0PinNumber, 'B', 21); // M2_MS0 (M2_MS1 is slaved to this signal also)
|
||||
_MAKE_MOTATE_PIN(kSocket4_EnablePinNumber, 'B', 22); // M4_ENABLE
|
||||
_MAKE_MOTATE_PIN(kSocket4_DirPinNumber, 'B', 23); // M4_DIR
|
||||
_MAKE_MOTATE_PIN(kOutput11_PinNumber, 'B', 24); // DO_11 (Header Bed FET)
|
||||
_MAKE_MOTATE_PIN(kHeaterOutput11_PinNumber, 'B', 24); // DO_11 (Header Bed FET)
|
||||
_MAKE_MOTATE_PIN(kOutput5_PinNumber, 'B', 25); // DO_5 (Fan2A_PWM)
|
||||
_MAKE_MOTATE_PIN(kInput1_PinNumber, 'B', 26); // DI_1 (XMin)
|
||||
_MAKE_MOTATE_PIN(kOutput4_PinNumber, 'B', 27); // DO_4 (Fan1A_PWM)
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ endif
|
||||
|
||||
ifeq ("$(CONFIG)","Ultimaker2Plus")
|
||||
ifeq ("$(BOARD)","NONE")
|
||||
BOARD=gquintic-c
|
||||
BOARD=gquintic-d
|
||||
endif
|
||||
SETTINGS_FILE="settings_Ultimaker_2_Plus.h"
|
||||
endif
|
||||
|
||||
@@ -718,8 +718,8 @@ stat_t cm_test_soft_limits(const float target[])
|
||||
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
|
||||
if (cm.homed[axis] != true) { continue; } // skip axis if not homed
|
||||
if (fp_EQ(cm.a[axis].travel_min, cm.a[axis].travel_max)) { continue; } // skip axis if identical
|
||||
if (fabs(cm.a[axis].travel_min) > DISABLE_SOFT_LIMIT) { continue; } // skip min test if disabled
|
||||
if (fabs(cm.a[axis].travel_max) > DISABLE_SOFT_LIMIT) { continue; } // skip max test if disabled
|
||||
if (std::abs(cm.a[axis].travel_min) > DISABLE_SOFT_LIMIT) { continue; } // skip min test if disabled
|
||||
if (std::abs(cm.a[axis].travel_max) > DISABLE_SOFT_LIMIT) { continue; } // skip max test if disabled
|
||||
|
||||
if (target[axis] < cm.a[axis].travel_min) {
|
||||
return (_finalize_soft_limits(STAT_SOFT_LIMIT_EXCEEDED_XMIN + 2*axis));
|
||||
|
||||
@@ -173,7 +173,7 @@ const cfgItem_t cfgArray[] = {
|
||||
{ "prb","prbb",_f0, 3, tx_print_nul, get_flt, set_ro, (float *)&cm.probe_results[0][AXIS_B], 0 },
|
||||
{ "prb","prbc",_f0, 3, tx_print_nul, get_flt, set_ro, (float *)&cm.probe_results[0][AXIS_C], 0 },
|
||||
{ "prb","prbs",_f0, 0, tx_print_nul, get_nul, cm_set_probe, (float *)&cs.null, 0 }, // store probe
|
||||
{ "prb","prbr",_f0, 0, tx_print_nul, cm_get_prbr, cm_get_prbr, nullptr, 0 }, // enable probe report. Init in cm_init
|
||||
{ "prb","prbr",_f0, 0, tx_print_nul, cm_get_prbr, cm_set_prbr, nullptr, 0 }, // enable probe report. Init in cm_init
|
||||
|
||||
{ "jog","jogx",_f0, 0, tx_print_nul, get_nul, cm_run_jogx, (float *)&cm.jogging_dest, 0},
|
||||
{ "jog","jogy",_f0, 0, tx_print_nul, get_nul, cm_run_jogy, (float *)&cm.jogging_dest, 0},
|
||||
|
||||
@@ -235,7 +235,7 @@ static stat_t _homing_axis_start(int8_t axis) {
|
||||
}
|
||||
|
||||
// calculate and test travel distance
|
||||
float travel_distance = fabs(cm.a[axis].travel_max - cm.a[axis].travel_min) + cm.a[axis].latch_backoff;
|
||||
float travel_distance = std::abs(cm.a[axis].travel_max - cm.a[axis].travel_min) + cm.a[axis].latch_backoff;
|
||||
if (fp_ZERO(travel_distance)) {
|
||||
return (_homing_error_exit(axis, STAT_HOMING_ERROR_TRAVEL_MIN_MAX_IDENTICAL));
|
||||
}
|
||||
@@ -245,22 +245,22 @@ static stat_t _homing_axis_start(int8_t axis) {
|
||||
hm.homing_input = cm.a[axis].homing_input;
|
||||
gpio_set_homing_mode(hm.homing_input, true);
|
||||
hm.axis = axis; // persist the axis
|
||||
hm.search_velocity = fabs(cm.a[axis].search_velocity); // search velocity is always positive
|
||||
hm.latch_velocity = fabs(cm.a[axis].latch_velocity); // latch velocity is always positive
|
||||
hm.search_velocity = std::abs(cm.a[axis].search_velocity); // search velocity is always positive
|
||||
hm.latch_velocity = std::abs(cm.a[axis].latch_velocity); // latch velocity is always positive
|
||||
|
||||
bool homing_to_max = cm.a[axis].homing_dir;
|
||||
|
||||
// setup parameters for positive or negative travel (homing to the max or min switch)
|
||||
if (homing_to_max) {
|
||||
hm.search_travel = travel_distance; // search travels in positive direction
|
||||
hm.latch_backoff = fabs(cm.a[axis].latch_backoff); // latch travels in positive direction
|
||||
hm.latch_backoff = std::abs(cm.a[axis].latch_backoff); // latch travels in positive direction
|
||||
hm.zero_backoff = -max(0.0f, cm.a[axis].zero_backoff); // zero backoff is negative direction (or zero)
|
||||
// will set the maximum position
|
||||
// (plus any negative backoff)
|
||||
hm.setpoint = cm.a[axis].travel_max + (max(0.0f, -cm.a[axis].zero_backoff));
|
||||
} else {
|
||||
hm.search_travel = -travel_distance; // search travels in negative direction
|
||||
hm.latch_backoff = -fabs(cm.a[axis].latch_backoff); // latch travels in negative direction
|
||||
hm.latch_backoff = -std::abs(cm.a[axis].latch_backoff); // latch travels in negative direction
|
||||
hm.zero_backoff = max(0.0f, cm.a[axis].zero_backoff); // zero backoff is positive direction (or zero)
|
||||
// will set the minimum position
|
||||
// (minus any negative backoff)
|
||||
|
||||
@@ -153,7 +153,7 @@ static stat_t _jogging_axis_start(int8_t axis) {
|
||||
static stat_t _jogging_axis_ramp_jog(int8_t axis) // run the jog ramp
|
||||
{
|
||||
float direction = jog.start_pos <= jog.dest_pos ? 1. : -1.;
|
||||
float delta = fabs(jog.dest_pos - jog.start_pos);
|
||||
float delta = std::abs(jog.dest_pos - jog.start_pos);
|
||||
uint8_t last = 0;
|
||||
|
||||
float velocity =
|
||||
|
||||
@@ -72,7 +72,7 @@ struct HSI_Color_t : NeopixelColorTag {
|
||||
float h_2 = h * h;
|
||||
|
||||
// to_hue needs to be the closest transition
|
||||
if (fabs(hue - to_hue) > fabs(hue - (360.0 + to_hue))) {
|
||||
if (std::abs(hue - to_hue) > std::abs(hue - (360.0 + to_hue))) {
|
||||
to_hue += 360.0;
|
||||
}
|
||||
|
||||
|
||||
+5
-8
@@ -90,11 +90,11 @@ struct ioDigitalInputExt {
|
||||
ioDigitalInputExt(const ioDigitalInputExt&) = delete; // delete copy
|
||||
ioDigitalInputExt(ioDigitalInputExt&&) = delete; // delete move
|
||||
|
||||
static constexpr d_in_t *in = &d_in[ext_pin_number-1];
|
||||
|
||||
void reset() {
|
||||
if (D_IN_CHANNELS < ext_pin_number) { return; }
|
||||
|
||||
d_in_t *in = &d_in[ext_pin_number-1];
|
||||
|
||||
if (in->mode == IO_MODE_DISABLED) {
|
||||
in->state = INPUT_DISABLED;
|
||||
return;
|
||||
@@ -108,8 +108,6 @@ struct ioDigitalInputExt {
|
||||
void pin_changed() {
|
||||
if (D_IN_CHANNELS < ext_pin_number) { return; }
|
||||
|
||||
d_in_t *in = &d_in[ext_pin_number-1];
|
||||
|
||||
// return if input is disabled (not supposed to happen)
|
||||
if (in->mode == IO_MODE_DISABLED) {
|
||||
in->state = INPUT_DISABLED;
|
||||
@@ -189,10 +187,9 @@ struct ioDigitalInputExt {
|
||||
if (in->action == INPUT_ACTION_RESET) {
|
||||
hw_hard_reset();
|
||||
}
|
||||
}
|
||||
|
||||
// these functions trigger on the leading edge
|
||||
if (in->edge == INPUT_EDGE_LEADING) {
|
||||
// these functions also trigger on the leading edge
|
||||
|
||||
if (in->function == INPUT_FUNCTION_LIMIT) {
|
||||
cm.limit_requested = ext_pin_number;
|
||||
|
||||
@@ -202,7 +199,7 @@ struct ioDigitalInputExt {
|
||||
} else if (in->function == INPUT_FUNCTION_INTERLOCK) {
|
||||
cm.safety_interlock_disengaged = ext_pin_number;
|
||||
}
|
||||
}
|
||||
} // if (in->edge == INPUT_EDGE_LEADING)
|
||||
|
||||
// trigger interlock release on trailing edge
|
||||
if (in->edge == INPUT_EDGE_TRAILING) {
|
||||
|
||||
+7
-7
@@ -179,7 +179,7 @@ stat_t cm_arc_feed(const float target[], const bool target_f[], // target en
|
||||
// test radius arcs for radius tolerance
|
||||
if (radius_f) {
|
||||
arc.radius = _to_millimeters(radius); // set radius to internal format (mm)
|
||||
if (fabs(arc.radius) < MIN_ARC_RADIUS) { // radius value must be > minimum radius
|
||||
if (std::abs(arc.radius) < MIN_ARC_RADIUS) { // radius value must be > minimum radius
|
||||
return (STAT_ARC_RADIUS_OUT_OF_TOLERANCE);
|
||||
}
|
||||
}
|
||||
@@ -298,7 +298,7 @@ static stat_t _compute_arc(const bool radius_f)
|
||||
// Compute end radius from the center of circle (offsets) to target endpoint
|
||||
float end_0 = arc.gm.target[arc.plane_axis_0] - arc.position[arc.plane_axis_0] - arc.offset[arc.plane_axis_0];
|
||||
float end_1 = arc.gm.target[arc.plane_axis_1] - arc.position[arc.plane_axis_1] - arc.offset[arc.plane_axis_1];
|
||||
float err = fabs(hypotf(end_0, end_1) - arc.radius); // end radius - start radius
|
||||
float err = std::abs(hypotf(end_0, end_1) - arc.radius); // end radius - start radius
|
||||
if ((err > ARC_RADIUS_ERROR_MAX) ||
|
||||
((err > ARC_RADIUS_ERROR_MIN) && (err > arc.radius * ARC_RADIUS_TOLERANCE))) {
|
||||
return (STAT_ARC_HAS_IMPOSSIBLE_CENTER_POINT);
|
||||
@@ -338,7 +338,7 @@ static stat_t _compute_arc(const bool radius_f)
|
||||
// Length is the total mm of travel of the helix (or just the planar arc)
|
||||
arc.linear_travel = arc.gm.target[arc.linear_axis] - arc.position[arc.linear_axis];
|
||||
arc.planar_travel = arc.angular_travel * arc.radius;
|
||||
arc.length = hypotf(arc.planar_travel, fabs(arc.linear_travel));
|
||||
arc.length = hypotf(arc.planar_travel, std::abs(arc.linear_travel));
|
||||
|
||||
// Find the minimum number of segments that meet accuracy and time constraints...
|
||||
// Note: removed segment_length test as segment_time accounts for this (build 083.37)
|
||||
@@ -497,10 +497,10 @@ static float _estimate_arc_time (float arc_time)
|
||||
}
|
||||
|
||||
// Downgrade the time if there is a rate-limiting axis
|
||||
arc_time = max(arc_time, (float)fabs(arc.planar_travel/cm.a[arc.plane_axis_0].feedrate_max));
|
||||
arc_time = max(arc_time, (float)fabs(arc.planar_travel/cm.a[arc.plane_axis_1].feedrate_max));
|
||||
if (fabs(arc.linear_travel) > 0) {
|
||||
arc_time = max(arc_time, (float)fabs(arc.linear_travel/cm.a[arc.linear_axis].feedrate_max));
|
||||
arc_time = max(arc_time, (float)std::abs(arc.planar_travel/cm.a[arc.plane_axis_0].feedrate_max));
|
||||
arc_time = max(arc_time, (float)std::abs(arc.planar_travel/cm.a[arc.plane_axis_1].feedrate_max));
|
||||
if (std::abs(arc.linear_travel) > 0) {
|
||||
arc_time = max(arc_time, (float)std::abs(arc.linear_travel/cm.a[arc.linear_axis].feedrate_max));
|
||||
}
|
||||
return (arc_time);
|
||||
}
|
||||
|
||||
@@ -839,40 +839,6 @@ static void _init_forward_diffs(const float v_0, const float v_1)
|
||||
const float Bh_4 = B * h_4;
|
||||
const float Ch_3 = C * h_3;
|
||||
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
const float const1 = 7.5625; // (121.0/16.0)
|
||||
const float const2 = 3.25; // ( 13.0/ 4.0)
|
||||
const float const3 = 82.5; // (165.0/ 2.0)
|
||||
|
||||
/*
|
||||
* F_5 = (121/16)A h^5 + 5 B h^4 + (13/4) C h^3 + 2 D h^2 + Eh
|
||||
* F_4 = (165/2)A h^5 + 29 B h^4 + 9 C h^3 + 2 D h^2
|
||||
* F_3 = 255 A h^5 + 48 B h^4 + 6 C h^3
|
||||
* F_2 = 300 A h^5 + 24 B h^4
|
||||
* F_1 = 120 A h^5
|
||||
*/
|
||||
|
||||
mr.forward_diff_5 = const1*Ah_5 + 5.0*Bh_4 + const2*Ch_3;
|
||||
mr.forward_diff_4 = const3*Ah_5 + 29.0*Bh_4 + 9.0*Ch_3;
|
||||
mr.forward_diff_3 = 255.0*Ah_5 + 48.0*Bh_4 + 6.0*Ch_3;
|
||||
mr.forward_diff_2 = 300.0*Ah_5 + 24.0*Bh_4;
|
||||
mr.forward_diff_1 = 120.0*Ah_5;
|
||||
|
||||
// Calculate the initial velocity by calculating V(h/2)
|
||||
const float half_h = h * 0.5; // h/2
|
||||
const float half_h_3 = half_h * half_h * half_h;
|
||||
const float half_h_4 = half_h_3 * half_h;
|
||||
const float half_h_5 = half_h_4 * half_h;
|
||||
|
||||
const float half_Ch_3 = C * half_h_3;
|
||||
const float half_Bh_4 = B * half_h_4;
|
||||
const float half_Ah_5 = A * half_h_5;
|
||||
|
||||
mr.segment_velocity = half_Ah_5 + half_Bh_4 + half_Ch_3 + v_0;
|
||||
|
||||
#else
|
||||
// NEW_FWD_DIFF == 1
|
||||
|
||||
/*
|
||||
* F_5 = A h^5 + B h^4 + C h^3 + D h^2 + E h
|
||||
* F_4 = 30 A h^5 + 14 B h^4 + 6 C h^3 + 2 D h^2
|
||||
@@ -889,8 +855,6 @@ static void _init_forward_diffs(const float v_0, const float v_1)
|
||||
|
||||
mr.segment_velocity = v_0;
|
||||
mr.target_velocity = v_0 + mr.forward_diff_5;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*********************************************************************************************
|
||||
@@ -901,9 +865,6 @@ static stat_t _exec_aline_head(mpBuf_t *bf)
|
||||
{
|
||||
bool first_pass = false;
|
||||
if (mr.section_state == SECTION_NEW) { // INITIALIZATION
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
first_pass = true;
|
||||
#endif
|
||||
if (fp_ZERO(mr.r->head_length)) {
|
||||
mr.section = SECTION_BODY;
|
||||
return(_exec_aline_body(bf)); // skip ahead to the body generator
|
||||
@@ -914,13 +875,8 @@ static stat_t _exec_aline_head(mpBuf_t *bf)
|
||||
|
||||
if (mr.segment_count == 1) {
|
||||
// We will only have one segment, simply average the velocities
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
mr.segment_velocity = mr.r->head_length / mr.segment_time;
|
||||
#else
|
||||
mr.segment_velocity = mr.entry_velocity;
|
||||
mr.target_velocity = mr.r->cruise_velocity;
|
||||
#endif
|
||||
|
||||
} else {
|
||||
_init_forward_diffs(mr.entry_velocity, mr.r->cruise_velocity); // <-- sets inital segment_velocity
|
||||
}
|
||||
@@ -931,12 +887,8 @@ static stat_t _exec_aline_head(mpBuf_t *bf)
|
||||
mr.section = SECTION_HEAD;
|
||||
mr.section_state = SECTION_RUNNING;
|
||||
} else {
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
mr.segment_velocity += mr.forward_diff_5;
|
||||
#else
|
||||
mr.segment_velocity = mr.target_velocity;
|
||||
mr.target_velocity += mr.forward_diff_5;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (_exec_aline_segment() == STAT_OK) { // set up for second half
|
||||
@@ -1001,10 +953,6 @@ static stat_t _exec_aline_tail(mpBuf_t *bf)
|
||||
{
|
||||
bool first_pass = false;
|
||||
if (mr.section_state == SECTION_NEW) { // INITIALIZATION
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
first_pass = true;
|
||||
#endif
|
||||
|
||||
// Mark the block as unplannable
|
||||
bf->plannable = false;
|
||||
|
||||
@@ -1014,12 +962,8 @@ static stat_t _exec_aline_tail(mpBuf_t *bf)
|
||||
mr.segment_time = mr.r->tail_time / mr.segments; // time to advance for each segment
|
||||
|
||||
if (mr.segment_count == 1) {
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
mr.segment_velocity = mr.r->tail_length / mr.segment_time;
|
||||
#else
|
||||
mr.segment_velocity = mr.r->cruise_velocity;
|
||||
mr.target_velocity = mr.r->exit_velocity;
|
||||
#endif
|
||||
} else {
|
||||
_init_forward_diffs(mr.r->cruise_velocity, mr.r->exit_velocity); // <-- sets inital segment_velocity
|
||||
}
|
||||
@@ -1031,12 +975,8 @@ static stat_t _exec_aline_tail(mpBuf_t *bf)
|
||||
mr.section = SECTION_TAIL;
|
||||
mr.section_state = SECTION_RUNNING;
|
||||
} else {
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
mr.segment_velocity += mr.forward_diff_5;
|
||||
#else
|
||||
mr.segment_velocity = mr.target_velocity;
|
||||
mr.target_velocity += mr.forward_diff_5;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (_exec_aline_segment() == STAT_OK) {
|
||||
@@ -1128,11 +1068,7 @@ static stat_t _exec_aline_segment()
|
||||
if ((--mr.segment_count == 0) && (cm.motion_state != MOTION_HOLD)) {
|
||||
copy_vector(mr.gm.target, mr.waypoint[mr.section]);
|
||||
} else {
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
float segment_length = mr.segment_velocity * mr.segment_time;
|
||||
#else
|
||||
float segment_length = (mr.segment_velocity+mr.target_velocity) * 0.5 * mr.segment_time;
|
||||
#endif
|
||||
// see https://en.wikipedia.org/wiki/Kahan_summation_algorithm
|
||||
// for the summation compensation description
|
||||
for (uint8_t a=0; a<AXES; a++) {
|
||||
@@ -1176,11 +1112,7 @@ static stat_t _exec_aline_segment()
|
||||
}
|
||||
|
||||
// Call the stepper prep function
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
ritorno(st_prep_line(travel_steps, mr.following_error, mr.segment_time));
|
||||
#else
|
||||
ritorno(st_prep_line(mr.segment_velocity, mr.target_velocity, travel_steps, mr.following_error, mr.segment_time));
|
||||
#endif
|
||||
|
||||
copy_vector(mr.position, mr.gm.target); // update position from target
|
||||
if (mr.segment_count == 0) {
|
||||
|
||||
@@ -531,10 +531,10 @@ static void _calculate_jerk(mpBuf_t* bf)
|
||||
float jerk = 0;
|
||||
|
||||
for (uint8_t axis = 0; axis < AXES; axis++) {
|
||||
if (fabs(bf->unit[axis]) > 0) { // if this axis is participating in the move
|
||||
if (std::abs(bf->unit[axis]) > 0) { // if this axis is participating in the move
|
||||
float axis_jerk = _get_axis_jerk(bf, axis);
|
||||
|
||||
jerk = axis_jerk / fabs(bf->unit[axis]);
|
||||
jerk = axis_jerk / std::abs(bf->unit[axis]);
|
||||
if (jerk < bf->jerk) {
|
||||
bf->jerk = jerk;
|
||||
// bf->jerk_axis = axis; // +++ diagnostic
|
||||
@@ -637,9 +637,9 @@ static void _calculate_vmaxes(mpBuf_t* bf, const float axis_length[], const floa
|
||||
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
|
||||
if (bf->axis_flags[axis]) {
|
||||
if (bf->gm.motion_mode == MOTION_MODE_STRAIGHT_TRAVERSE) {
|
||||
tmp_time = fabs(axis_length[axis]) / cm.a[axis].velocity_max;
|
||||
tmp_time = std::abs(axis_length[axis]) / cm.a[axis].velocity_max;
|
||||
} else { // gm.motion_mode == MOTION_MODE_STRAIGHT_FEED
|
||||
tmp_time = fabs(axis_length[axis]) / cm.a[axis].feedrate_max;
|
||||
tmp_time = std::abs(axis_length[axis]) / cm.a[axis].feedrate_max;
|
||||
}
|
||||
max_time = max(max_time, tmp_time);
|
||||
|
||||
@@ -734,11 +734,11 @@ static void _calculate_junction_vmax(mpBuf_t* bf)
|
||||
|
||||
for (uint8_t axis = 0; axis < AXES; axis++) {
|
||||
if (bf->axis_flags[axis] || bf->nx->axis_flags[axis]) { // (A) skip axes with no movement
|
||||
float delta = fabs(bf->unit[axis] - bf->nx->unit[axis]); // formula (1)
|
||||
float delta = std::abs(bf->unit[axis] - bf->nx->unit[axis]); // formula (1)
|
||||
|
||||
if (using_junction_unit) { // (B) special case
|
||||
// use the highest delta of the two
|
||||
delta = std::max(delta, fabs(bf->junction_unit[axis] - bf->nx->unit[axis])); // formula (1)
|
||||
delta = std::max(delta, std::abs(bf->junction_unit[axis] - bf->nx->unit[axis])); // formula (1)
|
||||
|
||||
// push the junction_unit for this axis into the next block, for future (B) cases
|
||||
bf->nx->junction_unit[axis] = bf->junction_unit[axis];
|
||||
|
||||
@@ -375,7 +375,7 @@ void mp_calculate_ramps(mpBlockRuntimeBuf_t* block, mpBuf_t* bf, const float ent
|
||||
float mp_get_target_length(const float v_0, const float v_1, const mpBuf_t* bf)
|
||||
{
|
||||
const float q_recip_2_sqrt_j = bf->q_recip_2_sqrt_j;
|
||||
return q_recip_2_sqrt_j * sqrt(fabs(v_1 - v_0)) * (v_1 + v_0);
|
||||
return q_recip_2_sqrt_j * sqrt(std::abs(v_1 - v_0)) * (v_1 + v_0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -417,7 +417,7 @@ float mp_get_target_velocity(const float v_0, const float L, const mpBuf_t* bf)
|
||||
// v_1 = 1/3 ((const1a v_0^2)/b + b const2a - v_0)
|
||||
const float v_1 = const3 * ((const1a * v_0_2) / b + b * const2a - v_0);
|
||||
|
||||
return fabs(v_1);
|
||||
return std::abs(v_1);
|
||||
}
|
||||
|
||||
|
||||
@@ -447,7 +447,7 @@ float mp_get_decel_velocity(const float v_0, const float L, const mpBuf_t* bf)
|
||||
const float sqrt_delta_v_0 = sqrt(v_0 - v_1);
|
||||
const float l_t = q_recip_2_sqrt_j * (sqrt_delta_v_0 * (v_1 + v_0)) - L;
|
||||
|
||||
if (fabs(l_t) < 0.00001) {
|
||||
if (std::abs(l_t) < 0.00001) {
|
||||
break;
|
||||
}
|
||||
// For the first pass, we tested velocity 0.
|
||||
@@ -548,8 +548,8 @@ static float _get_meet_velocity(const float v_0,
|
||||
}
|
||||
|
||||
// Precompute some common chunks -- note that some attempts may have v_1 < v_0 or v_1 < v_2
|
||||
const float sqrt_delta_v_0 = sqrt(fabs(v_1 - v_0));
|
||||
const float sqrt_delta_v_2 = sqrt(fabs(v_1 - v_2)); // 849us
|
||||
const float sqrt_delta_v_0 = sqrt(std::abs(v_1 - v_0));
|
||||
const float sqrt_delta_v_2 = sqrt(std::abs(v_1 - v_2)); // 849us
|
||||
|
||||
// l_c is our total-length calculation with the current v_1 estimate, minus the expected length.
|
||||
// This makes l_c == 0 when v_1 is the correct value.
|
||||
|
||||
+2
-4
@@ -149,8 +149,6 @@
|
||||
#ifndef PLANNER_H_ONCE
|
||||
#define PLANNER_H_ONCE
|
||||
|
||||
#define NEW_FWD_DIFF 1
|
||||
|
||||
#include "canonical_machine.h" // used for GCodeState_t
|
||||
#include "hardware.h" // for MIN_SEGMENT_MS
|
||||
|
||||
@@ -285,13 +283,13 @@ typedef enum {
|
||||
//// RG: Simulation shows +-0.001 is about as much as we should allow.
|
||||
// VELOCITY_EQ(v0,v1) reads: "True if v0 is within 0.0001 of v1"
|
||||
// VELOCITY_LT(v0,v1) reads: "True if v0 is less than v1 by at least 0.0001"
|
||||
#define VELOCITY_EQ(v0,v1) ( fabs(v0-v1) < 0.0001 )
|
||||
#define VELOCITY_EQ(v0,v1) ( std::abs(v0-v1) < 0.0001 )
|
||||
#define VELOCITY_LT(v0,v1) ( (v1 - v0) > 0.0001 )
|
||||
|
||||
#define Vthr2 300.0
|
||||
#define Veq2_hi 10.0
|
||||
#define Veq2_lo 1.0
|
||||
#define VELOCITY_ROUGHLY_EQ(v0,v1) ( (v0 > Vthr2) ? fabs(v0-v1) < Veq2_hi : fabs(v0-v1) < Veq2_lo )
|
||||
#define VELOCITY_ROUGHLY_EQ(v0,v1) ( (v0 > Vthr2) ? std::abs(v0-v1) < Veq2_hi : std::abs(v0-v1) < Veq2_lo )
|
||||
|
||||
//#define ASCII_ART(s) xio_writeline(s)
|
||||
#define ASCII_ART(s)
|
||||
|
||||
+1
-1
@@ -388,7 +388,7 @@ static uint8_t _populate_filtered_status_report()
|
||||
nv_get_nvObj(nv);
|
||||
|
||||
// report values that have changed by more than 0.0001, but always stops and ends
|
||||
if ((fabs(nv->value - sr.status_report_value[i]) > EPSILON3) ||
|
||||
if ((std::abs(nv->value - sr.status_report_value[i]) > EPSILON3) ||
|
||||
((nv->index == sr.stat_index) && fp_EQ(nv->value, COMBINED_PROGRAM_STOP)) ||
|
||||
((nv->index == sr.stat_index) && fp_EQ(nv->value, COMBINED_PROGRAM_END))) {
|
||||
|
||||
|
||||
@@ -323,69 +323,46 @@
|
||||
|
||||
//** Temperature Sensors **
|
||||
|
||||
#include "device/max31865/max31865.h"
|
||||
|
||||
#define USING_A_MAX31865 1
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_1 true
|
||||
#if HAS_TEMPERATURE_SENSOR_1
|
||||
// #define TEMPERATURE_SENSOR_1_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
// #define TEMPERATURE_SENSOR_1_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
// #define TEMPERATURE_SENSOR_1_TYPE Thermistor<kADC1_PinNumber>
|
||||
// #define TEMPERATURE_SENSOR_1_INIT { \
|
||||
// /*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
// /*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, &temperature_sensor_1_circuit \
|
||||
// }
|
||||
|
||||
#define TEMPERATURE_SENSOR_1_CIRCUIT_TYPE ADCCircuitRawResistance
|
||||
#define TEMPERATURE_SENSOR_1_CIRCUIT_INIT { /*pullup_resistance:*/ 430 }
|
||||
#define TEMPERATURE_SENSOR_1_TYPE Thermistor<MAX31865<SPIBus_used_t::SPIBusDevice>>
|
||||
#define TEMPERATURE_SENSOR_1_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_1_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_1_TYPE Thermistor<ADCPin<kADC1_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_1_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 99500.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, &temperature_sensor_1_circuit \
|
||||
/*MAX31865 config*/ spiBus, spiCSPinMux.getCS(5), 150000 \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_1_circuit \
|
||||
}
|
||||
|
||||
#endif // HAS_TEMPERATURE_SENSOR_1
|
||||
|
||||
#define EXTRUDER_1_OUTPUT_PIN kHeaterOutput1_PinNumber
|
||||
#define EXTRUDER_1_FAN_PIN kOutput5_PinNumber
|
||||
|
||||
#define EXTRUDER_1_FAN_PIN kOutput3_PinNumber
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_2 false
|
||||
#if HAS_TEMPERATURE_SENSOR_2
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_2_TYPE Thermistor<ADCDifferentialPair<kADC2_Neg_PinNumber, kADC2_Pos_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_2_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_2_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_2_TYPE Thermistor<ADCPin<kADC2_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_2_INIT { \
|
||||
/*T1:*/ 25.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 99500.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 10500.0 \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_2_circuit \
|
||||
}
|
||||
#else
|
||||
#define TEMPERATURE_SENSOR_2_TYPE PT100<ADCDifferentialPair<kADC2_Neg_PinNumber, kADC2_Pos_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_2_INIT {/*pullup_resistance:*/ 200, /*inline_resistance*/0.0}
|
||||
// #define TEMPERATURE_SENSOR_2_TYPE PT100<MAX31865<SPIBus_used_t::SPIBusDevice>>
|
||||
// #define TEMPERATURE_SENSOR_2_INIT {/*pullup_resistance:*/ 430, /*inline_resistance*/0, spiBus, spiCSPinMux.getCS(5)}
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_2
|
||||
|
||||
// Warning - the PrintrBoardG2 doesn't have a Output2
|
||||
#define EXTRUDER_2_OUTPUT_PIN kHeaterOutput2_PinNumber
|
||||
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_3 false
|
||||
#if HAS_TEMPERATURE_SENSOR_3
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_3_TYPE Thermistor<ADCDifferentialPair<kADC2_Neg_PinNumber, kADC2_Pos_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_3_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_3_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_3_TYPE Thermistor<ADCPin<kADC3_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_3_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 99500.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 10500.0 \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_3_circuit \
|
||||
}
|
||||
#else
|
||||
// #define TEMPERATURE_SENSOR_3_TYPE PT100<ADCDifferentialPair<kADC3_Neg_PinNumber, kADC3_Pos_PinNumber>>
|
||||
// #define TEMPERATURE_SENSOR_3_INIT {/*pullup_resistance:*/ 200, /*inline_resistance*/0.0}
|
||||
#define TEMPERATURE_SENSOR_3_TYPE PT100<MAX31865<SPIBus_used_t::SPIBusDevice>>
|
||||
#define TEMPERATURE_SENSOR_3_INIT {/*pullup_resistance:*/ 430, /*inline_resistance*/0, spiBus, spiCSPinMux.getCS(6)}
|
||||
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_3
|
||||
|
||||
#define BED_OUTPUT_PIN kHeaterOutput11_PinNumber
|
||||
|
||||
@@ -247,53 +247,47 @@
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_1 true
|
||||
#if HAS_TEMPERATURE_SENSOR_1
|
||||
// Must choose Thermistor or PT100
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_1_TYPE Thermistor<kADC1_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_1_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_1_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_1_TYPE Thermistor<ADCPin<kADC1_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_1_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 4700 \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_1_circuit \
|
||||
}
|
||||
#else
|
||||
#define TEMPERATURE_SENSOR_1_TYPE PT100<kADC1_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_1_INIT {/*pullup_resistance:*/ 2325, /*inline_resistance*/0.75}
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_1
|
||||
|
||||
#define EXTRUDER_1_OUTPUT_PIN kOutput1_PinNumber
|
||||
#define EXTRUDER_1_OUTPUT_PIN kHeaterOutput1_PinNumber
|
||||
#define EXTRUDER_1_FAN_PIN kOutput3_PinNumber
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_2 true
|
||||
#define HAS_TEMPERATURE_SENSOR_2 false
|
||||
#if HAS_TEMPERATURE_SENSOR_2
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_2_TYPE Thermistor<kADC2_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_2_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_2_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_2_TYPE Thermistor<ADCPin<kADC2_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_2_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 4700 \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_2_circuit \
|
||||
}
|
||||
#else
|
||||
#define TEMPERATURE_SENSOR_2_TYPE PT100<kADC2_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_2_INIT {/*pullup_resistance:*/ 2325, /*inline_resistance*/0.75}
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_2
|
||||
|
||||
#define EXTRUDER_2_OUTPUT_PIN kOutput2_PinNumber
|
||||
// Warning - the PrintrBoardG2 doesn't have a Output2
|
||||
#define EXTRUDER_2_OUTPUT_PIN kHeaterOutput2_PinNumber
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_3 true
|
||||
#define HAS_TEMPERATURE_SENSOR_3 false
|
||||
#if HAS_TEMPERATURE_SENSOR_3
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_3_TYPE Thermistor<kADC3_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_3_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_3_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_3_TYPE Thermistor<ADCPin<kADC3_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_3_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 4700 \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_3_circuit \
|
||||
}
|
||||
#else
|
||||
#define TEMPERATURE_SENSOR_3_TYPE PT100<kADC3_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_3_INIT {/*pullup_resistance:*/ 2325, /*inline_resistance*/0.75}
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_3
|
||||
|
||||
#define BED_OUTPUT_PIN kOutput11_PinNumber
|
||||
#define BED_OUTPUT_PIN kHeaterOutput11_PinNumber
|
||||
|
||||
//** Digital Inputs **
|
||||
|
||||
|
||||
@@ -243,53 +243,47 @@
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_1 true
|
||||
#if HAS_TEMPERATURE_SENSOR_1
|
||||
// Must choose Thermistor or PT100
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_1_TYPE Thermistor<kADC1_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_1_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_1_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_1_TYPE Thermistor<ADCPin<kADC1_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_1_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 4700 \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_1_circuit \
|
||||
}
|
||||
#else
|
||||
#define TEMPERATURE_SENSOR_1_TYPE PT100<kADC1_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_1_INIT {/*pullup_resistance:*/ 2325, /*inline_resistance*/0.75}
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_1
|
||||
|
||||
#define EXTRUDER_1_OUTPUT_PIN kOutput1_PinNumber
|
||||
#define EXTRUDER_1_OUTPUT_PIN kHeaterOutput1_PinNumber
|
||||
#define EXTRUDER_1_FAN_PIN kOutput3_PinNumber
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_2 true
|
||||
#define HAS_TEMPERATURE_SENSOR_2 false
|
||||
#if HAS_TEMPERATURE_SENSOR_2
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_2_TYPE Thermistor<kADC2_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_2_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_2_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_2_TYPE Thermistor<ADCPin<kADC2_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_2_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 4700 \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_2_circuit \
|
||||
}
|
||||
#else
|
||||
#define TEMPERATURE_SENSOR_2_TYPE PT100<kADC2_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_2_INIT {/*pullup_resistance:*/ 2325, /*inline_resistance*/0.75}
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_2
|
||||
|
||||
#define EXTRUDER_2_OUTPUT_PIN kOutput2_PinNumber
|
||||
// Warning - the PrintrBoardG2 doesn't have a Output2
|
||||
#define EXTRUDER_2_OUTPUT_PIN kHeaterOutput2_PinNumber
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_3 true
|
||||
#define HAS_TEMPERATURE_SENSOR_3 false
|
||||
#if HAS_TEMPERATURE_SENSOR_3
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_3_TYPE Thermistor<kADC3_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_3_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_3_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_3_TYPE Thermistor<ADCPin<kADC3_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_3_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 4700 \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_3_circuit \
|
||||
}
|
||||
#else
|
||||
#define TEMPERATURE_SENSOR_3_TYPE PT100<kADC3_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_3_INIT {/*pullup_resistance:*/ 2325, /*inline_resistance*/0.75}
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_3
|
||||
|
||||
#define BED_OUTPUT_PIN kOutput11_PinNumber
|
||||
#define BED_OUTPUT_PIN kHeaterOutput11_PinNumber
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -257,53 +257,47 @@
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_1 true
|
||||
#if HAS_TEMPERATURE_SENSOR_1
|
||||
// Must choose Thermistor or PT100
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_1_TYPE Thermistor<kADC1_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_1_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_1_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_1_TYPE Thermistor<ADCPin<kADC1_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_1_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 4700 \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_1_circuit \
|
||||
}
|
||||
#else
|
||||
#define TEMPERATURE_SENSOR_1_TYPE PT100<kADC1_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_1_INIT {/*pullup_resistance:*/ 2325, /*inline_resistance*/0.75}
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_1
|
||||
|
||||
#define EXTRUDER_1_OUTPUT_PIN kOutput1_PinNumber
|
||||
#define EXTRUDER_1_OUTPUT_PIN kHeaterOutput1_PinNumber
|
||||
#define EXTRUDER_1_FAN_PIN kOutput3_PinNumber
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_2 false
|
||||
#if HAS_TEMPERATURE_SENSOR_2
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_2_TYPE Thermistor<kADC2_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_2_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_2_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_2_TYPE Thermistor<ADCPin<kADC2_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_2_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 4700 \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_2_circuit \
|
||||
}
|
||||
#else
|
||||
#define TEMPERATURE_SENSOR_2_TYPE PT100<kADC2_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_2_INIT {/*pullup_resistance:*/ 2325, /*inline_resistance*/0.75}
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_2
|
||||
|
||||
#define EXTRUDER_2_OUTPUT_PIN kOutput2_PinNumber
|
||||
// Warning - the PrintrBoardG2 doesn't have a Output2
|
||||
#define EXTRUDER_2_OUTPUT_PIN kHeaterOutput2_PinNumber
|
||||
|
||||
#define HAS_TEMPERATURE_SENSOR_3 true
|
||||
#define HAS_TEMPERATURE_SENSOR_3 false
|
||||
#if HAS_TEMPERATURE_SENSOR_3
|
||||
#if 1 // 1 if a Thermistor, 0 if a PT100
|
||||
#define TEMPERATURE_SENSOR_3_TYPE Thermistor<kADC3_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_3_CIRCUIT_TYPE ADCCircuitSimplePullup
|
||||
#define TEMPERATURE_SENSOR_3_CIRCUIT_INIT { /*pullup_resistance:*/ 4700 }
|
||||
#define TEMPERATURE_SENSOR_3_TYPE Thermistor<ADCPin<kADC3_PinNumber>>
|
||||
#define TEMPERATURE_SENSOR_3_INIT { \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, /*pullup_resistance:*/ 4700 \
|
||||
/*T1:*/ 20.0, /*T2:*/ 190.0, /*T3:*/ 255.0, \
|
||||
/*R1:*/ 144700.0, /*R2:*/ 5190.0, /*R3:*/ 4809.0, \
|
||||
&temperature_sensor_3_circuit \
|
||||
}
|
||||
#else
|
||||
#define TEMPERATURE_SENSOR_3_TYPE PT100<kADC3_PinNumber>
|
||||
#define TEMPERATURE_SENSOR_3_INIT {/*pullup_resistance:*/ 2325, /*inline_resistance*/0.75}
|
||||
#endif // 0 or 1
|
||||
#endif // HAS_TEMPERATURE_SENSOR_3
|
||||
|
||||
#define BED_OUTPUT_PIN kOutput11_PinNumber
|
||||
#define BED_OUTPUT_PIN kHeaterOutput11_PinNumber
|
||||
|
||||
//** Digital Inputs **
|
||||
|
||||
|
||||
+5
-175
@@ -304,83 +304,47 @@ void dda_timer_type::interrupt()
|
||||
// process DDAs for each motor
|
||||
if ((st_run.mot[MOTOR_1].substep_accumulator += st_run.mot[MOTOR_1].substep_increment) > 0) {
|
||||
motor_1.stepStart(); // turn step bit on
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_1].substep_accumulator -= DDA_SUBSTEPS; //st_run.dda_ticks_X_substeps;
|
||||
#else
|
||||
st_run.mot[MOTOR_1].substep_accumulator -= st_run.dda_ticks_X_substeps;
|
||||
#endif
|
||||
INCREMENT_ENCODER(MOTOR_1);
|
||||
}
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_1].substep_increment += st_run.mot[MOTOR_1].substep_increment_increment;
|
||||
#endif
|
||||
if ((st_run.mot[MOTOR_2].substep_accumulator += st_run.mot[MOTOR_2].substep_increment) > 0) {
|
||||
motor_2.stepStart(); // turn step bit on
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_2].substep_accumulator -= DDA_SUBSTEPS; //st_run.dda_ticks_X_substeps;
|
||||
#else
|
||||
st_run.mot[MOTOR_2].substep_accumulator -= st_run.dda_ticks_X_substeps;
|
||||
#endif
|
||||
INCREMENT_ENCODER(MOTOR_2);
|
||||
}
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_2].substep_increment += st_run.mot[MOTOR_2].substep_increment_increment;
|
||||
#endif
|
||||
#if MOTORS > 2
|
||||
if ((st_run.mot[MOTOR_3].substep_accumulator += st_run.mot[MOTOR_3].substep_increment) > 0) {
|
||||
motor_3.stepStart(); // turn step bit on
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_3].substep_accumulator -= DDA_SUBSTEPS; //st_run.dda_ticks_X_substeps;
|
||||
#else
|
||||
st_run.mot[MOTOR_3].substep_accumulator -= st_run.dda_ticks_X_substeps;
|
||||
#endif
|
||||
INCREMENT_ENCODER(MOTOR_3);
|
||||
}
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_3].substep_increment += st_run.mot[MOTOR_3].substep_increment_increment;
|
||||
#endif
|
||||
#endif
|
||||
#if MOTORS > 3
|
||||
if ((st_run.mot[MOTOR_4].substep_accumulator += st_run.mot[MOTOR_4].substep_increment) > 0) {
|
||||
motor_4.stepStart(); // turn step bit on
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_4].substep_accumulator -= DDA_SUBSTEPS; //st_run.dda_ticks_X_substeps;
|
||||
#else
|
||||
st_run.mot[MOTOR_4].substep_accumulator -= st_run.dda_ticks_X_substeps;
|
||||
#endif
|
||||
INCREMENT_ENCODER(MOTOR_4);
|
||||
}
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_4].substep_increment += st_run.mot[MOTOR_4].substep_increment_increment;
|
||||
#endif
|
||||
#endif
|
||||
#if MOTORS > 4
|
||||
if ((st_run.mot[MOTOR_5].substep_accumulator += st_run.mot[MOTOR_5].substep_increment) > 0) {
|
||||
motor_5.stepStart(); // turn step bit on
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_5].substep_accumulator -= DDA_SUBSTEPS; //st_run.dda_ticks_X_substeps;
|
||||
#else
|
||||
st_run.mot[MOTOR_5].substep_accumulator -= st_run.dda_ticks_X_substeps;
|
||||
#endif
|
||||
INCREMENT_ENCODER(MOTOR_5);
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_5].substep_increment += st_run.mot[MOTOR_5].substep_increment_increment;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if MOTORS > 5
|
||||
if ((st_run.mot[MOTOR_6].substep_accumulator += st_run.mot[MOTOR_6].substep_increment) > 0) {
|
||||
motor_6.stepStart(); // turn step bit on
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_6].substep_accumulator -= DDA_SUBSTEPS; //st_run.dda_ticks_X_substeps;
|
||||
#else
|
||||
st_run.mot[MOTOR_6].substep_accumulator -= st_run.dda_ticks_X_substeps;
|
||||
#endif
|
||||
INCREMENT_ENCODER(MOTOR_6);
|
||||
}
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_6].substep_increment += st_run.mot[MOTOR_6].substep_increment_increment;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Process end of segment.
|
||||
@@ -533,10 +497,6 @@ static void _load_move()
|
||||
//**** setup the new segment ****
|
||||
|
||||
// st_run.dda_ticks_downcount is setup right before turning on the interrupt, since we don't turn it off
|
||||
#if NEW_DDA == 1
|
||||
#else
|
||||
st_run.dda_ticks_X_substeps = st_pre.dda_ticks_X_substeps;
|
||||
#endif
|
||||
// INLINED VERSION: 4.3us
|
||||
//**** MOTOR_1 LOAD ****
|
||||
|
||||
@@ -550,16 +510,7 @@ static void _load_move()
|
||||
// segments it may have been inactive in between.
|
||||
|
||||
// Apply accumulator correction if the time base has changed since previous segment
|
||||
#if NEW_DDA == 1
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_1].substep_increment_increment = st_pre.mot[MOTOR_1].substep_increment_increment;
|
||||
#endif
|
||||
#else
|
||||
if (st_pre.mot[MOTOR_1].accumulator_correction_flag == true) {
|
||||
st_pre.mot[MOTOR_1].accumulator_correction_flag = false;
|
||||
st_run.mot[MOTOR_1].substep_accumulator *= st_pre.mot[MOTOR_1].accumulator_correction;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Detect direction change and if so:
|
||||
// Set the direction bit in hardware.
|
||||
@@ -567,11 +518,7 @@ static void _load_move()
|
||||
|
||||
if (st_pre.mot[MOTOR_1].direction != st_pre.mot[MOTOR_1].prev_direction) {
|
||||
st_pre.mot[MOTOR_1].prev_direction = st_pre.mot[MOTOR_1].direction;
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_1].substep_accumulator = -(DDA_SUBSTEPS + st_run.mot[MOTOR_1].substep_accumulator); // invert the accumulator for the direction change
|
||||
#else
|
||||
st_run.mot[MOTOR_1].substep_accumulator = -(st_run.dda_ticks_X_substeps + st_run.mot[MOTOR_1].substep_accumulator);
|
||||
#endif
|
||||
motor_1.setDirection(st_pre.mot[MOTOR_1].direction);
|
||||
}
|
||||
|
||||
@@ -580,9 +527,7 @@ static void _load_move()
|
||||
SET_ENCODER_STEP_SIGN(MOTOR_1, st_pre.mot[MOTOR_1].step_sign);
|
||||
|
||||
} else { // Motor has 0 steps; might need to energize motor for power mode processing
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_1].substep_increment_increment = 0;
|
||||
#endif
|
||||
motor_1.motionStopped();
|
||||
}
|
||||
// accumulate counted steps to the step position and zero out counted steps for the segment currently being loaded
|
||||
@@ -590,155 +535,80 @@ static void _load_move()
|
||||
|
||||
#if (MOTORS >= 2)
|
||||
if ((st_run.mot[MOTOR_2].substep_increment = st_pre.mot[MOTOR_2].substep_increment) != 0) {
|
||||
#if NEW_DDA == 1
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_2].substep_increment_increment = st_pre.mot[MOTOR_2].substep_increment_increment;
|
||||
#endif
|
||||
#else
|
||||
if (st_pre.mot[MOTOR_2].accumulator_correction_flag == true) {
|
||||
st_pre.mot[MOTOR_2].accumulator_correction_flag = false;
|
||||
st_run.mot[MOTOR_2].substep_accumulator *= st_pre.mot[MOTOR_2].accumulator_correction;
|
||||
}
|
||||
#endif
|
||||
if (st_pre.mot[MOTOR_2].direction != st_pre.mot[MOTOR_2].prev_direction) {
|
||||
st_pre.mot[MOTOR_2].prev_direction = st_pre.mot[MOTOR_2].direction;
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_2].substep_accumulator = -(DDA_SUBSTEPS + st_run.mot[MOTOR_2].substep_accumulator); // invert the accumulator for the direction change
|
||||
#else
|
||||
st_run.mot[MOTOR_2].substep_accumulator = -(st_run.dda_ticks_X_substeps + st_run.mot[MOTOR_2].substep_accumulator);
|
||||
#endif
|
||||
motor_2.setDirection(st_pre.mot[MOTOR_2].direction);
|
||||
}
|
||||
motor_2.enable();
|
||||
SET_ENCODER_STEP_SIGN(MOTOR_2, st_pre.mot[MOTOR_2].step_sign);
|
||||
} else {
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_2].substep_increment_increment = 0;
|
||||
#endif
|
||||
motor_2.motionStopped();
|
||||
}
|
||||
ACCUMULATE_ENCODER(MOTOR_2);
|
||||
#endif
|
||||
#if (MOTORS >= 3)
|
||||
if ((st_run.mot[MOTOR_3].substep_increment = st_pre.mot[MOTOR_3].substep_increment) != 0) {
|
||||
#if NEW_DDA == 1
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_3].substep_increment_increment = st_pre.mot[MOTOR_3].substep_increment_increment;
|
||||
#endif
|
||||
#else
|
||||
if (st_pre.mot[MOTOR_3].accumulator_correction_flag == true) {
|
||||
st_pre.mot[MOTOR_3].accumulator_correction_flag = false;
|
||||
st_run.mot[MOTOR_3].substep_accumulator *= st_pre.mot[MOTOR_3].accumulator_correction;
|
||||
}
|
||||
#endif
|
||||
if (st_pre.mot[MOTOR_3].direction != st_pre.mot[MOTOR_3].prev_direction) {
|
||||
st_pre.mot[MOTOR_3].prev_direction = st_pre.mot[MOTOR_3].direction;
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_3].substep_accumulator = -(DDA_SUBSTEPS + st_run.mot[MOTOR_3].substep_accumulator); // invert the accumulator for the direction change
|
||||
#else
|
||||
st_run.mot[MOTOR_3].substep_accumulator = -(st_run.dda_ticks_X_substeps + st_run.mot[MOTOR_3].substep_accumulator);
|
||||
#endif
|
||||
motor_3.setDirection(st_pre.mot[MOTOR_3].direction);
|
||||
}
|
||||
motor_3.enable();
|
||||
SET_ENCODER_STEP_SIGN(MOTOR_3, st_pre.mot[MOTOR_3].step_sign);
|
||||
} else {
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_3].substep_increment_increment = 0;
|
||||
#endif
|
||||
motor_3.motionStopped();
|
||||
}
|
||||
ACCUMULATE_ENCODER(MOTOR_3);
|
||||
#endif
|
||||
#if (MOTORS >= 4)
|
||||
if ((st_run.mot[MOTOR_4].substep_increment = st_pre.mot[MOTOR_4].substep_increment) != 0) {
|
||||
#if NEW_DDA == 1
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_4].substep_increment_increment = st_pre.mot[MOTOR_4].substep_increment_increment;
|
||||
#endif
|
||||
#else
|
||||
if (st_pre.mot[MOTOR_4].accumulator_correction_flag == true) {
|
||||
st_pre.mot[MOTOR_4].accumulator_correction_flag = false;
|
||||
st_run.mot[MOTOR_4].substep_accumulator *= st_pre.mot[MOTOR_4].accumulator_correction;
|
||||
}
|
||||
#endif
|
||||
if (st_pre.mot[MOTOR_4].direction != st_pre.mot[MOTOR_4].prev_direction) {
|
||||
st_pre.mot[MOTOR_4].prev_direction = st_pre.mot[MOTOR_4].direction;
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_4].substep_accumulator = -(DDA_SUBSTEPS + st_run.mot[MOTOR_4].substep_accumulator); // invert the accumulator for the direction change
|
||||
#else
|
||||
st_run.mot[MOTOR_4].substep_accumulator = -(st_run.dda_ticks_X_substeps + st_run.mot[MOTOR_4].substep_accumulator);
|
||||
#endif
|
||||
motor_4.setDirection(st_pre.mot[MOTOR_4].direction);
|
||||
}
|
||||
motor_4.enable();
|
||||
SET_ENCODER_STEP_SIGN(MOTOR_4, st_pre.mot[MOTOR_4].step_sign);
|
||||
} else {
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_4].substep_increment_increment = 0;
|
||||
#endif
|
||||
motor_4.motionStopped();
|
||||
}
|
||||
ACCUMULATE_ENCODER(MOTOR_4);
|
||||
#endif
|
||||
#if (MOTORS >= 5)
|
||||
if ((st_run.mot[MOTOR_5].substep_increment = st_pre.mot[MOTOR_5].substep_increment) != 0) {
|
||||
#if NEW_DDA == 1
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_5].substep_increment_increment = st_pre.mot[MOTOR_5].substep_increment_increment;
|
||||
#endif
|
||||
#else
|
||||
if (st_pre.mot[MOTOR_5].accumulator_correction_flag == true) {
|
||||
st_pre.mot[MOTOR_5].accumulator_correction_flag = false;
|
||||
st_run.mot[MOTOR_5].substep_accumulator *= st_pre.mot[MOTOR_5].accumulator_correction;
|
||||
}
|
||||
#endif
|
||||
if (st_pre.mot[MOTOR_5].direction != st_pre.mot[MOTOR_5].prev_direction) {
|
||||
st_pre.mot[MOTOR_5].prev_direction = st_pre.mot[MOTOR_5].direction;
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_5].substep_accumulator = -(DDA_SUBSTEPS + st_run.mot[MOTOR_5].substep_accumulator); // invert the accumulator for the direction change
|
||||
#else
|
||||
st_run.mot[MOTOR_5].substep_accumulator = -(st_run.dda_ticks_X_substeps + st_run.mot[MOTOR_5].substep_accumulator);
|
||||
#endif
|
||||
motor_5.setDirection(st_pre.mot[MOTOR_5].direction);
|
||||
}
|
||||
motor_5.enable();
|
||||
SET_ENCODER_STEP_SIGN(MOTOR_5, st_pre.mot[MOTOR_5].step_sign);
|
||||
} else {
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_5].substep_increment_increment = 0;
|
||||
#endif
|
||||
motor_5.motionStopped();
|
||||
}
|
||||
ACCUMULATE_ENCODER(MOTOR_5);
|
||||
#endif
|
||||
#if (MOTORS >= 6)
|
||||
if ((st_run.mot[MOTOR_6].substep_increment = st_pre.mot[MOTOR_6].substep_increment) != 0) {
|
||||
#if NEW_DDA == 1
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_6].substep_increment_increment = st_pre.mot[MOTOR_6].substep_increment_increment;
|
||||
#endif
|
||||
#else
|
||||
if (st_pre.mot[MOTOR_6].accumulator_correction_flag == true) {
|
||||
st_pre.mot[MOTOR_6].accumulator_correction_flag = false;
|
||||
st_run.mot[MOTOR_6].substep_accumulator *= st_pre.mot[MOTOR_6].accumulator_correction;
|
||||
}
|
||||
#endif
|
||||
if (st_pre.mot[MOTOR_6].direction != st_pre.mot[MOTOR_6].prev_direction) {
|
||||
st_pre.mot[MOTOR_6].prev_direction = st_pre.mot[MOTOR_6].direction;
|
||||
#if NEW_DDA == 1
|
||||
st_run.mot[MOTOR_6].substep_accumulator = -(DDA_SUBSTEPS + st_run.mot[MOTOR_6].substep_accumulator); // invert the accumulator for the direction change
|
||||
#else
|
||||
st_run.mot[MOTOR_6].substep_accumulator = -(st_run.dda_ticks_X_substeps + st_run.mot[MOTOR_6].substep_accumulator);
|
||||
#endif
|
||||
motor_6.setDirection(st_pre.mot[MOTOR_6].direction);
|
||||
}
|
||||
motor_6.enable();
|
||||
SET_ENCODER_STEP_SIGN(MOTOR_6, st_pre.mot[MOTOR_6].step_sign);
|
||||
} else {
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
st_run.mot[MOTOR_6].substep_increment_increment = 0;
|
||||
#endif
|
||||
motor_6.motionStopped();
|
||||
}
|
||||
ACCUMULATE_ENCODER(MOTOR_6);
|
||||
@@ -791,11 +661,7 @@ static void _load_move()
|
||||
* dda_ticks_X_substeps = (int32_t)((microseconds/1000000) * f_dda * dda_substeps);
|
||||
*/
|
||||
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
stat_t st_prep_line(float travel_steps[], float following_error[], float segment_time)
|
||||
#else
|
||||
stat_t st_prep_line(float start_velocity, float end_velocity, float travel_steps[], float following_error[], float segment_time)
|
||||
#endif
|
||||
{
|
||||
stepper_debug("😶");
|
||||
// trap assertion failures and other conditions that would prevent queuing the line
|
||||
@@ -814,16 +680,10 @@ stat_t st_prep_line(float start_velocity, float end_velocity, float travel_steps
|
||||
|
||||
//st_pre.dda_period = _f_to_period(FREQUENCY_DDA); // FYI: this is a constant
|
||||
st_pre.dda_ticks = (int32_t)(segment_time * 60 * FREQUENCY_DDA);// NB: converts minutes to seconds
|
||||
#if NEW_DDA == 1
|
||||
#else
|
||||
st_pre.dda_ticks_X_substeps = st_pre.dda_ticks * DDA_SUBSTEPS;
|
||||
#endif
|
||||
|
||||
// setup motor parameters
|
||||
#if defined(NEW_FWD_DIFF) && (NEW_FWD_DIFF==1)
|
||||
// this is explained later
|
||||
double t_v0_v1 = (double)st_pre.dda_ticks * (start_velocity + end_velocity);
|
||||
#endif
|
||||
|
||||
float correction_steps;
|
||||
for (uint8_t motor=0; motor<MOTORS; motor++) { // remind us that this is motors, not axes
|
||||
@@ -845,33 +705,19 @@ stat_t st_prep_line(float start_velocity, float end_velocity, float travel_steps
|
||||
st_pre.mot[motor].step_sign = -1;
|
||||
}
|
||||
|
||||
#if NEW_DDA == 1
|
||||
#else
|
||||
// Detect segment time changes and setup the accumulator correction factor and flag.
|
||||
// Putting this here computes the correct factor even if the motor was dormant for some
|
||||
// number of previous moves. Correction is computed based on the last segment time actually used.
|
||||
|
||||
if (fabs(segment_time - st_pre.mot[motor].prev_segment_time) > 0.0000001) { // highly tuned FP != compare
|
||||
if (fp_NOT_ZERO(st_pre.mot[motor].prev_segment_time)) { // special case to skip first move
|
||||
st_pre.mot[motor].accumulator_correction_flag = true;
|
||||
st_pre.mot[motor].accumulator_correction = segment_time / st_pre.mot[motor].prev_segment_time;
|
||||
}
|
||||
st_pre.mot[motor].prev_segment_time = segment_time;
|
||||
}
|
||||
#endif
|
||||
|
||||
// 'Nudge' correction strategy. Inject a single, scaled correction value then hold off
|
||||
// NOTE: This clause can be commented out to test for numerical accuracy and accumulating errors
|
||||
if ((--st_pre.mot[motor].correction_holdoff < 0) &&
|
||||
(fabs(following_error[motor]) > STEP_CORRECTION_THRESHOLD)) {
|
||||
(std::abs(following_error[motor]) > STEP_CORRECTION_THRESHOLD)) {
|
||||
|
||||
st_pre.mot[motor].correction_holdoff = STEP_CORRECTION_HOLDOFF;
|
||||
correction_steps = following_error[motor] * STEP_CORRECTION_FACTOR;
|
||||
|
||||
if (correction_steps > 0) {
|
||||
correction_steps = std::min(std::min(correction_steps, fabs(travel_steps[motor])), STEP_CORRECTION_MAX);
|
||||
correction_steps = std::min(std::min(correction_steps, std::abs(travel_steps[motor])), STEP_CORRECTION_MAX);
|
||||
} else {
|
||||
correction_steps = std::max(std::max(correction_steps, -fabs(travel_steps[motor])), -STEP_CORRECTION_MAX);
|
||||
correction_steps = std::max(std::max(correction_steps, -std::abs(travel_steps[motor])), -STEP_CORRECTION_MAX);
|
||||
}
|
||||
st_pre.mot[motor].corrected_steps += correction_steps;
|
||||
travel_steps[motor] -= correction_steps;
|
||||
@@ -880,19 +726,8 @@ stat_t st_prep_line(float start_velocity, float end_velocity, float travel_steps
|
||||
// Compute substeb increment. The accumulator must be *exactly* the incoming
|
||||
// fractional steps times the substep multiplier or positional drift will occur.
|
||||
// Rounding is performed to eliminate a negative bias in the uint32 conversion
|
||||
// that results in long-term negative drift. (fabs/round order doesn't matter)
|
||||
// that results in long-term negative drift. (std::abs/round order doesn't matter)
|
||||
|
||||
#if NEW_DDA == 1
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
// t = v n s
|
||||
// m = v n
|
||||
// t = m s
|
||||
// m = t/s
|
||||
// Needed is steps/tick
|
||||
// 1/m = s/t
|
||||
|
||||
st_pre.mot[motor].substep_increment = round(fabs(travel_steps[motor] / (float)st_pre.dda_ticks) * (float)DDA_SUBSTEPS);
|
||||
#else
|
||||
// t is ticks duration of the move
|
||||
// T is time duration of the move in minutes
|
||||
// f is dda frequency, ticks/sec
|
||||
@@ -922,7 +757,7 @@ stat_t st_prep_line(float start_velocity, float end_velocity, float travel_steps
|
||||
// option 2:
|
||||
// d = (b (v_1 - v_0))/((t-1) a)
|
||||
|
||||
double s_double = fabs(travel_steps[motor] * 2.0);
|
||||
double s_double = std::abs(travel_steps[motor] * 2.0);
|
||||
|
||||
// 1/m_0 = (2 s v_0)/(t (v_0 + v_1))
|
||||
st_pre.mot[motor].substep_increment = round(((s_double * start_velocity)/(t_v0_v1)) * (double)DDA_SUBSTEPS);
|
||||
@@ -931,11 +766,6 @@ stat_t st_prep_line(float start_velocity, float end_velocity, float travel_steps
|
||||
// option 2:
|
||||
// d = (b (v_1 - v_0))/((t-1) a)
|
||||
st_pre.mot[motor].substep_increment_increment = round(((s_double*(end_velocity-start_velocity))/(((double)st_pre.dda_ticks-1.0)*t_v0_v1)) * (double)DDA_SUBSTEPS);
|
||||
#warning Using new increment style!
|
||||
#endif
|
||||
#else
|
||||
st_pre.mot[motor].substep_increment = round(fabs(travel_steps[motor] * (double)DDA_SUBSTEPS));
|
||||
#endif
|
||||
}
|
||||
st_pre.block_type = BLOCK_TYPE_ALINE;
|
||||
st_pre.buffer_state = PREP_BUFFER_OWNED_BY_LOADER; // signal that prep buffer is ready
|
||||
|
||||
@@ -254,8 +254,6 @@
|
||||
#ifndef STEPPER_H_ONCE
|
||||
#define STEPPER_H_ONCE
|
||||
|
||||
#define NEW_DDA 1
|
||||
|
||||
#include "MotateUtilities.h" // for HOT_DATA and HOT_FUNC
|
||||
|
||||
#include "planner.h" // planner.h must precede stepper.h for moveType typedef
|
||||
@@ -313,11 +311,7 @@ typedef enum {
|
||||
* The ARM is roughly the same as the DDA clock rate is 4x higher but the segment time is ~1/5
|
||||
* Decreasing the nominal segment time increases the number precision.
|
||||
*/
|
||||
#if NEW_DDA == 1
|
||||
#define DDA_SUBSTEPS (INT64_MAX-100)
|
||||
#else
|
||||
#define DDA_SUBSTEPS ((MAX_LONG * 0.90) / (FREQUENCY_DDA * (NOM_SEGMENT_TIME * 60)))
|
||||
#endif
|
||||
|
||||
/* Step correction settings
|
||||
*
|
||||
@@ -384,10 +378,6 @@ typedef struct stRunSingleton { // Stepper static values and axis pa
|
||||
magic_t magic_start; // magic number to test memory integrity
|
||||
uint32_t dda_ticks_downcount; // dda tick down-counter (unscaled)
|
||||
uint32_t dwell_ticks_downcount; // dwell tick down-counter (unscaled)
|
||||
#if NEW_DDA == 1
|
||||
#else
|
||||
uint32_t dda_ticks_X_substeps; // ticks multiplied by scaling factor
|
||||
#endif
|
||||
stRunMotor_t mot[MOTORS]; // runtime motor structures
|
||||
magic_t magic_end;
|
||||
} stRunSingleton_t;
|
||||
@@ -424,10 +414,6 @@ typedef struct stPrepSingleton {
|
||||
uint32_t dda_ticks; // DDA ticks for the move
|
||||
float dda_ticks_holdover; // partial DDA ticks from previous segment
|
||||
uint32_t dwell_ticks; // dwell ticks remaining
|
||||
#if NEW_DDA == 1
|
||||
#else
|
||||
uint32_t dda_ticks_X_substeps; // DDA ticks scaled by substep factor
|
||||
#endif
|
||||
stPrepMotor_t mot[MOTORS]; // prep time motor structs
|
||||
magic_t magic_end;
|
||||
} stPrepSingleton_t;
|
||||
@@ -609,11 +595,7 @@ void st_prep_null(void);
|
||||
void st_prep_command(void *bf); // use a void pointer since we don't know about mpBuf_t yet)
|
||||
void st_prep_dwell(float milliseconds);
|
||||
void st_request_out_of_band_dwell(float microseconds);
|
||||
#if !defined(NEW_FWD_DIFF) || (NEW_FWD_DIFF==0)
|
||||
stat_t st_prep_line(float travel_steps[], float following_error[], float segment_time) HOT_FUNC;
|
||||
#else
|
||||
stat_t st_prep_line(float start_velocity, float end_velocity, float travel_steps[], float following_error[], float segment_time) HOT_FUNC;
|
||||
#endif
|
||||
|
||||
stat_t st_set_ma(nvObj_t *nv);
|
||||
stat_t st_set_sa(nvObj_t *nv);
|
||||
|
||||
+8
-18
@@ -199,7 +199,7 @@ struct ValueHistory {
|
||||
float get_std_dev() {
|
||||
// Important note: this is a POPULATION standard deviation, not a population standard deviation
|
||||
float variance = (rolling_sum_sq/(float)sampled) - (rolling_mean*rolling_mean);
|
||||
return sqrt(fabs(variance));
|
||||
return sqrt(std::abs(variance));
|
||||
};
|
||||
|
||||
float value() {
|
||||
@@ -209,7 +209,7 @@ struct ValueHistory {
|
||||
float std_dev = get_std_dev();
|
||||
|
||||
for (uint16_t i=0; i<sampled; i++) {
|
||||
if (fabs(samples[i].value - rolling_mean) < (variance_max * std_dev)) {
|
||||
if (std::abs(samples[i].value - rolling_mean) < (variance_max * std_dev)) {
|
||||
temp += samples[i].value;
|
||||
++samples_kept;
|
||||
}
|
||||
@@ -398,7 +398,7 @@ struct Thermistor {
|
||||
// Call back function from the ADC to tell it that the ADC has a new sample...
|
||||
void adc_has_new_value() {
|
||||
raw_adc_value = adc_pin.getRaw();
|
||||
float v = fabs(adc_pin.getVoltage());
|
||||
float v = std::abs(adc_pin.getVoltage());
|
||||
history.add_sample(v);
|
||||
};
|
||||
};
|
||||
@@ -528,7 +528,7 @@ struct PT100 {
|
||||
// Call back function from the ADC to tell it that the ADC has a new sample...
|
||||
void adc_has_new_value(bool error = false) {
|
||||
raw_adc_value = adc_pin.getRaw();
|
||||
float v = fabs(adc_pin.getVoltage());
|
||||
float v = std::abs(adc_pin.getVoltage());
|
||||
// if (v < 0) {
|
||||
// char buffer[128];
|
||||
// char *str = buffer;
|
||||
@@ -684,7 +684,7 @@ struct PID {
|
||||
// Calculate the e (error)
|
||||
float e = _set_point - input;
|
||||
|
||||
if (fabs(e) < TEMP_SETPOINT_HYSTERESIS) {
|
||||
if (std::abs(e) < TEMP_SETPOINT_HYSTERESIS) {
|
||||
if (!_set_point_timeout.isSet()) {
|
||||
_set_point_timeout.set(TEMP_SETPOINT_HOLD_TIME);
|
||||
} else if (_set_point_timeout.isPast()) {
|
||||
@@ -795,16 +795,6 @@ struct PID {
|
||||
bool atSetPoint() {
|
||||
return _at_set_point;
|
||||
}
|
||||
|
||||
// //New-style JSON bindings. DISABLED FOR NOW.
|
||||
// auto json_bindings(const char *object_name) {
|
||||
// return JSON::bind_object(object_name,
|
||||
// JSON::bind("set", _set_point, /*print precision:*/2),
|
||||
// JSON::bind("p", _proportional, /*print precision:*/2),
|
||||
// JSON::bind("i", _integral, /*print precision:*/5),
|
||||
// JSON::bind("d", _derivative, /*print precision:*/5)
|
||||
// );
|
||||
// }
|
||||
};
|
||||
|
||||
// NOTICE, the JSON alters incoming values for these!
|
||||
@@ -923,7 +913,7 @@ stat_t temperature_callback()
|
||||
float out1 = pid1.getNewOutput(temp);
|
||||
fet_pin1.write(out1);
|
||||
|
||||
if (fabs(temp - last_reported_temp1) > kTempDiffSRTrigger) {
|
||||
if (std::abs(temp - last_reported_temp1) > kTempDiffSRTrigger) {
|
||||
last_reported_temp1 = temp;
|
||||
sr_requested = true;
|
||||
}
|
||||
@@ -935,7 +925,7 @@ stat_t temperature_callback()
|
||||
float out2 = pid2.getNewOutput(temp);
|
||||
fet_pin2.write(out2);
|
||||
|
||||
if (fabs(temp - last_reported_temp2) > kTempDiffSRTrigger) {
|
||||
if (std::abs(temp - last_reported_temp2) > kTempDiffSRTrigger) {
|
||||
last_reported_temp2 = temp;
|
||||
sr_requested = true;
|
||||
}
|
||||
@@ -949,7 +939,7 @@ stat_t temperature_callback()
|
||||
float out3 = pid3.getNewOutput(temp);
|
||||
fet_pin3.write(out3);
|
||||
|
||||
if (fabs(temp - last_reported_temp3) > kTempDiffSRTrigger) {
|
||||
if (std::abs(temp - last_reported_temp3) > kTempDiffSRTrigger) {
|
||||
last_reported_temp3 = temp;
|
||||
sr_requested = true;
|
||||
}
|
||||
|
||||
+6
-6
@@ -113,7 +113,7 @@ using std::max;
|
||||
template <typename T>
|
||||
inline T square(const T x) { return (x)*(x); } /* UNSAFE */
|
||||
|
||||
//inline float abs(const float a) { return fabs(a); }
|
||||
//inline float abs(const float a) { return std::abs(a); }
|
||||
|
||||
#ifndef avg
|
||||
template <typename T>
|
||||
@@ -129,19 +129,19 @@ inline T avg(const T a,const T b) {return (a+b)/2; }
|
||||
|
||||
// These functions all require math.h to be included in each file that uses them
|
||||
#ifndef fp_EQ
|
||||
#define fp_EQ(a,b) (fabs(a-b) < EPSILON)
|
||||
#define fp_EQ(a,b) (std::abs(a-b) < EPSILON)
|
||||
#endif
|
||||
#ifndef fp_NE
|
||||
#define fp_NE(a,b) (fabs(a-b) > EPSILON)
|
||||
#define fp_NE(a,b) (std::abs(a-b) > EPSILON)
|
||||
#endif
|
||||
#ifndef fp_GE
|
||||
#define fp_GE(a,b) (fabs(a-b) < EPSILON || a-b > EPSILON)
|
||||
#define fp_GE(a,b) (std::abs(a-b) < EPSILON || a-b > EPSILON)
|
||||
#endif
|
||||
#ifndef fp_ZERO
|
||||
#define fp_ZERO(a) (fabs(a) < EPSILON)
|
||||
#define fp_ZERO(a) (std::abs(a) < EPSILON)
|
||||
#endif
|
||||
#ifndef fp_NOT_ZERO
|
||||
#define fp_NOT_ZERO(a) (fabs(a) > EPSILON)
|
||||
#define fp_NOT_ZERO(a) (std::abs(a) > EPSILON)
|
||||
#endif
|
||||
#ifndef fp_FALSE
|
||||
#define fp_FALSE(a) (a < EPSILON)
|
||||
|
||||
Reference in New Issue
Block a user