File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change
1
+ public class ConfigurationException extends RuntimeException {
2
+ private final String message ;
3
+ public ConfigurationException (String message ){
4
+ this .message =message ;
5
+ }
6
+
7
+ @ Override
8
+ public void printStackTrace () {
9
+ System .err .println (message );
10
+ }
11
+ }
Original file line number Diff line number Diff line change @@ -164,15 +164,16 @@ public void startCollectingChannelsData(){
164
164
if (gpioController ==null || mcp3008GpioProvider ==null ){
165
165
throw new ModuleNotActiveException ("Module not active or not initialized" );
166
166
}
167
-
167
+ if (getVxPin ()==null || getVyPin ()==null ){
168
+ throw new ConfigurationException ("Please Register MCP3008 input Channels w/ the JoyStick module Vx & Vy" );
169
+ }
168
170
GpioPinAnalogInput [] gpioPinAnalogInput = new GpioPinAnalogInput [inputChannels .size ()];
169
171
/*a way of making the var of the number a final value to be used anonymously & to change it at the same time*/
170
172
final int [] position = {0 };
171
173
inputChannels .forEach (channel ->{
172
174
gpioPinAnalogInput [position [0 ]]= channel ;
173
175
position [0 ] +=1 ;
174
176
});
175
-
176
177
gpioController .addListener ((GpioPinListenerAnalog ) event -> {
177
178
double valueX =mcp3008GpioProvider .getValue (getVxPin ());
178
179
double valueY =mcp3008GpioProvider .getValue (getVyPin ());
You can’t perform that action at this time.
0 commit comments