mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2024-10-01 03:15:40 -04:00
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() {
|
||||
|
22
LoRa.cpp
22
LoRa.cpp
@ -515,15 +515,15 @@ long LoRaClass::getSignalBandwidth()
|
||||
byte bw = (readRegister(REG_MODEM_CONFIG_1) >> 4);
|
||||
switch (bw) {
|
||||
case 0: return 7.8E3;
|
||||
case 1: return 10.4E3;
|
||||
case 2: return 15.6E3;
|
||||
case 3: return 20.8E3;
|
||||
case 4: return 31.25E3;
|
||||
case 5: return 41.7E3;
|
||||
case 6: return 62.5E3;
|
||||
case 7: return 125E3;
|
||||
case 8: return 250E3;
|
||||
case 9: return 500E3;
|
||||
case 1: return 10.4E3;
|
||||
case 2: return 15.6E3;
|
||||
case 3: return 20.8E3;
|
||||
case 4: return 31.25E3;
|
||||
case 5: return 41.7E3;
|
||||
case 6: return 62.5E3;
|
||||
case 7: return 125E3;
|
||||
case 8: return 250E3;
|
||||
case 9: return 500E3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -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
Block a user