bug fix: bytes were not displayed correctly (signed)

This commit is contained in:
fros4943 2009-04-28 07:33:09 +00:00
parent 3aac9a49ce
commit 330b5275a1

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: VariableWatcher.java,v 1.6 2008/02/11 14:03:19 fros4943 Exp $
* $Id: VariableWatcher.java,v 1.7 2009/04/28 07:33:09 fros4943 Exp $
*/
package se.sics.cooja.plugins;
@ -201,7 +201,7 @@ public class VariableWatcher extends VisPlugin {
if (varType.getSelectedIndex() == BYTE_INDEX) {
try {
byte val = moteMemory.getByteValueOf((String) varName.getSelectedItem());
varValues[0].setValue(new Integer(val));
varValues[0].setValue(new Integer(0xFF & val));
varName.setBackground(Color.WHITE);
writeButton.setEnabled(true);
} catch (UnknownVariableException ex) {
@ -223,7 +223,7 @@ public class VariableWatcher extends VisPlugin {
int length = ((Number) varLength.getValue()).intValue();
byte[] vals = moteMemory.getByteArray((String) varName.getSelectedItem(), length);
for (int i=0; i < length; i++) {
varValues[i].setValue(new Integer(vals[i]));
varValues[i].setValue(new Integer(0xFF & vals[i]));
}
varName.setBackground(Color.WHITE);
writeButton.setEnabled(true);