From: Mark Slee Date: Sun, 11 Aug 2013 02:07:39 +0000 (-0700) Subject: Clean up some stuff now that we know each pandaboard has fixed # of channels X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1685dc840e4748f11a9e6690b9ddce4a6e8b7084;p=SugarCubes.git Clean up some stuff now that we know each pandaboard has fixed # of channels --- diff --git a/TestPatterns.pde b/TestPatterns.pde index 52e8ea4..7334945 100644 --- a/TestPatterns.pde +++ b/TestPatterns.pde @@ -187,23 +187,13 @@ class MappingTool extends SCPattern { MappingTool(GLucose glucose, PandaMapping[] pandaMappings) { super(glucose); this.pandaMappings = pandaMappings; - int totalChannels = 0; - for (PandaMapping pm : pandaMappings) { - totalChannels += pm.channelList.length; - } - numChannels = totalChannels; + numChannels = pandaMappings.length * PandaMapping.CHANNELS_PER_BOARD; setChannel(); } private void setChannel() { - mappingChannelIndex = channelIndex; - for (PandaMapping pm : pandaMappings) { - if (mappingChannelIndex < pm.channelList.length) { - activeMapping = pm; - break; - } - mappingChannelIndex -= pm.channelList.length; - } + mappingChannelIndex = channelIndex % PandaMapping.CHANNELS_PER_BOARD; + activeMapping = pandaMappings[channelIndex / PandaMapping.CHANNELS_PER_BOARD]; } private int cubeInChannel(Cube c) { diff --git a/_Overlay.pde b/_Overlay.pde index a07db2c..5bafe29 100644 --- a/_Overlay.pde +++ b/_Overlay.pde @@ -713,10 +713,7 @@ class DebugUI { final int DEBUG_STATE_OFF = 2; DebugUI(PandaMapping[] pandaMappings) { - int totalChannels = 0; - for (PandaMapping pm : pandaMappings) { - totalChannels += pm.channelList.length; - } + int totalChannels = pandaMappings.length * PandaMapping.CHANNELS_PER_BOARD; channelList = new int[totalChannels][]; int channelIndex = 0; for (PandaMapping pm : pandaMappings) { @@ -731,7 +728,7 @@ class DebugUI { } } - void draw() { + void draw() { noStroke(); int xBase = debugX; int yPos = debugY;