From 90969978df58fd29f512467369c8487267a224b9 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Mon, 11 Apr 2016 21:02:57 +0200 Subject: [PATCH] Configtool: replace DISPLAY_BUS parameter with a set of booleans. Having a choice with a defined set of options is nice, but it also requires these options to be #defined somewhere _before_ entering config.h. To keep class-like encapsulation, we'd need two header files for each code unit, one for the options, another one for the usual header. That said, we use other examples of such options, e.g. CPU, F_CPU or KINEMATICS. For CPU and F_CPU it works fine, because their options are numbers or other values known by the compiler. For KINEMATICS it kind of works, because this #define is used in only one place ... and there it's suboptimal already, because no option- set. Anyways, I was unsure about this change and if it turns out to be a poor decision later, it can be reverted. --- config/board.3drag.h | 27 ++++++++++-------------- config/board.cnc-shield-v3.h | 27 ++++++++++-------------- config/board.gen3.h | 27 ++++++++++-------------- config/board.gen6.h | 27 ++++++++++-------------- config/board.gen7-arm.h | 27 ++++++++++-------------- config/board.gen7-v1.1-v1.3.h | 27 ++++++++++-------------- config/board.gen7-v1.4.h | 27 ++++++++++-------------- config/board.melzi.h | 27 ++++++++++-------------- config/board.nanoheart-v1.0.h | 27 ++++++++++-------------- config/board.ramps-v1.2.h | 27 ++++++++++-------------- config/board.ramps-v1.3.h | 27 ++++++++++-------------- config/board.rumba.h | 27 ++++++++++-------------- config/board.sanguinololu-v1.1.h | 27 ++++++++++-------------- config/board.sanguinololu-v1.2.h | 27 ++++++++++-------------- config/board.sanguish.h | 27 ++++++++++-------------- config/board.sinaptec-at328-02.h | 27 ++++++++++-------------- config/board.teensy++-v2.0.h | 27 ++++++++++-------------- config/board.teensy-v2.0.h | 27 ++++++++++-------------- config/board.tronxy.h | 27 ++++++++++-------------- config_wrapper.h | 12 +---------- configtool/board.generic.h | 24 +++++++++------------- configtool/boardpanel.py | 21 +------------------ configtool/data.py | 1 - configtool/displaypage.py | 35 ++++++++++++++++++++++---------- testcases/config.h.Profiling | 24 +++++++++------------- 25 files changed, 255 insertions(+), 375 deletions(-) diff --git a/config/board.3drag.h b/config/board.3drag.h index 62bd176..eea4522 100644 --- a/config/board.3drag.h +++ b/config/board.3drag.h @@ -283,25 +283,20 @@ DEFINE_HEATER(fan, DIO8, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.cnc-shield-v3.h b/config/board.cnc-shield-v3.h index ebc4880..483fa25 100644 --- a/config/board.cnc-shield-v3.h +++ b/config/board.cnc-shield-v3.h @@ -279,25 +279,20 @@ DEFINE_HEATER(extruder, AIO2, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.gen3.h b/config/board.gen3.h index 3453af2..9637f88 100644 --- a/config/board.gen3.h +++ b/config/board.gen3.h @@ -271,25 +271,20 @@ DEFINE_TEMP_SENSOR(noheater, TT_INTERCOM, AIO0, 0) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.gen6.h b/config/board.gen6.h index 3eb8507..2987689 100644 --- a/config/board.gen6.h +++ b/config/board.gen6.h @@ -274,25 +274,20 @@ DEFINE_HEATER(extruder, DIO6, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.gen7-arm.h b/config/board.gen7-arm.h index 9348d68..7e4b591 100644 --- a/config/board.gen7-arm.h +++ b/config/board.gen7-arm.h @@ -289,25 +289,20 @@ DEFINE_HEATER(bed, PIO1_9, 1, 10) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.gen7-v1.1-v1.3.h b/config/board.gen7-v1.1-v1.3.h index 0671321..fb01c02 100644 --- a/config/board.gen7-v1.1-v1.3.h +++ b/config/board.gen7-v1.1-v1.3.h @@ -285,25 +285,20 @@ DEFINE_HEATER(bed, DIO3, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.gen7-v1.4.h b/config/board.gen7-v1.4.h index 3af88e2..9f7a752 100644 --- a/config/board.gen7-v1.4.h +++ b/config/board.gen7-v1.4.h @@ -286,25 +286,20 @@ DEFINE_HEATER(bed, DIO3, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.melzi.h b/config/board.melzi.h index 1b127d7..e544a73 100644 --- a/config/board.melzi.h +++ b/config/board.melzi.h @@ -287,25 +287,20 @@ DEFINE_HEATER(fan, DIO4, 0, 0) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.nanoheart-v1.0.h b/config/board.nanoheart-v1.0.h index d46394d..7c4412b 100644 --- a/config/board.nanoheart-v1.0.h +++ b/config/board.nanoheart-v1.0.h @@ -283,25 +283,20 @@ DEFINE_HEATER(bed, DIO3, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS i2c_twi - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.ramps-v1.2.h b/config/board.ramps-v1.2.h index c578e98..4cbaccc 100644 --- a/config/board.ramps-v1.2.h +++ b/config/board.ramps-v1.2.h @@ -284,25 +284,20 @@ DEFINE_HEATER(fan, DIO9, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.ramps-v1.3.h b/config/board.ramps-v1.3.h index 43880af..d183dd6 100644 --- a/config/board.ramps-v1.3.h +++ b/config/board.ramps-v1.3.h @@ -287,25 +287,20 @@ DEFINE_HEATER(fan, DIO9, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.rumba.h b/config/board.rumba.h index 73a4767..5d861b4 100644 --- a/config/board.rumba.h +++ b/config/board.rumba.h @@ -287,25 +287,20 @@ DEFINE_HEATER(fan, DIO8, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.sanguinololu-v1.1.h b/config/board.sanguinololu-v1.1.h index 9cc4cd4..2beeb9b 100644 --- a/config/board.sanguinololu-v1.1.h +++ b/config/board.sanguinololu-v1.1.h @@ -283,25 +283,20 @@ DEFINE_HEATER(bed, DIO14, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.sanguinololu-v1.2.h b/config/board.sanguinololu-v1.2.h index a4765ce..db1927f 100644 --- a/config/board.sanguinololu-v1.2.h +++ b/config/board.sanguinololu-v1.2.h @@ -283,25 +283,20 @@ DEFINE_HEATER(bed, DIO13, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.sanguish.h b/config/board.sanguish.h index 8b9e82e..b8b0afa 100644 --- a/config/board.sanguish.h +++ b/config/board.sanguish.h @@ -283,25 +283,20 @@ DEFINE_HEATER(bed, DIO4, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.sinaptec-at328-02.h b/config/board.sinaptec-at328-02.h index a23d58e..4b20f41 100644 --- a/config/board.sinaptec-at328-02.h +++ b/config/board.sinaptec-at328-02.h @@ -286,25 +286,20 @@ DEFINE_HEATER(fan, DIO5, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.teensy++-v2.0.h b/config/board.teensy++-v2.0.h index 3c440d9..676a7be 100644 --- a/config/board.teensy++-v2.0.h +++ b/config/board.teensy++-v2.0.h @@ -283,25 +283,20 @@ DEFINE_HEATER(fan, DIO16, 0, 0) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.teensy-v2.0.h b/config/board.teensy-v2.0.h index 09e4d20..c7f7d38 100644 --- a/config/board.teensy-v2.0.h +++ b/config/board.teensy-v2.0.h @@ -283,25 +283,20 @@ DEFINE_HEATER(fan, DIO8, 0, 0) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config/board.tronxy.h b/config/board.tronxy.h index 4b698ac..ef7e3ac 100644 --- a/config/board.tronxy.h +++ b/config/board.tronxy.h @@ -285,25 +285,20 @@ DEFINE_HEATER(fan, DIO4, 0, 1) * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled - -/** \def DISPLAY_TYPE_OPT +//#define DISPLAY_BUS_4BIT +//#define DISPLAY_BUS_8BIT +//#define DISPLAY_BUS_I2C +//#define DISPLAY_BUS_SPI +/** Display types a user should be able to choose from in Configtool. All commented out. */ diff --git a/config_wrapper.h b/config_wrapper.h index d0b38db..47869b6 100644 --- a/config_wrapper.h +++ b/config_wrapper.h @@ -1,14 +1,4 @@ -/** - Display bus stuff. This likely goes away soon or gets at least moved - elsewhere. -*/ -#define disabled 0 -#define direct_4bit 1 -#define direct_8bit 2 -#define i2c_twi 3 -#define spi 4 - /** Some stuff common to all config.h files. Put it here to allow files like board.*.config.h or printer.*.h to be moved to about everywhere in the @@ -55,7 +45,7 @@ /** Check wether we need I2C. */ -#if DISPLAY_BUS == i2c_twi +#ifdef DISPLAY_BUS_I2C #define I2C #endif diff --git a/configtool/board.generic.h b/configtool/board.generic.h index 3668e67..c3f782f 100644 --- a/configtool/board.generic.h +++ b/configtool/board.generic.h @@ -271,22 +271,18 @@ * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled +#define DISPLAY_BUS_4BIT +#define DISPLAY_BUS_8BIT +#define DISPLAY_BUS_I2C +#define DISPLAY_BUS_SPI /** \def DISPLAY_TYPE_OPT diff --git a/configtool/boardpanel.py b/configtool/boardpanel.py index 02a4646..8b7bc24 100644 --- a/configtool/boardpanel.py +++ b/configtool/boardpanel.py @@ -11,7 +11,7 @@ from configtool.data import (defineValueFormat, reStartSensors, reEndSensors, reStartHeaters, reEndHeaters, reCandHeatPins, reCandThermPins, reCandProcessors, reCandCPUClocks, reFloatAttr, - reCandDisplayBuses, reCandDisplayTypes, + reCandDisplayTypes, reDefine, reDefineBL, reDefQS, reDefQSm, reDefQSm2, reDefBool, reDefBoolBL, reDefHT, reDefTS, reDefTT, reSensor, reHeater3, reHeater4, @@ -218,7 +218,6 @@ class BoardPanel(wx.Panel): self.candThermPins = [] self.candProcessors = [] self.candClocks = [] - self.candDisplayBuses = [] self.candDisplayTypes = [] self.tempTables = {} gatheringHelpText = False @@ -278,7 +277,6 @@ class BoardPanel(wx.Panel): self.candThermPins = [] self.candProcessors = [] self.candClocks = [] - self.candDisplayBuses = [] self.candDisplayTypes = [] self.tempTables = {} gatheringHelpText = False @@ -336,7 +334,6 @@ class BoardPanel(wx.Panel): #print self.candThermPins #print self.candProcessors #print self.candClocks - #print self.candDisplayBuses #print self.candDisplayTypes #print self.tempTables #print self.cfgValues # #defines with a value and enabled booleans. @@ -362,7 +359,6 @@ class BoardPanel(wx.Panel): self.pgSensors.setCandidatePins(self.candThermPins) self.pgCpu.setCandidateProcessors(self.candProcessors) self.pgCpu.setCandidateClocks(self.candClocks) - self.pgDisplay.setCandidateDisplayBuses(self.candDisplayBuses) self.pgDisplay.setCandidateDisplayTypes(self.candDisplayTypes) for pg in self.pages: @@ -448,13 +444,6 @@ class BoardPanel(wx.Panel): self.candClocks.append(t[0]) return True - m = reCandDisplayBuses.match(ln) - if m: - t = m.groups() - if len(t) == 1: - self.candDisplayBuses.append(t[0]) - return True - m = reCandDisplayTypes.match(ln) if m: t = m.groups() @@ -585,7 +574,6 @@ class BoardPanel(wx.Panel): candHeatPinsWritten = False candProcessorsWritten = False candCPUClocksWritten = False - candDisplayBusesWritten = False candDisplayTypesWritten = False for ln in self.cfgBuffer: @@ -675,13 +663,6 @@ class BoardPanel(wx.Panel): candCPUClocksWritten = True continue - if reCandDisplayBuses.match(ln): - if not candDisplayBusesWritten: - for value in self.candDisplayBuses: - fp.write("//#define DISPLAY_BUS_OPT {}\n".format(value)) - candDisplayBusesWritten = True - continue - if reCandDisplayTypes.match(ln): if not candDisplayTypesWritten: for value in self.candDisplayTypes: diff --git a/configtool/data.py b/configtool/data.py index 11d0fcd..ccd95e0 100644 --- a/configtool/data.py +++ b/configtool/data.py @@ -51,7 +51,6 @@ reCandHeatPins = re.compile("^\s*//\s*#define\s+HEATER_PIN\s+(\w+)") reCandThermPins = re.compile("^\s*//\s*#define\s+TEMP_SENSOR_PIN\s+(\w+)") reCandProcessors = re.compile("^\s*//\s*#define\s+CPU_TYPE\s+(\w+)") reCandCPUClocks = re.compile("^\s*//\s*#define\s+F_CPU_OPT\s+(\w+)") -reCandDisplayBuses = re.compile("^\s*//\s*#define\s+DISPLAY_BUS_OPT\s+(\w+)") reCandDisplayTypes = re.compile("^\s*//\s*#define\s+DISPLAY_TYPE_OPT\s+(\w+)") reHelpTextStart = re.compile("^\s*/\*\*\s+\\\\def\s+(.*)") diff --git a/configtool/displaypage.py b/configtool/displaypage.py index b102d12..88f66fe 100644 --- a/configtool/displaypage.py +++ b/configtool/displaypage.py @@ -9,16 +9,19 @@ class DisplayPage(wx.Panel, Page): self.parent = parent self.id = idPg + self.displayBusKeys = ['DISPLAY_BUS_4BIT', 'DISPLAY_BUS_8BIT', + 'DISPLAY_BUS_I2C', 'DISPLAY_BUS_SPI'] + self.labels = {'DISPLAY_BUS': "Display Bus:", 'DISPLAY_TYPE': "Display Type:"} - self.buses = [] self.types = [] sz = wx.GridBagSizer() sz.AddSpacer((20, 40), pos = (0, 0)) k = 'DISPLAY_BUS' - ch = self.addChoice(k, self.buses, 0, 100, self.onChoice, size = (140, -1)) + ch = self.addChoice(k, ['(disabled)'] + self.displayBusKeys, 0, 100, + self.onChoice, size = (140, -1)) sz.Add(ch, pos = (1, 1)) sz.AddSpacer((100, 10), pos = (1, 2)) @@ -30,13 +33,6 @@ class DisplayPage(wx.Panel, Page): self.SetSizer(sz) self.enableAll(False) - def setCandidateDisplayBuses(self, busList): - k = 'DISPLAY_BUS' - self.choices[k].Clear() - for p in busList: - self.choices[k].Append(p) - self.buses = busList - def setCandidateDisplayTypes(self, typeList): k = 'DISPLAY_TYPE' self.choices[k].Clear() @@ -47,7 +43,24 @@ class DisplayPage(wx.Panel, Page): def insertValues(self, cfgValues): Page.insertValues(self, cfgValues) - if len(self.buses) > 0: - self.setChoice('DISPLAY_BUS', cfgValues, self.buses[0]) + k = 'DISPLAY_BUS' + for tag in self.displayBusKeys: + if tag in cfgValues.keys() and cfgValues[tag]: + self.setChoice(k, cfgValues, tag) + break + if len(self.types) > 0: self.setChoice('DISPLAY_TYPE', cfgValues, self.types[0]) + + def getValues(self): + result = Page.getValues(self) + + # Convert values to a set of booleans. + for k in ('DISPLAY_BUS', ): + del result[k] + + choice = self.choices[k] + for i in range(choice.GetCount()): + result[choice.GetString(i)] = (i == choice.GetSelection()) + + return result diff --git a/testcases/config.h.Profiling b/testcases/config.h.Profiling index 79e9c55..36a5f2c 100644 --- a/testcases/config.h.Profiling +++ b/testcases/config.h.Profiling @@ -673,22 +673,18 @@ PWM value for 'off' * * \***************************************************************************/ -/** \def DISPLAY_BUS_OPT +/** \def DISPLAY_BUS_4BIT DISPLAY_BUS_8BIT DISPLAY_BUS_I2C DISPLAY_BUS_SPI - Display buses a user should be able to choose from in Configtool. All - commented out. + The bus used to connect the display to the controller. This is a property + of the display. With most displays there can be only one correct choice. + + Comment in the one in use, comment out all others. If there is no display, + comment out all of them to remove display code for better performance. */ -//#define DISPLAY_BUS_OPT disabled -//#define DISPLAY_BUS_OPT direct_4bit -//#define DISPLAY_BUS_OPT direct_8bit -//#define DISPLAY_BUS_OPT i2c_twi -//#define DISPLAY_BUS_OPT spi - -/** \def DISPLAY_BUS - - The display bus in use. 'disabled' if there is no display. -*/ -#define DISPLAY_BUS disabled +#define DISPLAY_BUS_4BIT +#define DISPLAY_BUS_8BIT +#define DISPLAY_BUS_I2C +#define DISPLAY_BUS_SPI /** \def DISPLAY_TYPE_OPT