Commit Graph

155 Commits

Author SHA1 Message Date
Matt Gilbert 732bd470cf Homing order in configtool.
Adjustments by Traumflug:

 - Rebased to current 'experimental'.

 - Some whitespace adjustments.

 - Renamed labelWidth_homing to labelWidthHoming.

 - Fixed an issue in printer.py which would write only the first
   character of an option ('x' instead of 'x_positive', 'n'
   instead of 'none', etc.)

Thank you very much for the code, Matt!
2017-12-31 17:22:51 +01:00
Wurstnase 6d1fa83c0e Add more baud rates into configtool
Minor adjustment by Traumflug: use '115200' instead of
self.defaultBaud.
2017-12-31 13:27:41 +01:00
Nico Tonnhofer fbe1af4013 configtool: add FORCE_SOFTWARE_PWM to configtool 2017-03-21 15:04:26 +01:00
Nico Tonnhofer 4882d19215 heater: if pwm is set to 1, hardware pwm is forced, if available. 2017-03-21 15:04:26 +01:00
Nico Tonnhofer fb83d2de57 heaters: rework max heater value
remove the define USE_MAX_HEATER
this will cost only neglabile space when not enabled on AVR.
2017-03-21 14:51:01 +01:00
Phil Hord ab2c355821 Factor out some boilerplate code from configs
Configs are always included via a config_wrapper.h now, and configs always
must include this safety-definition for a missing DEFINE_HEATER.  Let's
simplify the configs by moving it to a common location.
2017-03-21 14:48:19 +01:00
Nico Tonnhofer f8c78e6384 heaters: add max heater value
You can reduce the max. power of each heater.
With the max_pwm value between 1 and 100% you reduce the active pwm.
For example you could reduce the power of your hotend.

My hotend for example is 12V 30W but connected to 24V. So it has
normally 120W. This is very huge. Setting the max_pwm to 25, it has
again ~30W.
2017-03-21 14:48:15 +01:00
Phil Hord 9d42fa4ac1 Configtool: speed up startup with wx-tricks.
This should fix issue #235.

Recently ConfigTool has been very slow for me on Ubuntu Linux.
When I run the app there is a 15 second wait before the window is
first displayed.  I bisected the problem and found it was tied to
the number of pins in `pinNames`, and ultimately that it was
caused by a slow initializer in wx.Choice() when the choices are
loaded when the widget is created.  For some reason, moving the
load after the widget is created is significantly faster.  This
change reduces my startup time to just under 4 seconds.

Further speedup could be had by using lazy initialization of the
controls.  But the controls are too bound up in the loaded data
to make this simple.  Maybe I will attack it later.

There is still a significant delay when closing the window, but I
haven't tracked what causes it.  Maybe it is caused just by
destroying all these pin controls.

In the process of making this change, I wanted to simplify the
number of locations that bothered to copy the pinNames list and,
to support lazy loading, to try to keep the same list in all
pinChoice controls.  I noticed that all the pinChoice controls
already have the same parameters passed to the addPinChoice
function which makes them redundant and confusing.  I removed the
extra initializers and just rely on pinNames as the only list
option in addPinChoice for now.  Maybe this flexibility is needed
for some reason later, but I can't see a purpose for it now.

Notes by reviewer Traumflug:

First of all, which "trick"? That's an excellent code
simplification and if this happens to make startup faster (it
does), all the better.

Measured startup & shutdown time here (click window close as soon
as it appears):

  Before:                With this commit:
  real    0m4.222s       real    0m3.780s
  user    0m3.864s       user    0m3.452s
  sys     0m0.084s       sys     0m0.100s

As the speedup was far more significant on the commit author's
machine, it might be a memory consumption issue (leading to
swapping on a small RAM machine). Linux allows to view this in
/proc/<pid>/status.

         Before:          Now:
VmPeak:	  708360 kB     708372 kB
VmSize:	  658916 kB     658756 kB
VmHWM:	   73792 kB      73492 kB
VmRSS:	   73792 kB      73492 kB
VmData:	  402492 kB     402332 kB

Still no obvious indicator, but a 300 kB smaller memory footprint
is certainly nice.
2016-10-26 22:00:21 +02:00
Markus Hitter 36f54adb7f thermistortablefile.py: fix output parameter list.
If you attempt a Steinhart-Hart table in the configtool with
parameters (4700, 25, 100000, 209, 475, 256, 201) it fails with a:

...
 File "/Users/drf/2014/RepRap/GIT/Teacup_Firmware/configtool/
   thermistortablefile.py", line 169, in SteinhartHartTable
   (i, int(t * 4), int(delta * 4 * 256), c, int(t), int(round(r))),
  TypeError: not enough arguments for format string

Catched and fix provided by dr5fn, this should fix issue #246.
2016-10-26 20:32:45 +02:00
Markus Hitter ef94d0672d Configtool: don't assign values to tuples.
Heck, that's simply forbidden. A C compiler had catched this in a
split second at compile time, Python didn't until the faulty code
section was actually executed (a section of code for rare cases).

The simple fix is to replace the old tuple with a changed, new
tuple.

This resolved issue #242.
2016-10-21 22:03:34 +02:00
Markus Hitter e9b2bf45cb Config files: update comment/help text for USE_INTERNAL_PULLUPS. 2016-09-30 13:51:01 +02:00
Markus Hitter e49de09f58 Config files: introduce USE_INTERNAL_PULLDOWN. 2016-09-30 13:48:46 +02:00
Ilya Epifanov 6dce728219 Configtool: fixed GUI crash when using DC extruder. 2016-07-30 11:02:29 +02:00
wurstnase 66f06d20a2 Temp: change TEMP_EWMA to integer.
This allows to use EWMA_ALPHA in an #if clause, which is needed
for the next commit.

Review changes by Traumflug: made changes to comments more
complete, added rounding ("+ 500") and also adjusted Configtool
for the change.
2016-06-25 14:30:59 +02:00
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