Skip to content

Commit eb58523

Browse files
committed
JP_STRICT: adjust MAX_TEXT_LEN based on LORA_CR setting
MAX_TEXT_LEN is automatically selected based on the LORA_CR build flag defined in platformio.ini (e.g. -D LORA_CR=5). CR4/5: 48 bytes (~16 JP chars, TX ~3808ms) CR4/6: 32 bytes (~10 JP chars) CR4/7: 24 bytes (~8 JP chars) CR4/8: 16 bytes (~5 JP chars, default) To enable CR4/5 for Japan, add -D LORA_CR=5 to your board's build_flags in platformio.ini. Set LORA_CR=5 for WioTrackerL1 and RAK WisMesh Tag.
1 parent f4519b1 commit eb58523

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/helpers/BaseChatMesh.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,24 @@
66
#include <helpers/TxtDataHelpers.h>
77

88
// JP_STRICT: limit MAX_TEXT_LEN to keep TX time under 4s (ARIB STD-T108)
9-
// SF12/BW125/CR4-8: 60 bytes total packet = ~3809ms, overhead ~44 bytes
10-
// leaving 16 bytes (1*CIPHER_BLOCK_SIZE) for text payload
9+
// SF12/BW125, packet overhead ~44 bytes
10+
// CR4/5: 100 bytes total = ~3808ms → 56 bytes text → ~18 JP chars
11+
// CR4/6: 80 bytes total = ~3530ms → 36 bytes text → ~12 JP chars
12+
// CR4/7: 70 bytes total = ~3530ms → 26 bytes text → ~8 JP chars
13+
// CR4/8: 60 bytes total = ~3809ms → 16 bytes text → ~5 JP chars
1114
#ifdef JP_STRICT
12-
#define MAX_TEXT_LEN (1*CIPHER_BLOCK_SIZE) // ~16 chars, TX <= 4s for JP
15+
#if defined(LORA_CR) && (LORA_CR == 5)
16+
#define MAX_TEXT_LEN (3*CIPHER_BLOCK_SIZE) // 48 bytes ~18 JP chars
17+
#elif defined(LORA_CR) && (LORA_CR == 6)
18+
#define MAX_TEXT_LEN (2*CIPHER_BLOCK_SIZE) // 32 bytes ~10 JP chars
19+
#elif defined(LORA_CR) && (LORA_CR == 7)
20+
#define MAX_TEXT_LEN (1*CIPHER_BLOCK_SIZE+8) // 24 bytes ~8 JP chars
21+
#else
22+
#define MAX_TEXT_LEN (1*CIPHER_BLOCK_SIZE) // 16 bytes ~5 JP chars
23+
#endif
1324
#else
14-
#define MAX_TEXT_LEN (10*CIPHER_BLOCK_SIZE) // must be LESS than (MAX_PACKET_PAYLOAD - 4 - CIPHER_MAC_SIZE - 1)
25+
#define MAX_TEXT_LEN (10*CIPHER_BLOCK_SIZE)
26+
// must be LESS than (MAX_PACKET_PAYLOAD - 4 - CIPHER_MAC_SIZE - 1)
1527
#endif
1628

1729
#include "ContactInfo.h"

variants/rak_wismesh_tag/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ build_flags = ${nrf52_base.build_flags}
2626
-D PIN_BOARD_SDA=PIN_WIRE_SDA
2727
-D PIN_BOARD_SCL=PIN_WIRE_SCL
2828
-D JP_STRICT
29+
-D LORA_CR=5
2930
build_src_filter = ${nrf52_base.build_src_filter}
3031
+<../variants/rak_wismesh_tag>
3132
+<helpers/ui/MomentaryButton.cpp>

variants/wio-tracker-l1/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ build_flags = ${nrf52_base.build_flags}
1717
-D PIN_OLED_RESET=-1
1818
-D GPS_BAUD_RATE=9600
1919
-D JP_STRICT
20+
-D LORA_CR=5
2021
build_src_filter = ${nrf52_base.build_src_filter}
2122
+<WioTrackerL1Board.cpp>
2223
+<../variants/wio-tracker-l1>

0 commit comments

Comments
 (0)