message_t reportmsg;
void report(error_t e) {
- uint8_t *msg = call AMSend.getPayload(&reportmsg);
+ uint8_t *msg = call AMSend.getPayload(&reportmsg, 1);
- msg[0] = e;
- if (call AMSend.send(AM_BROADCAST_ADDR, &reportmsg, 1) != SUCCESS)
- call Leds.led0On();
+ if (msg)
+ {
+ msg[0] = e;
+ if (call AMSend.send(AM_BROADCAST_ADDR, &reportmsg, 1) == SUCCESS)
+ return;
+ }
+ call Leds.led0On();
}
event void AMSend.sendDone(message_t* msg, error_t error) {