removed some debug printout and added initial serial output on stdout

This commit is contained in:
joxe 2009-03-19 14:47:36 +00:00
parent 6b22fa60e8
commit a464b9455c
5 changed files with 44 additions and 25 deletions

View file

@ -27,6 +27,7 @@
<classpath> <classpath>
<pathelement location="${avrora_jar}"/> <pathelement location="${avrora_jar}"/>
<pathelement location="${cooja_jar}"/> <pathelement location="${cooja_jar}"/>
<pathelement location="${cooja}/apps/mspsim/build"/>
</classpath> </classpath>
</javac> </javac>
</target> </target>

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: MicaZMote.java,v 1.4 2009/03/19 09:08:44 joxe Exp $ * $Id: MicaZMote.java,v 1.5 2009/03/19 14:47:36 joxe Exp $
*/ */
package se.sics.cooja.avrmote; package se.sics.cooja.avrmote;
@ -235,7 +235,7 @@ public class MicaZMote implements Mote {
getType().setIdentifier(element.getText()); getType().setIdentifier(element.getText());
try { try {
prepareMote(myMoteType.getContikiFirmwareFile().getName()); prepareMote(myMoteType.getContikiFirmwareFile().getAbsolutePath());
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: MicaZMoteType.java,v 1.3 2009/03/12 15:11:03 fros4943 Exp $ * $Id: MicaZMoteType.java,v 1.4 2009/03/19 14:47:37 joxe Exp $
*/ */
package se.sics.cooja.avrmote; package se.sics.cooja.avrmote;
@ -266,10 +266,10 @@ public class MicaZMoteType implements MoteType {
} }
// Check dependency files // Check dependency files
File elfFile = null; File elfFile = getContikiFirmwareFile();
if (getContikiFirmwareFile() != null) { // if (getContikiFirmwareFile() != null) {
elfFile = new File(getContikiFirmwareFile().getName()); // elfFile = new File(getContikiFirmwareFile().getName());
} // }
if (elfFile == null || !elfFile.exists()) { if (elfFile == null || !elfFile.exists()) {
if (!visAvailable) { if (!visAvailable) {
throw new MoteTypeCreationException("ELF file does not exist: " + getContikiFirmwareFile()); throw new MoteTypeCreationException("ELF file does not exist: " + getContikiFirmwareFile());

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: MicaZLED.java,v 1.1 2009/02/22 16:45:01 joxe Exp $ * $Id: MicaZLED.java,v 1.2 2009/03/19 14:47:37 joxe Exp $
*/ */
package se.sics.cooja.avrmote.interfaces; package se.sics.cooja.avrmote.interfaces;
@ -38,6 +38,7 @@ import org.apache.log4j.Logger;
import org.jdom.Element; import org.jdom.Element;
import avrora.sim.FiniteStateMachine; import avrora.sim.FiniteStateMachine;
import avrora.sim.mcu.AtmelMicrocontroller;
import avrora.sim.platform.MicaZ; import avrora.sim.platform.MicaZ;
import se.sics.cooja.*; import se.sics.cooja.*;
import se.sics.cooja.interfaces.LED; import se.sics.cooja.interfaces.LED;
@ -63,6 +64,27 @@ public class MicaZLED extends LED {
public MicaZLED(MicaZ micaZ) { public MicaZLED(MicaZ micaZ) {
avrora.sim.platform.LED.LEDGroup leds = avrora.sim.platform.LED.LEDGroup leds =
(avrora.sim.platform.LED.LEDGroup) micaZ.getDevice("leds"); (avrora.sim.platform.LED.LEDGroup) micaZ.getDevice("leds");
/* this should go into some other piece of code for serial data */
AtmelMicrocontroller mcu = (AtmelMicrocontroller) micaZ.getMicrocontroller();
avrora.sim.mcu.USART usart = (avrora.sim.mcu.USART) mcu.getDevice("usart0");
if (usart != null) {
System.out.println("MicaZ: connecting to USART1");
usart.connect( new avrora.sim.mcu.USART.USARTDevice() {
char[] stream = {'h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd'};
int count;
public avrora.sim.mcu.USART.Frame transmitFrame() {
System.out.println("MicaZ: transmitting to micaz...");
return new avrora.sim.mcu.USART.Frame((byte)stream[count++ % stream.length], false, 8);
}
public void receiveFrame(avrora.sim.mcu.USART.Frame frame) {
System.out.println("MicaZ: usart output: " + frame.toString());
}
});
} else {
System.out.println("MicaZ: could not find usart1 interface...");
}
leds.leds[0].getFSM().insertProbe(new FiniteStateMachine.Probe() { leds.leds[0].getFSM().insertProbe(new FiniteStateMachine.Probe() {
public void fireAfterTransition(int old, int newstate) { public void fireAfterTransition(int old, int newstate) {
redOn = newstate > 0; redOn = newstate > 0;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: MicaZRadio.java,v 1.1 2009/02/24 07:49:42 joxe Exp $ * $Id: MicaZRadio.java,v 1.2 2009/03/19 14:47:37 joxe Exp $
*/ */
package se.sics.cooja.avrmote.interfaces; package se.sics.cooja.avrmote.interfaces;
@ -49,6 +49,7 @@ import se.sics.cooja.avrmote.MicaZMote;
import se.sics.cooja.interfaces.CustomDataRadio; import se.sics.cooja.interfaces.CustomDataRadio;
import se.sics.cooja.interfaces.Position; import se.sics.cooja.interfaces.Position;
import se.sics.cooja.interfaces.Radio; import se.sics.cooja.interfaces.Radio;
import se.sics.cooja.mspmote.interfaces.CC2420RadioPacketConverter;
/** /**
* CC2420 to COOJA wrapper. * CC2420 to COOJA wrapper.
@ -103,13 +104,10 @@ public class MicaZRadio extends Radio implements CustomDataRadio {
if (len == 0) { if (len == 0) {
lastEventTime = MicaZRadio.this.mote.getSimulation().getSimulationTime(); lastEventTime = MicaZRadio.this.mote.getSimulation().getSimulationTime();
lastEvent = RadioEvent.TRANSMISSION_STARTED; lastEvent = RadioEvent.TRANSMISSION_STARTED;
/*logger.debug("----- SKY TRANSMISSION STARTED -----");*/ /*logger.debug("----- MICAZ TRANSMISSION STARTED -----");*/
setChanged(); setChanged();
notifyObservers(); notifyObservers();
} }
System.out.println("Node transmitting byte: " +
Integer.toString(val & 0xff, 16));
/* send this byte to all nodes */ /* send this byte to all nodes */
lastOutgoingByte = new RadioByte(val); lastOutgoingByte = new RadioByte(val);
lastEventTime = MicaZRadio.this.mote.getSimulation().getSimulationTime(); lastEventTime = MicaZRadio.this.mote.getSimulation().getSimulationTime();
@ -125,15 +123,14 @@ public class MicaZRadio extends Radio implements CustomDataRadio {
} }
if (len == expLen) { if (len == expLen) {
/*logger.debug("----- SKY CUSTOM DATA TRANSMITTED -----");*/ /*logger.debug("----- MICAZ CUSTOM DATA TRANSMITTED -----");*/
// NO CROSSLAYER FOR NOW... lastOutgoingPacket = CC2420RadioPacketConverter.fromCC2420ToCooja(buffer);
// lastOutgoingPacket = CC2420RadioPacketConverter.fromCC2420ToCooja(buffer); lastEventTime = MicaZRadio.this.mote.getSimulation().getSimulationTime();
// lastEventTime = MicaZRadio.this.mote.getSimulation().getSimulationTime(); lastEvent = RadioEvent.PACKET_TRANSMITTED;
// lastEvent = RadioEvent.PACKET_TRANSMITTED; /*logger.debug("----- MICAZ PACKET TRANSMITTED -----");*/
// /*logger.debug("----- SKY PACKET TRANSMITTED -----");*/ setChanged();
// setChanged(); notifyObservers();
// notifyObservers();
// System.out.println("## CC2420 Transmission finished..."); // System.out.println("## CC2420 Transmission finished...");
@ -172,7 +169,6 @@ public class MicaZRadio extends Radio implements CustomDataRadio {
public void receiveCustomData(Object data) { public void receiveCustomData(Object data) {
if (data instanceof RadioByte) { if (data instanceof RadioByte) {
lastIncomingByte = (RadioByte) data; lastIncomingByte = (RadioByte) data;
System.out.println("Node receiving byte: " + lastIncomingByte.getPacketData()[0]);
recv.nextByte(true, (byte)lastIncomingByte.getPacketData()[0]); recv.nextByte(true, (byte)lastIncomingByte.getPacketData()[0]);
} }
} }
@ -256,11 +252,11 @@ public class MicaZRadio extends Radio implements CustomDataRadio {
} }
public double getCurrentOutputPower() { public double getCurrentOutputPower() {
return 0.0;//cc2420.getOutputPower(); return 1.1;//cc2420.getOutputPower();
} }
public int getCurrentOutputPowerIndicator() { public int getCurrentOutputPowerIndicator() {
return 0; //cc2420.getOutputPowerIndicator(); return 7; //cc2420.getOutputPowerIndicator();
} }
public int getOutputPowerIndicatorMax() { public int getOutputPowerIndicatorMax() {
@ -276,7 +272,7 @@ public class MicaZRadio extends Radio implements CustomDataRadio {
} }
public double energyConsumption() { public double energyConsumption() {
return 0; return 1.0;
} }
public JPanel getInterfaceVisualizer() { public JPanel getInterfaceVisualizer() {