CADSTAR PCB: Invert logic for guessing which layer is top / bottom

Ensures correct automatic layer mapping is applied to the design in
https://gitlab.com/kicad/code/kicad/-/issues/12349
This commit is contained in:
Roberto Fernandez Bautista 2022-09-03 23:57:33 +02:00
parent c961624d43
commit 9abf3438b8
1 changed files with 3 additions and 3 deletions

View File

@ -462,7 +462,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup()
boardDesignSettings.SetBoardThickness( thickness );
boardDesignSettings.m_HasStackup = true;
int numElecAndPowerLayers = 0;
int numElecLayersProcessed = 0;
// Map CADSTAR documentation layers to KiCad "User layers"
int currentDocLayer = 0;
@ -485,7 +485,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup()
auto selectLayerID =
[&]( PCB_LAYER_ID aFront, PCB_LAYER_ID aBack, LOG_LEVEL aLogType )
{
if( numElecAndPowerLayers > 0 )
if( numElecLayersProcessed >= m_numCopperLayers )
kicadLayerID = aBack;
else
kicadLayerID = aFront;
@ -520,7 +520,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup()
case LAYER_TYPE::JUMPERLAYER:
case LAYER_TYPE::ELEC:
case LAYER_TYPE::POWER:
++numElecAndPowerLayers;
++numElecLayersProcessed;
KI_FALLTHROUGH;
case LAYER_TYPE::CONSTRUCTION:
//Already dealt with these when loading board stackup