diff --git a/common/projet_config.cpp b/common/projet_config.cpp index 1e91b2dcfc..fce2668a30 100644 --- a/common/projet_config.cpp +++ b/common/projet_config.cpp @@ -463,6 +463,53 @@ void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const } +PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxChar* ident, int* ptparam, + int default_val, int min, int max, + const wxChar* group, double aBiu2cfgunit ) : + PARAM_CFG_INT( ident, ptparam, default_val, min, max, group ) +{ + m_Type = PARAM_INT_WITH_SCALE; + m_BIU_to_cfgunit = aBiu2cfgunit; +} + + +PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( bool Insetup, + const wxChar* ident, int* ptparam, + int default_val, int min, int max, + const wxChar* group, double aBiu2cfgunit ) : + PARAM_CFG_INT( Insetup, ident, ptparam, default_val, min, max, group ) +{ + m_Type = PARAM_INT_WITH_SCALE; + m_BIU_to_cfgunit = aBiu2cfgunit; +} + + +void PARAM_CFG_INT_WITH_SCALE::ReadParam( wxConfigBase* aConfig ) const +{ + if( m_Pt_param == NULL || aConfig == NULL ) + return; + + double default_value = m_Default * m_BIU_to_cfgunit; + double dtmp = aConfig->Read( m_Ident, default_value ); + + int itmp = KiROUND( dtmp / m_BIU_to_cfgunit ); + + if( (itmp < m_Min) || (itmp > m_Max) ) + itmp = m_Default; + + *m_Pt_param = itmp; +} + + +void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const +{ + if( m_Pt_param == NULL || aConfig == NULL ) + return; + + aConfig->Write( m_Ident, *m_Pt_param * m_BIU_to_cfgunit ); +} + + PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptparam, EDA_COLOR_T default_val, const wxChar* group ) : diff --git a/include/param_config.h b/include/param_config.h index a98ca1c607..1868cf9afb 100644 --- a/include/param_config.h +++ b/include/param_config.h @@ -17,6 +17,7 @@ /** Type of parameter in the configuration file */ enum paramcfg_id { PARAM_INT, + PARAM_INT_WITH_SCALE, PARAM_SETCOLOR, PARAM_DOUBLE, PARAM_BOOL, @@ -92,6 +93,36 @@ public: virtual void SaveParam( wxConfigBase* aConfig ) const; }; +/** + * Configuration parameter - Integer Class + * with unit conversion. + * Mainly used to store an integer value in millimeters (or inches) + * and retrieve it in internal units + * the stored value is a floating number + */ +class PARAM_CFG_INT_WITH_SCALE : public PARAM_CFG_INT +{ +public: + double m_BIU_to_cfgunit; ///< the factor to convert the saved value in internal value + +public: + PARAM_CFG_INT_WITH_SCALE( const wxChar* ident, int* ptparam, + int default_val = 0, + int min = std::numeric_limits::min(), + int max = std::numeric_limits::max(), + const wxChar* group = NULL, + double aBiu2cfgunit = 1.0); + PARAM_CFG_INT_WITH_SCALE( bool Insetup, const wxChar* ident, int* ptparam, + int default_val = 0, + int min = std::numeric_limits::min(), + int max = std::numeric_limits::max(), + const wxChar* group = NULL, + double aBiu2cfgunit = 1.0 ); + + virtual void ReadParam( wxConfigBase* aConfig ) const; + virtual void SaveParam( wxConfigBase* aConfig ) const; +}; + /** * Configuration parameter - SetColor Class diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index 8fcdeae7ed..58aadfbcc9 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -11,8 +11,20 @@ #include #include +#include -#define DEFAULT_BOARD_THICKNESS_DMILS 620 +// Board thickness, mainly for 3D view: +#define DEFAULT_BOARD_THICKNESS_MM 1.6 + +// Default values for some board items +#define DEFAULT_TEXT_PCB_SIZE Millimeter2iu( 1.5 ) +#define DEFAULT_TEXT_PCB_THICKNESS Millimeter2iu( 0.3 ) +#define DEFAULT_PCB_EDGE_THICKNESS Millimeter2iu( 0.15 ) +#define DEFAULT_GRAPHIC_THICKNESS Millimeter2iu( 0.2 ) +#define DEFAULT_TEXT_MODULE_SIZE Millimeter2iu( 1.5 ) +#define DEFAULT_GR_MODULE_THICKNESS Millimeter2iu( 0.15 ) + +#define DEFAULT_SOLDERMASK_CLEARANCE Millimeter2iu( 0.1 ) BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : @@ -36,13 +48,13 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : m_MicroViasAllowed = false; // true to allow micro vias - m_DrawSegmentWidth = DMils2iu( 100 ); // current graphic line width (not EDGE layer) + m_DrawSegmentWidth = DEFAULT_GRAPHIC_THICKNESS; // current graphic line width (not EDGE layer) - m_EdgeSegmentWidth = DMils2iu( 100 ); // current graphic line width (EDGE layer only) - m_PcbTextWidth = DMils2iu( 100 ); // current Pcb (not module) Text width + m_EdgeSegmentWidth = DEFAULT_PCB_EDGE_THICKNESS; // current graphic line width (EDGE layer only) + m_PcbTextWidth = DEFAULT_TEXT_PCB_THICKNESS; // current Pcb (not module) Text width - m_PcbTextSize = wxSize( DMils2iu( 500 ), DMils2iu( 500 ) ); - // current Pcb (not module) Text size + m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_SIZE, + DEFAULT_TEXT_PCB_SIZE ); // current Pcb (not module) Text size m_TrackMinWidth = DMils2iu( 100 ); // track min value for width ((min copper size value m_ViasMinSize = DMils2iu( 350 ); // vias (not micro vias) min diameter @@ -51,57 +63,80 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : m_MicroViasMinDrill = DMils2iu( 50 ); // micro vias (not vias) min drill diameter // Global mask margins: - m_SolderMaskMargin = DMils2iu( 150 ); // Solder mask margin + m_SolderMaskMargin = DEFAULT_SOLDERMASK_CLEARANCE; // Solder mask margin m_SolderPasteMargin = 0; // Solder paste margin absolute value m_SolderPasteMarginRatio = 0.0; // Solder pask margin ratio value of pad size // The final margin is the sum of these 2 values // Usually < 0 because the mask is smaller than pad - m_ModuleTextSize = wxSize( DMils2iu( 500 ), DMils2iu( 500 ) ); - m_ModuleTextWidth = DMils2iu( 100 ); - m_ModuleSegmentWidth = DMils2iu( 100 ); + m_ModuleTextSize = wxSize( DEFAULT_TEXT_MODULE_SIZE, + DEFAULT_TEXT_MODULE_SIZE ); + m_ModuleTextWidth = DEFAULT_GR_MODULE_THICKNESS; + m_ModuleSegmentWidth = DEFAULT_GR_MODULE_THICKNESS; // Layer thickness for 3D viewer - m_boardThickness = DMils2iu( DEFAULT_BOARD_THICKNESS_DMILS ); + m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM ); } - +// Add parameters to save in project config. +// values are saved in mm void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult ) { m_Pad_Master.AppendConfigs( aResult ); - aResult->push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ), &m_boardThickness, - DMils2iu( DEFAULT_BOARD_THICKNESS_DMILS ), 0, 0xFFFF ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeV" ), + &m_PcbTextSize.y, + DEFAULT_TEXT_PCB_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "TxtPcbV" ), &m_PcbTextSize.y, - DMils2iu( 600 ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeH" ), + &m_PcbTextSize.x, + DEFAULT_TEXT_PCB_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "TxtPcbH" ), &m_PcbTextSize.x, - DMils2iu( 600 ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextThickness" ), + &m_PcbTextWidth, + DEFAULT_TEXT_PCB_THICKNESS, + Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModV" ), &m_ModuleTextSize.y, - DMils2iu( 500 ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeV" ), + &m_ModuleTextSize.y, + DEFAULT_TEXT_MODULE_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModH" ), &m_ModuleTextSize.x, - DMils2iu( 500 ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeH" ), + &m_ModuleTextSize.x, + DEFAULT_TEXT_MODULE_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModW" ), &m_ModuleTextWidth, - DMils2iu( 100 ), 1, TEXTS_MAX_WIDTH ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeThickness" ), + &m_ModuleTextWidth, + DEFAULT_GR_MODULE_THICKNESS, 1, TEXTS_MAX_WIDTH, + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "VEgarde" ), &m_SolderMaskMargin, - DMils2iu( 100 ), 0, DMils2iu( 10000 ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskClearance" ), + &m_SolderMaskMargin, + DEFAULT_SOLDERMASK_CLEARANCE, 0, Millimeter2iu( 1.0 ), + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "DrawLar" ), &m_DrawSegmentWidth, - DMils2iu( 120 ), 0, 0xFFFF ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "DrawSegmentWidth" ), + &m_DrawSegmentWidth, + DEFAULT_GRAPHIC_THICKNESS, + Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "EdgeLar" ), &m_EdgeSegmentWidth, - DMils2iu( 120 ), 0, 0xFFFF ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BoardOutlineThickness" ), + &m_EdgeSegmentWidth, + DEFAULT_PCB_EDGE_THICKNESS, + Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "TxtLar" ), &m_PcbTextWidth, - DMils2iu( 120 ), 0, 0xFFFF ) ); - - aResult->push_back( new PARAM_CFG_INT( wxT( "MSegLar" ), &m_ModuleSegmentWidth, - DMils2iu( 120 ), 0, 0xFFFF ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleOutlineThickness" ), + &m_ModuleSegmentWidth, + DEFAULT_GR_MODULE_THICKNESS, + Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), + NULL, MM_PER_IU ) ); } diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 47eace8b8d..29d8ad4747 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -45,6 +45,7 @@ #include #include #include +#include int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode @@ -165,14 +166,23 @@ void D_PAD::Flip( int aTranslationY ) void D_PAD::AppendConfigs( PARAM_CFG_ARRAY* aResult ) { - aResult->push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &m_Drill.x, - 320, 0, 0x7FFF ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadDrill" ), + &m_Drill.x, + Millimeter2iu( 0.6 ), + Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ), + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "PadDimH" ), &m_Size.x, - 550, 0, 0x7FFF ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeH" ), + &m_Size.x, + Millimeter2iu( 1.4 ), + Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ), + NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "PadDimV" ), &m_Size.y, - 550, 0, 0x7FFF ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeV" ), + &m_Size.y, + Millimeter2iu( 1.4 ), + Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ), + NULL, MM_PER_IU ) ); } diff --git a/template/raspberrypi-gpio/meta/brd.png b/template/raspberrypi-gpio/meta/brd.png new file mode 100644 index 0000000000..f464b7fc8e Binary files /dev/null and b/template/raspberrypi-gpio/meta/brd.png differ diff --git a/template/raspberrypi-gpio/meta/info.html b/template/raspberrypi-gpio/meta/info.html index bfb19c4a45..9991a528af 100644 --- a/template/raspberrypi-gpio/meta/info.html +++ b/template/raspberrypi-gpio/meta/info.html @@ -1,22 +1,23 @@ - - -Raspberry Pi - Expansion Board - - -

Raspberry Pi

-

Expansion Board

-This project template is the basis of an expansion board for the -Raspberry Pi $25 ARM -board. -

-This base project includes a PCB edge defined as the same size as the -Raspberry-Pi PCB with the connectors placed correctly to align the two boards. -All IO present on the Raspberry-Pi board is connected to the project through the -0.1" expansion headers. -

-The board outline looks like the following: -

-(c)2012 Brian Sidebotham
-(c)2012 Kicad Developers
- - + + +Raspberry Pi - Expansion Board + + +

Raspberry Pi

+

Expansion Board

+This project template is the basis of an expansion board for the +Raspberry Pi $25 ARM +board. +

+This base project includes a PCB edge defined as the same size as the +Raspberry-Pi PCB with the connectors placed correctly to align the two boards. +All IO present on the Raspberry-Pi board is connected to the project through the +0.1" expansion headers. +

+The board outline looks like the following: +



(c)2012 +

+(c)2012 Brian Sidebotham
+(c)2012 Kicad Developers
+ +