tx preamle len settings, extended rx timeout
rodzic
7dc1c3c728
commit
88c7994e47
|
@ -154,6 +154,10 @@ You like to enable, if you use your tracker portable and it should automatically
|
|||
<label for="txPower">TX power [dBm]</label>
|
||||
<input name="txPower" id="txPower" type="number" min="0" max="23" title="LoRa TX Power. Range 0 to 23dBm">
|
||||
</div>
|
||||
<div>
|
||||
<label for="preambleLen">TX preamble length [symbols]</label>
|
||||
<input name="preambleLen" id="preambleLen" type="number" min="8" max="4096" title="LoRa TX Preamble size. Range 8 to 4096 symbols">
|
||||
</div>
|
||||
<div>
|
||||
<label for="lora_cradapt">Automatic CodeRate adaption on TX</label>
|
||||
<input name="lora_cradapt" id="lora_cradapt" type="checkbox" value="1" title="Enable automatic CR adaption. Has only influence on TX (RX can decode every CR). Use this only if you are not a WIDE1 or WIDE2 digi (here you like to send always with higher speed). Still testing, if it behaves good to our network. Currently works only for SF12 modes, because for SF 10 and lower the code for programming CR+SF+BW-combination has not been written yet">
|
||||
|
|
|
@ -37,6 +37,8 @@ static const char *const PREF_LORA_TX_ENABLE_INIT = "lora_tx_en_i";
|
|||
static const char *const PREF_LORA_TX_ENABLE = "lora_tx_en";
|
||||
static const char *const PREF_LORA_TX_POWER_INIT = "txPower_i";
|
||||
static const char *const PREF_LORA_TX_POWER = "txPower";
|
||||
static const char *const PREF_LORA_TX_PREAMBLE_LEN_INIT = "preambleLen_i";
|
||||
static const char *const PREF_LORA_TX_PREAMBLE_LEN = "preambleLen";
|
||||
static const char *const PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET_INIT = "lora_rssi2p_i";
|
||||
static const char *const PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET = "lora_rssi2p";
|
||||
static const char *const PREF_LORA_ADD_SNR_RSSI_TO_PATH_END_AT_KISS_PRESET_INIT = "snraprsis_i";
|
||||
|
|
|
@ -448,6 +448,8 @@ boolean lora_tx_enabled = true;
|
|||
uint8_t txPower_cross_digi = 23;
|
||||
#endif
|
||||
#endif
|
||||
uint32_t preambleLen = 64; // default tx preamble len
|
||||
constexpr uint32_t rxTimeoutSymbols = 1024; // extended rx timout to avoid rejecting packets with long preamble
|
||||
|
||||
#define UNITS_SPEED_KMH 1
|
||||
#define UNITS_SPEED_MS 2
|
||||
|
@ -1208,6 +1210,7 @@ void loraSend(byte lora_LTXPower, float lora_FREQ, ulong lora_SPEED, uint8_t fla
|
|||
lora_set_speed(lora_SPEED);
|
||||
rf95.setFrequency(lora_FREQ);
|
||||
rf95.setTxPower(lora_LTXPower);
|
||||
rf95.setPreambleLength(preambleLen);
|
||||
|
||||
#ifdef ENABLE_LED_SIGNALING
|
||||
digitalWrite(TXLED, LOW);
|
||||
|
@ -3027,6 +3030,7 @@ void load_preferences_cfg_file()
|
|||
lora_rx_enabled = jsonElementFromPreferenceCFGBool(PREF_LORA_RX_ENABLE,PREF_LORA_RX_ENABLE_INIT);
|
||||
lora_tx_enabled = jsonElementFromPreferenceCFGBool(PREF_LORA_TX_ENABLE,PREF_LORA_TX_ENABLE_INIT);
|
||||
txPower = jsonElementFromPreferenceCFGInt(PREF_LORA_TX_POWER,PREF_LORA_TX_POWER_INIT);
|
||||
preambleLen = jsonElementFromPreferenceCFGInt(PREF_LORA_TX_PREAMBLE_LEN, PREF_LORA_TX_PREAMBLE_LEN_INIT);
|
||||
lora_automatic_cr_adaption = jsonElementFromPreferenceCFGBool(PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET,PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET_INIT);
|
||||
lora_add_snr_rssi_to_path = jsonElementFromPreferenceCFGInt(PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET,PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET_INIT);
|
||||
kiss_add_snr_rssi_to_path_at_position_without_digippeated_flag = jsonElementFromPreferenceCFGBool(PREF_LORA_ADD_SNR_RSSI_TO_PATH_END_AT_KISS_PRESET,PREF_LORA_ADD_SNR_RSSI_TO_PATH_END_AT_KISS_PRESET_INIT);
|
||||
|
@ -3196,6 +3200,12 @@ void load_preferences_from_flash()
|
|||
}
|
||||
txPower = lora_tx_enabled ? preferences.getInt(PREF_LORA_TX_POWER) : 0;
|
||||
|
||||
if (!preferences.getBool(PREF_LORA_TX_PREAMBLE_LEN_INIT)){
|
||||
preferences.putBool(PREF_LORA_TX_PREAMBLE_LEN_INIT, true);
|
||||
preferences.putInt(PREF_LORA_TX_PREAMBLE_LEN, preambleLen);
|
||||
}
|
||||
preambleLen = preferences.getInt(PREF_LORA_TX_PREAMBLE_LEN);
|
||||
|
||||
if (!preferences.getBool(PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET_INIT)){
|
||||
preferences.putBool(PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET_INIT, true);
|
||||
preferences.putBool(PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET, lora_automatic_cr_adaption);
|
||||
|
@ -3740,9 +3750,12 @@ void setup_phase2_soft_reconfiguration(boolean runtime_reconfiguration) {
|
|||
|
||||
// we tx on main and/or secondary frequency. For tx, loraSend is called (and always has desired txpower as argument)
|
||||
rf95.setTxPower((lora_digipeating_mode < 2 || lora_cross_digipeating_mode < 1) ? txPower : txPower_cross_digi);
|
||||
|
||||
|
||||
Serial.printf("LoRa PWR: %d, LoRa PWR XDigi: %d, RX Enable: %d, TX Enable: %d\r\n", txPower, txPower_cross_digi, lora_rx_enabled, lora_tx_enabled);
|
||||
|
||||
|
||||
// setting rx TO, default to allow rx of long preamble packets
|
||||
rf95.setPreambleLength(rxTimeoutSymbols);
|
||||
|
||||
// APRS fixed location and icon settings
|
||||
init_and_validate_aprs_position_and_icon();
|
||||
|
||||
|
@ -6751,6 +6764,8 @@ invalid_packet:
|
|||
if (sema_lora_lock_success) {
|
||||
rf95.setFrequency(lora_freq_rx_curr);
|
||||
lora_set_speed(lora_speed_rx_curr);
|
||||
// setting rx TO, default to allow rx of long preamble packets
|
||||
rf95.setPreambleLength(rxTimeoutSymbols);
|
||||
// Avoid packet in rx queue from secondary qrg being interpreted to come from main qrg
|
||||
if (lora_freq_rx_curr == lora_freq)
|
||||
rf95.recvAPRS(0, 0);
|
||||
|
|
|
@ -485,6 +485,7 @@ void refill_preferences_as_jsonData()
|
|||
s = s + "\n " + jsonLineFromPreferenceBool(PREF_LORA_RX_ENABLE);
|
||||
s = s + "\n " + jsonLineFromPreferenceBool(PREF_LORA_TX_ENABLE);
|
||||
s = s + "\n " + jsonLineFromPreferenceInt(PREF_LORA_TX_POWER);
|
||||
s = s + "\n " + jsonLineFromPreferenceInt(PREF_LORA_TX_PREAMBLE_LEN);
|
||||
s = s + "\n " + jsonLineFromPreferenceBool(PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET);
|
||||
s = s + "\n " + jsonLineFromPreferenceInt(PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET);
|
||||
s = s + "\n " + jsonLineFromPreferenceBool(PREF_LORA_ADD_SNR_RSSI_TO_PATH_END_AT_KISS_PRESET);
|
||||
|
@ -961,6 +962,9 @@ void handle_SaveAPRSCfg() {
|
|||
if (server.hasArg(PREF_LORA_TX_POWER)) {
|
||||
preferences.putInt(PREF_LORA_TX_POWER, server.arg(PREF_LORA_TX_POWER).toInt());
|
||||
}
|
||||
if (server.hasArg(PREF_LORA_TX_PREAMBLE_LEN)) {
|
||||
preferences.putInt(PREF_LORA_TX_PREAMBLE_LEN, server.arg(PREF_LORA_TX_PREAMBLE_LEN).toInt());
|
||||
}
|
||||
preferences.putBool(PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET, server.hasArg(PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET));
|
||||
if (server.hasArg(PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET)){
|
||||
preferences.putInt(PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET, server.arg(PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET).toInt());
|
||||
|
|
Ładowanie…
Reference in New Issue