Jump to content

JavaLaurence

Members
  • Gesamte Inhalte

    216
  • Benutzer seit

  • Letzter Besuch

Alle erstellten Inhalte von JavaLaurence

  1. The DHCP lease times are not configurable on my AP (which is a standard issue residential box from Belgium's 2nd-largest ISP, Belgacom). But you can set them to "static", so I've now made the Wifi Extension get a static IP address.. so let's see if this fixes these awkward TimeoutExceptions.
  2. This is a pain. Imagine stacks in really inaccessible places. Basically the current architecture means that such stacks are doomed to be frozen in time, as far as firmware improvements are concerned. I think it would be a major new feature if Master Brick firmware could be upgrade via the normal communication mechanisms.
  3. At one point in the docs, you write "At the end, press “Save WIFI Configuration” to save the configuration." Could you please also explain what this save does precisely? Where is this config saved? In the Extension? In a Master Brick? On your local control machine? I just upgraded my Master Brick firmware from 2.0.4 to 2.0.5 and my Wifi Extension fails to associate with my AP. Do I need to reconfigure this from scratch again? Basically, please enhance the docs. Thanks!
  4. Personally, the way I would tackle this is not to hide UI elements depending on availability or not of target firmware, but to disable elements, plus add tooltips that give the user a friendly hint, like "Requires Master Brick firmware Vx.y, your Master runs Vz.q". But point taken, I need to disassemble my stack in my cellar, upgrade firmware (on 2nd floor, next Mac), then reassemble. Oh well.. that's good for the legs :-) Thx for the explanation, as usual..
  5. I've got the latest Brickv but cannot see any text field where I can define a host name. Where is this? Thanks.
  6. I always use a Wacom Bamboo graphics tablet instead of a mouse. With some rare applications, like brickv, "mouse clicks" are interpreted too quickly by the application, leading to problems. In the case of brickv, the Connect/Disconnect button sometimes behaves as if it gets two lightning-quick clicks, one after the other. I click Connect, the program tries to connect, and immediately tries to Disconnect. I know this is behavior caused by the graphics tablet BUT 99% of programs do behave completely normally. I would be grateful if TF could maybe disable the button while the connection attempt is pending, and re-enable it only when the connection is up? Should be peanuts to implement..
  7. Brickv connects to my stack over Wifi.. then tells me there is no Wifi Extension present. Clearly impossible!
  8. OK, first I had to learn a bit of DHCP protocol ;-) Then I analysed the log from my AP (see attached file). What i think happens is this: my AP (which has very few config options) issues DHCP leases lasting only 3 hours. I have no clue whether this is reasonable or paranoid. Anyway, my three Wifi-connected devices (incl TinkerForge stack with Wifi Extension) are therefore forced to beg the AP for a new lease every 3 hours. The logs show that renewing may take a few seconds, just enough for my 2Hz polling loop to fail to "see" the stack for a few polls. Resulting in Timeouts. I know I should be using callbacks instead of polling, but for now, I'm perfectly happy with how things work. I'll see if there's any way to increase the lease time on my Belgacom BBox2 AP (a really crappy piece of kit). DHCP.1.log
  9. Here's the log of past night. I'll see later if I can correlate any exceptions with stuff happening in AP. Starting Cellar Water Pump Control System @ Wed Feb 27 22:38:51 CET 2013 Running on Java 1.7.0_04 hosted by Mac OS X 10.7.5 Initializing TinkerForge stack.. Aha. Connected @ 21:38:51 because: CONNECT_REASON_REQUEST Done. [1] Ouch.. exception @ Wed Feb 27 22:39:22 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletTemperature.getTemperature(BrickletTemperature.java:139) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFTemperature.getTemperature(TFTemperature.java:53) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:225) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [2] Ouch.. exception @ Wed Feb 27 22:39:57 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) Switching pump ON @ Wed Feb 27 22:41:16 CET 2013. Duration: 00:00:24 Switching pump ON @ Wed Feb 27 22:41:43 CET 2013. Duration: 00:00:01 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 2 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDualRelay.getState(BrickletDualRelay.java:126) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.output.TFDualRelay.getState(TFDualRelay.java:43) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.external.Pump.getPumpState(Pump.java:46) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.showStatus(CellarWaterPumpController.java:295) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.updateLCD(CellarWaterPumpController.java:249) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:213) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [3] Ouch.. exception @ Wed Feb 27 22:48:27 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [4] Ouch.. exception @ Wed Feb 27 22:53:22 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletTemperature.getTemperature(BrickletTemperature.java:139) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFTemperature.getTemperature(TFTemperature.java:53) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:225) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [5] Ouch.. exception @ Wed Feb 27 22:53:25 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [6] Ouch.. exception @ Wed Feb 27 22:53:27 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [7] Ouch.. exception @ Wed Feb 27 22:53:30 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [8] Ouch.. exception @ Wed Feb 27 22:53:32 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [9] Ouch.. exception @ Wed Feb 27 22:53:35 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [10] Ouch.. exception @ Wed Feb 27 22:53:37 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [11] Ouch.. exception @ Wed Feb 27 22:53:40 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [12] Ouch.. exception @ Wed Feb 27 22:53:42 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) Hmm. Disconnected @ 21:53:42 because: DISCONNECT_REASON_ERROR Aha. Connected @ 21:53:42 because: CONNECT_REASON_AUTO_RECONNECT [13] Ouch.. exception @ Wed Feb 27 22:53:45 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [14] Ouch.. exception @ Wed Feb 27 23:25:44 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) Duration: 00:44:46 [15] Ouch.. exception @ Wed Feb 27 23:27:03 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) [16] Ouch.. exception @ Thu Feb 28 01:53:42 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) Switching pump ON @ Thu Feb 28 02:03:32 CET 2013. Duration: 00:00:18 Switching pump ON @ Thu Feb 28 03:12:44 CET 2013. Duration: 00:00:35 Switching pump ON @ Thu Feb 28 04:29:44 CET 2013. Safety OFF override! Duration: 00:00:45 Switching pump ON @ Thu Feb 28 05:54:22 CET 2013. Duration: 00:00:19 Switching pump ON @ Thu Feb 28 06:50:57 CET 2013. Duration: 00:00:19 Switching pump ON @ Thu Feb 28 07:39:13 CET 2013. Safety OFF override! Duration: 00:00:45 [17] Ouch.. exception @ Thu Feb 28 07:53:44 CET 2013 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:223) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:211) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:192) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:446) Switching pump ON @ Thu Feb 28 08:36:41 CET 2013. Duration: 00:00:36
  10. Forgive me for not understanding.. but for setWifiHostname() to work, I already need a connection to the AP. No? Does that mean I need to first connect using numeric IP, and then call setWifiHostname(), and from that moment onwards I can in the future just connect via the assigned name? What if the AP suffers a reset? I just don't understand.. maybe a few extra sentences in the docs would help. Plz.
  11. I've changed the program to adopt your two suggestions (listeners + timestamps on TimeoutException). Let's see what the log contains tomorrow morning ;-) BTW, have a look at what I have to do in the listener code to be able to report a human readable reason instead of meaningless short? Not pretty.. any chance of TinkerForge adopting enums for stuff like this? They've been around for a long time in Java.. @Override public void disconnected(final short disconnectReason) { System.err.println("\nHmm. Disconnected @ " + currentTime() + " because: " + ReflectionKit.getNameOfShortConstant(IPConnection.class, "DISCONNECT_REASON_", disconnectReason)); } @Override public void connected(final short connectReason) { System.out.println("\nAha. Connected @ " + currentTime() + " because: " + ReflectionKit.getNameOfShortConstant(IPConnection.class, "CONNECT_REASON_", connectReason)); } public static String getNameOfShortConstant(final Class<?> declaringClass, final String symbolicConstantPrefix, final short constantValue) { return getNameOfNumericConstant(declaringClass, short.class, symbolicConstantPrefix, constantValue); } /************************************************************************* * Get the name of symbolic constant as defined in some class. This method * scans the list of fields of a class to find a constant that has the same * value as the argument. <br> * Here are some examples: * <ul> * <LI>getNameOfIntConstant(0, Cursor.class) -> "DEFAULT_CURSOR" * <LI> * getNameOfIntConstant(3, Cursor.class) -> "WAIT_CURSOR" * </ul> * * @param constantValue the value of the integer constant for which we want * to find the symbolic name * @param declaringClass the class in which the constant is declared * @param symbolicConstantPrefix a String prefix that the symbolic constant * must have * @return the name of the constant, or null if no such constant found. *************************************************************************/ public static <N extends Number> String getNameOfNumericConstant(final Class<?> declaringClass, final Class<N> numberClass, final String symbolicConstantPrefix, final N constantValue) { final Field[] fields = declaringClass.getFields(); final Long constantAsLong = constantValue.longValue(); for (final Field field : fields) { if (field.getType() == numberClass) { if (field.getName().startsWith(symbolicConstantPrefix)) { try { final Long value = field.getLong(null); if (value.equals(constantAsLong)) { return field.getName(); } } catch (final IllegalArgumentException illegalArgumentException) { : } catch (final IllegalAccessException illegalAccessException) { : } } } } // end forall fields return null; }
  12. Yes, sorry about that :-S a simple quick edit caused the bug on my side. Now the output is more like this: Switching pump ON @ Wed Feb 27 01:23:09 CET 2013. Duration: 00:00:16 Switching pump ON @ Wed Feb 27 02:17:32 CET 2013. Duration: 00:00:18 Switching pump ON @ Wed Feb 27 02:45:23 CET 2013. Duration: 00:00:21 Switching pump ON @ Wed Feb 27 02:45:47 CET 2013. Duration: 00:00:04 Switching pump ON @ Wed Feb 27 02:45:55 CET 2013. Duration: 00:00:01 Switching pump ON @ Wed Feb 27 02:46:03 CET 2013. Duration: 00:00:04 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:209) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:197) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:181) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:418) com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:209) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:197) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:181) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:418) Switching pump ON @ Wed Feb 27 03:56:25 CET 2013. Duration: 00:00:39 Switching pump ON @ Wed Feb 27 04:36:35 CET 2013. Duration: 00:00:25 Switching pump ON @ Wed Feb 27 05:25:56 CET 2013. Duration: 00:00:15 Switching pump ON @ Wed Feb 27 05:50:32 CET 2013. Duration: 00:00:20 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:209) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:197) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:181) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:418) Switching pump ON @ Wed Feb 27 07:13:50 CET 2013. Duration: 00:00:18 Switching pump ON @ Wed Feb 27 07:38:05 CET 2013. Duration: 00:00:20 Switching pump ON @ Wed Feb 27 08:31:43 CET 2013. Duration: 00:00:24 com.tinkerforge.TimeoutException: Did not receive response in time for function ID 1 at com.tinkerforge.Device.sendRequest(Device.java:197) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:209) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:197) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:181) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:418) Switching pump ON @ Wed Feb 27 09:20:20 CET 2013. Duration: 00:00:15
  13. Photron, mea culpa Found the TimeoutException-swallowing bug in my code, not yours. Also the 0 timeouts in brickv is due to the behavior you just explained.. nothing more sinister. I'll hopefully compensate your loss of time by ordering some more TF kit to play with. ;-) L.
  14. OK. will test this later today. Just another data point: looking at my program's log from the past night, the connection again got lost, and again the program keeps going without any TimoutExceptions. And here's a clue: I had brickv running all night too.. and it ALSO shows zero (0) timeouts. So something's going on, definitely.
  15. Hi, Is there any way to upgrade Master Bricks remotely, i.e. without having them hooked up to USB, and close enough to press a button? Are there any plans to make this possible? If not, stacks embedded in hard to access places become a bit of a problem as far as upgrading is concerned.. Thx.
  16. Hi TF team, Wouldn't it be nice if.. you also supplied Java bindings documentation using (Java) industry standard, online javadocs? I know you guys generate docs for all supported languages in a TinkerForge-uniform manner, but my suggestion doesn't impact this approach. You could just do both. Producing javadocs from your source code is trivial, and can easily be automated. (but then your code comments need to comply with javadoc standards.. which they currently don't.. mmm. Maybe that's a problem). Anyway, I suspect most Java programmers would agree that they would prefer standard javadocs if they could choose between the two.
  17. I'm not looking at aggressively minimizing costs, my project is a one-off anyway. But I understand that using a IO-4 or IO-16 instead of numerous Analog In bricklets is a far superior approach, if only because it saves precious Bricklet connectors on the Masters (I've just got 3 unused connectors left on my 2-Master stack). I'll have to get hold of the sensor, an IO-16 and an Analog In for good measure (pardon the pun)... and experiment. Thx for the tips guys !
  18. How does that setWifiHostname() work exactly? I'm no TCP/IP guru, but I know that non-numerical IP addresses need to be lookup via DNS, or via an etc/hosts file. If my program should be able to always connect to my stack via a stack name instead of a numeric address, then I'd expect setWifiHostname() to have to interact with a DNS server, or edit a hosts file. Sounds unlikely.. The online docs are extremely sparse.
  19. Wie viele von euch würden beim Kauf eines Lehrbuchs über TinkerForge Technologie, in englischer Sprache verfasst interessiert sein? (bitte nur verwenden, Stimme, wie ich kann nicht deutsch lesen Antworten) How many of you would be interested in buying a textbook on TinkerForge technology, written in English ? (please only use vote, as I can not read German replies)
  20. I'd love to be able to track our water/gas/electricity usage via a mechanism similar to that developed by http://www.bwired.nl/How_rfxcom.asp This chap hooked a plain, cheap sensor to a commercial pulse-counter. With my TF stack now living happily in our cellar, I'd like to try to hook up a Vishay CNY70 Optical Reflective Sensor to an Analog In bricklet and replicate the bwired design. I've got no electronics experience, so am wondering whether this setup can work? Looking at the Analog In, I see that it has a single In line, and two 3.3/5V lines.. so I'm assuming I can just hook up the sensor with no additional electronics..? The rest would be down to the software. Does anyone have experience of Analog In for pulse counting? Thx!
  21. My take on data logging is that it's about both persistent storage and graph-centric visualization. A plain database doesn't give me any visualization. RRDTool looks attractive because it can produce very nice graphs, but it's not exactly trivial to use. With your approach, where does your DB live physically? What did you do to avoid having your DB trigger hard disk activity constantly? My "controller" is my iMac, and I don't really fancy wearing out its main disk.
  22. I've attached the code of my main class, and the Distance IR wrapper class.. and here's a dump of System.out showing the stack traces, but no actual program crash.. the program keeps going. Starting Cellar Water Pump Control System @ Fri Feb 22 22:23:25 CET 2013 Running on Java 1.7.0_04 hosted by Mac OS X 10.7.5 Initializing TinkerForge stack.. Done. Switching pump ON @ Fri Feb 22 23:10:32 CET 2013. Safety OFF override! Duration: 00:00:45 Switching pump ON @ Fri Feb 22 23:54:04 CET 2013. Duration: 00:00:25 Switching pump ON @ Fri Feb 22 23:54:34 CET 2013. Duration: 00:00:10 Switching pump ON @ Sat Feb 23 00:53:27 CET 2013. Duration: 00:00:23 Switching pump ON @ Sat Feb 23 01:50:05 CET 2013. Safety OFF override! Duration: 00:00:45 Switching pump ON @ Sat Feb 23 02:51:07 CET 2013. Duration: 00:00:16 Switching pump ON @ Sat Feb 23 03:38:46 CET 2013. Safety OFF override! Duration: 00:00:45 Switching pump ON @ Sat Feb 23 04:43:43 CET 2013. Safety OFF override! Duration: 00:00:45 Switching pump ON @ Sat Feb 23 05:44:50 CET 2013. Duration: 00:00:26 Switching pump ON @ Sat Feb 23 05:45:19 CET 2013. Duration: 00:00:03 Switching pump ON @ Sat Feb 23 06:38:05 CET 2013. Duration: 00:00:23 Switching pump ON @ Sat Feb 23 07:24:31 CET 2013. Duration: 00:00:13 Switching pump ON @ Sat Feb 23 07:45:16 CET 2013. Safety OFF override! Duration: 00:00:45 Switching pump ON @ Sat Feb 23 08:37:04 CET 2013. Duration: 00:00:22 Switching pump ON @ Sat Feb 23 09:26:04 CET 2013. Duration: 00:00:16 Switching pump ON @ Sat Feb 23 10:21:25 CET 2013. Duration: 00:00:28 Switching pump ON @ Sat Feb 23 11:19:28 CET 2013. Duration: 00:00:24 Switching pump ON @ Sat Feb 23 12:18:00 CET 2013. Duration: 00:00:18 Switching pump ON @ Sat Feb 23 12:18:20 CET 2013. Safety OFF override! Duration: 00:00:45 Switching pump ON @ Sat Feb 23 13:15:43 CET 2013. Duration: 00:00:23 Switching pump ON @ Sat Feb 23 14:12:30 CET 2013. Duration: 00:00:17 Switching pump ON @ Sat Feb 23 15:00:19 CET 2013. Safety OFF override! Duration: 00:00:45 java.net.SocketException: Host is down at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:141) at com.tinkerforge.IPConnection.sendRequest(IPConnection.java:817) at com.tinkerforge.Device.sendRequest(Device.java:185) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:209) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:197) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:181) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:418) java.net.SocketException: Host is down at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:141) at com.tinkerforge.IPConnection.sendRequest(IPConnection.java:817) at com.tinkerforge.Device.sendRequest(Device.java:185) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:209) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:197) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:181) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:418) java.net.SocketException: Host is down at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:141) at com.tinkerforge.IPConnection.sendRequest(IPConnection.java:817) at com.tinkerforge.Device.sendRequest(Device.java:185) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:209) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:197) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:181) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:418) java.net.SocketException: Host is down at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:141) at com.tinkerforge.IPConnection.sendRequest(IPConnection.java:817) at com.tinkerforge.Device.sendRequest(Device.java:185) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:209) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:197) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:181) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:418) java.net.SocketException: Host is down at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:141) at com.tinkerforge.IPConnection.sendRequest(IPConnection.java:817) at com.tinkerforge.Device.sendRequest(Device.java:185) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:209) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:197) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:181) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:418) java.net.SocketException: Host is down at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:141) at com.tinkerforge.IPConnection.sendRequest(IPConnection.java:817) at com.tinkerforge.Device.sendRequest(Device.java:185) at com.tinkerforge.BrickletDistanceIR.getDistance(BrickletDistanceIR.java:219) at com.softwarepearls.lego.hardware.tinkerforge.impl.tf.input.TFDistanceIR.getDistance(TFDistanceIR.java:56) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.dealWithWaterLevelAndPump(CellarWaterPumpController.java:209) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.controlLogic(CellarWaterPumpController.java:197) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.start(CellarWaterPumpController.java:181) at com.softwarepearls.apps.hardware.tinkerforge.waterpump.CellarWaterPumpController.main(CellarWaterPumpController.java:418) CellarWaterPumpController.java TFDistanceIR.java
  23. Does anyone have a stack running 24/24, 365/365, and logging sensor values or other system state? I'd like to log all kinds of stack inputs, and wonder what kind of approach could work (beyond just dumping data in a plain file). I already encountered RRDTool.. anyone using this?
×
×
  • Neu erstellen...