Configtool: incorporate most of previous comments.
See discussion to Issue #111 on Github.
This commit is contained in:
parent
d7789ee217
commit
d6b2a2293e
658
config.default.h
658
config.default.h
|
|
@ -1,652 +1,12 @@
|
|||
/* Notice to developers: this file is intentionally included twice. */
|
||||
|
||||
/** \file
|
||||
\brief Sample Configuration
|
||||
|
||||
\note this sample uses AIO0 for both X_STEP and thermistor, and is intended to be an example only!
|
||||
/** \file config.default.h
|
||||
In case you prefer to build with the makefile or with Arduino IDE instead
|
||||
of the config tool, copy this file to config.h and adjust it to your needs.
|
||||
*/
|
||||
|
||||
/*
|
||||
CONTENTS
|
||||
// Uncomment your controller board, comment out all others.
|
||||
#include "config/board.gen7-v1.4.h"
|
||||
//#include "config/board.ramps-v1.3.h"
|
||||
|
||||
1. Mechanical/Hardware
|
||||
2. Acceleration settings
|
||||
3. Pinouts
|
||||
4. Temperature sensors
|
||||
5. Heaters
|
||||
6. Communication options
|
||||
7. Miscellaneous
|
||||
8. Appendix A - PWMable pins and mappings
|
||||
*/
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* 1. MECHANICAL/HARDWARE *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
/*
|
||||
Set your microcontroller type in Makefile! atmega168/atmega328p/atmega644p/atmega1280
|
||||
|
||||
If you want to port this to a new chip, start off with arduino.h and see how you go.
|
||||
*/
|
||||
|
||||
/** \def F_CPU
|
||||
CPU clock rate
|
||||
*/
|
||||
#ifndef F_CPU
|
||||
#define F_CPU 16000000UL
|
||||
#endif
|
||||
|
||||
/** \def MOTHERBOARD
|
||||
This is the motherboard, as opposed to the extruder. See extruder/ directory for GEN3 extruder firmware
|
||||
*/
|
||||
#define MOTHERBOARD
|
||||
|
||||
|
||||
/** \def KINEMATICS
|
||||
|
||||
This defines the type of kinematics your printer uses. That's essential!
|
||||
|
||||
Valid values (see dda_kinematics.h):
|
||||
|
||||
KINEMATICS_STRAIGHT Motors move axis directions directly. This is the
|
||||
traditional type, found in many printers, including
|
||||
Mendel, Prusa i3, Mendel90, Ormerod, Mantis.
|
||||
|
||||
KINEMATICS_COREXY A bot using CoreXY kinematics. Typical for CoreXY are
|
||||
long and crossing toothed belts and a print head moving
|
||||
on the X-Y-plane.
|
||||
*/
|
||||
#define KINEMATICS KINEMATICS_STRAIGHT
|
||||
|
||||
|
||||
/** \def STEPS_PER_M
|
||||
steps per meter ( = steps per mm * 1000 )
|
||||
|
||||
calculate these values appropriate for your machine
|
||||
|
||||
for threaded rods, this is
|
||||
(steps motor per turn) / (pitch of the thread) * 1000
|
||||
|
||||
for belts, this is
|
||||
(steps per motor turn) / (number of gear teeth) / (belt module) * 1000
|
||||
|
||||
half-stepping doubles the number, quarter stepping requires * 4, etc.
|
||||
|
||||
valid range = 20 to 4'0960'000 (0.02 to 40960 steps/mm)
|
||||
|
||||
all numbers are integers, so no decimal point, please :-)
|
||||
*/
|
||||
#define STEPS_PER_M_X 320000
|
||||
#define STEPS_PER_M_Y 320000
|
||||
#define STEPS_PER_M_Z 320000
|
||||
|
||||
/// http://blog.arcol.hu/?p=157 may help with this one
|
||||
#define STEPS_PER_M_E 320000
|
||||
|
||||
|
||||
/*
|
||||
Values depending on the capabilities of your stepper motors and other mechanics.
|
||||
All numbers are integers, no decimals allowed.
|
||||
|
||||
Units are mm/min
|
||||
*/
|
||||
|
||||
/// used for G0 rapid moves and as a cap for all other feedrates
|
||||
#define MAXIMUM_FEEDRATE_X 200
|
||||
#define MAXIMUM_FEEDRATE_Y 200
|
||||
#define MAXIMUM_FEEDRATE_Z 100
|
||||
#define MAXIMUM_FEEDRATE_E 200
|
||||
|
||||
/// Used when doing precision endstop search and as default feedrate.
|
||||
#define SEARCH_FEEDRATE_X 50
|
||||
#define SEARCH_FEEDRATE_Y 50
|
||||
#define SEARCH_FEEDRATE_Z 50
|
||||
// no SEARCH_FEEDRATE_E, as E can't be searched
|
||||
|
||||
/** \def ENDSTOP_CLEARANCE_X
|
||||
\def ENDSTOP_CLEARANCE_Y
|
||||
\def ENDSTOP_CLEARANCE_Z
|
||||
|
||||
When hitting an endstop, Teacup properly decelerates instead of doing an
|
||||
aprupt stop to save your mechanics. Ineviteably, this means it overshoots
|
||||
the endstop trigger point by some distance.
|
||||
|
||||
To deal with this, Teacup adapts homing movement speeds to what your
|
||||
endstops can deal with. The higher the allowed acceleration ( = deceleration,
|
||||
see #define ACCELERATION) and the more clearance the endstop comes with,
|
||||
the faster Teacup will do homing movements.
|
||||
|
||||
Set here how many micrometers (mm * 1000) your endstop allows the carriage
|
||||
to overshoot the trigger point. Typically 1000 or 2000 for mechanical
|
||||
endstops, more for optical ones. You can set it to zero, in which case
|
||||
SEARCH_FEEDRATE_{XYZ} is used, but expect very slow homing movements.
|
||||
|
||||
Units: micrometers
|
||||
Sane values: 0 to 20000 (0 to 20 mm)
|
||||
Valid range: 0 to 1000000
|
||||
*/
|
||||
#define ENDSTOP_CLEARANCE_X 1000
|
||||
#define ENDSTOP_CLEARANCE_Y 1000
|
||||
#define ENDSTOP_CLEARANCE_Z 100
|
||||
|
||||
/**
|
||||
Soft axis limits, in mm.
|
||||
Define them to your machine's size relative to what your host considers to be the origin.
|
||||
*/
|
||||
|
||||
//#define X_MIN 0.0
|
||||
//#define X_MAX 200.0
|
||||
|
||||
//#define Y_MIN 0.0
|
||||
//#define Y_MAX 200.0
|
||||
|
||||
//#define Z_MIN 0.0
|
||||
//#define Z_MAX 140.0
|
||||
|
||||
/** \def E_ABSOLUTE
|
||||
Some G-Code creators produce relative length commands for the extruder, others absolute ones. G-Code using absolute lengths can be recognized when there are G92 E0 commands from time to time. If you have G92 E0 in your G-Code, define this flag.
|
||||
|
||||
This is the startup default and can be changed with M82/M83 while running.
|
||||
*/
|
||||
// #define E_ABSOLUTE
|
||||
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* 2. ACCELERATION *
|
||||
* *
|
||||
* Choose optionally one of ACCELERATION_REPRAP, ACCELERATION_RAMPING or *
|
||||
* ACCELERATION_TEMPORAL. With none of them defined, movements are done *
|
||||
* without acceleration. Recommended is ACCELERATION_RAMPING. *
|
||||
* *
|
||||
* LOOKAHEAD is experimental for now and works in conjunction with *
|
||||
* ACCELERATION_RAMPING, only. That's why it's off by default. *
|
||||
* *
|
||||
* Also don't forget to adjust ACCELERATION to the capabilities of your *
|
||||
* printer. The default is very moderate to be on the safe side. *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
/** \def ACCELERATION_REPRAP
|
||||
acceleration, reprap style.
|
||||
Each movement starts at the speed of the previous command and accelerates or decelerates linearly to reach target speed at the end of the movement.
|
||||
*/
|
||||
// #define ACCELERATION_REPRAP
|
||||
|
||||
/** \def ACCELERATION_RAMPING
|
||||
acceleration and deceleration ramping.
|
||||
Each movement starts at (almost) no speed, linearly accelerates to target speed and decelerates just in time to smoothly stop at the target. alternative to ACCELERATION_REPRAP
|
||||
*/
|
||||
#define ACCELERATION_RAMPING
|
||||
|
||||
/** \def ACCELERATION
|
||||
how fast to accelerate when using ACCELERATION_RAMPING.
|
||||
given in mm/s^2, decimal allowed, useful range 1. to 10'000. Start with 10. for milling (high precision) or 1000. for printing
|
||||
*/
|
||||
#define ACCELERATION 1000.
|
||||
|
||||
/** \def ACCELERATION_TEMPORAL
|
||||
temporal step algorithm
|
||||
This algorithm causes the timer to fire when any axis needs to step, instead of synchronising to the axis with the most steps ala bresenham.
|
||||
|
||||
This algorithm is not a type of acceleration, and I haven't worked out how to integrate acceleration with it.
|
||||
However it does control step timing, so acceleration algorithms seemed appropriate
|
||||
|
||||
The Bresenham algorithm is great for drawing lines, but not so good for steppers - In the case where X steps 3 times to Y's two, Y experiences massive jitter as it steps in sync with X every 2 out of 3 X steps. This is a worst-case, but the problem exists for most non-45/90 degree moves. At higher speeds, the jitter /will/ cause position loss and unnecessary vibration.
|
||||
This algorithm instead calculates when a step occurs on any axis, and sets the timer to that value.
|
||||
|
||||
// TODO: figure out how to add acceleration to this algorithm
|
||||
*/
|
||||
// #define ACCELERATION_TEMPORAL
|
||||
|
||||
/** \def LOOKAHEAD
|
||||
Define this to enable look-ahead during *ramping* acceleration to smoothly
|
||||
transition between moves instead of performing a dead stop every move.
|
||||
Enabling look-ahead requires about 3600 bytes of flash memory.
|
||||
*/
|
||||
// #define LOOKAHEAD
|
||||
|
||||
/** \def MAX_JERK_X
|
||||
\def MAX_JERK_Y
|
||||
\def MAX_JERK_Z
|
||||
\def MAX_JERK_E
|
||||
|
||||
When performing look-ahead, we need to decide what an acceptable jerk to the
|
||||
mechanics is. Look-ahead attempts to instantly change direction at movement
|
||||
crossings, which means instant changes in the speed of the axes participating
|
||||
in the movement. Define here how big the speed bumps on each of the axes is
|
||||
allowed to be.
|
||||
|
||||
If you want a full stop before and after moving a specific axis, define
|
||||
MAX_JERK of this axis to 0. This is often wanted for the Z axis. If you want
|
||||
to ignore jerk on an axis, define it to twice the maximum feedrate of this
|
||||
axis.
|
||||
|
||||
Having these values too low results in more than neccessary slowdown at
|
||||
movement crossings, but is otherwise harmless. Too high values can result
|
||||
in stepper motors suddenly stalling. If angles between movements in your
|
||||
G-code are small and your printer runs through entire curves full speed,
|
||||
there's no point in raising the values.
|
||||
|
||||
Units: mm/min
|
||||
Sane values: 0 to 400
|
||||
Valid range: 0 to 65535
|
||||
*/
|
||||
#define MAX_JERK_X 20
|
||||
#define MAX_JERK_Y 20
|
||||
#define MAX_JERK_Z 0
|
||||
#define MAX_JERK_E 20
|
||||
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* 3. PINOUTS *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
/*
|
||||
Machine Pin Definitions
|
||||
- make sure to avoid duplicate usage of a pin
|
||||
- comment out pins not in use, as this drops the corresponding code and makes operations faster
|
||||
*/
|
||||
|
||||
#include "arduino.h"
|
||||
|
||||
/** \def USE_INTERNAL_PULLUPS
|
||||
internal pullup resistors
|
||||
the ATmega has internal pullup resistors on it's input pins which are counterproductive with the commonly used eletronic endstops, so they should be switched off. For other endstops, like mechanical ones, you may want to uncomment this.
|
||||
*/
|
||||
//#define USE_INTERNAL_PULLUPS
|
||||
|
||||
/*
|
||||
user defined pins
|
||||
adjust to suit your electronics,
|
||||
or adjust your electronics to suit this
|
||||
*/
|
||||
|
||||
#define X_STEP_PIN AIO0
|
||||
#define X_DIR_PIN AIO1
|
||||
#define X_MIN_PIN AIO2
|
||||
//#define X_MAX_PIN xxxx
|
||||
//#define X_ENABLE_PIN xxxx
|
||||
//#define X_INVERT_DIR
|
||||
//#define X_INVERT_MIN
|
||||
//#define X_INVERT_MAX
|
||||
//#define X_INVERT_ENABLE
|
||||
|
||||
#define Y_STEP_PIN AIO3
|
||||
#define Y_DIR_PIN AIO4
|
||||
#define Y_MIN_PIN AIO5
|
||||
//#define Y_MAX_PIN xxxx
|
||||
//#define Y_ENABLE_PIN xxxx
|
||||
//#define Y_INVERT_DIR
|
||||
//#define Y_INVERT_MIN
|
||||
//#define Y_INVERT_MAX
|
||||
//#define Y_INVERT_ENABLE
|
||||
|
||||
#define Z_STEP_PIN DIO2
|
||||
#define Z_DIR_PIN DIO3
|
||||
#define Z_MIN_PIN DIO4
|
||||
//#define Z_MAX_PIN xxxx
|
||||
//#define Z_ENABLE_PIN xxxx
|
||||
//#define Z_INVERT_DIR
|
||||
//#define Z_INVERT_MIN
|
||||
//#define Z_INVERT_MAX
|
||||
//#define Z_INVERT_ENABLE
|
||||
|
||||
#define E_STEP_PIN DIO7
|
||||
#define E_DIR_PIN DIO8
|
||||
//#define E_ENABLE_PIN xxxx
|
||||
//#define E_INVERT_DIR
|
||||
//#define E_INVERT_ENABLE
|
||||
|
||||
#define PS_ON_PIN DIO9
|
||||
//#define PS_MOSFET_PIN xxxx
|
||||
//#define STEPPER_ENABLE_PIN xxxx
|
||||
//#define STEPPER_INVERT_ENABLE
|
||||
|
||||
/** \def DEBUG_LED_PIN
|
||||
|
||||
Enable flashing of a LED during motor stepping.
|
||||
|
||||
Disabled by default. Uncommenting this makes the binary a few bytes larger
|
||||
and adds a few cycles to the step timing interrrupt in timer.c. Also used
|
||||
for precision profiling (profiling works even without actually having such
|
||||
a LED in hardware), see
|
||||
http://reprap.org/wiki/Teacup_Firmware#Doing_precision_profiling
|
||||
*/
|
||||
// #define DEBUG_LED_PIN DIO13
|
||||
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* 4. TEMPERATURE SENSORS *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
/** \def TEMP_HYSTERESIS
|
||||
|
||||
Actual temperature must be target +/- this hysteresis before target
|
||||
temperature is considered to be achieved. Also, BANG_BANG tries to stay
|
||||
within half of this hysteresis.
|
||||
|
||||
Unit: degree Celsius
|
||||
*/
|
||||
#define TEMP_HYSTERESIS 10
|
||||
|
||||
/**
|
||||
TEMP_RESIDENCY_TIME: actual temperature must be close to target (within
|
||||
set temperature +- TEMP_HYSTERESIS) for this long before target is achieved
|
||||
(and a M116 succeeds). Unit is seconds.
|
||||
*/
|
||||
#define TEMP_RESIDENCY_TIME 60
|
||||
|
||||
/**
|
||||
TEMP_EWMA: Smooth noisy temperature sensors. Good hardware shouldn't be
|
||||
noisy. Set to 1.0 for unfiltered data (and a 140 bytes smaller binary).
|
||||
|
||||
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
||||
0.05 to 0.1 are typical. Smaller is smoother but slower adjusting, larger is
|
||||
quicker but rougher. If you need to use this, set the PID parameter to zero
|
||||
(M132 S0) to make the PID loop insensitive to noise.
|
||||
|
||||
Valid range: 0.001 to 1.0
|
||||
*/
|
||||
#define TEMP_EWMA 1.0
|
||||
|
||||
/// which temperature sensors are you using? List every type of sensor you use here once, to enable the appropriate code. Intercom is the gen3-style separate extruder board.
|
||||
// #define TEMP_MAX6675
|
||||
#define TEMP_THERMISTOR
|
||||
// #define TEMP_AD595
|
||||
// #define TEMP_PT100
|
||||
// #define TEMP_INTERCOM
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* Define your temperature sensors here. One line for each sensor, only *
|
||||
* limited by the number of available ATmega pins. *
|
||||
* *
|
||||
* Types are same as TEMP_ list above - TT_MAX6675, TT_THERMISTOR, TT_AD595, *
|
||||
* TT_PT100, TT_INTERCOM. See list in temp.c. *
|
||||
* *
|
||||
* The "additional" field is used for TT_THERMISTOR only. It defines the *
|
||||
* name of the table(s) in ThermistorTable.h to use. Typically, this is *
|
||||
* THERMISTOR_EXTRUDER for the first or only table, or THERMISTOR_BED for *
|
||||
* the second table. See also early in ThermistorTable.{single|double}.h. *
|
||||
* *
|
||||
* For a GEN3 set temp_type to TT_INTERCOM and temp_pin to AIO0. The pin *
|
||||
* won't be used in this case. *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
#ifndef DEFINE_TEMP_SENSOR
|
||||
#define DEFINE_TEMP_SENSOR(...)
|
||||
#endif
|
||||
|
||||
// name type pin additional
|
||||
DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO0, THERMISTOR_EXTRUDER)
|
||||
DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1, THERMISTOR_EXTRUDER)
|
||||
// "noheater" is a special name for a sensor which doesn't have a heater.
|
||||
// Use "M105 P#" to read it, where # is a zero-based index into this list.
|
||||
// DEFINE_TEMP_SENSOR(noheater, TT_THERMISTOR, 1, 0)
|
||||
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* 5. HEATERS *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
/** \def HEATER_SANITY_CHECK
|
||||
check if heater responds to changes in target temperature, disable and spit errors if not
|
||||
largely untested, please comment in forum if this works, or doesn't work for you!
|
||||
*/
|
||||
// #define HEATER_SANITY_CHECK
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* Define your heaters and devices here. *
|
||||
* *
|
||||
* To attach a heater to a temp sensor above, simply use exactly the same *
|
||||
* name - copy+paste is your friend. Some common names are 'extruder', *
|
||||
* 'bed', 'fan', 'motor', ... names with special meaning can be found *
|
||||
* in gcode_process.c. Currently, these are: *
|
||||
* HEATER_extruder (M104) *
|
||||
* HEATER_bed (M140) *
|
||||
* HEATER_fan (M106) *
|
||||
* *
|
||||
* Devices don't neccessarily have a temperature sensor, e.g. fans or *
|
||||
* milling spindles. Operate such devices by setting their power (M106), *
|
||||
* instead of setting their temperature (M104). *
|
||||
* *
|
||||
* Also note, the index of a heater (M106 P#) can differ from the index of *
|
||||
* its attached temperature sensor (M104 P#) in case sensor-less devices *
|
||||
* are defined or the order of the definitions differs. The first defined *
|
||||
* device has the index 0 (zero). *
|
||||
* *
|
||||
* Set 'pwm' to ... *
|
||||
* 1 for using PWM on a PWM-able pin and on/off on other pins. *
|
||||
* 0 for using on/off on a PWM-able pin, too. *
|
||||
* Using PWM usually gives smoother temperature control but can conflict *
|
||||
* with slow switches, like solid state relays. PWM frequency can be *
|
||||
* influenced globally with FAST_PWM, see below. *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
#ifndef DEFINE_HEATER
|
||||
#define DEFINE_HEATER(...)
|
||||
#endif
|
||||
|
||||
// name port pwm
|
||||
DEFINE_HEATER(extruder, PB3, 1)
|
||||
DEFINE_HEATER(bed, PB4, 1)
|
||||
// DEFINE_HEATER(fan, PINB4, 1)
|
||||
// DEFINE_HEATER(chamber, PIND7, 1)
|
||||
// DEFINE_HEATER(motor, PIND6, 1)
|
||||
|
||||
/// and now because the c preprocessor isn't as smart as it could be,
|
||||
/// uncomment the ones you've listed above and comment the rest.
|
||||
/// NOTE: these are used to enable various capability-specific chunks of code, you do NOT need to create new entries unless you are adding new capabilities elsewhere in the code!
|
||||
/// so if you list a bed above, uncomment HEATER_BED, but if you list a chamber you do NOT need to create HEATED_CHAMBER
|
||||
/// I have searched high and low for a way to make the preprocessor do this for us, but so far I have not found a way.
|
||||
|
||||
#define HEATER_EXTRUDER HEATER_extruder
|
||||
#define HEATER_BED HEATER_bed
|
||||
// #define HEATER_FAN HEATER_fan
|
||||
// #define HEATER_CHAMBER HEATER_chamber
|
||||
// #define HEATER_MOTOR HEATER_motor
|
||||
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* 6. COMMUNICATION OPTIONS *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
// #define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
Redundant when using RepRap Host for sending GCode, but mandatory when sending GCode files with a plain terminal emulator, like GtkTerm (Linux), CoolTerm (Mac) or HyperTerminal (Windows).
|
||||
Can also be set in Makefile
|
||||
*/
|
||||
// #define XONXOFF
|
||||
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* 7. MISCELLANEOUS OPTIONS *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
/** \def EECONFIG
|
||||
EECONFIG: Enable EEPROM configuration storage.
|
||||
|
||||
Enabled by default. Commenting this out makes the binary several hundred
|
||||
bytes smaller, so you might want to disable EEPROM storage on small MCUs,
|
||||
like the ATmega168.
|
||||
*/
|
||||
#define EECONFIG
|
||||
|
||||
/** \def DEBUG
|
||||
DEBUG
|
||||
enables /heaps/ of extra output, and some extra M-codes.
|
||||
WARNING: this WILL break most host-side talkers that expect particular responses from firmware such as reprap host and replicatorG
|
||||
use with serial terminal or other suitable talker only.
|
||||
*/
|
||||
// #define DEBUG
|
||||
|
||||
/** \def BANG_BANG
|
||||
BANG_BANG
|
||||
drops PID loop from heater control, reduces code size significantly (1300 bytes!)
|
||||
may allow DEBUG on '168
|
||||
*/
|
||||
// #define BANG_BANG
|
||||
/** \def BANG_BANG_ON
|
||||
BANG_BANG_ON
|
||||
PWM value for 'on'
|
||||
*/
|
||||
// #define BANG_BANG_ON 200
|
||||
/** \def BANG_BANG_OFF
|
||||
BANG_BANG_OFF
|
||||
PWM value for 'off'
|
||||
*/
|
||||
// #define BANG_BANG_OFF 45
|
||||
|
||||
/**
|
||||
move buffer size, in number of moves
|
||||
note that each move takes a fair chunk of ram (69 bytes as of this writing) so don't make the buffer too big - a bigger serial readbuffer may help more than increasing this unless your gcodes are more than 70 characters long on average.
|
||||
however, a larger movebuffer will probably help with lots of short consecutive moves, as each move takes a bunch of math (hence time) to set up so a longer buffer allows more of the math to be done during preceding longer moves
|
||||
*/
|
||||
#define MOVEBUFFER_SIZE 8
|
||||
|
||||
/** \def DC_EXTRUDER
|
||||
DC extruder
|
||||
If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above.
|
||||
*/
|
||||
// #define DC_EXTRUDER HEATER_motor
|
||||
// #define DC_EXTRUDER_PWM 180
|
||||
|
||||
/** \def USE_WATCHDOG
|
||||
Teacup implements a watchdog, which has to be reset every 250ms or it will reboot the controller. As rebooting (and letting the GCode sending application trying to continue the build with a then different Home point) is probably even worse than just hanging, and there is no better restore code in place, this is disabled for now.
|
||||
*/
|
||||
// #define USE_WATCHDOG
|
||||
|
||||
/**
|
||||
analog subsystem stuff
|
||||
REFERENCE - which analog reference to use. see analog.h for choices
|
||||
*/
|
||||
#define REFERENCE REFERENCE_AVCC
|
||||
|
||||
/** \def STEP_INTERRUPT_INTERRUPTIBLE
|
||||
this option makes the step interrupt interruptible (nested).
|
||||
this should help immensely with dropped serial characters, but may also make debugging infuriating due to the complexities arising from nested interrupts
|
||||
\note disable this option if you're using a '168 or for some reason your ram usage is above 90%. This option hugely increases likelihood of stack smashing.
|
||||
*/
|
||||
#define STEP_INTERRUPT_INTERRUPTIBLE 1
|
||||
|
||||
/**
|
||||
temperature history count. This is how many temperature readings to keep in order to calculate derivative in PID loop
|
||||
higher values make PID derivative term more stable at the expense of reaction time
|
||||
*/
|
||||
#define TH_COUNT 8
|
||||
|
||||
/** \def FAST_PWM
|
||||
Teacup offers two PWM frequencies, 76(61) Hz and 78000(62500) Hz on a
|
||||
20(16) MHz electronics. The slower one is the default, as it's the safer
|
||||
choice. Drawback is, in a quiet environment you might notice the heaters
|
||||
and your power supply humming.
|
||||
|
||||
Uncomment this option if you want to get rid of this humming or want
|
||||
faster PWM for other reasons.
|
||||
|
||||
See also: http://reprap.org/wiki/Gen7_Research#MOSFET_heat_and_PWM
|
||||
*/
|
||||
// #define FAST_PWM
|
||||
|
||||
/// this is the scaling of internally stored PID values. 1024L is a good value
|
||||
#define PID_SCALE 1024L
|
||||
|
||||
/** \def ENDSTOP_STEPS
|
||||
number of steps to run into the endstops intentionally
|
||||
As Endstops trigger false alarm sometimes, Teacup debounces them by counting a number of consecutive positives. Valid range is 1...255. Use 4 or less for reliable endstops, 8 or even more for flaky ones.
|
||||
*/
|
||||
#define ENDSTOP_STEPS 4
|
||||
|
||||
/** \def CANNED_CYCLE
|
||||
|
||||
G-code commands in this string will be executed over and over again, without
|
||||
user interaction or even a serial connection. It's purpose is e.g. for
|
||||
exhibitions or when using Teacup for other purposes than printing. You can
|
||||
add any G-code supported by Teacup.
|
||||
|
||||
Note: don't miss these newlines (\n) and backslashes (\).
|
||||
*/
|
||||
/*
|
||||
#define CANNED_CYCLE "G1 X100 F3000\n" \
|
||||
"G4 P500\n" \
|
||||
"G1 X0\n" \
|
||||
"G4 P500\n"
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* 8. APPENDIX A - PWMABLE PINS AND MAPPINGS *
|
||||
* *
|
||||
* *
|
||||
* list of PWM-able pins and corresponding timers *
|
||||
* timer1 is used for step timing so don't use OC1A/OC1B *
|
||||
* they are omitted from this listing for that reason *
|
||||
* *
|
||||
* For the atmega168/328, timer/pin mappings are as follows *
|
||||
* *
|
||||
* OCR0A - PD6 - DIO6 *
|
||||
* OCR0B - PD5 - DIO5 *
|
||||
* OCR2A - PB3 - DIO11 *
|
||||
* OCR2B - PD3 - DIO3 *
|
||||
* *
|
||||
* For the atmega644, timer/pin mappings are as follows *
|
||||
* *
|
||||
* OCR0A - PB3 - DIO3 *
|
||||
* OCR0B - PB4 - DIO4 *
|
||||
* OCR2A - PD7 - DIO15 *
|
||||
* OCR2B - PD6 - DIO14 *
|
||||
* *
|
||||
* For the atmega1280, timer/pin mappings are as follows *
|
||||
* *
|
||||
* OCR0A - PB7 - DIO13 *
|
||||
* OCR0B - PG5 - DIO4 *
|
||||
* OCR2A - PB4 - DIO10 *
|
||||
* OCR2B - PH6 - DIO9 *
|
||||
* OCR3AL - PE3 - DIO5 *
|
||||
* OCR3BL - PE4 - DIO2 *
|
||||
* OCR3CL - PE5 - DIO3 *
|
||||
* OCR4AL - PH3 - DIO6 *
|
||||
* OCR4BL - PH4 - DIO7 *
|
||||
* OCR4CL - PH5 - DIO8 *
|
||||
* OCR5AL - PL3 - DIO46 *
|
||||
* OCR5BL - PL4 - DIO45 *
|
||||
* OCR5CL - PL5 - DIO44 *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
// Uncomment your printer type, comment out all others.
|
||||
#include "config/printer.wolfstrap.h"
|
||||
//#include "config/printer.mendel.h"
|
||||
|
|
|
|||
158
config.py
158
config.py
|
|
@ -9,7 +9,7 @@ cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(
|
|||
|
||||
from configtool.printerpanel import PrinterPanel
|
||||
from configtool.boardpanel import BoardPanel
|
||||
from configtool.data import VERSION
|
||||
from configtool.data import VERSION, reInclude
|
||||
|
||||
ID_LOAD_PRINTER = 1000
|
||||
ID_SAVE_PRINTER = 1001
|
||||
|
|
@ -17,28 +17,37 @@ ID_SAVE_PRINTER_AS = 1002
|
|||
ID_LOAD_BOARD = 1010
|
||||
ID_SAVE_BOARD = 1011
|
||||
ID_SAVE_BOARD_AS = 1012
|
||||
ID_LOAD_CONFIG = 1020
|
||||
ID_LOAD_DEFAULT = 1021
|
||||
ID_SAVE_CONFIG = 1022
|
||||
|
||||
|
||||
class ConfigFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1,
|
||||
"Teacup Firmware Configurator - " + VERSION,
|
||||
size = (880, 500))
|
||||
size = (880, 550))
|
||||
self.Bind(wx.EVT_CLOSE, self.onClose)
|
||||
|
||||
self.font = wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
|
||||
wx.FONTWEIGHT_BOLD)
|
||||
|
||||
panel = wx.Panel(self, -1)
|
||||
|
||||
self.heaters = []
|
||||
self.savePrtEna = False
|
||||
self.saveBrdEna = False
|
||||
|
||||
sz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.nb = wx.Notebook(panel, wx.ID_ANY, size = (880, 500),
|
||||
self.nb = wx.Notebook(panel, wx.ID_ANY, size = (880, 550),
|
||||
style = wx.BK_DEFAULT)
|
||||
self.nb.SetFont(self.font)
|
||||
|
||||
self.pgPrinter = PrinterPanel(self, self.nb, cmd_folder)
|
||||
self.pgPrinter = PrinterPanel(self, self.nb, self.font, cmd_folder)
|
||||
self.nb.AddPage(self.pgPrinter, "Printer")
|
||||
|
||||
self.pgBoard = BoardPanel(self, self.nb, cmd_folder)
|
||||
self.pgBoard = BoardPanel(self, self.nb, self.font, cmd_folder)
|
||||
self.nb.AddPage(self.pgBoard, "Board")
|
||||
|
||||
panel.Fit()
|
||||
|
|
@ -69,6 +78,20 @@ class ConfigFrame(wx.Frame):
|
|||
def makeMenu(self):
|
||||
file_menu = wx.Menu()
|
||||
|
||||
file_menu.Append(ID_LOAD_CONFIG, "Load config.h",
|
||||
"Load config.h and its named printer and board files.")
|
||||
self.Bind(wx.EVT_MENU, self.onLoadConfig, id = ID_LOAD_CONFIG)
|
||||
|
||||
file_menu.Append(ID_LOAD_DEFAULT, "Load default",
|
||||
"Load default config.h and its named printer and board files.")
|
||||
self.Bind(wx.EVT_MENU, self.onLoadDefault, id = ID_LOAD_DEFAULT)
|
||||
|
||||
file_menu.Append(ID_SAVE_CONFIG, "Save config.h", "Save config.h file.")
|
||||
self.Bind(wx.EVT_MENU, self.onSaveConfig, id = ID_SAVE_CONFIG)
|
||||
file_menu.Enable(ID_SAVE_CONFIG, False)
|
||||
|
||||
file_menu.AppendSeparator()
|
||||
|
||||
file_menu.Append(ID_LOAD_PRINTER, "Load printer",
|
||||
"Load a printer configuration file.")
|
||||
self.Bind(wx.EVT_MENU, self.pgPrinter.onLoadConfig, id = ID_LOAD_PRINTER)
|
||||
|
|
@ -115,10 +138,135 @@ class ConfigFrame(wx.Frame):
|
|||
def enableSavePrinter(self, flag):
|
||||
self.fileMenu.Enable(ID_SAVE_PRINTER, flag)
|
||||
self.fileMenu.Enable(ID_SAVE_PRINTER_AS, flag)
|
||||
self.savePrtEna = flag
|
||||
if self.savePrtEna and self.saveBrdEna:
|
||||
self.enableSaveConfig(True)
|
||||
else:
|
||||
self.enableSaveConfig(False)
|
||||
|
||||
def enableSaveBoard(self, flag):
|
||||
self.fileMenu.Enable(ID_SAVE_BOARD, flag)
|
||||
self.fileMenu.Enable(ID_SAVE_BOARD_AS, flag)
|
||||
self.saveBrdEna = flag
|
||||
if self.savePrtEna and self.saveBrdEna:
|
||||
self.enableSaveConfig(True)
|
||||
else:
|
||||
self.enableSaveConfig(False)
|
||||
|
||||
def enableSaveConfig(self, flag):
|
||||
self.fileMenu.Enable(ID_SAVE_CONFIG, flag)
|
||||
|
||||
def onLoadConfig(self, evt):
|
||||
self.loadConfigFile("config.h")
|
||||
|
||||
def onLoadDefault(self, evt):
|
||||
self.loadConfigFile("config.default.h")
|
||||
|
||||
def loadConfigFile(self, fn):
|
||||
if not self.pgPrinter.confirmLoseChanges("load config"):
|
||||
return
|
||||
if not self.pgBoard.confirmLoseChanges("load config"):
|
||||
return
|
||||
|
||||
pfile = None
|
||||
bfile = None
|
||||
path = os.path.join(cmd_folder, fn)
|
||||
try:
|
||||
cfgBuffer = list(open(path))
|
||||
except:
|
||||
self.message("Unable to process config file %s." % fn, "File error")
|
||||
return
|
||||
|
||||
for ln in cfgBuffer:
|
||||
if not ln.lstrip().startswith("#include"):
|
||||
continue
|
||||
|
||||
m = reInclude.search(ln)
|
||||
if m:
|
||||
t = m.groups()
|
||||
if len(t) == 1:
|
||||
if "printer." in t[0]:
|
||||
if pfile:
|
||||
self.message("Multiple printer file include statements.\n"
|
||||
"Ignoring %s." % ln, "Config error",
|
||||
wx.OK + wx.ICON_WARNING)
|
||||
else:
|
||||
pfile = os.path.join(cmd_folder, t[0])
|
||||
elif "board." in t[0]:
|
||||
if bfile:
|
||||
self.message("Multiple board file include statements.\n"
|
||||
"Ignoring %s." % ln, "Config error",
|
||||
wx.OK + wx.ICON_WARNING)
|
||||
else:
|
||||
bfile = os.path.join(cmd_folder, t[0])
|
||||
else:
|
||||
self.message("Unable to parse include statement:\n%s" % ln,
|
||||
"Config error")
|
||||
|
||||
if not pfile:
|
||||
self.message("Config file did not contain a printer file include "
|
||||
"statement.", "Config error")
|
||||
return
|
||||
|
||||
if not bfile:
|
||||
self.message("Config file did not contain a board file include "
|
||||
"statement.", "Config error")
|
||||
return
|
||||
|
||||
self.pgPrinter.loadConfigFile(pfile)
|
||||
|
||||
self.pgBoard.loadConfigFile(bfile)
|
||||
|
||||
def onSaveConfig(self, evt):
|
||||
fn = os.path.join(cmd_folder, "config.h")
|
||||
try:
|
||||
fp = open(fn, 'w')
|
||||
except:
|
||||
self.message("Unable to open config.h for output.", "File error")
|
||||
return
|
||||
|
||||
bfn = self.pgBoard.getFileName()
|
||||
if not self.pgBoard.saveConfigFile(bfn):
|
||||
self.message("Unable to save board configuration %s." %
|
||||
os.path.basename(bfn), "File error")
|
||||
return
|
||||
|
||||
pfn = self.pgPrinter.getFileName()
|
||||
if not self.pgPrinter.saveConfigFile(pfn):
|
||||
self.message("Unable to save printer configuration %s." %
|
||||
os.path.basename(pfn), "File error")
|
||||
return
|
||||
|
||||
prefix = cmd_folder + os.path.sep
|
||||
lpfx = len(prefix)
|
||||
|
||||
if bfn.startswith(prefix):
|
||||
rbfn = bfn[lpfx:]
|
||||
else:
|
||||
rbfn = bfn
|
||||
|
||||
if pfn.startswith(prefix):
|
||||
rpfn = pfn[lpfx:]
|
||||
else:
|
||||
rpfn = pfn
|
||||
|
||||
fp.write("\n")
|
||||
fp.write("// Configuration for controller board.\n")
|
||||
fp.write("#include \"%s\"\n" % rbfn)
|
||||
fp.write("\n")
|
||||
fp.write("// Configuration for printer board.\n")
|
||||
fp.write("#include \"%s\"\n" % rpfn)
|
||||
|
||||
fp.close()
|
||||
|
||||
m = ("%s successfully saved.\n"
|
||||
"%s successfully saved.\nconfig.h successfully saved.") % (rbfn, rpfn)
|
||||
self.message(m, "Save configuration success", wx.OK + wx.ICON_INFORMATION)
|
||||
|
||||
def message(self, text, title, style = wx.OK + wx.ICON_ERROR):
|
||||
dlg = wx.MessageDialog(self, text, title, style)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -212,6 +212,15 @@ DEFINE_HEATER(bed, DIO3, 1)
|
|||
*/
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
||||
Redundant when using RepRap Host for sending G-code, but mandatory when
|
||||
sending G-code files with a plain terminal emulator, like GtkTerm (Linux),
|
||||
CoolTerm (Mac) or HyperTerminal (Windows).
|
||||
*/
|
||||
//#define XONXOFF
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
|
|
|
|||
|
|
@ -208,6 +208,15 @@ DEFINE_HEATER(bed, DIO8, 1)
|
|||
*/
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
||||
Redundant when using RepRap Host for sending G-code, but mandatory when
|
||||
sending G-code files with a plain terminal emulator, like GtkTerm (Linux),
|
||||
CoolTerm (Mac) or HyperTerminal (Windows).
|
||||
*/
|
||||
//#define XONXOFF
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@
|
|||
Units: mm/s^2
|
||||
Useful range: 1 to 10'000
|
||||
*/
|
||||
#define ACCELERATION 1000 /* float */
|
||||
#define ACCELERATION 1000
|
||||
|
||||
/** \def LOOKAHEAD
|
||||
Define this to enable look-ahead during *ramping* acceleration to smoothly
|
||||
|
|
@ -192,7 +192,7 @@
|
|||
|
||||
Valid range: 0.001 to 1.0
|
||||
*/
|
||||
#define TEMP_EWMA 1.0 /* float */
|
||||
#define TEMP_EWMA 1.0
|
||||
|
||||
/** \def HEATER_SANITY_CHECK
|
||||
Check if heater responds to changes in target temperature, disable and spit
|
||||
|
|
@ -201,15 +201,6 @@
|
|||
*/
|
||||
//#define HEATER_SANITY_CHECK
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
||||
Redundant when using RepRap Host for sending G-code, but mandatory when
|
||||
sending G-code files with a plain terminal emulator, like GtkTerm (Linux),
|
||||
CoolTerm (Mac) or HyperTerminal (Windows).
|
||||
*/
|
||||
//#define XONXOFF
|
||||
|
||||
/** \def EECONFIG
|
||||
Enable EEPROM configuration storage.
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@
|
|||
Units: mm/s^2
|
||||
Useful range: 1 to 10'000
|
||||
*/
|
||||
#define ACCELERATION 100 /* float */
|
||||
#define ACCELERATION 100
|
||||
|
||||
/** \def LOOKAHEAD
|
||||
Define this to enable look-ahead during *ramping* acceleration to smoothly
|
||||
|
|
@ -192,7 +192,7 @@
|
|||
|
||||
Valid range: 0.001 to 1.0
|
||||
*/
|
||||
#define TEMP_EWMA 1.0 /* float */
|
||||
#define TEMP_EWMA 1.0
|
||||
|
||||
/** \def HEATER_SANITY_CHECK
|
||||
Check if heater responds to changes in target temperature, disable and spit
|
||||
|
|
@ -201,15 +201,6 @@
|
|||
*/
|
||||
//#define HEATER_SANITY_CHECK
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
||||
Redundant when using RepRap Host for sending G-code, but mandatory when
|
||||
sending G-code files with a plain terminal emulator, like GtkTerm (Linux),
|
||||
CoolTerm (Mac) or HyperTerminal (Windows).
|
||||
*/
|
||||
//#define XONXOFF
|
||||
|
||||
/** \def EECONFIG
|
||||
Enable EEPROM configuration storage.
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ from configtool.page import Page
|
|||
|
||||
|
||||
class AccelerationPage(wx.Panel, Page):
|
||||
def __init__(self, parent, nb, idPg):
|
||||
def __init__(self, parent, nb, idPg, font):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
Page.__init__(self)
|
||||
Page.__init__(self, font)
|
||||
self.parent = parent
|
||||
self.id = idPg
|
||||
|
||||
|
|
@ -25,6 +25,7 @@ class AccelerationPage(wx.Panel, Page):
|
|||
sz = wx.GridBagSizer()
|
||||
sz.AddSpacer((20, 40), pos = (0, 0))
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Acceleration Type")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
style = wx.RB_GROUP
|
||||
|
|
@ -36,6 +37,7 @@ class AccelerationPage(wx.Panel, Page):
|
|||
sbox.AddSpacer((5, 5))
|
||||
|
||||
self.rbNone = wx.RadioButton(self, wx.ID_ANY, "None", style = style)
|
||||
self.rbNone.SetFont(font)
|
||||
self.rbNone.SetValue(True)
|
||||
self.Bind(wx.EVT_RADIOBUTTON, self.onAccTypeSelect, self.rbNone)
|
||||
sbox.Add(self.rbNone, 1, wx.LEFT + wx.RIGHT, 16)
|
||||
|
|
@ -43,6 +45,7 @@ class AccelerationPage(wx.Panel, Page):
|
|||
sz.Add(sbox, pos = (1, 1))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Ramping Parameters")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
|
|
@ -63,6 +66,7 @@ class AccelerationPage(wx.Panel, Page):
|
|||
sz.Add(sbox, pos = (1, 3))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Maximum Jerk")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k in self.jerkKeys:
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
|
||||
import wx
|
||||
from configtool.data import pinNames, BSIZESMALL
|
||||
from configtool.data import BSIZESMALL
|
||||
|
||||
|
||||
class AddHeaterDlg(wx.Dialog):
|
||||
def __init__(self, parent, names, pins):
|
||||
def __init__(self, parent, names, pins, font):
|
||||
wx.Dialog.__init__(self, parent, wx.ID_ANY, "Add heater", size = (400, 204))
|
||||
self.SetFont(font)
|
||||
self.Bind(wx.EVT_CLOSE, self.onCancel)
|
||||
|
||||
self.names = names
|
||||
self.choices = pins
|
||||
|
||||
self.nameValid = False
|
||||
|
||||
|
|
@ -19,9 +21,11 @@ class AddHeaterDlg(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Heater Name:", size = (80, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
|
||||
self.tcName = wx.TextCtrl(self, wx.ID_ANY, "")
|
||||
self.tcName.SetFont(font)
|
||||
self.tcName.SetBackgroundColour("pink")
|
||||
self.tcName.Bind(wx.EVT_TEXT, self.onNameEntry)
|
||||
lsz.Add(self.tcName)
|
||||
|
|
@ -32,9 +36,11 @@ class AddHeaterDlg(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Pin:", size = (80, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
|
||||
self.chPin = wx.Choice(self, wx.ID_ANY, choices = pins)
|
||||
self.chPin.SetFont(font)
|
||||
self.chPin.Bind(wx.EVT_CHOICE, self.onChoice)
|
||||
self.chPin.SetSelection(0)
|
||||
lsz.Add(self.chPin)
|
||||
|
|
@ -43,6 +49,7 @@ class AddHeaterDlg(wx.Dialog):
|
|||
gsz.Add(lsz, pos = (3, 1))
|
||||
|
||||
self.cbPwm = wx.CheckBox(self, wx.ID_ANY, "PWM")
|
||||
self.cbPwm.SetFont(font)
|
||||
self.cbPwm.SetToolTipString("Use Pulse Width Modulation in case the "
|
||||
"choosen pin allows to do so.")
|
||||
|
||||
|
|
@ -56,6 +63,7 @@ class AddHeaterDlg(wx.Dialog):
|
|||
bsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.bSave = wx.Button(self, wx.ID_ANY, "Save", size = BSIZESMALL)
|
||||
self.bSave.SetFont(font)
|
||||
self.bSave.Bind(wx.EVT_BUTTON, self.onSave)
|
||||
bsz.Add(self.bSave)
|
||||
self.bSave.Enable(False)
|
||||
|
|
@ -63,12 +71,16 @@ class AddHeaterDlg(wx.Dialog):
|
|||
bsz.AddSpacer(30, 100)
|
||||
|
||||
self.bCancel = wx.Button(self, wx.ID_ANY, "Cancel", size = BSIZESMALL)
|
||||
self.bCancel.SetFont(font)
|
||||
self.bCancel.Bind(wx.EVT_BUTTON, self.onCancel)
|
||||
bsz.Add(self.bCancel)
|
||||
|
||||
sz.Add(bsz, flag = wx.ALIGN_CENTER_HORIZONTAL)
|
||||
sz.AddSpacer((10, 10))
|
||||
self.SetSizer(sz)
|
||||
|
||||
self.Fit()
|
||||
|
||||
def onNameEntry(self, evt):
|
||||
tc = evt.GetEventObject()
|
||||
w = tc.GetValue().strip()
|
||||
|
|
@ -100,7 +112,7 @@ class AddHeaterDlg(wx.Dialog):
|
|||
|
||||
def getValues(self):
|
||||
nm = self.tcName.GetValue()
|
||||
pin = pinNames[self.chPin.GetSelection()]
|
||||
pin = self.choices[self.chPin.GetSelection()]
|
||||
if self.cbPwm.IsChecked():
|
||||
pwm = "1"
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,106 +1,120 @@
|
|||
|
||||
import wx
|
||||
from configtool.data import pinNames, BSIZESMALL
|
||||
from configtool.data import pinNames, BSIZESMALL, sensorTypes
|
||||
|
||||
|
||||
class AddSensorDlg(wx.Dialog):
|
||||
def __init__(self, parent, names, sl, pins):
|
||||
def __init__(self, parent, names, pins, font):
|
||||
wx.Dialog.__init__(self, parent, wx.ID_ANY, "Add temperature sensor",
|
||||
size = (400, 204))
|
||||
self.SetFont(font)
|
||||
self.Bind(wx.EVT_CLOSE, self.onCancel)
|
||||
|
||||
self.names = names
|
||||
self.choices = pins
|
||||
|
||||
labelWidth = 160
|
||||
|
||||
self.nameValid = False
|
||||
|
||||
sz = wx.BoxSizer(wx.VERTICAL)
|
||||
hsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
hsz.AddSpacer((10, 10))
|
||||
|
||||
csz = wx.GridBagSizer()
|
||||
csz.AddSpacer((10, 10), pos = (0, 0))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Sensor Type")
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
style = wx.RB_GROUP
|
||||
self.rbs = {}
|
||||
for k in sl:
|
||||
rb = wx.RadioButton(self, wx.ID_ANY, k, style = style)
|
||||
self.rbs[k] = rb
|
||||
self.Bind(wx.EVT_RADIOBUTTON, self.onSensorType, rb)
|
||||
style = 0
|
||||
|
||||
sbox.Add(rb, 1, wx.LEFT + wx.RIGHT, 16)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
csz.Add(sbox, pos = (1, 3))
|
||||
|
||||
vsz = wx.BoxSizer(wx.VERTICAL)
|
||||
vsz.AddSpacer((10, 10))
|
||||
csz = wx.BoxSizer(wx.VERTICAL)
|
||||
csz.AddSpacer((10, 10))
|
||||
|
||||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Sensor Name:", size = (80, -1),
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Sensor Name:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
|
||||
self.tcName = wx.TextCtrl(self, wx.ID_ANY, "")
|
||||
self.tcName.SetFont(font)
|
||||
self.tcName.SetBackgroundColour("pink")
|
||||
self.tcName.Bind(wx.EVT_TEXT, self.onNameEntry)
|
||||
lsz.Add(self.tcName)
|
||||
self.tcName.SetToolTipString("Enter a unique name for this sensor.")
|
||||
|
||||
vsz.Add(lsz)
|
||||
vsz.AddSpacer((10, 10))
|
||||
csz.Add(lsz)
|
||||
csz.AddSpacer((10, 10))
|
||||
|
||||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Pin:", size = (80, -1),
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Sensor Type:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
|
||||
sl = sorted(sensorTypes.keys())
|
||||
|
||||
ch = wx.Choice(self, wx.ID_ANY, choices = sl)
|
||||
ch.SetFont(font)
|
||||
ch.Bind(wx.EVT_CHOICE, self.onSensorType)
|
||||
ch.SetSelection(0)
|
||||
self.chType = ch
|
||||
lsz.Add(ch)
|
||||
|
||||
csz.Add(lsz)
|
||||
csz.AddSpacer((10, 10))
|
||||
|
||||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Pin:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
|
||||
self.choiceList = pinNames
|
||||
self.chPin = wx.Choice(self, wx.ID_ANY, choices = pins)
|
||||
self.chPin.SetFont(font)
|
||||
self.chPin.Bind(wx.EVT_CHOICE, self.onChoice)
|
||||
self.chPin.SetSelection(0)
|
||||
lsz.Add(self.chPin)
|
||||
self.chPin.SetToolTipString("Choose a pin name for this sensor.")
|
||||
|
||||
vsz.Add(lsz)
|
||||
vsz.AddSpacer((10, 10))
|
||||
csz.Add(lsz)
|
||||
csz.AddSpacer((10, 10))
|
||||
|
||||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Additional:", size = (80, -1),
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Additional:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
|
||||
self.tcAddtl = wx.TextCtrl(self, wx.ID_ANY, "")
|
||||
self.tcAddtl.SetFont(font)
|
||||
self.tcAddtl.Bind(wx.EVT_TEXT, self.onAddtlEntry)
|
||||
self.selectSensorType(sl[0])
|
||||
lsz.Add(self.tcAddtl)
|
||||
self.tcAddtl.SetToolTipString("Enter additional information required "
|
||||
"by the sensor type.")
|
||||
|
||||
vsz.Add(lsz)
|
||||
csz.Add(vsz, pos = (1, 1))
|
||||
csz.Add(lsz)
|
||||
|
||||
csz.AddSpacer((10, 10), pos = (1, 4))
|
||||
|
||||
sz.Add(csz)
|
||||
sz.AddSpacer((30, 30))
|
||||
csz.AddSpacer((10,10))
|
||||
|
||||
bsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.bSave = wx.Button(self, wx.ID_ANY, "Save", size = BSIZESMALL)
|
||||
self.bSave.SetFont(font)
|
||||
self.bSave.Bind(wx.EVT_BUTTON, self.onSave)
|
||||
bsz.Add(self.bSave)
|
||||
self.bSave.Enable(False)
|
||||
|
||||
bsz.AddSpacer(30, 100)
|
||||
bsz.AddSpacer((30, 10))
|
||||
|
||||
self.bCancel = wx.Button(self, wx.ID_ANY, "Cancel", size = BSIZESMALL)
|
||||
self.bCancel.SetFont(font)
|
||||
self.bCancel.Bind(wx.EVT_BUTTON, self.onCancel)
|
||||
bsz.Add(self.bCancel)
|
||||
|
||||
sz.Add(bsz, flag = wx.ALIGN_CENTER_HORIZONTAL)
|
||||
self.SetSizer(sz)
|
||||
csz.Add(bsz, flag = wx.ALIGN_CENTER_HORIZONTAL)
|
||||
csz.AddSpacer((10, 10))
|
||||
|
||||
hsz.Add(csz)
|
||||
hsz.AddSpacer((10, 10))
|
||||
|
||||
self.SetSizer(hsz)
|
||||
self.Fit()
|
||||
|
||||
def onNameEntry(self, evt):
|
||||
tc = evt.GetEventObject()
|
||||
|
|
@ -132,7 +146,7 @@ class AddSensorDlg(wx.Dialog):
|
|||
evt.Skip()
|
||||
|
||||
def selectSensorType(self, lbl):
|
||||
if lbl == 'TT_THERMISTOR':
|
||||
if lbl == 'Thermistor':
|
||||
self.tcAddtl.Enable(True);
|
||||
else:
|
||||
self.tcAddtl.Enable(False);
|
||||
|
|
@ -141,8 +155,9 @@ class AddSensorDlg(wx.Dialog):
|
|||
pass
|
||||
|
||||
def onSensorType(self, evt):
|
||||
rb = evt.GetEventObject()
|
||||
label = rb.GetLabel()
|
||||
ch = evt.GetEventObject()
|
||||
s = ch.GetSelection()
|
||||
label = ch.GetString(s)
|
||||
|
||||
self.selectSensorType(label)
|
||||
|
||||
|
|
@ -150,21 +165,14 @@ class AddSensorDlg(wx.Dialog):
|
|||
|
||||
def getValues(self):
|
||||
nm = self.tcName.GetValue()
|
||||
pin = pinNames[self.chPin.GetSelection()]
|
||||
pin = self.choices[self.chPin.GetSelection()]
|
||||
addtl = self.tcAddtl.GetValue()
|
||||
stype = self.chType.GetString(self.chType.GetSelection())
|
||||
|
||||
for k in self.rbs:
|
||||
if self.rbs[k].GetValue():
|
||||
stype = k
|
||||
break
|
||||
|
||||
if stype is None:
|
||||
stype = "??"
|
||||
|
||||
if stype in ['TT_THERMISTOR']:
|
||||
return (nm, stype, pin, addtl)
|
||||
if stype in ['Thermistor']:
|
||||
return (nm, sensorTypes[stype], pin, addtl)
|
||||
else:
|
||||
return (nm, stype, pin)
|
||||
return (nm, sensorTypes[stype], pin)
|
||||
|
||||
|
||||
def onSave(self, evt):
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ from configtool.data import (supportedCPUs, defineValueFormat,
|
|||
reCommDefBoolBL, reHelpTextStart, reHelpTextEnd,
|
||||
reStartSensors, reEndSensors, reStartHeaters,
|
||||
reEndHeaters, reStartProcessors, reEndProcessors,
|
||||
reCandHeatPins, reCandThermPins, reAVR, reDefine,
|
||||
reDefineBL, reDefQS, reDefQSm, reDefQSm2,
|
||||
reDefBool, reDefBoolBL, reDefHT, reDefTS,
|
||||
reHeater, reSensor3, reSensor4)
|
||||
reCandHeatPins, reCandThermPins, reFloatAttr,
|
||||
reAVR, reDefine, reDefineBL, reDefQS, reDefQSm,
|
||||
reDefQSm2, reDefBool, reDefBoolBL, reDefHT,
|
||||
reDefTS, reHeater, reSensor3, reSensor4)
|
||||
from configtool.pinoutspage import PinoutsPage
|
||||
from configtool.sensorpage import SensorsPage
|
||||
from configtool.heaterspage import HeatersPage
|
||||
|
|
@ -20,10 +20,12 @@ from configtool.cpupage import CpuPage
|
|||
|
||||
|
||||
class BoardPanel(wx.Panel):
|
||||
def __init__(self, parent, nb, folder):
|
||||
def __init__(self, parent, nb, font, folder):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
self.parent = parent
|
||||
|
||||
self.configFile = None
|
||||
|
||||
self.cfgValues = {}
|
||||
self.heaters = []
|
||||
self.sensors = []
|
||||
|
|
@ -36,13 +38,14 @@ class BoardPanel(wx.Panel):
|
|||
|
||||
self.nb = wx.Notebook(self, wx.ID_ANY, size = (21, 21),
|
||||
style = wx.BK_DEFAULT)
|
||||
self.nb.SetFont(font)
|
||||
|
||||
self.pages = []
|
||||
self.titles = []
|
||||
self.pageModified = []
|
||||
self.pageValid = []
|
||||
|
||||
self.pgCpu = CpuPage(self, self.nb, len(self.pages))
|
||||
self.pgCpu = CpuPage(self, self.nb, len(self.pages), font)
|
||||
text = "CPU"
|
||||
self.nb.AddPage(self.pgCpu, text)
|
||||
self.pages.append(self.pgCpu)
|
||||
|
|
@ -50,7 +53,7 @@ class BoardPanel(wx.Panel):
|
|||
self.pageModified.append(False)
|
||||
self.pageValid.append(True)
|
||||
|
||||
self.pgPins = PinoutsPage(self, self.nb, len(self.pages))
|
||||
self.pgPins = PinoutsPage(self, self.nb, len(self.pages), font)
|
||||
text = "Pinouts"
|
||||
self.nb.AddPage(self.pgPins, text)
|
||||
self.pages.append(self.pgPins)
|
||||
|
|
@ -58,7 +61,7 @@ class BoardPanel(wx.Panel):
|
|||
self.pageModified.append(False)
|
||||
self.pageValid.append(True)
|
||||
|
||||
self.pgSensors = SensorsPage(self, self.nb, len(self.pages))
|
||||
self.pgSensors = SensorsPage(self, self.nb, len(self.pages), font)
|
||||
text = "Temperature Sensors"
|
||||
self.nb.AddPage(self.pgSensors, text)
|
||||
self.pages.append(self.pgSensors)
|
||||
|
|
@ -66,7 +69,7 @@ class BoardPanel(wx.Panel):
|
|||
self.pageModified.append(False)
|
||||
self.pageValid.append(True)
|
||||
|
||||
self.pgHeaters = HeatersPage(self, self.nb, len(self.pages))
|
||||
self.pgHeaters = HeatersPage(self, self.nb, len(self.pages), font)
|
||||
text = "Heaters"
|
||||
self.nb.AddPage(self.pgHeaters, text)
|
||||
self.pages.append(self.pgHeaters)
|
||||
|
|
@ -74,7 +77,8 @@ class BoardPanel(wx.Panel):
|
|||
self.pageModified.append(False)
|
||||
self.pageValid.append(True)
|
||||
|
||||
self.pgCommunications = CommunicationsPage(self, self.nb, len(self.pages))
|
||||
self.pgCommunications = CommunicationsPage(self, self.nb, len(self.pages),
|
||||
font)
|
||||
text = "Communications"
|
||||
self.nb.AddPage(self.pgCommunications, text)
|
||||
self.pages.append(self.pgCommunications)
|
||||
|
|
@ -85,6 +89,7 @@ class BoardPanel(wx.Panel):
|
|||
sz.Add(self.nb, 1, wx.EXPAND + wx.ALL, 5)
|
||||
|
||||
self.SetSizer(sz)
|
||||
self.Fit()
|
||||
|
||||
def assertModified(self, pg, flag = True):
|
||||
self.pageModified[pg] = flag
|
||||
|
|
@ -93,6 +98,9 @@ class BoardPanel(wx.Panel):
|
|||
def isModified(self):
|
||||
return (True in self.pageModified)
|
||||
|
||||
def getFileName(self):
|
||||
return self.configFile
|
||||
|
||||
def assertValid(self, pg, flag = True):
|
||||
self.pageValid[pg] = flag
|
||||
self.modifyTab(pg)
|
||||
|
|
@ -169,19 +177,6 @@ class BoardPanel(wx.Panel):
|
|||
dlg.Destroy()
|
||||
return
|
||||
|
||||
self.parent.enableSaveBoard(True)
|
||||
self.parent.setBoardTabText("Board <%s>" % os.path.basename(path))
|
||||
self.pgHeaters.setCandidatePins(self.candHeatPins)
|
||||
self.pgSensors.setCandidatePins(self.candThermPins)
|
||||
|
||||
for pg in self.pages:
|
||||
pg.insertValues(self.cfgValues)
|
||||
pg.setHelpText(self.helpText)
|
||||
|
||||
self.pgSensors.setSensors(self.sensors)
|
||||
self.pgHeaters.setHeaters(self.heaters)
|
||||
self.pgCpu.setProcessors(self.processors)
|
||||
|
||||
def loadConfigFile(self, fn):
|
||||
try:
|
||||
self.cfgBuffer = list(open(fn))
|
||||
|
|
@ -297,6 +292,8 @@ class BoardPanel(wx.Panel):
|
|||
t = m.groups()
|
||||
if len(t) == 2:
|
||||
self.cfgValues[t[0]] = t[1]
|
||||
if reFloatAttr.search(ln):
|
||||
pass
|
||||
continue
|
||||
|
||||
m = reDefBool.search(ln)
|
||||
|
|
@ -324,6 +321,19 @@ class BoardPanel(wx.Panel):
|
|||
self.heaters.append(s)
|
||||
continue
|
||||
|
||||
self.parent.enableSaveBoard(True)
|
||||
self.parent.setBoardTabText("Board <%s>" % os.path.basename(fn))
|
||||
self.pgHeaters.setCandidatePins(self.candHeatPins)
|
||||
self.pgSensors.setCandidatePins(self.candThermPins)
|
||||
|
||||
for pg in self.pages:
|
||||
pg.insertValues(self.cfgValues)
|
||||
pg.setHelpText(self.helpText)
|
||||
|
||||
self.pgSensors.setSensors(self.sensors)
|
||||
self.pgHeaters.setHeaters(self.heaters)
|
||||
self.pgCpu.setProcessors(self.processors)
|
||||
|
||||
return True
|
||||
|
||||
def parseSensor(self, s):
|
||||
|
|
@ -378,7 +388,6 @@ class BoardPanel(wx.Panel):
|
|||
if self.saveConfigFile(path):
|
||||
dlg = wx.MessageDialog(self, "File %s successfully written." % path,
|
||||
"Save successful", wx.OK + wx.ICON_INFORMATION)
|
||||
self.parent.setBoardTabText("Board <%s>" % os.path.basename(path))
|
||||
else:
|
||||
dlg = wx.MessageDialog(self, "Unable to write to file %s." % path,
|
||||
"File error", wx.OK + wx.ICON_ERROR)
|
||||
|
|
@ -408,7 +417,6 @@ class BoardPanel(wx.Panel):
|
|||
|
||||
self.processors = self.pgCpu.getProcessors()
|
||||
|
||||
|
||||
skipToSensorEnd = False
|
||||
skipToHeaterEnd = False
|
||||
skipToProcessorEnd = False
|
||||
|
|
@ -475,8 +483,10 @@ class BoardPanel(wx.Panel):
|
|||
if len(t) == 2:
|
||||
if t[0] in values.keys() and values[t[0]] != "":
|
||||
fp.write(defineValueFormat % (t[0], values[t[0]]))
|
||||
else:
|
||||
elif t[0] in values.keys():
|
||||
fp.write("//" + ln)
|
||||
else:
|
||||
fp.write(ln)
|
||||
continue
|
||||
|
||||
m = reDefBoolBL.match(ln)
|
||||
|
|
@ -485,8 +495,10 @@ class BoardPanel(wx.Panel):
|
|||
if len(t) == 1:
|
||||
if t[0] in values.keys() and values[t[0]]:
|
||||
fp.write(defineBoolFormat % t[0])
|
||||
else:
|
||||
elif t[0] in values.keys():
|
||||
fp.write("//" + ln)
|
||||
else:
|
||||
fp.write(ln)
|
||||
continue
|
||||
|
||||
m = reCommDefBL.match(ln)
|
||||
|
|
@ -512,4 +524,7 @@ class BoardPanel(wx.Panel):
|
|||
fp.write(ln)
|
||||
|
||||
fp.close()
|
||||
|
||||
self.parent.setBoardTabText("Board <%s>" % os.path.basename(path))
|
||||
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -1,18 +1,21 @@
|
|||
|
||||
import wx
|
||||
|
||||
from configtool.data import BSIZESMALL, reFloat
|
||||
from configtool.data import BSIZESMALL, reFloat, reInteger
|
||||
|
||||
|
||||
class CalcBelt(wx.Dialog):
|
||||
def __init__(self, parent, cbUse):
|
||||
def __init__(self, parent, font, cbUse):
|
||||
wx.Dialog.__init__(self, parent, wx.ID_ANY,
|
||||
"Steps calculator for belt driven axes",
|
||||
size = (360, 300))
|
||||
self.SetFont(font)
|
||||
self.Bind(wx.EVT_CLOSE, self.onExit)
|
||||
|
||||
self.use = cbUse
|
||||
labelWidth = 110
|
||||
labelWidth = 130
|
||||
|
||||
hsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
hsz.AddSpacer((10, 10))
|
||||
|
||||
sz = wx.BoxSizer(wx.VERTICAL)
|
||||
sz.AddSpacer((10, 10))
|
||||
|
|
@ -20,6 +23,7 @@ class CalcBelt(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Step Angle:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
|
|
@ -27,6 +31,7 @@ class CalcBelt(wx.Dialog):
|
|||
"7.5 (48 per revolution)"]
|
||||
self.stepAngleValues = [200, 400, 48]
|
||||
tc = wx.Choice(self, wx.ID_ANY, choices = stepAngles)
|
||||
tc.SetFont(font)
|
||||
tc.SetSelection(0)
|
||||
tc.Bind(wx.EVT_CHOICE, self.onChoice)
|
||||
lsz.Add(tc)
|
||||
|
|
@ -39,6 +44,7 @@ class CalcBelt(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Microstepping:",
|
||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
|
|
@ -46,6 +52,7 @@ class CalcBelt(wx.Dialog):
|
|||
"1/8", "1/16", "1/32", "1/64", "1/128"]
|
||||
self.microSteppingValues = [1, 2, 4, 8, 16, 32, 64, 128]
|
||||
tc = wx.Choice(self, wx.ID_ANY, choices = microStepping)
|
||||
tc.SetFont(font)
|
||||
tc.Bind(wx.EVT_CHOICE, self.onChoice)
|
||||
tc.SetSelection(4)
|
||||
lsz.Add(tc)
|
||||
|
|
@ -61,10 +68,12 @@ class CalcBelt(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Belt Pitch (in mm):",
|
||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
tc = wx.TextCtrl(self, wx.ID_ANY, "2", style = wx.TE_RIGHT)
|
||||
tc.SetFont(font)
|
||||
tc.Bind(wx.EVT_TEXT, self.onTextCtrlFloat)
|
||||
lsz.Add(tc)
|
||||
tc.SetToolTipString("Belt pitch. Distance between two teeth on the belt.")
|
||||
|
|
@ -77,6 +86,7 @@ class CalcBelt(wx.Dialog):
|
|||
"5mm Pitch (T5, GTD, HTD)", "0.2\" XL belt (5.08mm)"]
|
||||
self.beltPresetValues = [-1, 2.0, 2.03, 2.5, 3.0, 5.0, 5.08]
|
||||
tc = wx.Choice(self, wx.ID_ANY, choices = beltPresets)
|
||||
tc.SetFont(font)
|
||||
tc.SetSelection(0)
|
||||
tc.Bind(wx.EVT_CHOICE, self.onPresetChoice)
|
||||
lsz.Add(tc)
|
||||
|
|
@ -89,11 +99,13 @@ class CalcBelt(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Pulley Teeth Count:",
|
||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
tc = wx.TextCtrl(self, wx.ID_ANY, "8", style = wx.TE_RIGHT)
|
||||
tc.Bind(wx.EVT_TEXT, self.onTextCtrlFloat)
|
||||
tc.SetFont(font)
|
||||
tc.Bind(wx.EVT_TEXT, self.onTextCtrlInteger)
|
||||
lsz.Add(tc)
|
||||
tc.SetToolTipString("Pulley teeth count. Count them!")
|
||||
self.tcPulleyTeeth = tc
|
||||
|
|
@ -104,11 +116,13 @@ class CalcBelt(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Result:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
tc = wx.StaticText(self, wx.ID_ANY, "", size = (200, -1),
|
||||
tc = wx.StaticText(self, wx.ID_ANY, "", size = (260, -1),
|
||||
style = wx.ALIGN_LEFT)
|
||||
tc.SetFont(font)
|
||||
lsz.Add(tc)
|
||||
self.tcResult = tc
|
||||
|
||||
|
|
@ -116,11 +130,13 @@ class CalcBelt(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Resolution:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
tc = wx.StaticText(self, wx.ID_ANY, "", size = (200, -1),
|
||||
tc = wx.StaticText(self, wx.ID_ANY, "", size = (260, -1),
|
||||
style = wx.ALIGN_LEFT)
|
||||
tc.SetFont(font)
|
||||
lsz.Add(tc)
|
||||
self.tcResolution = tc
|
||||
|
||||
|
|
@ -130,33 +146,41 @@ class CalcBelt(wx.Dialog):
|
|||
|
||||
bsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
b = wx.Button(self, wx.ID_ANY, "Use for X", size = BSIZESMALL)
|
||||
b.SetFont(font)
|
||||
self.Bind(wx.EVT_BUTTON, self.onUseForX, b)
|
||||
bsz.Add(b)
|
||||
self.bUseForX = b
|
||||
bsz.AddSpacer((5, 5))
|
||||
|
||||
b = wx.Button(self, wx.ID_ANY, "Use for Y", size = BSIZESMALL)
|
||||
b.SetFont(font)
|
||||
self.Bind(wx.EVT_BUTTON, self.onUseForY, b)
|
||||
bsz.Add(b)
|
||||
self.bUseForY = b
|
||||
bsz.AddSpacer((5, 5))
|
||||
|
||||
b = wx.Button(self, wx.ID_ANY, "Use for Z", size = BSIZESMALL)
|
||||
b.SetFont(font)
|
||||
self.Bind(wx.EVT_BUTTON, self.onUseForZ, b)
|
||||
bsz.Add(b)
|
||||
self.bUseForZ = b
|
||||
bsz.AddSpacer((5, 5))
|
||||
|
||||
b = wx.Button(self, wx.ID_ANY, "Use for E", size = BSIZESMALL)
|
||||
b.SetFont(font)
|
||||
self.Bind(wx.EVT_BUTTON, self.onUseForE, b)
|
||||
bsz.Add(b)
|
||||
self.bUseForE = b
|
||||
|
||||
sz.Add(bsz)
|
||||
sz.AddSpacer((10, 10))
|
||||
|
||||
hsz.Add(sz)
|
||||
hsz.AddSpacer((10, 10))
|
||||
|
||||
self.enableUseButtons(False)
|
||||
|
||||
self.SetSizer(sz)
|
||||
self.SetSizer(hsz)
|
||||
|
||||
self.Fit()
|
||||
|
||||
|
|
@ -227,6 +251,26 @@ class CalcBelt(wx.Dialog):
|
|||
def onChoice(self, evt):
|
||||
self.calculate()
|
||||
|
||||
def onTextCtrlInteger(self, evt):
|
||||
tc = evt.GetEventObject()
|
||||
w = tc.GetValue().strip()
|
||||
if w == "":
|
||||
valid = False
|
||||
else:
|
||||
m = reInteger.match(w)
|
||||
if m:
|
||||
valid = True
|
||||
else:
|
||||
valid = False
|
||||
|
||||
if valid:
|
||||
tc.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
|
||||
else:
|
||||
tc.SetBackgroundColour("pink")
|
||||
tc.Refresh()
|
||||
self.calculate()
|
||||
evt.Skip()
|
||||
|
||||
def onTextCtrlFloat(self, evt):
|
||||
tc = evt.GetEventObject()
|
||||
w = tc.GetValue().strip()
|
||||
|
|
|
|||
|
|
@ -4,14 +4,18 @@ from configtool.data import BSIZESMALL, reFloat
|
|||
|
||||
|
||||
class CalcScrew(wx.Dialog):
|
||||
def __init__(self, parent, cbUse):
|
||||
def __init__(self, parent, font, cbUse):
|
||||
wx.Dialog.__init__(self, parent, wx.ID_ANY,
|
||||
"Steps calculator for screw driven axes",
|
||||
size = (400, 204))
|
||||
self.SetFont(font)
|
||||
self.Bind(wx.EVT_CLOSE, self.onExit)
|
||||
|
||||
self.use = cbUse
|
||||
labelWidth = 110
|
||||
labelWidth = 150
|
||||
|
||||
hsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
hsz.AddSpacer((10, 10))
|
||||
|
||||
sz = wx.BoxSizer(wx.VERTICAL)
|
||||
sz.AddSpacer((10, 10))
|
||||
|
|
@ -19,6 +23,7 @@ class CalcScrew(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Step Angle:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
|
|
@ -26,6 +31,7 @@ class CalcScrew(wx.Dialog):
|
|||
"7.5 (48 per revolution)"]
|
||||
self.stepAngleValues = [200, 400, 48]
|
||||
tc = wx.Choice(self, wx.ID_ANY, choices = stepAngles)
|
||||
tc.SetFont(font)
|
||||
tc.SetSelection(0)
|
||||
tc.Bind(wx.EVT_CHOICE, self.onChoice)
|
||||
lsz.Add(tc)
|
||||
|
|
@ -38,6 +44,7 @@ class CalcScrew(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Microstepping:",
|
||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
|
|
@ -45,6 +52,7 @@ class CalcScrew(wx.Dialog):
|
|||
"1/8", "1/16", "1/32", "1/64", "1/128"]
|
||||
self.microSteppingValues = [1, 2, 4, 8, 16, 32, 64, 128]
|
||||
tc = wx.Choice(self, wx.ID_ANY, choices = microStepping)
|
||||
tc.SetFont(font)
|
||||
tc.Bind(wx.EVT_CHOICE, self.onChoice)
|
||||
tc.SetSelection(4)
|
||||
lsz.Add(tc)
|
||||
|
|
@ -60,10 +68,12 @@ class CalcScrew(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Screw Pitch (mm/rev):",
|
||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
tc = wx.TextCtrl(self, wx.ID_ANY, "2", style = wx.TE_RIGHT)
|
||||
tc.SetFont(font)
|
||||
tc.Bind(wx.EVT_TEXT, self.onTextCtrlFloat)
|
||||
lsz.Add(tc)
|
||||
tc.SetToolTipString("Screw pitch. Defined by the pitch of the screw.")
|
||||
|
|
@ -80,6 +90,7 @@ class CalcScrew(wx.Dialog):
|
|||
self.screwPresetValues = [-1, 1.25, 1.00, 0.8, 12.0, 16.0, 25.0, 1.41111,
|
||||
1.270, 1.5875]
|
||||
tc = wx.Choice(self, wx.ID_ANY, choices = screwPresets)
|
||||
tc.SetFont(font)
|
||||
tc.SetSelection(0)
|
||||
tc.Bind(wx.EVT_CHOICE, self.onPresetChoice)
|
||||
lsz.Add(tc)
|
||||
|
|
@ -92,10 +103,12 @@ class CalcScrew(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Gear Ratio:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
tc = wx.TextCtrl(self, wx.ID_ANY, "1", size = (40, -1), style = wx.TE_RIGHT)
|
||||
tc.SetFont(font)
|
||||
tc.Bind(wx.EVT_TEXT, self.onTextCtrlFloat)
|
||||
lsz.Add(tc)
|
||||
tc.SetToolTipString("Gear ratio. 1:1 if there is no gear.")
|
||||
|
|
@ -103,10 +116,12 @@ class CalcScrew(wx.Dialog):
|
|||
|
||||
lsz.AddSpacer((5, 5))
|
||||
st = wx.StaticText(self, wx.ID_ANY, ":")
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
tc = wx.TextCtrl(self, wx.ID_ANY, "1", size = (40, -1), style = wx.TE_RIGHT)
|
||||
tc.SetFont(font)
|
||||
tc.Bind(wx.EVT_TEXT, self.onTextCtrlFloat)
|
||||
lsz.Add(tc)
|
||||
tc.SetToolTipString("Gear ratio. 1:1 if there is no gear.")
|
||||
|
|
@ -118,11 +133,13 @@ class CalcScrew(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Result:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
tc = wx.StaticText(self, wx.ID_ANY, "", size = (300, -1),
|
||||
style = wx.ALIGN_LEFT)
|
||||
tc.SetFont(font)
|
||||
lsz.Add(tc)
|
||||
self.tcResult = tc
|
||||
|
||||
|
|
@ -130,11 +147,13 @@ class CalcScrew(wx.Dialog):
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, "Resolution:", size = (labelWidth, -1),
|
||||
style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(font)
|
||||
lsz.Add(st)
|
||||
lsz.AddSpacer((5, 5))
|
||||
|
||||
tc = wx.StaticText(self, wx.ID_ANY, "", size = (300, -1),
|
||||
style = wx.ALIGN_LEFT)
|
||||
tc.SetFont(font)
|
||||
lsz.Add(tc)
|
||||
self.tcResolution = tc
|
||||
|
||||
|
|
@ -144,33 +163,41 @@ class CalcScrew(wx.Dialog):
|
|||
|
||||
bsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
b = wx.Button(self, wx.ID_ANY, "Use for X", size = BSIZESMALL)
|
||||
b.SetFont(font)
|
||||
self.Bind(wx.EVT_BUTTON, self.onUseForX, b)
|
||||
bsz.Add(b)
|
||||
self.bUseForX = b
|
||||
bsz.AddSpacer((5, 5))
|
||||
|
||||
b = wx.Button(self, wx.ID_ANY, "Use for Y", size = BSIZESMALL)
|
||||
b.SetFont(font)
|
||||
self.Bind(wx.EVT_BUTTON, self.onUseForY, b)
|
||||
bsz.Add(b)
|
||||
self.bUseForY = b
|
||||
bsz.AddSpacer((5, 5))
|
||||
|
||||
b = wx.Button(self, wx.ID_ANY, "Use for Z", size = BSIZESMALL)
|
||||
b.SetFont(font)
|
||||
self.Bind(wx.EVT_BUTTON, self.onUseForZ, b)
|
||||
bsz.Add(b)
|
||||
self.bUseForZ = b
|
||||
bsz.AddSpacer((5, 5))
|
||||
|
||||
b = wx.Button(self, wx.ID_ANY, "Use for E", size = BSIZESMALL)
|
||||
b.SetFont(font)
|
||||
self.Bind(wx.EVT_BUTTON, self.onUseForE, b)
|
||||
bsz.Add(b)
|
||||
self.bUseForE = b
|
||||
|
||||
sz.Add(bsz, flag = wx.ALIGN_CENTER_HORIZONTAL)
|
||||
sz.AddSpacer((10, 10))
|
||||
|
||||
hsz.Add(sz)
|
||||
hsz.AddSpacer((10, 10))
|
||||
|
||||
self.enableUseButtons(False)
|
||||
|
||||
self.SetSizer(sz)
|
||||
self.SetSizer(hsz)
|
||||
|
||||
self.Fit()
|
||||
|
||||
|
|
|
|||
|
|
@ -4,33 +4,44 @@ from configtool.page import Page
|
|||
|
||||
|
||||
class CommunicationsPage(wx.Panel, Page):
|
||||
def __init__(self, parent, nb, idPg):
|
||||
def __init__(self, parent, nb, idPg, font):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
Page.__init__(self)
|
||||
Page.__init__(self, font)
|
||||
self.parent = parent
|
||||
self.id = idPg
|
||||
self.defaultBaud = '115200'
|
||||
|
||||
self.bauds = ['19200', '38400', '57600', self.defaultBaud]
|
||||
|
||||
self.labels = {'BAUD': "Baud Rate:", 'USB_SERIAL': "USB Serial"}
|
||||
self.labels = {'XONXOFF': "XON/XOFF Flow Control", 'BAUD': "Baud Rate:",
|
||||
'USB_SERIAL': "USB Serial"}
|
||||
|
||||
sz = wx.GridBagSizer()
|
||||
sz.AddSpacer((20, 40), pos = (0, 0))
|
||||
|
||||
ch = self.addChoice('BAUD', self.bauds, self.bauds.index(self.defaultBaud),
|
||||
60, self.onChoice)
|
||||
sz.Add(ch, pos = (1, 1))
|
||||
|
||||
sz.AddSpacer((100, 10), pos = (1, 2))
|
||||
|
||||
k = 'USB_SERIAL'
|
||||
cb = self.addCheckBox(k, self.onCheckBox)
|
||||
sz.Add(cb, pos = (1, 3))
|
||||
cb = self.addCheckBox(k, self.onUSBCheckBox)
|
||||
sz.Add(cb, pos = (1, 1))
|
||||
|
||||
ch = self.addChoice('BAUD', self.bauds, self.bauds.index(self.defaultBaud),
|
||||
80, self.onChoice)
|
||||
sz.Add(ch, pos = (1, 3))
|
||||
|
||||
cb = self.addCheckBox('XONXOFF', self.onCheckBox)
|
||||
sz.Add(cb, pos = (3, 3))
|
||||
|
||||
sz.AddSpacer((100, 10), pos = (2, 2))
|
||||
|
||||
self.SetSizer(sz)
|
||||
self.enableAll(False)
|
||||
|
||||
def onUSBCheckBox(self, evt):
|
||||
self.assertModified(True)
|
||||
f = not self.checkBoxes['USB_SERIAL'].IsChecked()
|
||||
self.checkBoxes['XONXOFF'].Enable(f)
|
||||
self.choices['BAUD'].Enable(f)
|
||||
evt.Skip()
|
||||
|
||||
def insertValues(self, cfgValues):
|
||||
self.assertValid(True)
|
||||
self.enableAll(True)
|
||||
|
|
@ -44,5 +55,17 @@ class CommunicationsPage(wx.Panel, Page):
|
|||
self.checkBoxes[k].SetValue(False)
|
||||
|
||||
self.setChoice('BAUD', cfgValues, self.defaultBaud)
|
||||
if self.checkBoxes['USB_SERIAL'].IsChecked():
|
||||
self.checkBoxes['XONXOFF'].Enable(False)
|
||||
self.choices['BAUD'].Enable(False)
|
||||
|
||||
self.assertModified(False)
|
||||
|
||||
def getValues(self):
|
||||
result = Page.getValues(self)
|
||||
|
||||
if result['USB_SERIAL']:
|
||||
result['BAUD'] = ""
|
||||
result['XONXOFF'] = False
|
||||
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ from configtool.data import supportedCPUs
|
|||
|
||||
|
||||
class CpuPage(wx.Panel, Page):
|
||||
def __init__(self, parent, nb, idPg):
|
||||
def __init__(self, parent, nb, idPg, font):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
Page.__init__(self)
|
||||
Page.__init__(self, font)
|
||||
self.parent = parent
|
||||
self.id = idPg
|
||||
|
||||
self.labels = {'MOTHERBOARD': "Motherboard", 'F_CPU': "CPU Clock Rate:"}
|
||||
self.labels = {'F_CPU': "CPU Clock Rate:"}
|
||||
self.defaultClock = '16000000UL'
|
||||
self.clocks = ['8000000UL', self.defaultClock, '20000000UL']
|
||||
self.processors = []
|
||||
|
|
@ -19,18 +19,11 @@ class CpuPage(wx.Panel, Page):
|
|||
sz = wx.GridBagSizer()
|
||||
sz.AddSpacer((20, 40), pos = (0, 0))
|
||||
|
||||
|
||||
k = 'MOTHERBOARD'
|
||||
cb = self.addCheckBox(k, self.onCheckBox)
|
||||
sz.Add(cb, pos = (1, 1))
|
||||
sz.AddSpacer((100, 10), pos = (1, 2))
|
||||
|
||||
|
||||
k = 'F_CPU'
|
||||
ch = self.addChoice(k, self.clocks, self.clocks.index(self.defaultClock),
|
||||
80, self.onChoice)
|
||||
sz.Add(ch, pos = (1, 3))
|
||||
sz.AddSpacer((100, 10), pos = (1, 4))
|
||||
100, self.onChoice)
|
||||
sz.Add(ch, pos = (1, 1))
|
||||
sz.AddSpacer((100, 10), pos = (1, 2))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Processor Type(s)")
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
|
|
@ -43,7 +36,7 @@ class CpuPage(wx.Panel, Page):
|
|||
sbox.AddSpacer((120, 5))
|
||||
|
||||
sbox.AddSpacer((5, 5))
|
||||
sz.Add(sbox, pos = (1, 5), span = (3, 1))
|
||||
sz.Add(sbox, pos = (1, 3), span = (3, 1))
|
||||
|
||||
self.SetSizer(sz)
|
||||
self.enableAll(False)
|
||||
|
|
|
|||
|
|
@ -4,18 +4,29 @@ import re
|
|||
|
||||
VERSION = "0.1"
|
||||
|
||||
supportedCPUs = ['ATmega168', 'ATmega328P', 'ATmega644P', 'ATmega644PA',
|
||||
'ATmega1280', 'ATmega1284P', 'ATmega2560', 'AT90USB1286']
|
||||
supportedCPUs = ['ATmega168', 'ATmega328P', 'ATmega644', 'ATmega644P',
|
||||
'ATmega644PA', 'ATmega1280', 'ATmega1284', 'ATmega1284P',
|
||||
'ATmega2560', 'AT90USB1286']
|
||||
|
||||
pinNames = ["AIO%d" % x for x in range(16)] + ["DIO%d" % x for x in range(64)]
|
||||
pinNamesWithBlank = ["-"] + pinNames
|
||||
|
||||
sensorTypes = {'MAX6675': "TT_MAX6675", 'Thermistor': "TT_THERMISTOR",
|
||||
'AD595': "TT_AD595", 'PT100': "TT_PT100",
|
||||
'Intercom': "TT_INTERCOM"}
|
||||
|
||||
BSIZE = (90, 60)
|
||||
BSIZESMALL = (90, 30)
|
||||
|
||||
|
||||
TYPE_GENERAL = 0
|
||||
TYPE_FLOAT = 1
|
||||
|
||||
reDefQSm = re.compile("\s*#define\s+(\S+)\s+(.*)")
|
||||
reDefQSm2 = re.compile("\s*(\"[^\"]*\")")
|
||||
|
||||
reInclude = re.compile("^\s*#include\s+\"([^\"]*)")
|
||||
reFloatAttr = re.compile("/\*\s*float\s*\*/")
|
||||
reDefine = re.compile("\s*#define\s+(\w+)\s+(\S+)")
|
||||
reDefineBL = re.compile("^\s*#define\s+(\w+)\s+(\S+)")
|
||||
reCommDefBL = re.compile("^\s*//\s*#define\s+(\w+)\s+(\S+)")
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ import wx
|
|||
|
||||
|
||||
class HeaterList(wx.ListCtrl):
|
||||
def __init__(self, parent):
|
||||
def __init__(self, parent, font):
|
||||
self.parent = parent
|
||||
self.currentItem = None
|
||||
wx.ListCtrl.__init__(self, parent, wx.ID_ANY, size = (165 + 4, 100),
|
||||
wx.ListCtrl.__init__(self, parent, wx.ID_ANY,
|
||||
size = (95 + 55 + 55 + 4, 100),
|
||||
style = wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES |
|
||||
wx.LC_VRULES)
|
||||
self.SetFont(font)
|
||||
|
||||
self.valid = []
|
||||
self.heaterList = []
|
||||
|
|
@ -16,7 +18,7 @@ class HeaterList(wx.ListCtrl):
|
|||
self.InsertColumn(0, "Name")
|
||||
self.InsertColumn(1, "Pin")
|
||||
self.InsertColumn(2, "PWM")
|
||||
self.SetColumnWidth(0, 55)
|
||||
self.SetColumnWidth(0, 95)
|
||||
self.SetColumnWidth(1, 55)
|
||||
self.SetColumnWidth(2, 55)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@ from configtool.addheaterdlg import AddHeaterDlg
|
|||
|
||||
|
||||
class HeatersPage(wx.Panel, Page):
|
||||
def __init__(self, parent, nb, idPg):
|
||||
def __init__(self, parent, nb, idPg, font):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
Page.__init__(self)
|
||||
Page.__init__(self, font)
|
||||
self.parent = parent
|
||||
self.font = font
|
||||
self.id = idPg
|
||||
|
||||
sz = wx.GridBagSizer()
|
||||
|
|
@ -20,11 +21,13 @@ class HeatersPage(wx.Panel, Page):
|
|||
self.validPins = pinNames
|
||||
|
||||
|
||||
self.lb = HeaterList(self)
|
||||
sz.Add(self.lb, pos = (1, 1), span = (1, 3))
|
||||
self.lb = HeaterList(self, font)
|
||||
sz.Add(self.lb, pos = (1, 1))
|
||||
sz.AddSpacer((20, 20), pos = (1, 2))
|
||||
|
||||
bsz = wx.BoxSizer(wx.VERTICAL)
|
||||
self.bAdd = wx.Button(self, wx.ID_ANY, "Add", size = BSIZESMALL)
|
||||
self.bAdd.SetFont(font)
|
||||
self.Bind(wx.EVT_BUTTON, self.doAdd, self.bAdd)
|
||||
self.bAdd.SetToolTipString("Add a heater to the configuration.")
|
||||
|
||||
|
|
@ -32,13 +35,14 @@ class HeatersPage(wx.Panel, Page):
|
|||
|
||||
bsz.AddSpacer((10, 10))
|
||||
self.bDelete = wx.Button(self, wx.ID_ANY, "Delete", size = BSIZESMALL)
|
||||
self.bDelete.SetFont(font)
|
||||
self.bDelete.Enable(False)
|
||||
self.Bind(wx.EVT_BUTTON, self.doDelete, self.bDelete)
|
||||
bsz.Add(self.bDelete)
|
||||
self.bDelete.SetToolTipString("Remove the selected heater from the "
|
||||
"configuration.")
|
||||
|
||||
sz.Add(bsz, pos = (1, 4))
|
||||
sz.Add(bsz, pos = (1, 3))
|
||||
|
||||
self.SetSizer(sz)
|
||||
self.enableAll(False)
|
||||
|
|
@ -59,7 +63,7 @@ class HeatersPage(wx.Panel, Page):
|
|||
for s in self.heaters:
|
||||
nm.append(s[0])
|
||||
|
||||
dlg = AddHeaterDlg(self, nm, self.validPins)
|
||||
dlg = AddHeaterDlg(self, nm, self.validPins, self.font)
|
||||
rc = dlg.ShowModal()
|
||||
if rc == wx.ID_OK:
|
||||
ht = dlg.getValues()
|
||||
|
|
@ -73,6 +77,7 @@ class HeatersPage(wx.Panel, Page):
|
|||
self.lb.updateList(self.heaters)
|
||||
self.validateTable()
|
||||
self.parent.setHeaters(self.heaters)
|
||||
self.assertModified(True)
|
||||
|
||||
def doDelete(self, evt):
|
||||
if self.selection is None:
|
||||
|
|
@ -84,6 +89,7 @@ class HeatersPage(wx.Panel, Page):
|
|||
self.lb.updateList(self.heaters)
|
||||
self.validateTable()
|
||||
self.parent.setHeaters(self.heaters)
|
||||
self.assertModified(True)
|
||||
|
||||
def insertValues(self, cfgValues):
|
||||
self.enableAll(True)
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@ from configtool.calcscrew import CalcScrew
|
|||
|
||||
|
||||
class MechanicalPage(wx.Panel, Page):
|
||||
def __init__(self, parent, nb, idPg):
|
||||
def __init__(self, parent, nb, idPg, font):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
Page.__init__(self)
|
||||
Page.__init__(self, font)
|
||||
self.id = idPg
|
||||
self.parent = parent
|
||||
self.font = font
|
||||
|
||||
self.spmKeys = ['STEPS_PER_M_X', 'STEPS_PER_M_Y', 'STEPS_PER_M_Z',
|
||||
'STEPS_PER_M_E']
|
||||
|
|
@ -50,50 +51,55 @@ class MechanicalPage(wx.Panel, Page):
|
|||
sz.AddSpacer((90, 10), pos = (0, 4))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Steps Per Meter")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k in self.spmKeys:
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlFloat)
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlInteger)
|
||||
sbox.Add(tc)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
sz.Add(sbox, pos = (1, 1))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Maximum Feedrate")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k in self.mfrKeys:
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlFloat)
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlInteger)
|
||||
sbox.Add(tc)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
sz.Add(sbox, pos = (1, 5))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Search Feedrate")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k in self.msrKeys:
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlFloat)
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlInteger)
|
||||
sbox.Add(tc)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
sz.Add(sbox, pos = (1, 7))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Endstop Clearance")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k in self.eclKeys:
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlFloat)
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlInteger)
|
||||
sbox.Add(tc)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
sz.Add(sbox, pos = (3, 5))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Travel Limits")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k in self.minmaxKeys:
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlFloat)
|
||||
tc = self.addTextCtrl(k, labelWidth + 20, self.onTextCtrlInteger)
|
||||
sbox.Add(tc)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
|
|
@ -102,6 +108,7 @@ class MechanicalPage(wx.Panel, Page):
|
|||
vsz = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Kinematics")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
style = wx.RB_GROUP
|
||||
|
|
@ -122,12 +129,14 @@ class MechanicalPage(wx.Panel, Page):
|
|||
|
||||
bsz = wx.BoxSizer(wx.VERTICAL)
|
||||
b = wx.Button(self, wx.ID_ANY, "Calculate\nBelt Driven", size = BSIZE)
|
||||
b.SetFont(font)
|
||||
b.SetToolTipString("Open the calculator for axes that are belt-driven.")
|
||||
self.Bind(wx.EVT_BUTTON, self.onCalcBelt, b)
|
||||
self.bCalcBelt = b
|
||||
|
||||
bsz.Add(b, 1, wx.ALL, 5)
|
||||
b = wx.Button(self, wx.ID_ANY, "Calculate\nScrew Driven", size = BSIZE)
|
||||
b.SetFont(font)
|
||||
bsz.Add(b, 1, wx.ALL, 5)
|
||||
b.SetToolTipString("Open the calculator for axes that are screw-driven.")
|
||||
self.Bind(wx.EVT_BUTTON, self.onCalcScrew, b)
|
||||
|
|
@ -147,7 +156,7 @@ class MechanicalPage(wx.Panel, Page):
|
|||
evt.Skip()
|
||||
|
||||
def onCalcBelt(self, evt):
|
||||
dlg = CalcBelt(self, self.cbCalcBelt)
|
||||
dlg = CalcBelt(self, self.font, self.cbCalcBelt)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
|
|
@ -156,7 +165,7 @@ class MechanicalPage(wx.Panel, Page):
|
|||
self.textControls[field].SetValue(s)
|
||||
|
||||
def onCalcScrew(self, evt):
|
||||
dlg = CalcScrew(self, self.cbCalcScrew)
|
||||
dlg = CalcScrew(self, self.font, self.cbCalcScrew)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@ from configtool.data import reFloat
|
|||
|
||||
|
||||
class MiscellaneousPage(wx.Panel, Page):
|
||||
def __init__(self, parent, nb, idPg):
|
||||
def __init__(self, parent, nb, idPg, font):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
Page.__init__(self)
|
||||
Page.__init__(self, font)
|
||||
self.parent = parent
|
||||
self.id = idPg
|
||||
self.font = font
|
||||
|
||||
self.labels = {'USE_INTERNAL_PULLUPS': "Use Internal Pullups",
|
||||
'EECONFIG': "Enable EEPROM Storage",
|
||||
|
|
@ -79,13 +80,9 @@ class MiscellaneousPage(wx.Panel, Page):
|
|||
cb = self.addCheckBox(k, self.onCheckBox)
|
||||
sz.Add(cb, pos = (6, 1))
|
||||
|
||||
k = 'XONXOFF'
|
||||
cb = self.addCheckBox(k, self.onCheckBox)
|
||||
sz.Add(cb, pos = (7, 1))
|
||||
|
||||
k = 'HEATER_SANITY_CHECK'
|
||||
cb = self.addCheckBox(k, self.onCheckBox)
|
||||
sz.Add(cb, pos = (8, 1))
|
||||
sz.Add(cb, pos = (7, 1))
|
||||
|
||||
k = 'REFERENCE'
|
||||
ch = self.addChoice(k, self.references,
|
||||
|
|
@ -94,6 +91,7 @@ class MiscellaneousPage(wx.Panel, Page):
|
|||
sz.Add(ch, pos = (1, 3))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "BANG BANG Bed Control")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
|
|
@ -103,18 +101,19 @@ class MiscellaneousPage(wx.Panel, Page):
|
|||
sbox.AddSpacer((5, 20))
|
||||
|
||||
k = 'BANG_BANG_ON'
|
||||
tc = self.addTextCtrl(k, 80, self.onTextCtrlInteger)
|
||||
tc = self.addTextCtrl(k, 100, self.onTextCtrlInteger)
|
||||
sbox.Add(tc)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
k = 'BANG_BANG_OFF'
|
||||
tc = self.addTextCtrl(k, 80, self.onTextCtrlInteger)
|
||||
tc = self.addTextCtrl(k, 100, self.onTextCtrlInteger)
|
||||
sbox.Add(tc)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
sz.Add(sbox, pos = (3, 3), span = (4, 1), flag = wx.ALIGN_CENTER_HORIZONTAL)
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "DC Motor Extruder")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
|
|
@ -130,6 +129,8 @@ class MiscellaneousPage(wx.Panel, Page):
|
|||
|
||||
sz.Add(sbox, pos = (8,3), flag = wx.ALIGN_CENTER_HORIZONTAL)
|
||||
|
||||
labelWidth = 180;
|
||||
|
||||
k = 'MOVEBUFFER_SIZE'
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlInteger)
|
||||
sz.Add(tc, pos = (1, 5))
|
||||
|
|
@ -147,7 +148,7 @@ class MiscellaneousPage(wx.Panel, Page):
|
|||
sz.Add(tc, pos = (4, 5))
|
||||
|
||||
k = 'TEMP_HYSTERESIS'
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlFloat)
|
||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlInteger)
|
||||
sz.Add(tc, pos = (6, 5))
|
||||
|
||||
k = 'TEMP_RESIDENCY_TIME'
|
||||
|
|
@ -195,9 +196,9 @@ class MiscellaneousPage(wx.Panel, Page):
|
|||
self.boardHeaters = [s[0] for s in hlist]
|
||||
self.heaterNames = [self.heaterNameNone] + self.boardHeaters
|
||||
self.choices[k].Clear()
|
||||
self.choices[k].SetFont(self.font)
|
||||
for h in self.heaterNames:
|
||||
self.choices[k].Append(h)
|
||||
self.choiceOptions[k] = self.heaterNames
|
||||
|
||||
try:
|
||||
v = self.heaterNames.index(currentChoice)
|
||||
|
|
@ -220,7 +221,7 @@ class MiscellaneousPage(wx.Panel, Page):
|
|||
hname = h[len("HEATER_"):]
|
||||
else:
|
||||
hname = h
|
||||
if len(self.boardHeaters) != 0:
|
||||
if hname and len(self.boardHeaters) != 0:
|
||||
if hname not in self.boardHeaters:
|
||||
dlg = wx.MessageDialog(self,
|
||||
"Printer: Miscellaneous tab:\nDC Extruder "
|
||||
|
|
@ -233,12 +234,12 @@ class MiscellaneousPage(wx.Panel, Page):
|
|||
self.heaterNames = [self.heaterNameNone] + self.boardHeaters
|
||||
else:
|
||||
self.heaterNames = [self.heaterNameNone]
|
||||
if h and h != self.heaterNameNone:
|
||||
if hname and hname != self.heaterNameNone:
|
||||
self.heaterNames.append(hname)
|
||||
self.choices[k].Clear()
|
||||
self.choices[k].SetFont(self.font)
|
||||
for ht in self.heaterNames:
|
||||
self.choices[k].Append(ht)
|
||||
self.choiceOptions[k] = self.heaterNames
|
||||
if hname:
|
||||
try:
|
||||
v = self.heaterNames.index(hname)
|
||||
|
|
@ -282,7 +283,7 @@ class MiscellaneousPage(wx.Panel, Page):
|
|||
|
||||
k = "DC_EXTRUDER"
|
||||
s = self.choices[k].GetSelection()
|
||||
v = self.choiceOptions[k][s]
|
||||
v = self.choices[k].GetString(s)
|
||||
if v == self.heaterNameNone:
|
||||
result[k] = ""
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
import wx
|
||||
|
||||
from configtool.data import pinNames, pinNamesWithBlank, reInteger, reFloat
|
||||
from configtool.data import reInteger, reFloat
|
||||
|
||||
|
||||
class Page:
|
||||
def __init__(self):
|
||||
def __init__(self, font):
|
||||
self.modified = False
|
||||
self.valid = True
|
||||
self.fieldValid = {}
|
||||
|
|
@ -13,7 +13,8 @@ class Page:
|
|||
self.checkBoxes = {}
|
||||
self.radioButtons = {}
|
||||
self.choices = {}
|
||||
self.choiceOptions = {}
|
||||
self.font = font
|
||||
|
||||
|
||||
def enableAll(self, flag = True):
|
||||
for c in self.textControls.keys():
|
||||
|
|
@ -27,11 +28,13 @@ class Page:
|
|||
|
||||
def addTextCtrl(self, name, labelWidth, validator):
|
||||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, self.labels[name],
|
||||
st = wx.StaticText(self, wx.ID_ANY, self.labels[name] + " ",
|
||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(self.font)
|
||||
lsz.Add(st)
|
||||
|
||||
tc = wx.TextCtrl(self, wx.ID_ANY, "", style = wx.TE_RIGHT, name = name)
|
||||
tc.SetFont(self.font)
|
||||
self.fieldValid[name] = True
|
||||
tc.Bind(wx.EVT_TEXT, validator)
|
||||
self.textControls[name] = tc
|
||||
|
|
@ -45,6 +48,7 @@ class Page:
|
|||
else:
|
||||
lbl = name
|
||||
cb = wx.CheckBox(self, wx.ID_ANY, lbl)
|
||||
cb.SetFont(self.font)
|
||||
cb.Bind(wx.EVT_CHECKBOX, validator)
|
||||
self.checkBoxes[name] = cb
|
||||
|
||||
|
|
@ -52,6 +56,7 @@ class Page:
|
|||
|
||||
def addRadioButton(self, name, style, validator):
|
||||
rb = wx.RadioButton(self, wx.ID_ANY, self.labels[name], style = style)
|
||||
rb.SetFont(self.font)
|
||||
self.Bind(wx.EVT_RADIOBUTTON, validator, rb)
|
||||
self.radioButtons[name] = rb
|
||||
|
||||
|
|
@ -61,32 +66,35 @@ class Page:
|
|||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, self.labels[name],
|
||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(self.font)
|
||||
lsz.Add(st)
|
||||
|
||||
ch = wx.Choice(self, wx.ID_ANY, choices = choices, name = name)
|
||||
ch.SetFont(self.font)
|
||||
ch.Bind(wx.EVT_CHOICE, validator)
|
||||
ch.SetSelection(selection)
|
||||
lsz.Add(ch)
|
||||
self.choices[name] = ch
|
||||
self.choiceOptions[name] = choices
|
||||
|
||||
return lsz
|
||||
|
||||
def addPinChoice(self, name, choiceVal, allowBlank, labelWidth):
|
||||
def addPinChoice(self, name, choiceVal, pins, allowBlank , labelWidth):
|
||||
lsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||
st = wx.StaticText(self, wx.ID_ANY, self.labels[name],
|
||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||
st.SetFont(self.font)
|
||||
lsz.Add(st)
|
||||
|
||||
if allowBlank:
|
||||
opts = pinNamesWithBlank
|
||||
opts = ["-"] + pins
|
||||
else:
|
||||
opts = pinNames
|
||||
opts = pins
|
||||
|
||||
ch = wx.Choice(self, wx.ID_ANY, choices = opts, name = name)
|
||||
ch = wx.Choice(self, wx.ID_ANY, choices = opts, name = name,
|
||||
style = wx.CB_SORT)
|
||||
ch.SetFont(self.font)
|
||||
ch.Bind(wx.EVT_CHOICE, self.onChoice)
|
||||
self.choices[name] = ch
|
||||
self.choiceOptions[name] = opts
|
||||
try:
|
||||
sv = self.pinNames.index(choiceVal)
|
||||
except:
|
||||
|
|
@ -102,12 +110,10 @@ class Page:
|
|||
else:
|
||||
bv = default
|
||||
|
||||
try:
|
||||
s = self.choiceOptions[name].index(bv)
|
||||
except:
|
||||
try:
|
||||
s = self.choiceOptions[name].index(default)
|
||||
except:
|
||||
s = self.choices[name].FindString(bv)
|
||||
if s < 0:
|
||||
s = self.choices[name].FindString(default)
|
||||
if s < 0:
|
||||
s = 0
|
||||
|
||||
self.choices[name].SetSelection(s)
|
||||
|
|
@ -209,7 +215,7 @@ class Page:
|
|||
|
||||
for k in self.choices.keys():
|
||||
v = self.choices[k].GetSelection()
|
||||
result[k] = self.choiceOptions[k][v]
|
||||
result[k] = self.choices[k].GetString(v)
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
|
||||
import wx
|
||||
from configtool.page import Page
|
||||
from configtool.data import pinNames
|
||||
|
||||
|
||||
class PinoutsPage(wx.Panel, Page):
|
||||
def __init__(self, parent, nb, idPg):
|
||||
def __init__(self, parent, nb, idPg, font):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
Page.__init__(self)
|
||||
Page.__init__(self, font)
|
||||
self.parent = parent
|
||||
self.id = idPg
|
||||
|
||||
|
|
@ -68,6 +69,7 @@ class PinoutsPage(wx.Panel, Page):
|
|||
sz.AddSpacer((10, 10), pos = (0, 0))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "X Axis")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k, ctype in pinXkeys:
|
||||
|
|
@ -75,7 +77,7 @@ class PinoutsPage(wx.Panel, Page):
|
|||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlPin)
|
||||
sbox.Add(tc)
|
||||
elif ctype == 2:
|
||||
tc = self.addPinChoice(k, "", True, labelWidth)
|
||||
tc = self.addPinChoice(k, "", pinNames, True, labelWidth)
|
||||
sbox.Add(tc)
|
||||
else:
|
||||
cb = self.addCheckBox(k, self.onCheckBox)
|
||||
|
|
@ -86,6 +88,7 @@ class PinoutsPage(wx.Panel, Page):
|
|||
sz.Add(sbox, pos = (1, 1))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Y Axis")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k, ctype in pinYkeys:
|
||||
|
|
@ -93,7 +96,7 @@ class PinoutsPage(wx.Panel, Page):
|
|||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlPin)
|
||||
sbox.Add(tc)
|
||||
elif ctype == 2:
|
||||
tc = self.addPinChoice(k, "", True, labelWidth)
|
||||
tc = self.addPinChoice(k, "", pinNames, True, labelWidth)
|
||||
sbox.Add(tc)
|
||||
else:
|
||||
cb = self.addCheckBox(k, self.onCheckBox)
|
||||
|
|
@ -104,6 +107,7 @@ class PinoutsPage(wx.Panel, Page):
|
|||
sz.Add(sbox, pos = (1, 3))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Z Axis")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k, ctype in pinZkeys:
|
||||
|
|
@ -111,7 +115,7 @@ class PinoutsPage(wx.Panel, Page):
|
|||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlPin)
|
||||
sbox.Add(tc)
|
||||
elif ctype == 2:
|
||||
tc = self.addPinChoice(k, "", True, labelWidth)
|
||||
tc = self.addPinChoice(k, "", pinNames, True, labelWidth)
|
||||
sbox.Add(tc)
|
||||
else:
|
||||
cb = self.addCheckBox(k, self.onCheckBox)
|
||||
|
|
@ -122,6 +126,7 @@ class PinoutsPage(wx.Panel, Page):
|
|||
sz.Add(sbox, pos = (1, 5))
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "E Axis")
|
||||
b.SetFont(font)
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k, ctype in pinEkeys:
|
||||
|
|
@ -129,7 +134,7 @@ class PinoutsPage(wx.Panel, Page):
|
|||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlPin)
|
||||
sbox.Add(tc)
|
||||
elif ctype == 2:
|
||||
tc = self.addPinChoice(k, "", True, labelWidth)
|
||||
tc = self.addPinChoice(k, "", pinNames, True, labelWidth)
|
||||
sbox.Add(tc)
|
||||
else:
|
||||
cb = self.addCheckBox(k, self.onCheckBox)
|
||||
|
|
@ -140,7 +145,7 @@ class PinoutsPage(wx.Panel, Page):
|
|||
sz.Add(sbox, pos = (1, 7))
|
||||
|
||||
k = "STEPPER_ENABLE_PIN"
|
||||
tc = self.addPinChoice(k, "", True, labelWidth)
|
||||
tc = self.addPinChoice(k, "", pinNames, True, labelWidth + 20)
|
||||
sz.Add(tc, pos = (3, 1))
|
||||
|
||||
sz.AddSpacer((10, 10), pos = (4, 1))
|
||||
|
|
@ -150,20 +155,24 @@ class PinoutsPage(wx.Panel, Page):
|
|||
sz.Add(cb, pos = (5, 1), flag = wx.ALIGN_CENTER_HORIZONTAL)
|
||||
|
||||
k = "PS_ON_PIN"
|
||||
tc = self.addPinChoice(k, "", True, labelWidth)
|
||||
tc = self.addPinChoice(k, "", pinNames, True, labelWidth)
|
||||
sz.Add(tc, pos = (3, 3))
|
||||
|
||||
k = "PS_MOSFET_PIN"
|
||||
tc = self.addPinChoice(k, "", True, labelWidth)
|
||||
tc = self.addPinChoice(k, "", pinNames, True, labelWidth)
|
||||
sz.Add(tc, pos = (5, 3))
|
||||
|
||||
k = "DEBUG_LED_PIN"
|
||||
tc = self.addPinChoice(k, "", True, labelWidth)
|
||||
tc = self.addPinChoice(k, "", pinNames, True, labelWidth)
|
||||
sz.Add(tc, pos = (3, 7))
|
||||
|
||||
self.SetSizer(sz)
|
||||
self.enableAll(False)
|
||||
|
||||
def onChoice(self, evt):
|
||||
self.assertModified(True)
|
||||
evt.Skip()
|
||||
|
||||
def insertValues(self, cfgValues):
|
||||
self.assertValid(True)
|
||||
self.enableAll(True)
|
||||
|
|
|
|||
|
|
@ -6,17 +6,20 @@ import re
|
|||
from configtool.data import (defineValueFormat, defineBoolFormat, reCommDefBL,
|
||||
reCommDefBoolBL, reHelpTextStart, reHelpTextEnd,
|
||||
reDefine, reDefineBL, reDefQS, reDefQSm,
|
||||
reDefQSm2, reDefBool, reDefBoolBL)
|
||||
reDefQSm2, reDefBool, reDefBoolBL, reFloatAttr,
|
||||
TYPE_FLOAT, TYPE_GENERAL)
|
||||
from configtool.mechanicalpage import MechanicalPage
|
||||
from configtool.accelerationpage import AccelerationPage
|
||||
from configtool.miscellaneouspage import MiscellaneousPage
|
||||
|
||||
|
||||
class PrinterPanel(wx.Panel):
|
||||
def __init__(self, parent, nb, folder):
|
||||
def __init__(self, parent, nb, font, folder):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
self.parent = parent
|
||||
|
||||
self.configFile = None
|
||||
|
||||
self.cfgValues = {}
|
||||
self.heaters = []
|
||||
self.dir = os.path.join(folder, "config")
|
||||
|
|
@ -25,13 +28,14 @@ class PrinterPanel(wx.Panel):
|
|||
|
||||
self.nb = wx.Notebook(self, wx.ID_ANY, size = (21, 21),
|
||||
style = wx.BK_DEFAULT)
|
||||
self.nb.SetFont(font)
|
||||
|
||||
self.pages = []
|
||||
self.titles = []
|
||||
self.pageModified = []
|
||||
self.pageValid = []
|
||||
|
||||
self.pgMech = MechanicalPage(self, self.nb, len(self.pages))
|
||||
self.pgMech = MechanicalPage(self, self.nb, len(self.pages), font)
|
||||
text = "Mechanical"
|
||||
self.nb.AddPage(self.pgMech, text)
|
||||
self.pages.append(self.pgMech)
|
||||
|
|
@ -39,7 +43,7 @@ class PrinterPanel(wx.Panel):
|
|||
self.pageModified.append(False)
|
||||
self.pageValid.append(True)
|
||||
|
||||
self.pgAcc = AccelerationPage(self, self.nb, len(self.pages))
|
||||
self.pgAcc = AccelerationPage(self, self.nb, len(self.pages), font)
|
||||
text = "Acceleration"
|
||||
self.nb.AddPage(self.pgAcc, text)
|
||||
self.pages.append(self.pgAcc)
|
||||
|
|
@ -47,7 +51,8 @@ class PrinterPanel(wx.Panel):
|
|||
self.pageModified.append(False)
|
||||
self.pageValid.append(True)
|
||||
|
||||
self.pgMiscellaneous = MiscellaneousPage(self, self.nb, len(self.pages))
|
||||
self.pgMiscellaneous = MiscellaneousPage(self, self.nb, len(self.pages),
|
||||
font)
|
||||
text = "Miscellaneous"
|
||||
self.nb.AddPage(self.pgMiscellaneous, text)
|
||||
self.pages.append(self.pgMiscellaneous)
|
||||
|
|
@ -58,15 +63,10 @@ class PrinterPanel(wx.Panel):
|
|||
sz.Add(self.nb, 1, wx.EXPAND + wx.ALL, 5)
|
||||
|
||||
self.SetSizer(sz)
|
||||
self.Fit()
|
||||
|
||||
def onPageChange(self, evt):
|
||||
print "printer notebook page changed"
|
||||
print evt.GetSelection()
|
||||
print evt.GetEventObject()
|
||||
evt.Skip()
|
||||
|
||||
def checkFocus(self):
|
||||
print "check focus: ", self.nb.GetSelection()
|
||||
def getFileName(self):
|
||||
return self.configFile
|
||||
|
||||
def assertModified(self, pg, flag = True):
|
||||
self.pageModified[pg] = flag
|
||||
|
|
@ -150,20 +150,6 @@ class PrinterPanel(wx.Panel):
|
|||
dlg.Destroy()
|
||||
return
|
||||
|
||||
self.parent.enableSavePrinter(True)
|
||||
self.parent.setPrinterTabText("Printer <%s>" % os.path.basename(path))
|
||||
|
||||
for pg in self.pages:
|
||||
pg.insertValues(self.cfgValues)
|
||||
pg.setHelpText(self.helpText)
|
||||
|
||||
k = 'DC_EXTRUDER'
|
||||
if k in self.cfgValues.keys():
|
||||
print "calling orig with (%s)" % self.cfgValues[k]
|
||||
self.pgMiscellaneous.setOriginalHeater(self.cfgValues[k])
|
||||
else:
|
||||
self.pgMiscellaneous.setOriginalHeater(None)
|
||||
|
||||
def loadConfigFile(self, fn):
|
||||
try:
|
||||
self.cfgBuffer = list(open(fn))
|
||||
|
|
@ -233,7 +219,6 @@ class PrinterPanel(wx.Panel):
|
|||
if m:
|
||||
t = m.groups()
|
||||
if len(t) == 2:
|
||||
if t[0] == 'DC_EXTRUDER': print "raw value (%s)" % t[1]
|
||||
self.cfgValues[t[0]] = t[1]
|
||||
continue
|
||||
|
||||
|
|
@ -243,6 +228,19 @@ class PrinterPanel(wx.Panel):
|
|||
if len(t) == 1:
|
||||
self.cfgValues[t[0]] = True
|
||||
|
||||
self.parent.enableSavePrinter(True)
|
||||
self.parent.setPrinterTabText("Printer <%s>" % os.path.basename(fn))
|
||||
|
||||
for pg in self.pages:
|
||||
pg.insertValues(self.cfgValues)
|
||||
pg.setHelpText(self.helpText)
|
||||
|
||||
k = 'DC_EXTRUDER'
|
||||
if k in self.cfgValues.keys():
|
||||
self.pgMiscellaneous.setOriginalHeater(self.cfgValues[k])
|
||||
else:
|
||||
self.pgMiscellaneous.setOriginalHeater(None)
|
||||
|
||||
return True
|
||||
|
||||
def onSaveConfig(self, evt):
|
||||
|
|
@ -312,8 +310,10 @@ class PrinterPanel(wx.Panel):
|
|||
if len(t) == 2:
|
||||
if t[0] in values.keys() and values[t[0]] != "":
|
||||
fp.write(defineValueFormat % (t[0], values[t[0]]))
|
||||
else:
|
||||
elif t[0] in values.keys():
|
||||
fp.write("//" + ln)
|
||||
else:
|
||||
fp.write(ln)
|
||||
continue
|
||||
|
||||
m = reDefBoolBL.match(ln)
|
||||
|
|
@ -322,8 +322,10 @@ class PrinterPanel(wx.Panel):
|
|||
if len(t) == 1:
|
||||
if t[0] in values.keys() and values[t[0]]:
|
||||
fp.write(defineBoolFormat % t[0])
|
||||
else:
|
||||
elif t[0] in values.keys():
|
||||
fp.write("//" + ln)
|
||||
else:
|
||||
fp.write(ln)
|
||||
continue
|
||||
|
||||
m = reCommDefBL.match(ln)
|
||||
|
|
|
|||
|
|
@ -3,13 +3,16 @@ import wx
|
|||
|
||||
|
||||
class SensorList(wx.ListCtrl):
|
||||
def __init__(self, parent):
|
||||
def __init__(self, parent, font):
|
||||
self.parent = parent
|
||||
self.currentItem = None
|
||||
wx.ListCtrl.__init__(self, parent, wx.ID_ANY, size = (495 + 4, 100),
|
||||
wx.ListCtrl.__init__(self, parent, wx.ID_ANY,
|
||||
size = (105 + 105 + 55 + 280 + 4, 100),
|
||||
style = wx.LC_REPORT | wx.LC_VIRTUAL |
|
||||
wx.LC_HRULES | wx.LC_VRULES)
|
||||
|
||||
self.SetFont(font)
|
||||
|
||||
self.valid = []
|
||||
self.sensorList = []
|
||||
|
||||
|
|
@ -17,7 +20,7 @@ class SensorList(wx.ListCtrl):
|
|||
self.InsertColumn(1, "Sensor Type")
|
||||
self.InsertColumn(2, "Pin")
|
||||
self.InsertColumn(3, "Additional")
|
||||
self.SetColumnWidth(0, 55)
|
||||
self.SetColumnWidth(0, 105)
|
||||
self.SetColumnWidth(1, 105)
|
||||
self.SetColumnWidth(2, 55)
|
||||
self.SetColumnWidth(3, 280)
|
||||
|
|
|
|||
|
|
@ -7,19 +7,17 @@ from addsensordlg import AddSensorDlg
|
|||
|
||||
|
||||
class SensorsPage(wx.Panel, Page):
|
||||
def __init__(self, parent, nb, idPg):
|
||||
def __init__(self, parent, nb, idPg, font):
|
||||
wx.Panel.__init__(self, nb, wx.ID_ANY)
|
||||
Page.__init__(self)
|
||||
Page.__init__(self, font)
|
||||
self.parent = parent
|
||||
self.font = font
|
||||
self.id = idPg
|
||||
|
||||
self.sensorTypeKeys = ['TEMP_MAX6675', 'TEMP_THERMISTOR', 'TEMP_AD595',
|
||||
'TEMP_PT100', 'TEMP_INTERCOM']
|
||||
self.sensorType = {'TEMP_MAX6675': "TT_MAX6675",
|
||||
'TEMP_THERMISTOR': "TT_THERMISTOR",
|
||||
'TEMP_AD595': "TT_AD595",
|
||||
'TEMP_PT100': "TT_PT100",
|
||||
'TEMP_INTERCOM': "TT_INTERCOM"}
|
||||
self.sensorTypeKeys = {'TT_MAX6675': 'TEMP_MAX6675',
|
||||
'TT_THERMISTOR': 'TEMP_THERMISTOR',
|
||||
'TT_AD595': 'TEMP_AD595', 'TT_PT100': 'TEMP_PT100',
|
||||
'TT_INTERCOM': 'TEMP_INTERCOM' }
|
||||
self.labels = {'TEMP_MAX6675': "MAX6675", 'TEMP_THERMISTOR': "Thermistor",
|
||||
'TEMP_AD595': "AD595", 'TEMP_PT100': "PT100",
|
||||
'TEMP_INTERCOM': "Intercom"}
|
||||
|
|
@ -27,25 +25,17 @@ class SensorsPage(wx.Panel, Page):
|
|||
self.validPins = pinNames
|
||||
|
||||
sz = wx.GridBagSizer()
|
||||
sz.AddSpacer((30, 30), pos = (0, 0))
|
||||
sz.AddSpacer((10, 10), pos = (0, 0))
|
||||
|
||||
self.sensors = []
|
||||
|
||||
b = wx.StaticBox(self, wx.ID_ANY, "Sensor Types")
|
||||
sbox = wx.StaticBoxSizer(b, wx.VERTICAL)
|
||||
sbox.AddSpacer((5, 5))
|
||||
for k in self.sensorTypeKeys:
|
||||
cb = self.addCheckBox(k, self.onCheckBoxSensorType)
|
||||
sbox.Add(cb, 1, wx.LEFT + wx.RIGHT, 10)
|
||||
sbox.AddSpacer((5, 5))
|
||||
|
||||
sz.Add(sbox, pos = (1, 1), span = (5, 1))
|
||||
|
||||
self.lb = SensorList(self)
|
||||
sz.Add(self.lb, pos = (7, 1), span = (1, 3))
|
||||
self.lb = SensorList(self, font)
|
||||
sz.Add(self.lb, pos = (1, 1))
|
||||
sz.AddSpacer((20, 20), pos = (1, 2))
|
||||
|
||||
bsz = wx.BoxSizer(wx.VERTICAL)
|
||||
self.bAdd = wx.Button(self, wx.ID_ANY, "Add", size = BSIZESMALL)
|
||||
self.bAdd.SetFont(font)
|
||||
self.Bind(wx.EVT_BUTTON, self.doAdd, self.bAdd)
|
||||
self.bAdd.Enable(False)
|
||||
self.bAdd.SetToolTipString("Add a sensor to the configuration.")
|
||||
|
|
@ -54,32 +44,18 @@ class SensorsPage(wx.Panel, Page):
|
|||
|
||||
bsz.AddSpacer((10, 10))
|
||||
self.bDelete = wx.Button(self, wx.ID_ANY, "Delete", size = BSIZESMALL)
|
||||
self.bDelete.SetFont(font)
|
||||
self.bDelete.Enable(False)
|
||||
self.Bind(wx.EVT_BUTTON, self.doDelete, self.bDelete)
|
||||
bsz.Add(self.bDelete)
|
||||
self.bDelete.SetToolTipString("Remove the selected temperature sensor "
|
||||
"from the configuration.")
|
||||
|
||||
sz.Add(bsz, pos = (7, 4))
|
||||
sz.Add(bsz, pos = (1, 3))
|
||||
|
||||
self.SetSizer(sz)
|
||||
self.enableAll(False)
|
||||
|
||||
def onCheckBoxSensorType(self, evt):
|
||||
self.assertModified(True)
|
||||
|
||||
ct = 0
|
||||
for tt in self.sensorTypeKeys:
|
||||
if self.checkBoxes[tt].IsChecked():
|
||||
ct += 1
|
||||
|
||||
if ct == 0:
|
||||
self.bAdd.Enable(False)
|
||||
else:
|
||||
self.bAdd.Enable(True)
|
||||
|
||||
evt.Skip()
|
||||
|
||||
def setItemSelected(self, n):
|
||||
self.selection = n
|
||||
if n is None:
|
||||
|
|
@ -88,16 +64,11 @@ class SensorsPage(wx.Panel, Page):
|
|||
self.bDelete.Enable(True)
|
||||
|
||||
def doAdd(self, evt):
|
||||
sl = []
|
||||
for tt in self.sensorTypeKeys:
|
||||
if self.checkBoxes[tt].IsChecked():
|
||||
sl.append(self.sensorType[tt])
|
||||
|
||||
nm = []
|
||||
for s in self.sensors:
|
||||
nm.append(s[0])
|
||||
|
||||
dlg = AddSensorDlg(self, nm, sl, self.validPins)
|
||||
dlg = AddSensorDlg(self, nm, self.validPins, self.font)
|
||||
rc = dlg.ShowModal()
|
||||
if rc == wx.ID_OK:
|
||||
tt = dlg.getValues()
|
||||
|
|
@ -110,7 +81,7 @@ class SensorsPage(wx.Panel, Page):
|
|||
self.sensors.append(tt)
|
||||
self.lb.updateList(self.sensors)
|
||||
self.validateTable()
|
||||
self.limitSensorTypeControls()
|
||||
self.assertModified(True)
|
||||
|
||||
def doDelete(self, evt):
|
||||
if self.selection is None:
|
||||
|
|
@ -121,26 +92,11 @@ class SensorsPage(wx.Panel, Page):
|
|||
del self.sensors[self.selection]
|
||||
self.lb.updateList(self.sensors)
|
||||
self.validateTable()
|
||||
self.limitSensorTypeControls()
|
||||
|
||||
def limitSensorTypeControls(self):
|
||||
using = {}
|
||||
for s in self.sensors:
|
||||
using[s[1]] = True
|
||||
|
||||
for k in self.sensorTypeKeys:
|
||||
self.checkBoxes[k].Enable(True)
|
||||
|
||||
for tt in using.keys():
|
||||
if not tt.startswith("TT_"):
|
||||
continue
|
||||
|
||||
k = "TEMP_" + tt[3:]
|
||||
if k in self.sensorTypeKeys:
|
||||
self.checkBoxes[k].Enable(False)
|
||||
self.assertModified(True)
|
||||
|
||||
def insertValues(self, cfgValues):
|
||||
self.enableAll(True)
|
||||
self.bAdd.Enable(True)
|
||||
for k in self.textControls.keys():
|
||||
if k in cfgValues.keys():
|
||||
self.textControls[k].SetValue(cfgValues[k])
|
||||
|
|
@ -153,18 +109,12 @@ class SensorsPage(wx.Panel, Page):
|
|||
else:
|
||||
self.checkBoxes[k].SetValue(False)
|
||||
|
||||
ct = 0
|
||||
for k in self.sensorTypeKeys:
|
||||
if self.checkBoxes[k].IsChecked(): ct += 1
|
||||
self.bAdd.Enable(ct != 0)
|
||||
|
||||
self.assertModified(False)
|
||||
|
||||
def setSensors(self, sensors):
|
||||
self.sensors = sensors
|
||||
self.lb.updateList(self.sensors)
|
||||
self.validateTable()
|
||||
self.limitSensorTypeControls()
|
||||
|
||||
def setCandidatePins(self, plist):
|
||||
if not plist or len(plist) == 0:
|
||||
|
|
@ -188,3 +138,18 @@ class SensorsPage(wx.Panel, Page):
|
|||
k = 'DEFINE_TEMP_SENSOR'
|
||||
if k in ht.keys():
|
||||
self.bAdd.SetToolTipString(ht[k])
|
||||
|
||||
def getValues(self):
|
||||
result = Page.getValues(self)
|
||||
|
||||
values = {}
|
||||
for k in self.sensorTypeKeys.values():
|
||||
values[k] = False
|
||||
|
||||
for s in self.sensors:
|
||||
values[self.sensorTypeKeys[s[1]]] = True
|
||||
|
||||
for v in values.keys():
|
||||
result[v] = values[v]
|
||||
|
||||
return result
|
||||
|
|
|
|||
Loading…
Reference in New Issue