mirror of
https://github.com/Genaker/LoraSA.git
synced 2026-03-28 17:42:59 +01:00
Add formatter
This commit is contained in:
5
.clang-format
Normal file
5
.clang-format
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
BasedOnStyle: LLVM
|
||||||
|
UseTab: Never
|
||||||
|
ColumnLimit: 90
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
IndentWidth: 4
|
||||||
25
.vscode/settings.json
vendored
25
.vscode/settings.json
vendored
@@ -1,12 +1,15 @@
|
|||||||
{
|
{
|
||||||
"files.associations": {
|
// Suggest where to make a new line by adding two vertical lines
|
||||||
"images.h": "c",
|
// Vertical lines, 79 works well for code reviews and diffs
|
||||||
"*.tcc": "cpp",
|
"editor.rulers": [
|
||||||
"deque": "cpp",
|
79,
|
||||||
"string": "cpp",
|
90
|
||||||
"unordered_map": "cpp",
|
],
|
||||||
"unordered_set": "cpp",
|
"editor.formatOnSave": true,
|
||||||
"vector": "cpp",
|
"editor.minimap.enabled": false,
|
||||||
"system_error": "cpp"
|
"workbench.colorCustomizations": {
|
||||||
}
|
"editorRuler.foreground": "#ff4081"
|
||||||
}
|
},
|
||||||
|
"files.insertFinalNewline": true,
|
||||||
|
"files.autoSave": "onFocusChange",
|
||||||
|
}
|
||||||
|
|||||||
15
.vscode/tasks.json
vendored
Normal file
15
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Format All Files with ClangFormat",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "find . -name '*.cpp' -o -name '*.h' | xargs clang-format -i",
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
#ifndef __IMAGES_H__
|
#ifndef __IMAGES_H__
|
||||||
#define __IMAGES_H__
|
#define __IMAGES_H__
|
||||||
|
|
||||||
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 1040)
|
// Array of all bitmaps for convenience. (Total bytes used to store images in
|
||||||
|
// PROGMEM = 1040)
|
||||||
|
|
||||||
extern const unsigned char epd_bitmap_ucog [];
|
extern const unsigned char epd_bitmap_ucog[];
|
||||||
|
|
||||||
#endif // __IMAGES_H__
|
#endif // __IMAGES_H__
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
#ifndef __UI_H__
|
#ifndef __UI_H__
|
||||||
#define __UI_H__
|
#define __UI_H__
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include "SSD1306Wire.h"
|
|
||||||
#include "OLEDDisplayUi.h"
|
#include "OLEDDisplayUi.h"
|
||||||
|
#include "SSD1306Wire.h"
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
// #include <heltec_unofficial.h>
|
// #include <heltec_unofficial.h>
|
||||||
|
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
#define ONE_MILLISEC 1
|
#define ONE_MILLISEC 1
|
||||||
|
|
||||||
// Prints debug information and the scan measurement bins from the SX1262 in hex
|
// Prints debug information and the scan measurement bins from the SX1262 in
|
||||||
// Change spectrum plot values at once or by line
|
// hex Change spectrum plot values at once or by line
|
||||||
#define ANIMATED_RELOAD false
|
#define ANIMATED_RELOAD false
|
||||||
|
|
||||||
#define MAJOR_TICK_LENGTH 2
|
#define MAJOR_TICK_LENGTH 2
|
||||||
|
|||||||
173
src/images.cpp
173
src/images.cpp
@@ -1,102 +1,89 @@
|
|||||||
|
|
||||||
#include "images.h"
|
#include "images.h"
|
||||||
//'Logo_UCOG', 128x64px
|
//'Logo_UCOG', 128x64px
|
||||||
//https://www.online-utility.org/image/convert/to/XBM
|
// https://www.online-utility.org/image/convert/to/XBM
|
||||||
//https://javl.github.io/image2cpp/
|
// https://javl.github.io/image2cpp/
|
||||||
//#define 1721604660673_width 128
|
//#define 1721604660673_width 128
|
||||||
//#define 1721604660673_height 64
|
//#define 1721604660673_height 64
|
||||||
|
|
||||||
const unsigned char epd_bitmap_ucog[] = {
|
const unsigned char epd_bitmap_ucog[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF,
|
0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xF8, 0x01, 0x00, 0x00,
|
0x10, 0x84, 0xC3, 0x81, 0x03, 0x00, 0x60, 0x00, 0xCC, 0x07, 0x00, 0x00, 0x00, 0x70,
|
||||||
0x00, 0xC0, 0x00, 0x00, 0x10, 0x84, 0xC3, 0x81, 0x03, 0x00, 0x60, 0x00,
|
0x00, 0x00, 0x30, 0xE6, 0xF3, 0xE3, 0x07, 0x00, 0x60, 0x00, 0x0C, 0x3E, 0x00, 0x00,
|
||||||
0xCC, 0x07, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x30, 0xE6, 0xF3, 0xE3,
|
0x00, 0x38, 0x00, 0x00, 0x30, 0x66, 0x10, 0x36, 0x00, 0x00, 0x60, 0x00, 0x06, 0xF8,
|
||||||
0x07, 0x00, 0x60, 0x00, 0x0C, 0x3E, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x30, 0x26, 0x18, 0x36, 0x00, 0x00, 0x60, 0x00,
|
||||||
0x30, 0x66, 0x10, 0x36, 0x00, 0x00, 0x60, 0x00, 0x06, 0xF8, 0x00, 0x00,
|
0x07, 0xE0, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x30, 0x26, 0x18, 0x36, 0x07, 0x00,
|
||||||
0x00, 0x0E, 0x00, 0x00, 0x30, 0x26, 0x18, 0x36, 0x00, 0x00, 0x60, 0x00,
|
0x60, 0x00, 0x03, 0x00, 0x1F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x30, 0x26, 0x18, 0x36,
|
||||||
0x07, 0xE0, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x30, 0x26, 0x18, 0x36,
|
0x06, 0x00, 0x60, 0x80, 0x01, 0x00, 0x7C, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x30, 0x66,
|
||||||
0x07, 0x00, 0x60, 0x00, 0x03, 0x00, 0x1F, 0x00, 0xC0, 0x01, 0x00, 0x00,
|
0x38, 0x76, 0x06, 0x0C, 0x60, 0xC0, 0x01, 0x00, 0xF0, 0x01, 0x78, 0x00, 0x00, 0x00,
|
||||||
0x30, 0x26, 0x18, 0x36, 0x06, 0x00, 0x60, 0x80, 0x01, 0x00, 0x7C, 0x00,
|
0xE0, 0xE3, 0xF3, 0xE3, 0x07, 0x0E, 0x60, 0xC0, 0x03, 0x00, 0x80, 0x0F, 0x1C, 0x00,
|
||||||
0xE0, 0x00, 0x00, 0x00, 0x30, 0x66, 0x38, 0x76, 0x06, 0x0C, 0x60, 0xC0,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x60, 0xE0, 0x07, 0x00, 0x00, 0x3E,
|
||||||
0x01, 0x00, 0xF0, 0x01, 0x78, 0x00, 0x00, 0x00, 0xE0, 0xE3, 0xF3, 0xE3,
|
0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x60, 0x60, 0x0E, 0x00,
|
||||||
0x07, 0x0E, 0x60, 0xC0, 0x03, 0x00, 0x80, 0x0F, 0x1C, 0x00, 0x00, 0x00,
|
0x00, 0xF8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x60, 0x70,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x60, 0xE0, 0x07, 0x00, 0x00, 0x3E,
|
0x1C, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00,
|
||||||
0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x60, 0x60,
|
0x60, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x0E, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x70, 0x00, 0x60, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xE0, 0x01, 0x60, 0x70, 0x1C, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x38, 0x00, 0xF0, 0x18, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x60, 0x30, 0x38, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xFC, 0x0D, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x60, 0x18,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0xFE, 0x0F, 0xC0, 0x00, 0x00, 0x00,
|
||||||
0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x67, 0x0F, 0x00, 0x00,
|
||||||
0x38, 0x00, 0xF0, 0x18, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x61, 0x1C,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xFC, 0x0D, 0xE0, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0xFE, 0x0F,
|
0x60, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x38, 0x60, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x80, 0x67, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x7E, 0xE0, 0xE0, 0x01, 0x00, 0x00, 0x00, 0xF0, 0x7F, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x61, 0x1C, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x10, 0x67, 0xE0, 0x83, 0x03, 0x00, 0x00, 0xE0, 0xFF, 0xE1,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x60, 0x38,
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x63, 0x60, 0x07, 0x07, 0x00, 0xC0, 0xFF,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x03, 0x80, 0x03, 0x00, 0x00, 0x08, 0x00, 0x02, 0xF0, 0x61, 0x60, 0x1C, 0x1F, 0x80,
|
||||||
0x00, 0x38, 0x60, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
|
0xFF, 0x07, 0x00, 0x00, 0x0E, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xF8,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0xE0, 0xE0, 0x01, 0x00, 0x00, 0x00,
|
0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x18, 0x00, 0x02, 0xF0, 0x7F,
|
||||||
0xF0, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x67, 0xE0, 0x83,
|
0x60, 0xDC, 0x1F, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x02,
|
||||||
0x03, 0x00, 0x00, 0xE0, 0xFF, 0xE1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02,
|
0xD0, 0x61, 0x60, 0x07, 0x0F, 0x00, 0xC0, 0xFF, 0x03, 0x80, 0x07, 0x00, 0x00, 0x00,
|
||||||
0xD0, 0x63, 0x60, 0x07, 0x07, 0x00, 0xC0, 0xFF, 0x03, 0x80, 0x03, 0x00,
|
0x00, 0x00, 0x90, 0x67, 0xE0, 0x83, 0x03, 0x00, 0x00, 0xF0, 0xFF, 0xC1, 0x01, 0x00,
|
||||||
0x00, 0x08, 0x00, 0x02, 0xF0, 0x61, 0x60, 0x1C, 0x1F, 0x80, 0xFF, 0x07,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0xE0, 0xC1, 0x01, 0x00, 0x00, 0x00, 0xF8, 0x7F,
|
||||||
0x00, 0x00, 0x0E, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xF8,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x18, 0x00, 0x02,
|
0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x60, 0x38, 0x00, 0x00,
|
||||||
0xF0, 0x7F, 0x60, 0xDC, 0x1F, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x1E, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x61, 0x1C,
|
||||||
0x00, 0x00, 0x00, 0x02, 0xD0, 0x61, 0x60, 0x07, 0x0F, 0x00, 0xC0, 0xFF,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
|
||||||
0x03, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x67, 0xE0, 0x83,
|
0x67, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x03, 0x00, 0x00, 0xF0, 0xFF, 0xC1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0xEE, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x7E, 0xE0, 0xC1, 0x01, 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00,
|
0x00, 0x00, 0x1C, 0x00, 0xFC, 0x0D, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0xF0, 0x18, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x60, 0x38,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x60, 0x18, 0x70, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x60, 0x30, 0x38, 0x00,
|
||||||
0x00, 0xC0, 0x61, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x60, 0x70,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x67, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
0x3C, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE, 0x0F,
|
0x60, 0x60, 0x1E, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x80, 0x07, 0x60, 0xE0, 0x0F, 0x00, 0x00, 0x3E, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x1C, 0x00, 0xFC, 0x0D, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x07, 0x03, 0x00, 0x0F, 0x60, 0xC0, 0x03, 0x00, 0x80, 0x0F, 0x1C, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0xF0, 0x18, 0xE0, 0x00, 0x00, 0x00,
|
0x00, 0x80, 0x01, 0x07, 0x00, 0x0C, 0x60, 0xC0, 0x01, 0x00, 0xF0, 0x01, 0x38, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x60, 0x18,
|
0x00, 0x00, 0x00, 0x80, 0x81, 0x05, 0x00, 0x08, 0x60, 0xC0, 0x01, 0x00, 0x7C, 0x00,
|
||||||
0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xE0, 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x0C, 0x00, 0x00, 0x60, 0x00, 0x03, 0x00,
|
||||||
0x70, 0x00, 0x60, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x1F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x0C, 0x00, 0x00, 0x60, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x60, 0x70, 0x3C, 0x00, 0x00, 0xE0,
|
0x07, 0xE0, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0xCC, 0x0F, 0x00, 0x00,
|
||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x60, 0x60,
|
0x60, 0x00, 0x06, 0xF8, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0xCC, 0x1F,
|
||||||
0x1E, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x60, 0x00, 0x0E, 0x3E, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x80,
|
||||||
0x80, 0x07, 0x60, 0xE0, 0x0F, 0x00, 0x00, 0x3E, 0x0F, 0x00, 0x00, 0x00,
|
0x67, 0x18, 0x00, 0x00, 0x60, 0x00, 0xCC, 0x07, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x07, 0x03, 0x00, 0x0F, 0x60, 0xC0, 0x03, 0x00, 0x80, 0x0F,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0xE0,
|
||||||
0x1C, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x07, 0x00, 0x0C, 0x60, 0xC0,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0xFC, 0x01, 0x00, 0x00,
|
||||||
0x01, 0x00, 0xF0, 0x01, 0x38, 0x00, 0x00, 0x00, 0x00, 0x80, 0x81, 0x05,
|
0x00, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF,
|
||||||
0x00, 0x08, 0x60, 0xC0, 0x01, 0x00, 0x7C, 0x00, 0xE0, 0x00, 0x00, 0x00,
|
0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF,
|
||||||
0x00, 0x80, 0x83, 0x0C, 0x00, 0x00, 0x60, 0x00, 0x03, 0x00, 0x1F, 0x00,
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xC0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x0C, 0x00, 0x00, 0x60, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x07, 0xE0, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0xCC, 0x0F,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x60, 0x00, 0x06, 0xF8, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0xCC, 0x1F, 0x00, 0x00, 0x60, 0x00, 0x0E, 0x3E, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x1C, 0x00, 0x00, 0x00, 0x80, 0x67, 0x18, 0x00, 0x00, 0x60, 0x00,
|
0x00, 0x00,
|
||||||
0xCC, 0x07, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x60, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0xFC, 0x01, 0x00, 0x00,
|
|
||||||
0x00, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF,
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 1040)
|
// Array of all bitmaps for convenience. (Total bytes used to store images in
|
||||||
// const int epd_bitmap_allArray_LEN = 1;
|
// PROGMEM = 1040) const int epd_bitmap_allArray_LEN = 1; const unsigned char*
|
||||||
// const unsigned char* epd_bitmap_allArray[1] = {
|
// epd_bitmap_allArray[1] = { epd_bitmap_ucog
|
||||||
// epd_bitmap_ucog
|
|
||||||
// };
|
// };
|
||||||
|
|||||||
126
src/main.cpp
126
src/main.cpp
@@ -21,7 +21,6 @@
|
|||||||
https://jgromes.github.io/RadioLib/
|
https://jgromes.github.io/RadioLib/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <heltec_unofficial.h>
|
#include <heltec_unofficial.h>
|
||||||
// This file contains a binary patch for the SX1262
|
// This file contains a binary patch for the SX1262
|
||||||
@@ -62,8 +61,8 @@ uint64_t RANGE_PER_PAGE = FREQ_END - FREQ_BEGIN; // FREQ_END - FREQ_BEGIN
|
|||||||
#define LOW_FILTER 3
|
#define LOW_FILTER 3
|
||||||
#define FILTER_SPECTRUM_RESULTS true
|
#define FILTER_SPECTRUM_RESULTS true
|
||||||
|
|
||||||
// Number of samples for each frequency scan. Fewer samples = better temporal resolution.
|
// Number of samples for each frequency scan. Fewer samples = better temporal
|
||||||
// if more than 100 it can freez
|
// resolution. if more than 100 it can freez
|
||||||
#define SAMPLES 100 //(scan time = 1294)
|
#define SAMPLES 100 //(scan time = 1294)
|
||||||
// number of samples for RSSI method
|
// number of samples for RSSI method
|
||||||
#define SAMPLES_RSSI RADIOLIB_SX126X_SPECTRAL_SCAN_WINDOW_DEFAULT // 21 //
|
#define SAMPLES_RSSI RADIOLIB_SX126X_SPECTRAL_SCAN_WINDOW_DEFAULT // 21 //
|
||||||
@@ -72,7 +71,6 @@ uint64_t RANGE_PER_PAGE = FREQ_END - FREQ_BEGIN; // FREQ_END - FREQ_BEGIN
|
|||||||
|
|
||||||
#define SINGLE_STEP (float)(RANGE / STEPS)
|
#define SINGLE_STEP (float)(RANGE / STEPS)
|
||||||
|
|
||||||
|
|
||||||
uint64_t range = (int)(FREQ_END - FREQ_BEGIN);
|
uint64_t range = (int)(FREQ_END - FREQ_BEGIN);
|
||||||
uint64_t fr_begin = FREQ_BEGIN;
|
uint64_t fr_begin = FREQ_BEGIN;
|
||||||
uint64_t fr_end = FREQ_BEGIN;
|
uint64_t fr_end = FREQ_BEGIN;
|
||||||
@@ -105,7 +103,6 @@ uint64_t detection_count = 0;
|
|||||||
bool single_page_scan = false;
|
bool single_page_scan = false;
|
||||||
bool SOUND_ON = true;
|
bool SOUND_ON = true;
|
||||||
|
|
||||||
|
|
||||||
#define PRINT_PROFILE_TIME
|
#define PRINT_PROFILE_TIME
|
||||||
|
|
||||||
#ifdef PRINT_PROFILE_TIME
|
#ifdef PRINT_PROFILE_TIME
|
||||||
@@ -173,11 +170,10 @@ void setup(void)
|
|||||||
RADIOLIB_OR_HALT(radio.setDataShaping(RADIOLIB_SHAPING_NONE));
|
RADIOLIB_OR_HALT(radio.setDataShaping(RADIOLIB_SHAPING_NONE));
|
||||||
both.println("Starting scanning...");
|
both.println("Starting scanning...");
|
||||||
vbat = heltec_vbat();
|
vbat = heltec_vbat();
|
||||||
both.printf("V battery: %.2fV (%d%%)\n", vbat,
|
both.printf("V battery: %.2fV (%d%%)\n", vbat, heltec_battery_percent(vbat));
|
||||||
heltec_battery_percent(vbat));
|
|
||||||
delay(300);
|
delay(300);
|
||||||
display.clear();
|
display.clear();
|
||||||
|
|
||||||
resolution = RANGE / STEPS;
|
resolution = RANGE / STEPS;
|
||||||
|
|
||||||
single_page_scan = (RANGE_PER_PAGE == range);
|
single_page_scan = (RANGE_PER_PAGE == range);
|
||||||
@@ -195,7 +191,8 @@ void setup(void)
|
|||||||
both.println("Single Page Screen MODE");
|
both.println("Single Page Screen MODE");
|
||||||
both.println("Multi Screen View Press P - button");
|
both.println("Multi Screen View Press P - button");
|
||||||
both.println("Single Screen Resolution: " + String(resolution) + "Mhz/tick");
|
both.println("Single Screen Resolution: " + String(resolution) + "Mhz/tick");
|
||||||
both.println("Curent Resolution: " + String((float)RANGE_PER_PAGE / STEPS) + "Mhz/tick");
|
both.println("Curent Resolution: " + String((float)RANGE_PER_PAGE / STEPS) +
|
||||||
|
"Mhz/tick");
|
||||||
for (int i = 0; i < 500; i++)
|
for (int i = 0; i < 500; i++)
|
||||||
{
|
{
|
||||||
button.update();
|
button.update();
|
||||||
@@ -217,7 +214,8 @@ void setup(void)
|
|||||||
both.println("Multi Page Screen MODE");
|
both.println("Multi Page Screen MODE");
|
||||||
both.println("Single screen View Press P - button");
|
both.println("Single screen View Press P - button");
|
||||||
both.println("Single screen Resolution: " + String(resolution) + "Mhz/tick");
|
both.println("Single screen Resolution: " + String(resolution) + "Mhz/tick");
|
||||||
both.println("Curent Resolution: " + String((float)RANGE_PER_PAGE / STEPS) + "Mhz/tick");
|
both.println("Curent Resolution: " + String((float)RANGE_PER_PAGE / STEPS) +
|
||||||
|
"Mhz/tick");
|
||||||
for (int i = 0; i < 500; i++)
|
for (int i = 0; i < 500; i++)
|
||||||
{
|
{
|
||||||
button.update();
|
button.update();
|
||||||
@@ -235,9 +233,8 @@ void setup(void)
|
|||||||
display.clear();
|
display.clear();
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
// calibrate only once ,,, at startup
|
// calibrate only once ,,, at startup
|
||||||
radio.setFrequency(FREQ_BEGIN,true);
|
radio.setFrequency(FREQ_BEGIN, true);
|
||||||
|
|
||||||
|
|
||||||
// waterfall start line y-axis
|
// waterfall start line y-axis
|
||||||
w = WATERFALL_START;
|
w = WATERFALL_START;
|
||||||
@@ -250,7 +247,7 @@ void loop(void)
|
|||||||
drone_detected_frequency_start = 0;
|
drone_detected_frequency_start = 0;
|
||||||
ranges_count = 0;
|
ranges_count = 0;
|
||||||
|
|
||||||
//reset scan time
|
// reset scan time
|
||||||
scan_time = 0;
|
scan_time = 0;
|
||||||
|
|
||||||
// general purpose loop conter
|
// general purpose loop conter
|
||||||
@@ -259,7 +256,7 @@ void loop(void)
|
|||||||
#ifdef PRINT_PROFILE_TIME
|
#ifdef PRINT_PROFILE_TIME
|
||||||
loop_start = millis();
|
loop_start = millis();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!ANIMATED_RELOAD || !single_page_scan)
|
if (!ANIMATED_RELOAD || !single_page_scan)
|
||||||
{
|
{
|
||||||
// clear the scan plot rectangle
|
// clear the scan plot rectangle
|
||||||
@@ -272,7 +269,7 @@ void loop(void)
|
|||||||
{
|
{
|
||||||
RANGE_PER_PAGE = range;
|
RANGE_PER_PAGE = range;
|
||||||
}
|
}
|
||||||
|
|
||||||
fr_begin = FREQ_BEGIN;
|
fr_begin = FREQ_BEGIN;
|
||||||
fr_end = fr_begin;
|
fr_end = fr_begin;
|
||||||
|
|
||||||
@@ -323,18 +320,18 @@ void loop(void)
|
|||||||
fr_end = SCAN_RANGES[range_item] % 1000;
|
fr_end = SCAN_RANGES[range_item] % 1000;
|
||||||
range = fr_end - fr_begin;
|
range = fr_end - fr_begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ANIMATED_RELOAD || !single_page_scan)
|
if (!ANIMATED_RELOAD || !single_page_scan)
|
||||||
{
|
{
|
||||||
// clear the scan plot rectangle
|
// clear the scan plot rectangle
|
||||||
UI_clearPlotter();
|
UI_clearPlotter();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (single_page_scan == false)
|
if (single_page_scan == false)
|
||||||
{
|
{
|
||||||
UI_displayDecorate(fr_begin, fr_end, true);
|
UI_displayDecorate(fr_begin, fr_end, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
drone_detected_frequency_start = 0;
|
drone_detected_frequency_start = 0;
|
||||||
display.setTextAlignment(TEXT_ALIGN_RIGHT);
|
display.setTextAlignment(TEXT_ALIGN_RIGHT);
|
||||||
|
|
||||||
@@ -342,7 +339,7 @@ void loop(void)
|
|||||||
for (x = 0; x < STEPS; x++)
|
for (x = 0; x < STEPS; x++)
|
||||||
{
|
{
|
||||||
#if ANIMATED_RELOAD
|
#if ANIMATED_RELOAD
|
||||||
UI_drawCursor(x);
|
UI_drawCursor(x);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PRINT_PROFILE_TIME
|
#ifdef PRINT_PROFILE_TIME
|
||||||
@@ -352,7 +349,8 @@ void loop(void)
|
|||||||
waterfall[range_item][x][w] = false;
|
waterfall[range_item][x][w] = false;
|
||||||
freq = fr_begin + (range * ((float)x / STEPS));
|
freq = fr_begin + (range * ((float)x / STEPS));
|
||||||
|
|
||||||
radio.setFrequency(freq,false); // false = no calibration need here
|
radio.setFrequency(freq,
|
||||||
|
false); // false = no calibration need here
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG
|
#ifdef PRINT_DEBUG
|
||||||
// Serial.printf("Step:%d Freq: %f\n",x,freq);
|
// Serial.printf("Step:%d Freq: %f\n",x,freq);
|
||||||
@@ -383,8 +381,8 @@ void loop(void)
|
|||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// memset
|
// memset
|
||||||
memset(result,0,RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE);
|
memset(result, 0, RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE);
|
||||||
result_index = 0u;
|
result_index = 0u;
|
||||||
// N of samples
|
// N of samples
|
||||||
for (int r = 0; r < SAMPLES_RSSI; r++)
|
for (int r = 0; r < SAMPLES_RSSI; r++)
|
||||||
@@ -392,7 +390,7 @@ void loop(void)
|
|||||||
rssi = radio.getRSSI(false);
|
rssi = radio.getRSSI(false);
|
||||||
// delay(ONE_MILLISEC);
|
// delay(ONE_MILLISEC);
|
||||||
// ToDO: check if 4 is correct value for 33 power bins
|
// ToDO: check if 4 is correct value for 33 power bins
|
||||||
result_index = uint8_t(abs(rssi) / 4); /// still not clear formula
|
result_index = uint8_t(abs(rssi) / 4); /// still not clear formula
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG
|
#ifdef PRINT_DEBUG
|
||||||
// Serial.printf("RSSI: %d IDX: %d\n",rssi,result_index);
|
// Serial.printf("RSSI: %d IDX: %d\n",rssi,result_index);
|
||||||
@@ -400,7 +398,8 @@ void loop(void)
|
|||||||
// avoid buffer overflow
|
// avoid buffer overflow
|
||||||
if (result_index < RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE)
|
if (result_index < RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE)
|
||||||
{
|
{
|
||||||
// Saving max value only rss is negative so smaller is bigger
|
// Saving max value only rss is negative so smaller is
|
||||||
|
// bigger
|
||||||
if (result[result_index] > rssi)
|
if (result[result_index] > rssi)
|
||||||
{
|
{
|
||||||
result[result_index] = rssi;
|
result[result_index] = rssi;
|
||||||
@@ -412,13 +411,11 @@ void loop(void)
|
|||||||
Serial.print("Out-of-Range: result_index %d\n");
|
Serial.print("Out-of-Range: result_index %d\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // SCAN_METHOD == METHOD_RSSI
|
#endif // SCAN_METHOD == METHOD_RSSI
|
||||||
|
|
||||||
detected = false;
|
|
||||||
|
|
||||||
|
detected = false;
|
||||||
|
|
||||||
for (y = 0; y < RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE; y++)
|
for (y = 0; y < RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE; y++)
|
||||||
{
|
{
|
||||||
@@ -433,13 +430,16 @@ void loop(void)
|
|||||||
// if RSSI method actual value is -xxx dB
|
// if RSSI method actual value is -xxx dB
|
||||||
if (result[y])
|
if (result[y])
|
||||||
{
|
{
|
||||||
// do not process 'first' and 'last' row to avoid out of index access
|
// do not process 'first' and 'last' row to avoid out of
|
||||||
if ((y!=0) && (y != (RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE - 1)))
|
// index access
|
||||||
|
if ((y != 0) && (y != (RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE - 1)))
|
||||||
{
|
{
|
||||||
if ((result[y + 1] != 0) || (result[y - 1] != 0))
|
if ((result[y + 1] != 0) || (result[y - 1] != 0))
|
||||||
{
|
{
|
||||||
// Filling the empty pixel between signals int the level < 27 (noise level)
|
// Filling the empty pixel between signals int the
|
||||||
/* if (y < 27 && result[y + 1] == 0 && result[y + 2] > 0)
|
// level < 27 (noise level)
|
||||||
|
/* if (y < 27 && result[y + 1] == 0 && result[y +
|
||||||
|
2] > 0)
|
||||||
{
|
{
|
||||||
result[y + 1] = 1;
|
result[y + 1] = 1;
|
||||||
filtered_result[y + 1] = 1;
|
filtered_result[y + 1] = 1;
|
||||||
@@ -450,18 +450,17 @@ void loop(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// if (result[y] || y == drone_detection_level)
|
// if (result[y] || y == drone_detection_level)
|
||||||
{
|
{
|
||||||
// check if we should alarm about a drone presence
|
// check if we should alarm about a drone presence
|
||||||
if ((filtered_result[y] == 1) // we have some data and
|
if ((filtered_result[y] == 1) // we have some data and
|
||||||
&& (y <= drone_detection_level)) // detection threshold match
|
&& (y <= drone_detection_level)) // detection threshold match
|
||||||
{
|
{
|
||||||
|
|
||||||
// Set LED to ON (filtered in UI component)
|
// Set LED to ON (filtered in UI component)
|
||||||
UI_setLedFlag(true);
|
UI_setLedFlag(true);
|
||||||
|
|
||||||
#if ( WATERFALL_ENABLED == true )
|
#if (WATERFALL_ENABLED == true)
|
||||||
if (single_page_scan)
|
if (single_page_scan)
|
||||||
{
|
{
|
||||||
// Drone detection true for waterfall
|
// Drone detection true for waterfall
|
||||||
@@ -472,14 +471,14 @@ void loop(void)
|
|||||||
#endif
|
#endif
|
||||||
if (drone_detected_frequency_start == 0)
|
if (drone_detected_frequency_start == 0)
|
||||||
{
|
{
|
||||||
// mark freq start
|
// mark freq start
|
||||||
drone_detected_frequency_start = freq;
|
drone_detected_frequency_start = freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark freq end ... will shift right to last detected range
|
// mark freq end ... will shift right to last detected
|
||||||
|
// range
|
||||||
drone_detected_frequency_end = freq;
|
drone_detected_frequency_end = freq;
|
||||||
|
|
||||||
|
|
||||||
// If level is set to sensitive,
|
// If level is set to sensitive,
|
||||||
// start beeping every 10th frequency and shorter
|
// start beeping every 10th frequency and shorter
|
||||||
if (drone_detection_level <= 25)
|
if (drone_detection_level <= 25)
|
||||||
@@ -491,7 +490,7 @@ void loop(void)
|
|||||||
if (detection_count % 5 == 0 && SOUND_ON)
|
if (detection_count % 5 == 0 && SOUND_ON)
|
||||||
{
|
{
|
||||||
tone(BUZZER_PIN, 205, 10); // same action ???
|
tone(BUZZER_PIN, 205, 10); // same action ???
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -501,22 +500,20 @@ void loop(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// debug draw
|
||||||
// debug draw
|
|
||||||
// display.setPixel(x, 1);
|
// display.setPixel(x, 1);
|
||||||
// display.setPixel(x, 2);
|
// display.setPixel(x, 2);
|
||||||
// display.setPixel(x, 3);
|
// display.setPixel(x, 3);
|
||||||
// display.setPixel(x, 4);
|
// display.setPixel(x, 4);
|
||||||
|
|
||||||
// draw vertical line on top of display for "drone detected" frequencies
|
// draw vertical line on top of display for "drone
|
||||||
display.drawLine(x , 1, x, 6 );
|
// detected" frequencies
|
||||||
|
display.drawLine(x, 1, x, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ( WATERFALL_ENABLED == true )
|
#if (WATERFALL_ENABLED == true)
|
||||||
if ((filtered_result[y] == 1)
|
if ((filtered_result[y] == 1) && (y > drone_detection_level) &&
|
||||||
&& ( y > drone_detection_level)
|
(single_page_scan) && (waterfall[range_item][x][w] != true))
|
||||||
&& ( single_page_scan )
|
|
||||||
&& ( waterfall[range_item][x][w] != true) )
|
|
||||||
{
|
{
|
||||||
// If drone not found set dark pixel on the waterfall
|
// If drone not found set dark pixel on the waterfall
|
||||||
// TODO: make something like scrolling up if possible
|
// TODO: make something like scrolling up if possible
|
||||||
@@ -531,7 +528,6 @@ void loop(void)
|
|||||||
|
|
||||||
#endif // If 0
|
#endif // If 0
|
||||||
|
|
||||||
|
|
||||||
// next 2 If's ... adds !!!! 10ms of runtime ......tfk ???
|
// next 2 If's ... adds !!!! 10ms of runtime ......tfk ???
|
||||||
if (filtered_result[y] == 1)
|
if (filtered_result[y] == 1)
|
||||||
{
|
{
|
||||||
@@ -543,21 +539,20 @@ void loop(void)
|
|||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// Draw "Detection Level line" every 2 pixel
|
// Draw "Detection Level line" every 2 pixel
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
if ( ( y == drone_detection_level) && (x % 2 == 0))
|
if ((y == drone_detection_level) && (x % 2 == 0))
|
||||||
{
|
{
|
||||||
display.setColor(INVERSE);
|
display.setColor(INVERSE);
|
||||||
display.setPixel(x, y);
|
display.setPixel(x, y);
|
||||||
display.setPixel(x, y+1); // 2 px wide
|
display.setPixel(x, y + 1); // 2 px wide
|
||||||
display.setColor(WHITE);
|
display.setColor(WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PRINT_PROFILE_TIME
|
#ifdef PRINT_PROFILE_TIME
|
||||||
scan_time += (millis() - scan_start_time);
|
scan_time += (millis() - scan_start_time);
|
||||||
#endif
|
#endif
|
||||||
// count detected
|
// count detected
|
||||||
if (detected)
|
if (detected)
|
||||||
{
|
{
|
||||||
detection_count++;
|
detection_count++;
|
||||||
@@ -606,7 +601,8 @@ void loop(void)
|
|||||||
{
|
{
|
||||||
// Visually confirm it's off so user releases button
|
// Visually confirm it's off so user releases button
|
||||||
display.displayOff();
|
display.displayOff();
|
||||||
// Deep sleep (has wait for release so we don't wake up immediately)
|
// Deep sleep (has wait for release so we don't wake up
|
||||||
|
// immediately)
|
||||||
heltec_deep_sleep();
|
heltec_deep_sleep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -637,7 +633,7 @@ void loop(void)
|
|||||||
{
|
{
|
||||||
w = WATERFALL_START;
|
w = WATERFALL_START;
|
||||||
}
|
}
|
||||||
#if ( WATERFALL_ENABLED == true )
|
#if (WATERFALL_ENABLED == true)
|
||||||
// Draw waterfall position cursor
|
// Draw waterfall position cursor
|
||||||
if (single_page_scan)
|
if (single_page_scan)
|
||||||
{
|
{
|
||||||
@@ -648,20 +644,18 @@ void loop(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Render display data here
|
// Render display data here
|
||||||
display.display();
|
display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG
|
#ifdef PRINT_DEBUG
|
||||||
//Serial.println("----");
|
// Serial.println("----");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
loop_time = millis() - loop_start;
|
loop_time = millis() - loop_start;
|
||||||
|
|
||||||
|
|
||||||
#ifdef PRINT_PROFILE_TIME
|
#ifdef PRINT_PROFILE_TIME
|
||||||
#ifdef PRINT_DEBUG
|
#ifdef PRINT_DEBUG
|
||||||
Serial.printf("LOOP: %lld ms; SCAN: %lld ms;\n ", loop_time,scan_time);
|
Serial.printf("LOOP: %lld ms; SCAN: %lld ms;\n ", loop_time, scan_time);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
74
src/ui.cpp
74
src/ui.cpp
@@ -1,7 +1,7 @@
|
|||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "images.h"
|
|
||||||
#include "global_config.h"
|
|
||||||
#include "RadioLib.h"
|
#include "RadioLib.h"
|
||||||
|
#include "global_config.h"
|
||||||
|
#include "images.h"
|
||||||
|
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
// LOCAL DEFINES
|
// LOCAL DEFINES
|
||||||
@@ -37,7 +37,6 @@ extern unsigned int range_item;
|
|||||||
|
|
||||||
extern uint64_t loop_time;
|
extern uint64_t loop_time;
|
||||||
|
|
||||||
|
|
||||||
void UI_Init(SSD1306Wire *display_ptr)
|
void UI_Init(SSD1306Wire *display_ptr)
|
||||||
{
|
{
|
||||||
// init pointer to display instance.
|
// init pointer to display instance.
|
||||||
@@ -49,10 +48,7 @@ void UI_Init(SSD1306Wire *display_ptr)
|
|||||||
display_instance->display();
|
display_instance->display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_setLedFlag(bool new_status)
|
void UI_setLedFlag(bool new_status) { led_flag = new_status; }
|
||||||
{
|
|
||||||
led_flag = new_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearStatus(void)
|
void clearStatus(void)
|
||||||
{
|
{
|
||||||
@@ -103,7 +99,8 @@ void drawTicks(float every, int length)
|
|||||||
tick_minor = 0;
|
tick_minor = 0;
|
||||||
median = (RANGE_PER_PAGE / every) / 2;
|
median = (RANGE_PER_PAGE / every) / 2;
|
||||||
// TODO: (RANGE_PER_PAGE / every)
|
// TODO: (RANGE_PER_PAGE / every)
|
||||||
// * 2 has twice extra steps we need to figureout correct logic or minor ticks is not showing to the end
|
// * 2 has twice extra steps we need to figureout correct logic or minor
|
||||||
|
// ticks is not showing to the end
|
||||||
for (int t = 0; t <= (RANGE_PER_PAGE / every) * 2; t++)
|
for (int t = 0; t <= (RANGE_PER_PAGE / every) * 2; t++)
|
||||||
{
|
{
|
||||||
// fix if pixels per step is not int and we have shift
|
// fix if pixels per step is not int and we have shift
|
||||||
@@ -121,22 +118,24 @@ void drawTicks(float every, int length)
|
|||||||
// Central tick
|
// Central tick
|
||||||
if (tick > (128 / 2) - 3 && tick < (128 / 2) + 3)
|
if (tick > (128 / 2) - 3 && tick < (128 / 2) + 3)
|
||||||
{
|
{
|
||||||
display_instance->drawLine(tick + 1, HEIGHT + X_AXIS_WEIGHT,
|
display_instance->drawLine(tick + 1, HEIGHT + X_AXIS_WEIGHT, tick + 1,
|
||||||
tick + 1, HEIGHT + X_AXIS_WEIGHT + length);
|
HEIGHT + X_AXIS_WEIGHT + length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef MINOR_TICKS
|
#ifdef MINOR_TICKS
|
||||||
// Fix two ticks together
|
// Fix two ticks together
|
||||||
if ((tick_minor + 1 != tick) && (tick_minor - 1 != tick) && (tick_minor + 2 != tick) && (tick_minor - 2 != tick))
|
if ((tick_minor + 1 != tick) && (tick_minor - 1 != tick) &&
|
||||||
|
(tick_minor + 2 != tick) && (tick_minor - 2 != tick))
|
||||||
{
|
{
|
||||||
display_instance->drawLine(tick_minor, HEIGHT + X_AXIS_WEIGHT,
|
display_instance->drawLine(tick_minor, HEIGHT + X_AXIS_WEIGHT, tick_minor,
|
||||||
tick_minor, HEIGHT + X_AXIS_WEIGHT + MINOR_TICK_LENGTH);
|
HEIGHT + X_AXIS_WEIGHT + MINOR_TICK_LENGTH);
|
||||||
}
|
}
|
||||||
// Central tick
|
// Central tick
|
||||||
if (tick_minor > (128 / 2) - 3 && tick_minor < (128 / 2) + 3)
|
if (tick_minor > (128 / 2) - 3 && tick_minor < (128 / 2) + 3)
|
||||||
{
|
{
|
||||||
display_instance->drawLine(tick_minor + 1, HEIGHT + X_AXIS_WEIGHT,
|
display_instance->drawLine(tick_minor + 1, HEIGHT + X_AXIS_WEIGHT,
|
||||||
tick_minor + 1, HEIGHT + X_AXIS_WEIGHT + MINOR_TICK_LENGTH);
|
tick_minor + 1,
|
||||||
|
HEIGHT + X_AXIS_WEIGHT + MINOR_TICK_LENGTH);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -159,10 +158,8 @@ void UI_displayDecorate(int begin = 0, int end = 0, bool redraw = false)
|
|||||||
if (!ui_initialized)
|
if (!ui_initialized)
|
||||||
{
|
{
|
||||||
// Start and end ticks
|
// Start and end ticks
|
||||||
display_instance->fillRect(0, HEIGHT + X_AXIS_WEIGHT, 2,
|
display_instance->fillRect(0, HEIGHT + X_AXIS_WEIGHT, 2, MAJOR_TICK_LENGTH + 1);
|
||||||
MAJOR_TICK_LENGTH + 1);
|
display_instance->fillRect(126, HEIGHT + X_AXIS_WEIGHT, 2, MAJOR_TICK_LENGTH + 1);
|
||||||
display_instance->fillRect(126, HEIGHT + X_AXIS_WEIGHT, 2,
|
|
||||||
MAJOR_TICK_LENGTH + 1);
|
|
||||||
// Drone detection level
|
// Drone detection level
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_RIGHT);
|
display_instance->setTextAlignment(TEXT_ALIGN_RIGHT);
|
||||||
display_instance->drawString(128, 0, String(drone_detection_level));
|
display_instance->drawString(128, 0, String(drone_detection_level));
|
||||||
@@ -179,13 +176,14 @@ void UI_displayDecorate(int begin = 0, int end = 0, bool redraw = false)
|
|||||||
display_instance->drawString(128, 0, String(drone_detection_level));
|
display_instance->drawString(128, 0, String(drone_detection_level));
|
||||||
// Frequency start
|
// Frequency start
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_LEFT);
|
display_instance->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
display_instance->drawString(0, ROW_STATUS_TEXT,
|
display_instance->drawString(0, ROW_STATUS_TEXT,
|
||||||
(begin == 0) ? String(FREQ_BEGIN) : String(begin));
|
(begin == 0) ? String(FREQ_BEGIN) : String(begin));
|
||||||
|
|
||||||
// Frequency detected
|
// Frequency detected
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_CENTER);
|
display_instance->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
display_instance->drawString(128 / 2, ROW_STATUS_TEXT,
|
display_instance->drawString(128 / 2, ROW_STATUS_TEXT,
|
||||||
(begin == 0) ? String(median_frequency) : String(begin + ((end - begin) / 2)));
|
(begin == 0) ? String(median_frequency)
|
||||||
|
: String(begin + ((end - begin) / 2)));
|
||||||
// Frequency end
|
// Frequency end
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_RIGHT);
|
display_instance->setTextAlignment(TEXT_ALIGN_RIGHT);
|
||||||
display_instance->drawString(128, ROW_STATUS_TEXT,
|
display_instance->drawString(128, ROW_STATUS_TEXT,
|
||||||
@@ -193,14 +191,16 @@ void UI_displayDecorate(int begin = 0, int end = 0, bool redraw = false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Status text block
|
// Status text block
|
||||||
if (led_flag) // 'drone' detected
|
if (led_flag) // 'drone' detected
|
||||||
{
|
{
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_CENTER);
|
display_instance->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
// clear status line
|
// clear status line
|
||||||
clearStatus();
|
clearStatus();
|
||||||
display_instance->drawString(start_scan_text, ROW_STATUS_TEXT,
|
display_instance->drawString(start_scan_text, ROW_STATUS_TEXT,
|
||||||
String(drone_detected_frequency_start) + ">RF<" + String(drone_detected_frequency_end));
|
String(drone_detected_frequency_start) + ">RF<" +
|
||||||
} else
|
String(drone_detected_frequency_end));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// "Scanning"
|
// "Scanning"
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_CENTER);
|
display_instance->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
@@ -208,23 +208,19 @@ void UI_displayDecorate(int begin = 0, int end = 0, bool redraw = false)
|
|||||||
clearStatus();
|
clearStatus();
|
||||||
if (scan_progress_count == 0)
|
if (scan_progress_count == 0)
|
||||||
{
|
{
|
||||||
display_instance->drawString(start_scan_text, ROW_STATUS_TEXT,
|
display_instance->drawString(start_scan_text, ROW_STATUS_TEXT, "Scan \\");
|
||||||
"Scan \\");
|
|
||||||
}
|
}
|
||||||
else if (scan_progress_count == 1)
|
else if (scan_progress_count == 1)
|
||||||
{
|
{
|
||||||
display_instance->drawString(start_scan_text, ROW_STATUS_TEXT,
|
display_instance->drawString(start_scan_text, ROW_STATUS_TEXT, "Scan |");
|
||||||
"Scan |");
|
|
||||||
}
|
}
|
||||||
else if (scan_progress_count == 2)
|
else if (scan_progress_count == 2)
|
||||||
{
|
{
|
||||||
display_instance->drawString(start_scan_text, ROW_STATUS_TEXT,
|
display_instance->drawString(start_scan_text, ROW_STATUS_TEXT, "Scan /");
|
||||||
"Scan /");
|
|
||||||
}
|
}
|
||||||
else if (scan_progress_count == 3)
|
else if (scan_progress_count == 3)
|
||||||
{
|
{
|
||||||
display_instance->drawString(start_scan_text, ROW_STATUS_TEXT,
|
display_instance->drawString(start_scan_text, ROW_STATUS_TEXT, "Scan -");
|
||||||
"Scan -");
|
|
||||||
}
|
}
|
||||||
scan_progress_count++;
|
scan_progress_count++;
|
||||||
if (scan_progress_count >= 4)
|
if (scan_progress_count >= 4)
|
||||||
@@ -233,7 +229,6 @@ void UI_displayDecorate(int begin = 0, int end = 0, bool redraw = false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (led_flag == true && detection_count >= 5)
|
if (led_flag == true && detection_count >= 5)
|
||||||
{
|
{
|
||||||
digitalWrite(LED, HIGH);
|
digitalWrite(LED, HIGH);
|
||||||
@@ -249,31 +244,32 @@ void UI_displayDecorate(int begin = 0, int end = 0, bool redraw = false)
|
|||||||
digitalWrite(LED, LOW);
|
digitalWrite(LED, LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ranges_count == 0)
|
if (ranges_count == 0)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_LEFT);
|
display_instance->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
display_instance->drawString(0, ROW_STATUS_TEXT,String(loop_time));
|
display_instance->drawString(0, ROW_STATUS_TEXT, String(loop_time));
|
||||||
#else
|
#else
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_LEFT);
|
display_instance->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
display_instance->drawString(0, ROW_STATUS_TEXT, String(FREQ_BEGIN));
|
display_instance->drawString(0, ROW_STATUS_TEXT, String(FREQ_BEGIN));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_RIGHT);
|
display_instance->setTextAlignment(TEXT_ALIGN_RIGHT);
|
||||||
display_instance->drawString(128, ROW_STATUS_TEXT, String(FREQ_END));
|
display_instance->drawString(128, ROW_STATUS_TEXT, String(FREQ_END));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (ranges_count > 0)
|
else if (ranges_count > 0)
|
||||||
{
|
{
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_LEFT);
|
display_instance->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
display_instance->drawString(0, ROW_STATUS_TEXT,
|
display_instance->drawString(0, ROW_STATUS_TEXT,
|
||||||
String(SCAN_RANGES[range_item] / 1000) + "-" + String(SCAN_RANGES[range_item] % 1000));
|
String(SCAN_RANGES[range_item] / 1000) + "-" +
|
||||||
|
String(SCAN_RANGES[range_item] % 1000));
|
||||||
if (range_item + 1 < iterations)
|
if (range_item + 1 < iterations)
|
||||||
{
|
{
|
||||||
display_instance->setTextAlignment(TEXT_ALIGN_RIGHT);
|
display_instance->setTextAlignment(TEXT_ALIGN_RIGHT);
|
||||||
display_instance->drawString(128, ROW_STATUS_TEXT,
|
display_instance->drawString(128, ROW_STATUS_TEXT,
|
||||||
String(SCAN_RANGES[range_item + 1] / 1000) + "-" + String(SCAN_RANGES[range_item + 1] % 1000));
|
String(SCAN_RANGES[range_item + 1] / 1000) +
|
||||||
|
"-" +
|
||||||
|
String(SCAN_RANGES[range_item + 1] % 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ui_initialized == false)
|
if (ui_initialized == false)
|
||||||
|
|||||||
Reference in New Issue
Block a user