Jump to content

[Java] Fehler im BrickletDualRelay getMonoflop()


Recommended Posts

Ich glaube, Ihr habt in der getMonoflop Methode vergessen, dem Rückgabewert (Monoflop) das Relay anzugeben:

 

Hier Euer code:

public Monoflop getMonoflop(short relay) throws TimeoutException, NotConnectedException {
	ByteBuffer bb = ipcon.createRequestPacket((byte)9, FUNCTION_GET_MONOFLOP, this);
	bb.put((byte)relay);

	byte[] response = sendRequest(bb.array());

	bb = ByteBuffer.wrap(response, 8, response.length - ;
	bb.order(ByteOrder.LITTLE_ENDIAN);

	Monoflop obj = new Monoflop();
	obj.state = (bb.get()) != 0;
	obj.time = IPConnection.unsignedInt(bb.getInt());
	obj.timeRemaining = IPConnection.unsignedInt(bb.getInt());

	return obj;
}

Heissen sollte er aber:

public Monoflop getMonoflop(short relay) throws TimeoutException, NotConnectedException {
	ByteBuffer bb = ipcon.createRequestPacket((byte)9, FUNCTION_GET_MONOFLOP, this);
	bb.put((byte)relay);

	byte[] response = sendRequest(bb.array());

	bb = ByteBuffer.wrap(response, 8, response.length - ;
	bb.order(ByteOrder.LITTLE_ENDIAN);

	Monoflop obj = new Monoflop();
	obj.relay = relay;
	obj.state = (bb.get()) != 0;
	obj.time = IPConnection.unsignedInt(bb.getInt());
	obj.timeRemaining = IPConnection.unsignedInt(bb.getInt());

	return obj;
}

Wäre es möglich, dass Ihr das Relay auch noch dort einfüllt... sonst ist das immer 0 und im weiteren Verlauf eines Programs verliert sich die Information... welches Monoflop da gemeint war.

Link zu diesem Kommentar
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...