Various fixes, courtesy of @atterman.
This commit is contained in:
parent
df4632f399
commit
56780d44d5
|
@ -119,7 +119,7 @@ char bt_devname[11];
|
|||
} else { return false; }
|
||||
} else { return false; }
|
||||
} else { return false; }
|
||||
}
|
||||
} else { return false; }
|
||||
}
|
||||
|
||||
bool bt_init() {
|
||||
|
|
4
LoRa.cpp
4
LoRa.cpp
|
@ -545,10 +545,10 @@ void LoRaClass::optimizeModemSensitivity(){
|
|||
byte bw = (readRegister(REG_MODEM_CONFIG_1) >> 4);
|
||||
uint32_t freq = getFrequency();
|
||||
|
||||
if (bw == 9 && 410E6 <= freq <= 525E6) {
|
||||
if (bw == 9 && (410E6 <= freq) && (freq <= 525E6)) {
|
||||
writeRegister(REG_HIGH_BW_OPTIMIZE_1, 0x02);
|
||||
writeRegister(REG_HIGH_BW_OPTIMIZE_2, 0x7f);
|
||||
} else if (bw == 9 && 862E6 <= freq <= 1020E6) {
|
||||
} else if (bw == 9 && (820E6 <= freq) && (freq <= 1020E6)) {
|
||||
writeRegister(REG_HIGH_BW_OPTIMIZE_1, 0x02);
|
||||
writeRegister(REG_HIGH_BW_OPTIMIZE_2, 0x64);
|
||||
} else {
|
||||
|
|
|
@ -426,7 +426,7 @@ void add_airtime(uint16_t written) {
|
|||
void update_airtime() {
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
uint16_t cb = current_airtime_bin();
|
||||
uint16_t pb = cb-1; if (pb < 0) { pb = AIRTIME_BINS-1; }
|
||||
uint16_t pb = cb-1; if (cb-1 < 0) { pb = AIRTIME_BINS-1; }
|
||||
uint16_t nb = cb+1; if (nb == AIRTIME_BINS) { nb = 0; }
|
||||
airtime_bins[nb] = 0;
|
||||
airtime = (float)(airtime_bins[cb]+airtime_bins[pb])/(2.0*AIRTIME_BINLEN_MS);
|
||||
|
@ -868,7 +868,7 @@ void serialCallback(uint8_t sbyte) {
|
|||
}
|
||||
|
||||
if (frame_len == DEV_HASH_LEN) {
|
||||
memcpy(dev_firmware_hash_target, cmdbuf, DEV_SIG_LEN);
|
||||
memcpy(dev_firmware_hash_target, cmdbuf, DEV_HASH_LEN);
|
||||
device_save_firmware_hash();
|
||||
}
|
||||
#endif
|
||||
|
@ -935,11 +935,12 @@ void updateModemStatus() {
|
|||
portEXIT_CRITICAL(&update_lock);
|
||||
#endif
|
||||
|
||||
if (status & SIG_DETECT == SIG_DETECT) { stat_signal_detected = true; } else { stat_signal_detected = false; }
|
||||
if (status & SIG_SYNCED == SIG_SYNCED) { stat_signal_synced = true; } else { stat_signal_synced = false; }
|
||||
if (status & RX_ONGOING == RX_ONGOING) { stat_rx_ongoing = true; } else { stat_rx_ongoing = false; }
|
||||
if ((status & SIG_DETECT) == SIG_DETECT) { stat_signal_detected = true; } else { stat_signal_detected = false; }
|
||||
if ((status & SIG_SYNCED) == SIG_SYNCED) { stat_signal_synced = true; } else { stat_signal_synced = false; }
|
||||
if ((status & RX_ONGOING) == RX_ONGOING) { stat_rx_ongoing = true; } else { stat_rx_ongoing = false; }
|
||||
|
||||
if (stat_signal_detected || stat_signal_synced || stat_rx_ongoing) {
|
||||
// if (stat_signal_detected || stat_signal_synced || stat_rx_ongoing) {
|
||||
if (stat_signal_detected || stat_signal_synced) {
|
||||
if (stat_rx_ongoing) {
|
||||
if (dcd_count < dcd_threshold) {
|
||||
dcd_count++;
|
||||
|
|
Loading…
Reference in New Issue