Fabmaster: use User layers for unknown layers

This is a bit of a hack as it will still only allow
9 more layers and drop the rest, but it's a start and
allows testing using the Beaglebone Black board and the
board in issue 19174.
This commit is contained in:
John Beard 2024-11-26 19:01:57 +08:00
parent 6cfcba9b37
commit faae009dba

View File

@ -742,6 +742,8 @@ bool FABMASTER::assignLayers()
std::vector<FABMASTER_LAYER*> layer_order;
int next_user_layer = User_1;
for( auto& el : layers )
{
FABMASTER_LAYER& layer = el.second;
@ -775,9 +777,32 @@ bool FABMASTER::assignLayers()
layer.layerid = F_Paste;
}
else if( layer.name.find( "NCLEGEND" ) != std::string::npos )
{
layer.layerid = Dwgs_User;
}
else
{
// Try to gather as many other layers into user layers as possible
// Skip ones that seem like a waste of good layers
if( layer.name.find( "AUTOSILK" ) == std::string::npos )
{
if( next_user_layer <= User_9 )
{
// Assign the mapping
layer.layerid = next_user_layer;
next_user_layer += 2;
}
else
{
// Out of additional layers
// For now, drop it, but maybr we could gather onto some other layer.
// Or implement a proper layer remapper.
layer.disable = true;
wxLogWarning( _( "No user layer to put layer %s" ), layer.name );
}
}
}
}
std::sort( layer_order.begin(), layer_order.end(), FABMASTER_LAYER::BY_ID() );
@ -810,6 +835,12 @@ bool FABMASTER::assignLayers()
}
}
for( const auto& [layer_name, fabmaster_layer] : layers )
{
wxLogTrace( traceFabmaster, wxT( "Layer %s -> KiCad layer %d" ), layer_name,
fabmaster_layer.layerid );
}
return true;
}