simulator.h is already included in config.h/arduino.h, so it doesn't
need to be included again most of the time. In some cases it was
included twice on purpose to undo some intervening include file, but
these intervening includes were unnecessary. Remove some related
include file redundancy by re-ordering the include files and relocating
some nested includes up to the parent .c file.
Because these two pins have no presence in Configtool's GUI, they
got dropped when writing a board config file. These pins are
needed for Gen3 Extruder Board support.
This should solve issue #179.
To the best of my bash script knowledge, this also means we have
to break on the first error, because pipe terms run in a subshell,
so they can't pass variables to the parent.
Add a test that puts the stock config files through the
Configtool input/output parsers and verifies the output matches
the input. If Configtool breaks down in the future and produces
different output, this should catch it.
If this fails because of some intentional change in the tool or
in the stock config files, then the tool or stock config files
should be updated to be compatible again before merging the result.
Teach configtool to save ini, board and printer files with the
--save commandline switch. Add a feature to Printer and Board
to let us pass None for the "values" to save; this causes the
class to save the previously loaded settings instead of taking
new settings in the argument.
Also add --quit switch to tell commandline not to continue to run the
GUI. There's not much point in running the gui after many of these
switches, but that will change in the future. Add this --quit option
to quit early so we can begin to use this new mode for test validation.
Teach configtool command line functions to load the printer, board
or ini file settings into internal classes. For now this only
exercises the "load" functionality of the classes, but with -vv
you can also see the results of the load dumped to the console.
Instead of passing myriad variables around in arguments to
classes and functions, put the global settings like "verbose" and
"cmdFolder" in the Settings object and pass that in to the top.
Move model functionality out of printerpanel.py into a new class,
Printer, so we can more easily add commandline driven tests in
the future and to help identify code reuse opportunities.
New boolean options were all enabled, which was a problem
especially with the boolean choices DISPLAY_BUS_xxx and
DISPLAY_TYPE_xxx: all choice entries were set to True, so display
code was not only enabled behind the users back, but also set to
an arbitrary value (depending on the Python implementation).
Previously, #defines requiring a value, but configured as boolean,
broke GUI code. While Configtool its self should never write such
broken #defines, they can happen with manual config file edits.
IMHO it's fine to do such repair attempts as long as it doesn't
hobble other functionality. Whatever was broken at read time will
end up disabled at write time, unless the user changes that value
in the GUI.
This is done by parsing values from the generic config before
parsing those in the user config. Values existing in the user
config overwrite those in the generic config; values not
existing there stay at the value in the generic config.
Previously, only boolean #defines were handled properly (and
by code somewhere else). Missing #defines with value were
written as boolean #define, making the file unparseable on
the next read.
We can't magically find out what the right pin is, but we can at
least make sure it gets written with valid syntax next time. This
also ensures pins can be handled in the GUI, avoiding failures
like the one reported by inline comments here:
b9fe0a5dd0
Also coalesce multiple pin-steps occurring at the same clock-time into
a single step. This allows us to treat X+Y movements at the same moment
into a single step on corexy.
We show pin output on the console when --verbose is 2. But this gets in
the way of other verbose output we may want to monitor. Move the pinouts
option to an explicit switch instead of relying on the --verbose flag.
When the simulator finishes processing the last gcode, it exits. This
leaves causes us to exit without completing the last commanded move.
Rework how we handle end-of-file parsing and wait for the dda queue to
empty before exiting at the end of file processing.
Add a function axes_um_to_steps to convert from um to steps on all axes
respecting current kinematics setting.
Extend code_stepper_axescode_axes_to_stepper_axes to convert all axes,
including E-axis for consistency.
It seems like axes_um_to_steps could be simplified to something like
"apply_kinematics_axes()" which would just do the transformation math
in-place on some axes[] to move from 'Cartesian' to 'target-kinematics'.
Then the original um_to_steps and delta_um code could remain untouched
since 2014. But I'm not sure how this will work with scara or delta
configurations. I'm fairly certain they only work from absolute positions
anyway.
Fixes#216.
(Ab)use the old Gen7 v1.3 configuration for this, as this is
rarely in use and because this board also happens to be the board
where the tested code was developed on.
All in one chunk because the infrastructure is already there.
This also implements the parallel 4-bit bus used by quite some
displays.
For now you have to add quite a number of #defines to your
config.h. First, there are all the pins required, pin names
changed to your actual board/display connection, of course:
#define DISPLAY_RS_PIN PC1
#define DISPLAY_RW_PIN PC0
#define DISPLAY_E_PIN PD2
#define DISPLAY_D4_PIN PD3
#define DISPLAY_D5_PIN PD4
#define DISPLAY_D6_PIN PD5
#define DISPLAY_D7_PIN PD6
And then the information about the display actually existing:
#define DISPLAY_BUS_4BIT
#define DISPLAY_TYPE_HD44780
Allowing to do all this in Configtool is forthcoming, of course.
CoreXY turns the X and Y motors to render a target position differently
than straight cartesian printer does. From the theory page on corexy.com,
where the motors are called A and B instead of X and Y:
dx = 1/2(dA + dB), dY = 1/2(dA - dB)
dA = dX + dY
dB = dX - dY
Accordingly, each step of a single motor results in half of a step in the
X or Y axis. To simplify this and not lose steps, make the pos[] array
hold 2*steps instead of single steps. Adjust back to single steps with
/2 where needed. Store 2*steps whenever writing to pos[] variables
which are not coreXY driven.
Since each step of X or Y (A or B) affects both X and Y position, send
updates to record_pin for all axes instead of only the "affected" axis.
The function record_pin will ignore reports for pins which did not change
from the previous call. This also helps us keep from reporting duplicate
positions for half-steps in coreXY mode, too.
Provide a simulated, simplified representation of the action of
mechanical endstop switches which turn on and off at slightly
different amounts of pressure. When any axis moves past -10,
simulate endstop "on" condition. When the axis moves to 0,
simulate the endstop "off" condition.
This support allows the simulation of G28 (home) commands.