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 to comment
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...