Permalink
Browse files

header type uint16_t -> uint8_t, -46 bytes of program memory

  • Loading branch information...
gioblu committed Jun 21, 2018
1 parent 5fb715c commit 506c936a8c0336721cd62ba007d05976a2c2ab5a
Showing with 17 additions and 16 deletions.
  1. +15 −15 src/PJON.h
  2. +2 −1 src/PJONDefines.h
@@ -155,12 +155,12 @@ class PJON {
char *destination,
const char *source,
uint16_t length,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST
) {
uint8_t index = 0;
if(header == PJON_FAIL) header = config;
if(header == PJON_NO_HEADER) header = config;
if(length > 255) header |= PJON_EXT_LEN_BIT;
if((config & PJON_PORT_BIT) || (requested_port != PJON_BROADCAST))
header |= PJON_PORT_BIT;
@@ -273,7 +273,7 @@ class PJON {
const char *packet,
uint16_t length,
uint32_t timing,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST,
uint16_t p_index = PJON_FAIL
@@ -354,8 +354,8 @@ class PJON {
/* Calculate packet overhead: */
uint8_t packet_overhead(uint16_t header = PJON_FAIL) const {
header = (header == PJON_FAIL) ? config : header;
uint8_t packet_overhead(uint8_t header = PJON_NO_HEADER) const {
header = (header == PJON_NO_HEADER) ? config : header;
return (
(
(header & PJON_MODE_BIT) ?
@@ -626,7 +626,7 @@ class PJON {
uint16_t reply(
const char *packet,
uint16_t length,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST
) {
@@ -650,7 +650,7 @@ class PJON {
uint8_t id,
const char *string,
uint16_t length,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST
) {
@@ -664,7 +664,7 @@ class PJON {
const uint8_t *b_id,
const char *string,
uint16_t length,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST
) {
@@ -682,7 +682,7 @@ class PJON {
const uint8_t *b_id,
const char *string,
uint16_t length,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST
) {
@@ -714,7 +714,7 @@ class PJON {
const char *string,
uint16_t length,
uint32_t timing,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST
) {
@@ -732,7 +732,7 @@ class PJON {
const char *string,
uint16_t length,
uint32_t timing,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST
) {
@@ -766,7 +766,7 @@ class PJON {
uint8_t id,
char *string,
uint16_t length,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST
) {
@@ -781,7 +781,7 @@ class PJON {
const uint8_t *b_id,
char *string,
uint16_t length,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST
) {
@@ -800,7 +800,7 @@ class PJON {
const uint8_t *b_id,
const char *string,
uint16_t length,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST,
uint32_t timeout = 3000000
@@ -846,7 +846,7 @@ class PJON {
uint8_t id,
const char *string,
uint16_t length,
uint16_t header = PJON_FAIL,
uint8_t header = PJON_NO_HEADER,
uint16_t p_id = 0,
uint16_t requested_port = PJON_BROADCAST,
uint32_t timeout = 3000000
@@ -90,8 +90,9 @@ limitations under the License. */
#define PJON_FAIL 65535
#define PJON_TO_BE_SENT 74
/* No header present */
#define PJON_NO_HEADER 0B01011000
/* HEADER BITS DEFINITION: */
/* 0 - Local network
1 - Shared network */
#define PJON_MODE_BIT 0B00000001

0 comments on commit 506c936

Please sign in to comment.