From 83cb702e726079a42adefba3bf44daf7cfc6f4ce Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 14 Feb 2015 23:44:01 -0800 Subject: [PATCH] Config sections, multi-field values, toggles, etc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Auto-detect “switchable” items where possible - Handle switchable multi-value fields - Add standard sections to config form - Add section markers to configurations - Add value options to configurations - Remove and re-add fields for loaded configs - Preserve sections across configs - Preserve non-added fields - Style added fields wider & newline by default --- Marlin/configurator/config/Configuration.h | 48 ++++ .../configurator/config/Configuration_adv.h | 36 ++- Marlin/configurator/css/configurator.css | 32 ++- Marlin/configurator/index.html | 26 +- Marlin/configurator/js/configurator.js | 253 ++++++++++++------ 5 files changed, 302 insertions(+), 93 deletions(-) diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h index e0c9cc3010..1727ebc59b 100644 --- a/Marlin/configurator/config/Configuration.h +++ b/Marlin/configurator/config/Configuration.h @@ -35,6 +35,8 @@ Here are some standard links for getting your machine calibrated: // example_configurations/SCARA directory. // +// @section info + // User-specified version info of this build to display in [Pronterface, etc] terminal window during // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. @@ -45,6 +47,8 @@ Here are some standard links for getting your machine calibrated: #define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2 +// @section machine + // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. // Serial port 0 is still used by the Arduino bootloader regardless of this setting. @@ -84,6 +88,8 @@ Here are some standard links for getting your machine calibrated: // Define this to have the electronics keep the power supply off on startup. If you don't know what this is leave it. // #define PS_DEFAULT_OFF +// @section temperature + //=========================================================================== //============================= Thermal Settings ============================ //=========================================================================== @@ -237,6 +243,7 @@ Here are some standard links for getting your machine calibrated: // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. #endif // PIDTEMPBED +// @section extruder //this prevents dangerous Extruder moves, i.e. if the temperature is under the limit //can be software-disabled for whatever purposes by @@ -291,9 +298,13 @@ your extruder heater takes 2 minutes to hit the target on heating. //============================= Mechanical Settings ========================= //=========================================================================== +// @section machine + // Uncomment the following line to enable CoreXY kinematics // #define COREXY +// @section homing + // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors @@ -326,33 +337,51 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS +// @section hidden + // Disable max endstops for compatibility with endstop checking routine #if defined(COREXY) && !defined(DISABLE_MAX_ENDSTOPS) #define DISABLE_MAX_ENDSTOPS #endif +// @section homing + // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 +// :[0,1] #define X_ENABLE_ON 0 #define Y_ENABLE_ON 0 #define Z_ENABLE_ON 0 #define E_ENABLE_ON 0 // For all extruders +// @section machine + // Disables axis when it's not being used. #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false + +// @section extruder + #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled +// @section machine + #define INVERT_X_DIR true // for Mendel set to false, for Orca set to true #define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false #define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true + +// @section extruder + #define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false #define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false #define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false +// @section homing + // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 @@ -360,6 +389,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. +// @section machine + // Travel limits after homing (units are in mm) #define X_MAX_POS 205 #define X_MIN_POS 0 @@ -368,6 +399,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define Z_MAX_POS 200 #define Z_MIN_POS 0 +// @section hidden + #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS) #define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS) #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS) @@ -377,6 +410,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //============================= Bed Auto Leveling =========================== //=========================================================================== +// @section bedlevel + //#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line) #define Z_PROBE_REPEATABILITY_TEST // If not commented out, Z-Probe Repeatability test will be included if Auto Bed Leveling is Enabled. @@ -493,6 +528,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif // ENABLE_AUTO_BED_LEVELING +// @section homing + // The position of the homing switches //#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) @@ -504,6 +541,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define MANUAL_Z_HOME_POS 0 //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +// @section movement + //// MOVEMENT SETTINGS #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0} // set the homing speeds (mm/min) @@ -533,6 +572,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //============================= Additional Features =========================== //============================================================================= +// @section more + // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES @@ -541,6 +582,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define Z_PROBE_OFFSET_RANGE_MAX -5 #endif +// @section extras // EEPROM // The microcontroller can store settings in the EEPROM, e.g. max velocity... @@ -553,6 +595,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // please keep turned on if you can. //#define EEPROM_CHITCHAT +// @section temperature + // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 #define PLA_PREHEAT_HPB_TEMP 70 @@ -562,6 +606,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define ABS_PREHEAT_HPB_TEMP 100 #define ABS_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255 +// @section lcd + //LCD and SD support // Character based displays can have different extended charsets. @@ -738,6 +784,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of # endif #endif +// @section extras + // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino //#define FAST_PWM_FAN diff --git a/Marlin/configurator/config/Configuration_adv.h b/Marlin/configurator/config/Configuration_adv.h index a503e640f5..98740714b7 100644 --- a/Marlin/configurator/config/Configuration_adv.h +++ b/Marlin/configurator/config/Configuration_adv.h @@ -1,6 +1,8 @@ #ifndef CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -44,6 +46,8 @@ //The M105 command return, besides traditional information, the ADC value read from temperature sensors. //#define SHOW_TEMP_ADC_VALUES +// @section extruder + // extruder run-out prevention. //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded //#define EXTRUDER_RUNOUT_PREVENT @@ -53,6 +57,8 @@ #define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed #define EXTRUDER_RUNOUT_EXTRUDE 100 +// @section temperature + //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. //The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET" #define TEMP_SENSOR_AD595_OFFSET 0.0 @@ -70,6 +76,8 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// @section extruder + // Extruder cooling fans // Configure fan pin outputs to automatically turn on/off when the associated // extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. @@ -87,6 +95,8 @@ //=============================Mechanical Settings=========================== //=========================================================================== +// @section machine + #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing @@ -210,12 +220,16 @@ #endif //DUAL_X_CARRIAGE +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: #define X_HOME_RETRACT_MM 5 #define Y_HOME_RETRACT_MM 5 #define Z_HOME_RETRACT_MM 2 //#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} #ifdef CONFIG_STEPPERS_TOSHIBA #define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers @@ -228,12 +242,14 @@ #define INVERT_Z_STEP_PIN false #define INVERT_E_STEP_PIN false -//default stepper release if idle +//default stepper release if idle. Set to 0 to deactivate. #define DEFAULT_STEPPER_DEACTIVE_TIME 60 #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +// @section lcd + // Feedrates for manual moves along X, Y, Z, E from panel #ifdef ULTIPANEL #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // set the speeds for manual moves (mm/min) @@ -244,6 +260,8 @@ #define ULTIPANEL_FEEDMULTIPLY #endif +// @section extras + // minimum time in microseconds that a movement needs to take if the buffer is emptied. #define DEFAULT_MINSEGMENTTIME 20000 @@ -287,6 +305,8 @@ //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again +// @section lcd + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. @@ -315,6 +335,8 @@ #endif #endif +// @section more + // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation. //#define USE_WATCHDOG @@ -373,12 +395,16 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement +// @section lcd + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should // be commented out otherwise #define SDCARDDETECTINVERTED +// @section hidden + #ifdef ULTIPANEL #undef SDCARDDETECTINVERTED #endif @@ -399,6 +425,8 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define PS_ON_ASLEEP LOW #endif +// @section temperature + // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -406,6 +434,8 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================Buffers ============================ //=========================================================================== +// @section hidden + // The number of linear motions that can be in the plan at any give time. // THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. #if defined SDSUPPORT @@ -414,11 +444,13 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define BLOCK_BUFFER_SIZE 16 // maximize block buffer #endif +// @section more //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// @section extras // Firmware based and LCD controlled retract // M207 and M208 can be used to define parameters for the retraction. @@ -460,6 +492,8 @@ const unsigned int dropsegments=5; //everything with less than this number of st //============================= Define Defines ============================ //=========================================================================== +// @section hidden + #if defined (ENABLE_AUTO_BED_LEVELING) && defined (DELTA) #error "Bed Auto Leveling is still not compatible with Delta Kinematics." #endif diff --git a/Marlin/configurator/css/configurator.css b/Marlin/configurator/css/configurator.css index 62157078f0..8b8f8c9994 100644 --- a/Marlin/configurator/css/configurator.css +++ b/Marlin/configurator/css/configurator.css @@ -45,7 +45,9 @@ p.info span { color: #800; } #message p.message { color: #080; background: #CFC; } #message p.error { color: #F00; background: #FF4; } #message p.warning { color: #FF0; background: #BA4; } -#message p.message span { +#message p.message span, +#message p.error span, +#message p.warning span { color: #A00; background: rgba(255, 255, 255, 1); border: 1px solid rgba(0,0,0,0.5); @@ -89,21 +91,22 @@ label { } input[type="text"], select { margin: 0.75em 0 0; } input[type="checkbox"], input[type="radio"], input[type="file"] { margin: 1em 0 0; } -input[type="checkbox"], input[type="radio"].enabler { margin-left: 1em; } +input[type="checkbox"].enabler, input[type="radio"].enabler { margin-left: 1em; } input:disabled { color: #BBB; } -#more input[type="text"] { width: 20em; } +#config_form input[type="text"].subitem { width: 4em; } +#config_form input[type="text"].subitem+.subitem { margin-left: 4px; } -#more label { - width: 240px; /* label area */ +input[type="text"].added { width: 20em; } +label.added { + width: 275px; /* label area */ height: 1em; padding: 10px 360px 10px 1em; margin-right: -350px; text-align: right; } - ul.tabs { padding: 0; list-style: none; } ul.tabs li { display: inline; } ul.tabs li a, @@ -192,8 +195,19 @@ fieldset legend { display: none; } /* Tooltips Checkbox */ -#tipson { float: right; font-weight: bold; font-size: 100%; font-family: helvetica; } -#tipson input { float: none; display: inline; } +#tipson { + width: auto; + height: auto; + padding: 0; + margin-right: 0; + float: right; + font-weight: bold; + font-size: 100%; + font-family: helvetica; + text-align: left; + cursor: pointer; + } +#tipson input { float: none; display: inline; cursor: pointer; } /* Config Text */ @@ -206,7 +220,7 @@ pre.config { clear: both; background-color: #FFF; color: #000; - font-family: "Fira Mono"; + font-family: "Fira Mono", monospace; font-size: small; } diff --git a/Marlin/configurator/index.html b/Marlin/configurator/index.html index ffd4a36f53..23a8411a20 100644 --- a/Marlin/configurator/index.html +++ b/Marlin/configurator/index.html @@ -25,7 +25,7 @@
-
?
+
@@ -40,9 +40,9 @@ - + - + @@ -52,6 +52,10 @@
+
+ Homing +
+
Temperature @@ -69,12 +73,20 @@
-
- Hot Ends +
+ Extruder +
+ +
+ LCD / SD +
+ +
+ Bed Leveling
-
- Heated Bed +
+ Extras
diff --git a/Marlin/configurator/js/configurator.js b/Marlin/configurator/js/configurator.js index 0d7de3608b..932123d552 100644 --- a/Marlin/configurator/js/configurator.js +++ b/Marlin/configurator/js/configurator.js @@ -143,6 +143,7 @@ var configuratorApp = (function(){ $config = $('#config_text pre'), $config_adv = $('#config_adv_text pre'), define_list = [[],[]], + define_section = {}, boards_list = {}, therms_list = {}, total_config_lines, @@ -308,16 +309,21 @@ var configuratorApp = (function(){ /** * Get all the unique define names */ - getDefinesFromText: function(txt) { - var leave_out_defines = ['CONFIGURATION_H', 'CONFIGURATION_ADV_H', 'STRING_VERSION', 'STRING_URL', 'STRING_VERSION_CONFIG_H', 'STRING_CONFIG_H_AUTHOR', 'STRING_SPLASH_LINE1', 'STRING_SPLASH_LINE2']; - // Get all the unique #define's and save them in an array - var r, define_obj = {}, findDef = new RegExp('#define[ \\t]+(\\w+)', 'gm'); + updateDefinesFromText: function(index, txt) { + var section = 'machine', + leave_out_defines = ['CONFIGURATION_H', 'CONFIGURATION_ADV_H', 'STRING_VERSION', 'STRING_URL', 'STRING_VERSION_CONFIG_H', 'STRING_CONFIG_H_AUTHOR', 'STRING_SPLASH_LINE1', 'STRING_SPLASH_LINE2'], + define_sect = {}, + r, findDef = new RegExp('(@section|#define)[ \\t]+(\\w+)', 'gm'); while((r = findDef.exec(txt)) !== null) { - if ($.inArray(r[1], leave_out_defines) < 0 && !(r[1] in define_obj)) - define_obj[r[1]] = null; + var name = r[2]; + if (r[1] == '@section') + section = name; + else if ($.inArray(name, leave_out_defines) < 0 && !(name in define_sect)) + define_sect[name] = section; } - this.log(Object.keys(define_obj), 2); - return Object.keys(define_obj); + define_list[index] = Object.keys(define_sect); + $.extend(define_section, define_sect); + this.log(define_list[index], 2); }, /** @@ -327,24 +333,48 @@ var configuratorApp = (function(){ var e = adv ? 1 : 0, n = 0; var fail_list = []; $.each(define_list[e], function(i,name) { - if (!$('#'+name).length) { - var $ff = $('#more'), - inf = self.getDefineInfo(name, adv); + var section = define_section[name]; + if (section != 'hidden' && !$('#'+name).length) { + var inf = self.getDefineInfo(name, adv); + if (inf) { - var $newlabel = $('