]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/rf2xx/rf230/RF230DriverLayerP.nc
move the energy detection to a better place so we can measure the energy of ack frames
[tinyos-2.x.git] / tos / chips / rf2xx / rf230 / RF230DriverLayerP.nc
index 65de3ca5449773d3653e55c4fd6d3f92e2dc3c5f..22c969cb8b904ee830f1f57ec21aed5b4de753f2 100644 (file)
@@ -702,6 +702,17 @@ implementation
                        }
 #endif
 
+#ifdef RF230_RSSI_ENERGY
+                       if( irq & RF230_IRQ_TRX_END )
+                       {
+                               if( irq == RF230_IRQ_TRX_END || 
+                                       (irq == (RF230_IRQ_RX_START | RF230_IRQ_TRX_END) && cmd == CMD_NONE) )
+                                       call PacketRSSI.set(rxMsg, readRegister(RF230_PHY_ED_LEVEL));
+                               else
+                                       call PacketRSSI.clear(rxMsg);
+                       }
+#endif
+
                        if( irq & RF230_IRQ_PLL_LOCK )
                        {
                                if( cmd == CMD_TURNON || cmd == CMD_CHANNEL )
@@ -784,12 +795,7 @@ implementation
                                else if( cmd == CMD_RECEIVE )
                                {
                                        ASSERT( state == STATE_RX_ON || state == STATE_PLL_ON_2_RX_ON );
-#ifdef RF230_RSSI_ENERGY
-                                       if( irq == RF230_IRQ_TRX_END )
-                                               call PacketRSSI.set(rxMsg, readRegister(RF230_PHY_ED_LEVEL));
-                                       else
-                                               call PacketRSSI.clear(rxMsg);
-#endif
+
                                        if( state == STATE_PLL_ON_2_RX_ON )
                                        {
                                                ASSERT( (readRegister(RF230_TRX_STATUS) & RF230_TRX_STATUS_MASK) == RF230_PLL_ON );