removed some debug printout and added initial serial output on stdout
This commit is contained in:
parent
6b22fa60e8
commit
a464b9455c
5 changed files with 44 additions and 25 deletions
|
@ -27,6 +27,7 @@
|
|||
<classpath>
|
||||
<pathelement location="${avrora_jar}"/>
|
||||
<pathelement location="${cooja_jar}"/>
|
||||
<pathelement location="${cooja}/apps/mspsim/build"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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;
|
||||
|
@ -235,7 +235,7 @@ public class MicaZMote implements Mote {
|
|||
getType().setIdentifier(element.getText());
|
||||
|
||||
try {
|
||||
prepareMote(myMoteType.getContikiFirmwareFile().getName());
|
||||
prepareMote(myMoteType.getContikiFirmwareFile().getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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;
|
||||
|
@ -266,10 +266,10 @@ public class MicaZMoteType implements MoteType {
|
|||
}
|
||||
|
||||
// Check dependency files
|
||||
File elfFile = null;
|
||||
if (getContikiFirmwareFile() != null) {
|
||||
elfFile = new File(getContikiFirmwareFile().getName());
|
||||
}
|
||||
File elfFile = getContikiFirmwareFile();
|
||||
// if (getContikiFirmwareFile() != null) {
|
||||
// elfFile = new File(getContikiFirmwareFile().getName());
|
||||
// }
|
||||
if (elfFile == null || !elfFile.exists()) {
|
||||
if (!visAvailable) {
|
||||
throw new MoteTypeCreationException("ELF file does not exist: " + getContikiFirmwareFile());
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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;
|
||||
|
@ -38,6 +38,7 @@ import org.apache.log4j.Logger;
|
|||
import org.jdom.Element;
|
||||
|
||||
import avrora.sim.FiniteStateMachine;
|
||||
import avrora.sim.mcu.AtmelMicrocontroller;
|
||||
import avrora.sim.platform.MicaZ;
|
||||
import se.sics.cooja.*;
|
||||
import se.sics.cooja.interfaces.LED;
|
||||
|
@ -63,6 +64,27 @@ public class MicaZLED extends LED {
|
|||
public MicaZLED(MicaZ micaZ) {
|
||||
avrora.sim.platform.LED.LEDGroup 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() {
|
||||
public void fireAfterTransition(int old, int newstate) {
|
||||
redOn = newstate > 0;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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;
|
||||
|
@ -49,6 +49,7 @@ import se.sics.cooja.avrmote.MicaZMote;
|
|||
import se.sics.cooja.interfaces.CustomDataRadio;
|
||||
import se.sics.cooja.interfaces.Position;
|
||||
import se.sics.cooja.interfaces.Radio;
|
||||
import se.sics.cooja.mspmote.interfaces.CC2420RadioPacketConverter;
|
||||
|
||||
/**
|
||||
* CC2420 to COOJA wrapper.
|
||||
|
@ -103,13 +104,10 @@ public class MicaZRadio extends Radio implements CustomDataRadio {
|
|||
if (len == 0) {
|
||||
lastEventTime = MicaZRadio.this.mote.getSimulation().getSimulationTime();
|
||||
lastEvent = RadioEvent.TRANSMISSION_STARTED;
|
||||
/*logger.debug("----- SKY TRANSMISSION STARTED -----");*/
|
||||
/*logger.debug("----- MICAZ TRANSMISSION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
System.out.println("Node transmitting byte: " +
|
||||
Integer.toString(val & 0xff, 16));
|
||||
|
||||
/* send this byte to all nodes */
|
||||
lastOutgoingByte = new RadioByte(val);
|
||||
lastEventTime = MicaZRadio.this.mote.getSimulation().getSimulationTime();
|
||||
|
@ -125,15 +123,14 @@ public class MicaZRadio extends Radio implements CustomDataRadio {
|
|||
}
|
||||
|
||||
if (len == expLen) {
|
||||
/*logger.debug("----- SKY CUSTOM DATA TRANSMITTED -----");*/
|
||||
/*logger.debug("----- MICAZ CUSTOM DATA TRANSMITTED -----");*/
|
||||
|
||||
// NO CROSSLAYER FOR NOW...
|
||||
// lastOutgoingPacket = CC2420RadioPacketConverter.fromCC2420ToCooja(buffer);
|
||||
// lastEventTime = MicaZRadio.this.mote.getSimulation().getSimulationTime();
|
||||
// lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
// /*logger.debug("----- SKY PACKET TRANSMITTED -----");*/
|
||||
// setChanged();
|
||||
// notifyObservers();
|
||||
lastOutgoingPacket = CC2420RadioPacketConverter.fromCC2420ToCooja(buffer);
|
||||
lastEventTime = MicaZRadio.this.mote.getSimulation().getSimulationTime();
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- MICAZ PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
// System.out.println("## CC2420 Transmission finished...");
|
||||
|
||||
|
@ -172,7 +169,6 @@ public class MicaZRadio extends Radio implements CustomDataRadio {
|
|||
public void receiveCustomData(Object data) {
|
||||
if (data instanceof RadioByte) {
|
||||
lastIncomingByte = (RadioByte) data;
|
||||
System.out.println("Node receiving 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() {
|
||||
return 0.0;//cc2420.getOutputPower();
|
||||
return 1.1;//cc2420.getOutputPower();
|
||||
}
|
||||
|
||||
public int getCurrentOutputPowerIndicator() {
|
||||
return 0; //cc2420.getOutputPowerIndicator();
|
||||
return 7; //cc2420.getOutputPowerIndicator();
|
||||
}
|
||||
|
||||
public int getOutputPowerIndicatorMax() {
|
||||
|
@ -276,7 +272,7 @@ public class MicaZRadio extends Radio implements CustomDataRadio {
|
|||
}
|
||||
|
||||
public double energyConsumption() {
|
||||
return 0;
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
public JPanel getInterfaceVisualizer() {
|
||||
|
|
Loading…
Reference in a new issue