moved ENERGEST_ON to actual transmission
This commit is contained in:
parent
25d2514541
commit
ccf6bc4d9d
@ -28,7 +28,7 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: simple-cc2420.c,v 1.9 2007/09/18 10:32:00 nifi Exp $
|
||||
* @(#)$Id: simple-cc2420.c,v 1.10 2007/09/18 10:36:31 nifi Exp $
|
||||
*/
|
||||
/*
|
||||
* This code is almost device independent and should be easy to port.
|
||||
@ -263,7 +263,6 @@ simple_cc2420_send(const u8_t *payload, u16_t payload_len)
|
||||
/* Write packet to TX FIFO, appending FCS if AUTOCRC is enabled. */
|
||||
strobe(CC2420_SFLUSHTX); /* Cancel send that never started. */
|
||||
|
||||
ENERGEST_ON(ENERGEST_TYPE_TRANSMIT);
|
||||
|
||||
{
|
||||
u8_t total_len = /*2 +*/ payload_len + 2; /* 2 bytes time stamp,
|
||||
@ -282,7 +281,6 @@ simple_cc2420_send(const u8_t *payload, u16_t payload_len)
|
||||
if(FIFOP_IS_1 && !FIFO_IS_1) {
|
||||
/* RXFIFO overflow, send on retransmit. */
|
||||
PRINTF("rxfifo overflow!\n");
|
||||
ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
|
||||
RELEASE_LOCK();
|
||||
return -4;
|
||||
}
|
||||
@ -304,10 +302,10 @@ simple_cc2420_send(const u8_t *payload, u16_t payload_len)
|
||||
if(SFD_IS_1) {
|
||||
/* PRINTF("simple_cc2420: do_send() transmission has started\n");*/
|
||||
|
||||
ENERGEST_ON(ENERGEST_TYPE_TRANSMIT);
|
||||
do {
|
||||
spiStatusByte = status();
|
||||
} while(spiStatusByte & BV(CC2420_TX_ACTIVE));
|
||||
|
||||
ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
|
||||
|
||||
RELEASE_LOCK();
|
||||
@ -316,8 +314,6 @@ simple_cc2420_send(const u8_t *payload, u16_t payload_len)
|
||||
}
|
||||
|
||||
PRINTF("simple_cc2420: do_send() transmission never started\n");
|
||||
|
||||
ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
|
||||
RELEASE_LOCK();
|
||||
return -3; /* Transmission never started! */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user