diff options
Diffstat (limited to 'serial-pjon/serial-pjon.cpp')
-rw-r--r-- | serial-pjon/serial-pjon.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/serial-pjon/serial-pjon.cpp b/serial-pjon/serial-pjon.cpp index 7c3a116..bb1320d 100644 --- a/serial-pjon/serial-pjon.cpp +++ b/serial-pjon/serial-pjon.cpp @@ -44,28 +44,31 @@ void error_handler(uint8_t code, uint8_t data) { printf("Possible wrong bus configuration!\r\n"); printf("higher MAX_PACKETS in PJON.h if necessary.\r\n"); } - if(code == MEMORY_FULL) { - printf("Packet memory allocation failed. Memory is full.\r\n"); - } if(code == CONTENT_TOO_LONG) { printf("Content is too long, length: %d\r\n", data); } if(code == ID_ACQUISITION_FAIL) { printf("Can't acquire a free id %d\r\n", data); } + if(code == DEVICES_BUFFER_FULL) { + printf("Packet memory allocation failed. Memory is full.\r\n"); + } } -void recv_handler(uint8_t id, uint8_t *payload, uint8_t length) { - if(length == 0) { - printf("got 0 byte message from %d...\r\n", id); - return; - } +void recv_handler(uint8_t *payload, uint8_t length, const PacketInfo &packet_info) { + + + + // if(length == 0) { + // printf("got 0 byte message from %d.%d.%d.%d...\r\n"); + // return; + // } led_on(); - printf("got message(%d bytes) from %d: '", length, id); - for(uint16_t i = 0; i < length; ++i) - putchar(payload[i]); - printf("'\r\n"); - delay(30); + // printf("got message(%d bytes) from %d: '", length, id); + // for(uint16_t i = 0; i < length; ++i) + // putchar(payload[i]); + // printf("'\r\n"); + // delay(30); led_off(); } @@ -97,7 +100,7 @@ int main(void) arduino_init(); bus.set_error(error_handler); bus.set_receiver(recv_handler); - bus.set_pin(8); + bus.strategy.set_pins(8, NOT_ASSIGNED); bus.begin(); for(;;) { |