Skip to content

Commit 333ef5b

Browse files
authored
Fix FEC calculation for 0 FEC, initialise FEC properly (#71)
1 parent 132d116 commit 333ef5b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

app/src/main/java/com/openipc/pixelpilot/VideoActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ void initDefaultOptions(){
743743
int adaptiveTxPower = prefs.getInt("adaptive_tx_power", 20);
744744
wfbLink.nativeSetAdaptiveLinkEnabled(adaptiveEnabled);
745745
wfbLink.nativeSetTxPower(adaptiveTxPower);
746+
boolean fecEnabled = prefs.getBoolean("custom_fec_enabled", true);
747+
wfbLink.nativeSetUseFec(fecEnabled ? 1 : 0);
746748
}
747749

748750
/**

app/wfbngrtl8812/src/main/cpp/SignalQualityCalculator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ std::pair<uint32_t, uint32_t> SignalQualityCalculator::get_accumulated_fec_data(
126126
// Make sure we clean up old FEC data first
127127
cleanup_old_fec_data();
128128

129+
if (m_fec_data.empty()) return {300, 300};
130+
129131
// __android_log_print(ANDROID_LOG_ERROR, "LOST size", "%zu", m_fec_data.size());
130132

131133
uint32_t p_recovered = 0;
@@ -136,7 +138,6 @@ std::pair<uint32_t, uint32_t> SignalQualityCalculator::get_accumulated_fec_data(
136138
p_recovered += data.recovered;
137139
p_lost += data.lost;
138140
}
139-
if (p_all == 0) return {300, 300};
140141
return {p_recovered, p_lost};
141142
}
142143

0 commit comments

Comments
 (0)