Commit graph

15 commits

Author SHA1 Message Date
jirogit
56a2d93aa4 Fix build for non-FreeRTOS and non-SX1262 platforms
- Replace vTaskDelay(1) with YIELD_TASK() macro for platform compatibility
  (FreeRTOS: vTaskDelay, others: delay)
- Make getCodingRate() and getFreqMHz() non-pure virtual with defaults
  (default CR4/8, default freq 0.0f for unknown platforms)
- Add getCodingRate() and getFreqMHz() to CustomSTM32WLxWrapper

All environments now build successfully.
2026-03-31 21:57:05 -07:00
jirogit
4276d84070 Remove TX duration debug logging
_tx_start_ms and TX duration logging were added for 4-second
airtime verification and are no longer needed.
2026-03-31 21:57:05 -07:00
jirogit
c725b82e77 Replace JP_STRICT build flag with runtime frequency detection
JP LBT mode now activates automatically based on operating frequency:
- CH25: 920.800MHz
- CH26: 921.000MHz
- CH27: 921.200MHz (ARIB STD-T108, 200kHz grid)

Changes:
- Add isJapanMode() to RadioLibWrapper using getFreqMHz()
- Add getFreqMHz() to CustomSX1262Wrapper and CustomLR1110Wrapper
- Remove #ifdef JP_STRICT throughout, replaced by isJapanMode()
- Remove -D JP_STRICT build flag from platformio.ini
- MAX_TEXT_LEN dynamically determined by CR at runtime via getMaxTextLen()

No build flags required: JP compliance activates automatically
when device is configured to Japan 3 frequencies.
2026-03-31 21:57:05 -07:00
jirogit
73ec37657c Add getCodingRate() to CustomLR1110 and CustomLR1110Wrapper
LR1110 has codingRate as protected field in LR_common.h, so
getCodingRate() is implemented in CustomLR1110 class directly,
and exposed via CustomLR1110Wrapper override.

This enables dynamic MAX_TEXT_LEN calculation for T1000-E
under JP_STRICT mode.
2026-03-31 21:57:05 -07:00
jirogit
2d11d9fedb Add exponential backoff for channel busy detection
Replace fixed random(8000-22000ms) backoff with exponential backoff:
- 1st busy: 3-6s
- 2nd busy: 6-12s
- 3rd+ busy: 12-20s (capped)
- Reset counter on channel free

Results (48-byte simultaneous DM, JP SF12/BW125/CR4-5):
- 3/3 success, delivered within 0:23-0:45
- Previous fixed backoff: 1:03-3:55
2026-03-31 21:57:05 -07:00
jirogit
f4519b19c8 JP_STRICT: use absolute -80dBm RSSI threshold for LBT (ARIB STD-T108)
Replace relative threshold (_noise_floor + _threshold) with absolute
-80dBm as specified by ARIB STD-T108 for carrier sense detection.

Previous relative threshold (~-99dBm) caused false busy detection
from environmental noise. -80dBm matches the legal requirement and
reduces spurious backoff.
2026-03-31 21:57:05 -07:00
jirogit
7bae0d8405 Add JP_STRICT 5ms continuous RSSI sensing before TX (ARIB STD-T108)
Under JP_STRICT mode, add energy-based carrier sensing loop before CAD:
- Sample RSSI continuously for >= 5ms before each TX attempt
- If RSSI exceeds threshold at any point, trigger random backoff
- ARIB STD-T108 requires energy-based sensing; LoRa CAD alone is
  insufficient as it only detects LoRa preambles

This satisfies the minimum 5ms continuous sensing requirement for
the 920.6-922.2 MHz zone (specified low power radio, LBT mode).

Test results (JP LoRa SF12/BW125/CR4-8, simultaneous DM):
- 16-char: 2/2 success, delivered within 1:03-1:50
- 1-char:  3/4 success, delivered within 0:46-2:11
           (shorter airtime reduces RSSI detection window)
2026-03-31 21:57:05 -07:00
Wessel Nieboer
52b9d877a6 Use hardware channel activity detection for checking interference 2026-03-31 21:57:05 -07:00
Wessel Nieboer
9106ab46e1
reset noise_floor sampling after agc reset 2026-02-28 19:09:25 +01:00
Wessel Nieboer
a2dc2eb50c
when doing AGC reset, call Calibrate(0x7F)
1. warm sleep
2. wake to stdby
3. Calibrate(0x7F) to reset all internal blocks
4. re-apply DIO2 RF / boosted gain & register patch to make sure
everything is as it was
2026-02-28 19:09:25 +01:00
Wessel Nieboer
f81ec4b14c
fix agc reset 2026-02-28 19:09:25 +01:00
Chris
c16bcd2fe3 Expose a counter to track RadioLib receive errors
This change counts when readData returns an err code other than RADIOLIB_ERR_NONE. In most cases this is going to be a CRC error. This counter is exposed in the `stats-packets` command, and in the repeater stats payload (4 additional bytes to the payload, which is now 56 bytes with this change. My incompetent robot claims the total payload size is 96 bytes (unverified but probably close).
2026-01-24 20:06:29 -08:00
entr0p1
245a818085 Fix TX LED stuck on when StartTransmit() fails 2025-12-20 23:15:41 +11:00
liamcottle
599e3a187c start rx again immediately after receive 2025-07-20 23:27:54 +12:00
recrof
6be8e19a9f move radiolib wrappers to dedicated directory 2025-07-13 11:37:33 +02:00
Renamed from src/helpers/RadioLibWrappers.cpp (Browse further)