Commit Graph

141 Commits

Author SHA1 Message Date
Markus Hitter 11e907de03 Configtool: also deal with PS_INVERT_ON.
This partially solves issue #165.
2016-06-11 13:10:09 +02:00
Markus Hitter bb275e2c21 Configtool: use platform.startswith() everywhere.
Using this instead of a direct comparison may make the code more
future proof, because exact versions (e.g. "win32" vs. "win64")
are ignored, then.
2016-06-11 12:41:10 +02:00
Markus Hitter c135c4c502 Configtool: simpler regex on OS X in the Save As... dialog as well.
Not neccessary on vintage Mac OS X 10.4, but might help with
issue #165.
2016-06-11 12:40:46 +02:00
benj919 84d8cf4d1b Configtool: write RX/TX_ENABLE_PIN as-is.
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.
2016-06-06 14:38:07 +02:00
Phil Hord 2a6f00454f Configtool: add --quit and --save commandline switches.
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.
2016-06-06 12:36:17 +02:00
Phil Hord ba5447b409 Configtool: add --show-all switch.
Show all the loaded (defined) variables. Leave out the commented
variables for now.
2016-06-05 21:09:25 +02:00
Phil Hord 2c5a36b14e Configtool: make Settings the "global" container.
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.
2016-06-05 21:09:11 +02:00
Phil Hord eafb8e0bfb Configtool: begin command line automation.
Add a command line handler mode to Configtool to permit automation
for scripts.

Traumflug's review note: restored Python 3 checks.
2016-06-05 21:09:04 +02:00
Phil Hord 11bb6bb1cf Configtool: refactor printerpanel for MVC.
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.
2016-06-05 21:08:55 +02:00
Phil Hord d3062ca1dd Configtool: refactor boardpanel for MVC.
Move model functionality out of boardpanel.py into a new class,
Board, so we can more easily add commandline driven tests in the
future.
2016-06-05 21:08:41 +02:00
Markus Hitter c80b4d4d28 Revert "Configtool: attempt to fix broken pin definitions."
This worked only when the GUI came up, so a better fix was found
with commit

  "Configtool: deal with missing #defines requiring a value."
2016-06-05 21:07:54 +02:00
Markus Hitter 5a28a62717 Configtool: default new config options to disabled.
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).
2016-06-05 15:03:13 +02:00
Markus Hitter 776b3dec94 Configtool: try to repair broken value-#defines.
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.
2016-06-05 15:03:13 +02:00
Markus Hitter 490e58a43c Configtool: simplify board config parsing (a little bit).
There should be no functional change. Mostly done for consistency
with other, similar code sections.
2016-06-05 15:03:13 +02:00
Markus Hitter d49520c36d Configtool: deal with missing #defines requiring a value.
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.
2016-06-05 15:03:13 +02:00
Markus Hitter 9d3a064f40 Configtool: remove redundant code.
There is no point in parsing candidates, just to throw away them
a moment later.
2016-06-05 15:03:13 +02:00
Markus Hitter 09bcb0cf42 Configtool: attempt to fix broken pin definitions.
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
2016-06-01 13:20:14 +02:00
Markus Hitter eb8d918836 Configtool: implement tooltips for boolChoices.
Now these display bus type and display type choices have their
help text, too.
2016-05-30 14:31:40 +02:00
Markus Hitter 0545a5bb2c Configtool: show display bus pins only if needed. 2016-05-30 13:41:27 +02:00
Markus Hitter b9fe0a5dd0 Configtool: learn about 4-bit bus pins. 2016-05-30 13:41:13 +02:00
Markus Hitter ad021f7df7 Configtool: move handling of unused pins to parent class.
This shouldn't change behaviour.
2016-05-30 11:12:37 +02:00
Markus Hitter 7a18217dee Configtool: move choices value insertion to the parent class.
This shouldn't change behaviour.
2016-05-30 11:10:08 +02:00
Markus Hitter ca69343a04 Configtool: allow ATmega pin names, too. 2016-05-30 11:08:00 +02:00
Markus Hitter 0947c5ba50 Configtool: learn about DISPLAY_TYPE_HD44780.
This replaces DISPLAY_TYPE_LCD1302, because LCD1302 has no
actual implementation, yet.
2016-05-30 11:05:50 +02:00
Phil Hord 90fbdd314a configtool: Add avrdude flags option to settings
Some target devices need extra avrdude command line switches to
get them to upload successfully.  There are dozens of options which
may be useful to different people. Instead of breaking all the possible
options out into separate fields, provide a generic "Program Flags" text
field which the user can fill in similar to the CFLAGS and LDFLAGS
settings.

The Arduino Mega2560 bootloader was changed[1] to report an error when
asked to erase flash because it has never actually implemented erasing
flash. To program this bootloader with avrdude requires the -D switch
to avoid flash erase. But it seems that every arduino will work fine
with -D, as evidenced by the fact that the Arduino IDE always [2]
includes -D in the avrdude commandline. Presumably the flash is erased
during/before programming anyway and the separate erase step is unneeded.

Perhaps the -D should be always added to avrdude command line in
configtool and in Makefile-AVR.  But I haven't tested any other boards
yet, and I'm being more cautious even though the Arduino IDE does
otherwise.

[1] arduino/Arduino#543
[2] d8e5997328/app/src/processing/app/debug/AvrdudeUploader.java (L168)
2016-05-17 12:57:16 -04:00
Markus Hitter 13c76244b6 Configtool: allow and use user friendly names for choices.
So far for choices based on boolean sets, only, because choices
for values typically need no more readable names.

This elegantly removes the somewhat ugly check for '(', too.
2016-04-20 22:02:10 +02:00
Markus Hitter a0fa1bbeb6 displaypage.py: disable display type choice if there is no bus. 2016-04-20 22:02:10 +02:00
Markus Hitter 2541d7a82c Configtool: introduce boolChoices.
This handles sets of booleans "magically" and is now used for
DISPLAY_BUS and DISPLAY_TYPE.
2016-04-20 22:02:10 +02:00
Markus Hitter a95a1c8855 Configtool: record False boolean #defines, too.
This will be helpful for handling sets of booleans better.
2016-04-20 22:02:09 +02:00
Markus Hitter bdacd8c9bc Configtool: remove unused reCommDefBL and reCommDefBoolBL. 2016-04-20 22:02:09 +02:00
Markus Hitter 4645715f18 Configtool: make KINEMATICS a set of booleans, too.
Reasons:

 - Less code, easier handling.

 - An entire case of configuration handling could be removed.

 - Better class-like encapsulation.
2016-04-20 22:02:07 +02:00
Markus Hitter 1fad0036a7 Configtool: replace DISPLAY_TYPE with a set of booleans, too.
Same reason, same procedure as the previous commit.
2016-04-20 22:00:47 +02:00
Markus Hitter 90969978df Configtool: replace DISPLAY_BUS parameter with a set of booleans.
Having a choice with a defined set of options is nice, but it
also requires these options to be #defined somewhere _before_
entering config.h. To keep class-like encapsulation, we'd need
two header files for each code unit, one for the options, another
one for the usual header.

That said, we use other examples of such options, e.g. CPU, F_CPU
or KINEMATICS. For CPU and F_CPU it works fine, because their
options are numbers or other values known by the compiler. For
KINEMATICS it kind of works, because this #define is used in only
one place ... and there it's suboptimal already, because no option-
set.

Anyways, I was unsure about this change and if it turns out to be
a poor decision later, it can be reverted.
2016-04-20 22:00:05 +02:00
Markus Hitter 4d37d35f29 Configtool: add debugging aid.
All comments, no functional change. One unused line of code
removed.
2016-04-20 21:56:54 +02:00
Ruslan Popov 212eca7f8e Configtool: add display page implementation.
Most work by Ruslan Popov, collected from various commits and
made compatible with regression tests by Traumflug.

Display test code is now enabled by #defining DISPLAY_BUS to
i2c_twi.
2016-04-20 21:56:39 +02:00
Ruslan Popov 071cb9067b Configtool: introduce a function for registering a page.
No functional and purely internal change, this should make adding
a page easier.
2016-04-20 21:49:33 +02:00
Markus Hitter 65857b17dc temp.c: get rid of TEMPTABLE_FORMAT.
Detecting tables by data size works fine, the optimiser removes
unneeded code successfully. Binary size stays the same.
2016-04-17 14:31:52 +02:00
Phil Hord 2291642456 Expand thermistortable to include precomputed slope
Save a division at runtime by pre-calculating the slope between each
pair of adjacent thermistortable values.  Since we use the larger value
each time, save the slope between two values A and B in the table
with the B data.  Therefore the slope is that between each value and
its predecessor in the list.

Store this new value in the third element of the now 3-integers-wide
array which makes up the table. Use fixed-point 6.10 format to store
the slope.  This is almost too narrow for some slopes and maybe it
should be changed to 8.8 fixed-point. In practice this presents a
loss in accuracy, but it is still significantly better than the
previous fixed-sample-size table production method. In particular no
provision is made to handle values which scale over 65535, and it
seems we should at least warn about this if not simply fail before
letting the user go off compiling his code.

Add a new flag TEMPTABLE_FORMAT and define it as 1 to tell the code
that we are using this new and incompatible format.  This lets us
tolerate old hand-crafted thermistor tables by keeping the slower
algorithm in case one is still used.  New thermistor tables should be
defined with this new format and with the FORMAT define set accordingly.

With the default 25 samples this adds 100 bytes to the flash image for
the thermistortable storage for two different thermistors.  But the
code is simplified and saves me 134 bytes in the bargain for a net
decrease in flash size of 34 bytes.
2016-04-17 14:31:12 +02:00
Phil Hord fe006021ee thermistortablefile.py: keep fractional part when computing table.
The Thermistortablefile.py routine prematurely drops the
fractional part of the temperature when computing the 14.2
temperature values to emit in the code. Keep this instead until
the last moment when we finally calculate the integer format we
will store.
2016-04-16 01:01:16 +02:00
Phil Hord 090be579d1 Refactor temp table optimization for any algorithm
This should be squashed but is separated here for comparison.
2016-04-14 13:26:17 +02:00
Phil Hord b7a2d58b31 Restrict thermistor table range to 0C-500C
We don't care about the accuracy of very cold temperatures
or unreasonably hot ones.
2016-04-14 13:24:59 +02:00
Phil Hord 6542c284fb Optimize temperature tables for accuracy
Temperature tables are emitted by selecting arbitrary sample values
to be used for the linear lookup table.  This is fine in the range
where the thermistor produces linear output, but it is markedly wrong
near the extremes where the thermister output begins to curve.

Introduce a new sample selector which chooses samples based on the "most
incorrect estimate" and improves from there to ensure we get a cleaner
approximation across the selected range.

Traumflug: this topic is tracked here:
https://github.com/Traumflug/Teacup_Firmware/pull/208
2016-04-14 13:03:30 +02:00
Witold Sowa fdf6dbe849 Added support for MCP3008 and MCP3004 ADC for temperature read 2016-04-12 22:37:50 +02:00
Phil Hord 52e5d784fd Remove useless lines from Configtool
I don't know what these lines were intended for, but the 'idx'
variable is not used anywhere else, so setting it is pointless.
2016-04-12 14:15:11 +02:00
Markus Hitter 82374b8e24 Rename Z_LATE_ENABLE to Z_AUTODISABLE and refine description.
Also turn it on by default for the Mendel printer.

Also add the forgotten Mendel90 printer.
2016-03-27 20:23:05 +02:00
Wurstnase 57afef9fdd Add Z late enable.
Until this commit, the Z axis is disabled after each move and
only enabled when the Z axis will move. Now you can enable this
as a feature. Some printer axes are too heavy or have a high
pitch which are not self locking. In that case simply do nothing.
It's now off by default.
2016-03-27 20:14:04 +02:00
Markus Hitter be6ca4c857 ARM, AVR: support inverted heater pin signals.
Implemented and tested for both platforms. This is quite a big
commit. Unlike with the previous changes to now choosable PWM
frequencies, all board configuration files and Configtool had
to be changed immediately to deal with the additional parameter
in DEFINE_HEATER() and keep AVR builds working (and regression
tests passing).
2015-08-13 17:12:10 +02:00
Markus Hitter 5a8dcf8e97 ARM: add a board configuration for Gen7-ARM.
Wohoo, this is the first ARM board in Configtool. Let's see how
Configtool deals with it :-)
2015-08-12 14:26:36 +02:00
Markus Hitter 43626b2ba2 boardpanel.py: fix getCPUInfo(), don't report tuples.
This was forgotten with the recent move to storing configuration
items as tuples (value, enabled). It should fix the refusal to
build reported in issue #86.
2015-08-12 14:18:40 +02:00
Markus Hitter 42b96e0e27 SD card: commit SD_CARD_SELECT_PIN to all the board files.
For the bigger boards like RAMPS or Rumba the pin numbers were
taken from Marlin. For the smaller boards, the pin is commented
out.
2015-07-30 15:31:57 +02:00