Merge branches 'main' and 'feature/add-sx1280PA' of https://github.com/Genaker/LoraSA into feature/add-sx1280PA

This commit is contained in:
Egor Shitikov
2024-09-22 14:17:32 -07:00
8 changed files with 299 additions and 60 deletions

View File

@@ -25,7 +25,7 @@
#include <Arduino.h>
// #define OSD_ENABLED true
#define OSD_ENABLED true
// #define WIFI_SCANNING_ENABLED true
// #define BT_SCANNING_ENABLED true
@@ -71,58 +71,6 @@ uint64_t bt_start = 0;
#include "DFRobot_OSD.h"
#define OSD_SIDE_BAR true
static constexpr uint16_t levels[10] = {
0x105, // 0
0x10E, // 1
0x10D, // 2
0x10C, // 3
0x10B, // 4
0x10A, // 5
0x109, // 6
0x108, // 7
0x107, // 8
0x106, // 9
};
static constexpr uint16_t power_level[MAX_POWER_LEVELS + 1] = {
0x10E, // 0
0x10E, // 1
0x10D, // 2
0x10C, // 3
0x10B, // 4
0x10A, // 5
0x109, // 6
0x108, // 7
0x107, // 8
0x106, // 9 not using 106 to accent rise
// new line
0x10E, // 10
0x10D, // 11
0x10C, // 12
0x10B, // 13
0x10A, // 14
0x109, // 15
0x108, // 16
0x107, // 17
0x106, // 18 not using 106
// new line
0x10E, // 19
0x10D, // 20
0x10C, // 21
0x10B, // 22
0x10A, // 23
0x109, // 24
0x108, // 25
0x107, // 26
0x106, // 27
0x105, // 28 ---
0x105, // 29
0x105, // 30
0x105, // 31
0x105, // 32
0x105 // 33
};
// SPI pins
#define OSD_CS 47
#define OSD_MISO 33
@@ -147,11 +95,6 @@ int global_counter = 0;
DFRobot_OSD osd(OSD_CS);
#endif
/*Define Custom characters Example*/
static const int buf0[36] = {0x02, 0x80, 0x02, 0x40, 0x7F, 0xE0, 0x42, 0x00,
0x42, 0x00, 0x7A, 0x40, 0x4A, 0x40, 0x4A, 0x80,
0x49, 0x20, 0x5A, 0xA0, 0x44, 0x60, 0x88, 0x20};
#include "global_config.h"
#include "ui.h"
@@ -212,8 +155,6 @@ constexpr int WINDOW_SIZE = 15;
// Number of samples for each frequency scan. Fewer samples = better temporal resolution.
// if more than 100 it can freeze
#define SAMPLES 35 //(scan time = 1294)
// number of samples for RSSI method
#define SAMPLES_RSSI 12 // 21 //
#define RANGE (int)(FREQ_END - FREQ_BEGIN)
@@ -232,6 +173,7 @@ uint64_t median_frequency = FREQ_BEGIN + FREQ_END - FREQ_BEGIN / 2;
// Array to store the scan results
uint16_t result[RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE];
uint16_t result[RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE];
bool filtered_result[RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE];
@@ -831,6 +773,8 @@ int max_rssi_x = 999;
RadioScan r;
RadioScan r;
void loop(void)
{
UI_displayDecorate(0, 0, false); // some default values
@@ -919,6 +863,7 @@ void loop(void)
// horizontal (x axis) Frequency loop
osd_x = 1, osd_y = 2, col = 0, max_bin = 0;
int radio_error_count = 0;
// x loop
for (x = 0; x < STEPS * SCAN_RBW_FACTOR; x++)
{