Merge branch 'dev' of https://github.com/DarkFlippers/unleashed-firmware into xfw-dev
@@ -8,9 +8,9 @@ App(
|
||||
fap_category="Tools",
|
||||
fap_icon="images/barcode_10.png",
|
||||
fap_icon_assets="images",
|
||||
fap_icon_assets_symbol="barcode_app",
|
||||
fap_file_assets="barcode_encoding_files",
|
||||
fap_author="@Kingal1337",
|
||||
fap_weburl="https://github.com/Kingal1337/flipper-barcode-generator",
|
||||
fap_version="1.0",
|
||||
fap_version="1.1",
|
||||
fap_description="App allows you to display various barcodes on flipper screen",
|
||||
)
|
||||
|
||||
11
applications/external/barcode_gen/barcode_app.h
vendored
@@ -23,20 +23,17 @@
|
||||
#define BARCODE_HEIGHT 50
|
||||
#define BARCODE_Y_START 3
|
||||
|
||||
//the folder where the encodings are located
|
||||
#define BARCODE_DATA_FILE_DIR_PATH EXT_PATH("apps_data/barcode_data")
|
||||
|
||||
//the folder where the codabar encoding table is located
|
||||
#define CODABAR_DICT_FILE_PATH BARCODE_DATA_FILE_DIR_PATH "/codabar_encodings.txt"
|
||||
#define CODABAR_DICT_FILE_PATH APP_ASSETS_PATH("codabar_encodings.txt")
|
||||
|
||||
//the folder where the code 39 encoding table is located
|
||||
#define CODE39_DICT_FILE_PATH BARCODE_DATA_FILE_DIR_PATH "/code39_encodings.txt"
|
||||
#define CODE39_DICT_FILE_PATH APP_ASSETS_PATH("code39_encodings.txt")
|
||||
|
||||
//the folder where the code 128 encoding table is located
|
||||
#define CODE128_DICT_FILE_PATH BARCODE_DATA_FILE_DIR_PATH "/code128_encodings.txt"
|
||||
#define CODE128_DICT_FILE_PATH APP_ASSETS_PATH("code128_encodings.txt")
|
||||
|
||||
//the folder where the code 128 C encoding table is located
|
||||
#define CODE128C_DICT_FILE_PATH BARCODE_DATA_FILE_DIR_PATH "/code128c_encodings.txt"
|
||||
#define CODE128C_DICT_FILE_PATH APP_ASSETS_PATH("code128c_encodings.txt")
|
||||
|
||||
//the folder where the user stores their barcodes
|
||||
#define DEFAULT_USER_BARCODES EXT_PATH("apps_data/barcodes")
|
||||
|
||||
22
applications/external/barcode_gen/barcode_encoding_files/codabar_encodings.txt
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# alternates between bars and spaces, always begins with bar
|
||||
# 0 for narrow, 1 for wide
|
||||
0: 0000011
|
||||
1: 0000110
|
||||
2: 0001001
|
||||
3: 1100000
|
||||
4: 0010010
|
||||
5: 1000010
|
||||
6: 0100001
|
||||
7: 0100100
|
||||
8: 0110000
|
||||
9: 1001000
|
||||
-: 0001100
|
||||
$: 0011000
|
||||
:: 1000101
|
||||
/: 1010001
|
||||
.: 1010100
|
||||
+: 0010101
|
||||
A: 0011010
|
||||
B: 0101001
|
||||
C: 0001011
|
||||
D: 0001110
|
||||
202
applications/external/barcode_gen/barcode_encoding_files/code128_encodings.txt
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
: 00
|
||||
!: 01
|
||||
": 02
|
||||
#: 03
|
||||
$: 04
|
||||
%: 05
|
||||
&: 06
|
||||
': 07
|
||||
(: 08
|
||||
): 09
|
||||
*: 10
|
||||
+: 11
|
||||
,: 12
|
||||
-: 13
|
||||
.: 14
|
||||
/: 15
|
||||
0: 16
|
||||
1: 17
|
||||
2: 18
|
||||
3: 19
|
||||
4: 20
|
||||
5: 21
|
||||
6: 22
|
||||
7: 23
|
||||
8: 24
|
||||
9: 25
|
||||
:: 26
|
||||
;: 27
|
||||
<: 28
|
||||
=: 29
|
||||
>: 30
|
||||
?: 31
|
||||
@: 32
|
||||
A: 33
|
||||
B: 34
|
||||
C: 35
|
||||
D: 36
|
||||
E: 37
|
||||
F: 38
|
||||
G: 39
|
||||
H: 40
|
||||
I: 41
|
||||
J: 42
|
||||
K: 43
|
||||
L: 44
|
||||
M: 45
|
||||
N: 46
|
||||
O: 47
|
||||
P: 48
|
||||
Q: 49
|
||||
R: 50
|
||||
S: 51
|
||||
T: 52
|
||||
U: 53
|
||||
V: 54
|
||||
W: 55
|
||||
X: 56
|
||||
Y: 57
|
||||
Z: 58
|
||||
[: 59
|
||||
\: 60
|
||||
]: 61
|
||||
^: 62
|
||||
_: 63
|
||||
`: 64
|
||||
a: 65
|
||||
b: 66
|
||||
c: 67
|
||||
d: 68
|
||||
e: 69
|
||||
f: 70
|
||||
g: 71
|
||||
h: 72
|
||||
i: 73
|
||||
j: 74
|
||||
k: 75
|
||||
l: 76
|
||||
m: 77
|
||||
n: 78
|
||||
o: 79
|
||||
p: 80
|
||||
q: 81
|
||||
r: 82
|
||||
s: 83
|
||||
t: 84
|
||||
u: 85
|
||||
v: 86
|
||||
w: 87
|
||||
x: 88
|
||||
y: 89
|
||||
z: 90
|
||||
{: 91
|
||||
|: 92
|
||||
}: 93
|
||||
~: 94
|
||||
|
||||
00: 11011001100
|
||||
01: 11001101100
|
||||
02: 11001100110
|
||||
03: 10010011000
|
||||
04: 10010001100
|
||||
05: 10001001100
|
||||
06: 10011001000
|
||||
07: 10011000100
|
||||
08: 10001100100
|
||||
09: 11001001000
|
||||
10: 11001000100
|
||||
11: 11000100100
|
||||
12: 10110011100
|
||||
13: 10011011100
|
||||
14: 10011001110
|
||||
15: 10111001100
|
||||
16: 10011101100
|
||||
17: 10011100110
|
||||
18: 11001110010
|
||||
19: 11001011100
|
||||
20: 11001001110
|
||||
21: 11011100100
|
||||
22: 11001110100
|
||||
23: 11101101110
|
||||
24: 11101001100
|
||||
25: 11100101100
|
||||
26: 11100100110
|
||||
27: 11101100100
|
||||
28: 11100110100
|
||||
29: 11100110010
|
||||
30: 11011011000
|
||||
31: 11011000110
|
||||
32: 11000110110
|
||||
33: 10100011000
|
||||
34: 10001011000
|
||||
35: 10001000110
|
||||
36: 10110001000
|
||||
37: 10001101000
|
||||
38: 10001100010
|
||||
39: 11010001000
|
||||
40: 11000101000
|
||||
41: 11000100010
|
||||
42: 10110111000
|
||||
43: 10110001110
|
||||
44: 10001101110
|
||||
45: 10111011000
|
||||
46: 10111000110
|
||||
47: 10001110110
|
||||
48: 11101110110
|
||||
49: 11010001110
|
||||
50: 11000101110
|
||||
51: 11011101000
|
||||
52: 11011100010
|
||||
53: 11011101110
|
||||
54: 11101011000
|
||||
55: 11101000110
|
||||
56: 11100010110
|
||||
57: 11101101000
|
||||
58: 11101100010
|
||||
59: 11100011010
|
||||
60: 11101111010
|
||||
61: 11001000010
|
||||
62: 11110001010
|
||||
63: 10100110000
|
||||
64: 10100001100
|
||||
65: 10010110000
|
||||
66: 10010000110
|
||||
67: 10000101100
|
||||
68: 10000100110
|
||||
69: 10110010000
|
||||
70: 10110000100
|
||||
71: 10011010000
|
||||
72: 10011000010
|
||||
73: 10000110100
|
||||
74: 10000110010
|
||||
75: 11000010010
|
||||
76: 11001010000
|
||||
77: 11110111010
|
||||
78: 11000010100
|
||||
79: 10001111010
|
||||
80: 10100111100
|
||||
81: 10010111100
|
||||
82: 10010011110
|
||||
83: 10111100100
|
||||
84: 10011110100
|
||||
85: 10011110010
|
||||
86: 11110100100
|
||||
87: 11110010100
|
||||
88: 11110010010
|
||||
89: 11011011110
|
||||
90: 11011110110
|
||||
91: 11110110110
|
||||
92: 10101111000
|
||||
93: 10100011110
|
||||
94: 10001011110
|
||||
95: 10111101000
|
||||
96: 10111100010
|
||||
97: 11110101000
|
||||
98: 11110100010
|
||||
99: 10111011110
|
||||
100: 10111101110
|
||||
101: 11101011110
|
||||
102: 11110101110
|
||||
103: 11010000100
|
||||
104: 11010010000
|
||||
105: 11010011100
|
||||
106
applications/external/barcode_gen/barcode_encoding_files/code128c_encodings.txt
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
00: 11011001100
|
||||
01: 11001101100
|
||||
02: 11001100110
|
||||
03: 10010011000
|
||||
04: 10010001100
|
||||
05: 10001001100
|
||||
06: 10011001000
|
||||
07: 10011000100
|
||||
08: 10001100100
|
||||
09: 11001001000
|
||||
10: 11001000100
|
||||
11: 11000100100
|
||||
12: 10110011100
|
||||
13: 10011011100
|
||||
14: 10011001110
|
||||
15: 10111001100
|
||||
16: 10011101100
|
||||
17: 10011100110
|
||||
18: 11001110010
|
||||
19: 11001011100
|
||||
20: 11001001110
|
||||
21: 11011100100
|
||||
22: 11001110100
|
||||
23: 11101101110
|
||||
24: 11101001100
|
||||
25: 11100101100
|
||||
26: 11100100110
|
||||
27: 11101100100
|
||||
28: 11100110100
|
||||
29: 11100110010
|
||||
30: 11011011000
|
||||
31: 11011000110
|
||||
32: 11000110110
|
||||
33: 10100011000
|
||||
34: 10001011000
|
||||
35: 10001000110
|
||||
36: 10110001000
|
||||
37: 10001101000
|
||||
38: 10001100010
|
||||
39: 11010001000
|
||||
40: 11000101000
|
||||
41: 11000100010
|
||||
42: 10110111000
|
||||
43: 10110001110
|
||||
44: 10001101110
|
||||
45: 10111011000
|
||||
46: 10111000110
|
||||
47: 10001110110
|
||||
48: 11101110110
|
||||
49: 11010001110
|
||||
50: 11000101110
|
||||
51: 11011101000
|
||||
52: 11011100010
|
||||
53: 11011101110
|
||||
54: 11101011000
|
||||
55: 11101000110
|
||||
56: 11100010110
|
||||
57: 11101101000
|
||||
58: 11101100010
|
||||
59: 11100011010
|
||||
60: 11101111010
|
||||
61: 11001000010
|
||||
62: 11110001010
|
||||
63: 10100110000
|
||||
64: 10100001100
|
||||
65: 10010110000
|
||||
66: 10010000110
|
||||
67: 10000101100
|
||||
68: 10000100110
|
||||
69: 10110010000
|
||||
70: 10110000100
|
||||
71: 10011010000
|
||||
72: 10011000010
|
||||
73: 10000110100
|
||||
74: 10000110010
|
||||
75: 11000010010
|
||||
76: 11001010000
|
||||
77: 11110111010
|
||||
78: 11000010100
|
||||
79: 10001111010
|
||||
80: 10100111100
|
||||
81: 10010111100
|
||||
82: 10010011110
|
||||
83: 10111100100
|
||||
84: 10011110100
|
||||
85: 10011110010
|
||||
86: 11110100100
|
||||
87: 11110010100
|
||||
88: 11110010010
|
||||
89: 11011011110
|
||||
90: 11011110110
|
||||
91: 11110110110
|
||||
92: 10101111000
|
||||
93: 10100011110
|
||||
94: 10001011110
|
||||
95: 10111101000
|
||||
96: 10111100010
|
||||
97: 11110101000
|
||||
98: 11110100010
|
||||
99: 10111011110
|
||||
100: 10111101110
|
||||
101: 11101011110
|
||||
102: 11110101110
|
||||
103: 11010000100
|
||||
104: 11010010000
|
||||
105: 11010011100
|
||||
44
applications/external/barcode_gen/barcode_encoding_files/code39_encodings.txt
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
0: 000110100
|
||||
1: 100100001
|
||||
2: 001100001
|
||||
3: 101100000
|
||||
4: 000110001
|
||||
5: 100110000
|
||||
6: 001110000
|
||||
7: 000100101
|
||||
8: 100100100
|
||||
9: 001100100
|
||||
A: 100001001
|
||||
B: 001001001
|
||||
C: 101001000
|
||||
D: 000011001
|
||||
E: 100011000
|
||||
F: 001011000
|
||||
G: 000001101
|
||||
H: 100001100
|
||||
I: 001001100
|
||||
J: 000011100
|
||||
K: 100000011
|
||||
L: 001000011
|
||||
M: 101000010
|
||||
N: 000010011
|
||||
O: 100010010
|
||||
P: 001010010
|
||||
Q: 000000111
|
||||
R: 100000110
|
||||
S: 001000110
|
||||
T: 000010110
|
||||
U: 110000001
|
||||
V: 011000001
|
||||
W: 111000000
|
||||
X: 010010001
|
||||
Y: 110010000
|
||||
Z: 011010000
|
||||
-: 010000101
|
||||
.: 110000100
|
||||
: 011000100
|
||||
*: 010010100
|
||||
$: 010101000
|
||||
/: 010100010
|
||||
+: 010001010
|
||||
%: 000101010
|
||||
BIN
applications/external/hid_app/assets/KB_key_Alt_17x10.png
vendored
Normal file
|
After Width: | Height: | Size: 162 B |
BIN
applications/external/hid_app/assets/KB_key_Cmd_17x10.png
vendored
Normal file
|
After Width: | Height: | Size: 163 B |
BIN
applications/external/hid_app/assets/KB_key_Ctl_17x10.png
vendored
Normal file
|
After Width: | Height: | Size: 161 B |
BIN
applications/external/hid_app/assets/KB_key_Del_17x10.png
vendored
Normal file
|
After Width: | Height: | Size: 165 B |
BIN
applications/external/hid_app/assets/KB_key_Esc_17x10.png
vendored
Normal file
|
After Width: | Height: | Size: 164 B |
BIN
applications/external/hid_app/assets/KB_key_Tab_17x10.png
vendored
Normal file
|
After Width: | Height: | Size: 163 B |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -139,17 +139,17 @@ const HidKeyboardKey hid_keyboard_keyset[ROW_COUNT][COLUMN_COUNT] = {
|
||||
{.width = 1, .icon = &I_ButtonRight_4x7, .value = HID_KEYBOARD_RIGHT_ARROW},
|
||||
},
|
||||
{
|
||||
{.width = 2, .icon = NULL, .key = "Ctl", .value = HID_KEYBOARD_L_CTRL},
|
||||
{.width = 2, .icon = &I_KB_key_Ctl_17x10, .value = HID_KEYBOARD_L_CTRL},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_CTRL},
|
||||
{.width = 2, .icon = NULL, .key = "Alt", .value = HID_KEYBOARD_L_ALT},
|
||||
{.width = 2, .icon = &I_KB_key_Alt_17x10, .value = HID_KEYBOARD_L_ALT},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_ALT},
|
||||
{.width = 2, .icon = NULL, .key = "Cmd", .value = HID_KEYBOARD_L_GUI},
|
||||
{.width = 2, .icon = &I_KB_key_Cmd_17x10, .value = HID_KEYBOARD_L_GUI},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_GUI},
|
||||
{.width = 2, .icon = NULL, .key = "Tab", .value = HID_KEYBOARD_TAB},
|
||||
{.width = 2, .icon = &I_KB_key_Tab_17x10, .value = HID_KEYBOARD_TAB},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_TAB},
|
||||
{.width = 2, .icon = NULL, .key = "Esc", .value = HID_KEYBOARD_ESCAPE},
|
||||
{.width = 2, .icon = &I_KB_key_Esc_17x10, .value = HID_KEYBOARD_ESCAPE},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_ESCAPE},
|
||||
{.width = 2, .icon = NULL, .key = "Del", .value = HID_KEYBOARD_DELETE_FORWARD},
|
||||
{.width = 2, .icon = &I_KB_key_Del_17x10, .value = HID_KEYBOARD_DELETE_FORWARD},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_DELETE_FORWARD},
|
||||
},
|
||||
};
|
||||
|
||||
10
applications/external/hid_app/views/hid_media.c
vendored
@@ -54,12 +54,12 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
|
||||
// Keypad circles
|
||||
canvas_draw_icon(canvas, 58, 3, &I_OutCircles);
|
||||
canvas_draw_icon(canvas, 58, 3, &I_OutCircles_70x51);
|
||||
|
||||
// Up
|
||||
if(model->up_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 68, 6, &I_S_UP);
|
||||
canvas_draw_icon(canvas, 68, 6, &I_S_UP_31x15);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
|
||||
// Down
|
||||
if(model->down_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN);
|
||||
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN_31x15);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
|
||||
// Left
|
||||
if(model->left_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT);
|
||||
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT_15x31);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
|
||||
// Right
|
||||
if(model->right_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT);
|
||||
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT_15x31);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
|
||||
10
applications/external/hid_app/views/hid_mouse.c
vendored
@@ -47,12 +47,12 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
|
||||
}
|
||||
|
||||
// Keypad circles
|
||||
canvas_draw_icon(canvas, 58, 3, &I_OutCircles);
|
||||
canvas_draw_icon(canvas, 58, 3, &I_OutCircles_70x51);
|
||||
|
||||
// Up
|
||||
if(model->up_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 68, 6, &I_S_UP);
|
||||
canvas_draw_icon(canvas, 68, 6, &I_S_UP_31x15);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
|
||||
// Down
|
||||
if(model->down_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN);
|
||||
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN_31x15);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
|
||||
// Left
|
||||
if(model->left_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT);
|
||||
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT_15x31);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
|
||||
// Right
|
||||
if(model->right_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT);
|
||||
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT_15x31);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ static void hid_tikshorts_draw_callback(Canvas* canvas, void* context) {
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
|
||||
// Keypad circles
|
||||
canvas_draw_icon(canvas, 58, 3, &I_OutCircles);
|
||||
canvas_draw_icon(canvas, 58, 3, &I_OutCircles_70x51);
|
||||
|
||||
// Pause
|
||||
if(model->back_mouse_pressed) {
|
||||
@@ -55,7 +55,7 @@ static void hid_tikshorts_draw_callback(Canvas* canvas, void* context) {
|
||||
// Up
|
||||
if(model->up_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 68, 6, &I_S_UP);
|
||||
canvas_draw_icon(canvas, 68, 6, &I_S_UP_31x15);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
@@ -65,7 +65,7 @@ static void hid_tikshorts_draw_callback(Canvas* canvas, void* context) {
|
||||
// Down
|
||||
if(model->down_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN);
|
||||
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN_31x15);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ static void hid_tikshorts_draw_callback(Canvas* canvas, void* context) {
|
||||
// Left
|
||||
if(model->left_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT);
|
||||
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT_15x31);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ static void hid_tikshorts_draw_callback(Canvas* canvas, void* context) {
|
||||
// Right
|
||||
if(model->right_pressed) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT);
|
||||
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT_15x31);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "spectrum_analyzer_worker.h"
|
||||
|
||||
typedef struct {
|
||||
uint16_t center_freq;
|
||||
uint32_t center_freq;
|
||||
uint8_t width;
|
||||
uint8_t band;
|
||||
uint8_t vscroll;
|
||||
@@ -53,39 +53,55 @@ void spectrum_analyzer_draw_scale(Canvas* canvas, const SpectrumAnalyzerModel* m
|
||||
}
|
||||
|
||||
// Draw scale tags
|
||||
uint16_t tag_left;
|
||||
uint16_t tag_center;
|
||||
uint16_t tag_right;
|
||||
uint32_t tag_left = 0;
|
||||
uint32_t tag_center = 0;
|
||||
uint32_t tag_right = 0;
|
||||
char temp_str[18];
|
||||
|
||||
tag_center = model->center_freq;
|
||||
|
||||
switch(model->width) {
|
||||
case NARROW:
|
||||
tag_left = model->center_freq - 2;
|
||||
tag_right = model->center_freq + 2;
|
||||
tag_left = model->center_freq - 2000;
|
||||
tag_right = model->center_freq + 2000;
|
||||
break;
|
||||
case ULTRANARROW:
|
||||
tag_left = model->center_freq - 1;
|
||||
tag_right = model->center_freq + 1;
|
||||
tag_left = model->center_freq - 1000;
|
||||
tag_right = model->center_freq + 1000;
|
||||
break;
|
||||
case PRECISE:
|
||||
tag_left = model->center_freq - 200;
|
||||
tag_right = model->center_freq + 200;
|
||||
break;
|
||||
case ULTRAWIDE:
|
||||
tag_left = model->center_freq - 40;
|
||||
tag_right = model->center_freq + 40;
|
||||
tag_left = model->center_freq - 40000;
|
||||
tag_right = model->center_freq + 40000;
|
||||
break;
|
||||
default:
|
||||
tag_left = model->center_freq - 10;
|
||||
tag_right = model->center_freq + 10;
|
||||
tag_left = model->center_freq - 10000;
|
||||
tag_right = model->center_freq + 10000;
|
||||
}
|
||||
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
snprintf(temp_str, 18, "%u", tag_left);
|
||||
canvas_draw_str_aligned(canvas, FREQ_START_X, 63, AlignCenter, AlignBottom, temp_str);
|
||||
snprintf(temp_str, 18, "%u", tag_center);
|
||||
canvas_draw_str_aligned(canvas, 128 / 2, 63, AlignCenter, AlignBottom, temp_str);
|
||||
snprintf(temp_str, 18, "%u", tag_right);
|
||||
canvas_draw_str_aligned(
|
||||
canvas, FREQ_START_X + FREQ_LENGTH_X - 1, 63, AlignCenter, AlignBottom, temp_str);
|
||||
switch(model->width) {
|
||||
case PRECISE:
|
||||
snprintf(temp_str, 18, "%.1f", ((double)tag_left) / 1000);
|
||||
canvas_draw_str_aligned(canvas, FREQ_START_X, 63, AlignCenter, AlignBottom, temp_str);
|
||||
snprintf(temp_str, 18, "%.1f", ((double)tag_center) / 1000);
|
||||
canvas_draw_str_aligned(canvas, 128 / 2, 63, AlignCenter, AlignBottom, temp_str);
|
||||
snprintf(temp_str, 18, "%.1f", ((double)tag_right) / 1000);
|
||||
canvas_draw_str_aligned(
|
||||
canvas, FREQ_START_X + FREQ_LENGTH_X - 1, 63, AlignCenter, AlignBottom, temp_str);
|
||||
break;
|
||||
default:
|
||||
snprintf(temp_str, 18, "%lu", tag_left / 1000);
|
||||
canvas_draw_str_aligned(canvas, FREQ_START_X, 63, AlignCenter, AlignBottom, temp_str);
|
||||
snprintf(temp_str, 18, "%lu", tag_center / 1000);
|
||||
canvas_draw_str_aligned(canvas, 128 / 2, 63, AlignCenter, AlignBottom, temp_str);
|
||||
snprintf(temp_str, 18, "%lu", tag_right / 1000);
|
||||
canvas_draw_str_aligned(
|
||||
canvas, FREQ_START_X + FREQ_LENGTH_X - 1, 63, AlignCenter, AlignBottom, temp_str);
|
||||
}
|
||||
}
|
||||
|
||||
static void spectrum_analyzer_render_callback(Canvas* const canvas, void* ctx) {
|
||||
@@ -115,6 +131,9 @@ static void spectrum_analyzer_render_callback(Canvas* const canvas, void* ctx) {
|
||||
case ULTRANARROW:
|
||||
strncpy(temp_mode_str, "ULTRANARROW", 12);
|
||||
break;
|
||||
case PRECISE:
|
||||
strncpy(temp_mode_str, "PRECISE", 12);
|
||||
break;
|
||||
case ULTRAWIDE:
|
||||
strncpy(temp_mode_str, "ULTRAWIDE", 12);
|
||||
break;
|
||||
@@ -207,12 +226,12 @@ void spectrum_analyzer_calculate_frequencies(SpectrumAnalyzerModel* model) {
|
||||
uint8_t new_band;
|
||||
uint32_t min_hz;
|
||||
uint32_t max_hz;
|
||||
uint8_t margin;
|
||||
uint8_t step;
|
||||
uint16_t upper_limit;
|
||||
uint16_t lower_limit;
|
||||
uint16_t next_up;
|
||||
uint16_t next_down;
|
||||
uint32_t margin;
|
||||
uint32_t step;
|
||||
uint32_t upper_limit;
|
||||
uint32_t lower_limit;
|
||||
uint32_t next_up;
|
||||
uint32_t next_down;
|
||||
uint8_t next_band_up;
|
||||
uint8_t next_band_down;
|
||||
|
||||
@@ -227,19 +246,24 @@ void spectrum_analyzer_calculate_frequencies(SpectrumAnalyzerModel* model) {
|
||||
step = ULTRANARROW_STEP;
|
||||
model->spacing = ULTRANARROW_SPACING;
|
||||
break;
|
||||
case PRECISE:
|
||||
margin = PRECISE_MARGIN;
|
||||
step = PRECISE_STEP;
|
||||
model->spacing = PRECISE_SPACING;
|
||||
break;
|
||||
case ULTRAWIDE:
|
||||
margin = ULTRAWIDE_MARGIN;
|
||||
step = ULTRAWIDE_STEP;
|
||||
model->spacing = ULTRAWIDE_SPACING;
|
||||
/* nearest 20 MHz step */
|
||||
model->center_freq = ((model->center_freq + 10) / 20) * 20;
|
||||
model->center_freq = ((model->center_freq + 10000) / 20000) * 20000;
|
||||
break;
|
||||
default:
|
||||
margin = WIDE_MARGIN;
|
||||
step = WIDE_STEP;
|
||||
model->spacing = WIDE_SPACING;
|
||||
/* nearest 5 MHz step */
|
||||
model->center_freq = ((model->center_freq + 2) / 5) * 5;
|
||||
model->center_freq = ((model->center_freq + 2000) / 5000) * 5000;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -288,21 +312,21 @@ void spectrum_analyzer_calculate_frequencies(SpectrumAnalyzerModel* model) {
|
||||
/* doing everything in Hz from here on */
|
||||
switch(model->band) {
|
||||
case BAND_400:
|
||||
min_hz = MIN_400 * 1000000;
|
||||
max_hz = MAX_400 * 1000000;
|
||||
min_hz = MIN_400 * 1000;
|
||||
max_hz = MAX_400 * 1000;
|
||||
break;
|
||||
case BAND_300:
|
||||
min_hz = MIN_300 * 1000000;
|
||||
max_hz = MAX_300 * 1000000;
|
||||
min_hz = MIN_300 * 1000;
|
||||
max_hz = MAX_300 * 1000;
|
||||
break;
|
||||
default:
|
||||
min_hz = MIN_900 * 1000000;
|
||||
max_hz = MAX_900 * 1000000;
|
||||
min_hz = MIN_900 * 1000;
|
||||
max_hz = MAX_900 * 1000;
|
||||
break;
|
||||
}
|
||||
|
||||
model->channel0_frequency =
|
||||
model->center_freq * 1000000 - (model->spacing * ((NUM_CHANNELS / 2) + 1));
|
||||
model->center_freq * 1000 - (model->spacing * ((NUM_CHANNELS / 2) + 1));
|
||||
|
||||
// /* calibrate upper channels */
|
||||
// hz = model->center_freq * 1000000;
|
||||
@@ -328,7 +352,7 @@ void spectrum_analyzer_calculate_frequencies(SpectrumAnalyzerModel* model) {
|
||||
model->max_rssi_dec = 0;
|
||||
|
||||
FURI_LOG_D("Spectrum", "setup_frequencies - max_hz: %lu - min_hz: %lu", max_hz, min_hz);
|
||||
FURI_LOG_D("Spectrum", "center_freq: %u", model->center_freq);
|
||||
FURI_LOG_D("Spectrum", "center_freq: %lu", model->center_freq);
|
||||
FURI_LOG_D(
|
||||
"Spectrum",
|
||||
"ch[0]: %lu - ch[%u]: %lu",
|
||||
@@ -425,7 +449,7 @@ int32_t spectrum_analyzer_app(void* p) {
|
||||
SpectrumAnalyzerModel* model = spectrum_analyzer->model;
|
||||
|
||||
uint8_t vstep = VERTICAL_SHORT_STEP;
|
||||
uint8_t hstep;
|
||||
uint32_t hstep;
|
||||
|
||||
bool exit_loop = false;
|
||||
|
||||
@@ -455,7 +479,7 @@ int32_t spectrum_analyzer_app(void* p) {
|
||||
break;
|
||||
case InputKeyRight:
|
||||
model->center_freq += hstep;
|
||||
FURI_LOG_D("Spectrum", "center_freq: %u", model->center_freq);
|
||||
FURI_LOG_D("Spectrum", "center_freq: %lu", model->center_freq);
|
||||
spectrum_analyzer_calculate_frequencies(model);
|
||||
spectrum_analyzer_worker_set_frequencies(
|
||||
spectrum_analyzer->worker, model->channel0_frequency, model->spacing, model->width);
|
||||
@@ -465,7 +489,7 @@ int32_t spectrum_analyzer_app(void* p) {
|
||||
spectrum_analyzer_calculate_frequencies(model);
|
||||
spectrum_analyzer_worker_set_frequencies(
|
||||
spectrum_analyzer->worker, model->channel0_frequency, model->spacing, model->width);
|
||||
FURI_LOG_D("Spectrum", "center_freq: %u", model->center_freq);
|
||||
FURI_LOG_D("Spectrum", "center_freq: %lu", model->center_freq);
|
||||
break;
|
||||
case InputKeyOk: {
|
||||
switch(model->width) {
|
||||
@@ -476,6 +500,9 @@ int32_t spectrum_analyzer_app(void* p) {
|
||||
model->width = ULTRANARROW;
|
||||
break;
|
||||
case ULTRANARROW:
|
||||
model->width = PRECISE;
|
||||
break;
|
||||
case PRECISE:
|
||||
model->width = ULTRAWIDE;
|
||||
break;
|
||||
case ULTRAWIDE:
|
||||
|
||||
@@ -15,17 +15,20 @@
|
||||
* wide mode (default): 20 MHz on screen, 196 kHz per channel
|
||||
* narrow mode: 4 MHz on screen, 39 kHz per channel
|
||||
* ultranarrow mode: 2 MHz on screen, 19 kHz per channel
|
||||
* pricse mode: 400 KHz on screen, 3.92 kHz per channel
|
||||
*/
|
||||
#define WIDE 0
|
||||
#define NARROW 1
|
||||
#define ULTRAWIDE 2
|
||||
#define ULTRANARROW 3
|
||||
#define PRECISE 4
|
||||
|
||||
/* channel spacing in Hz */
|
||||
#define WIDE_SPACING 196078
|
||||
#define NARROW_SPACING 39215
|
||||
#define ULTRAWIDE_SPACING 784313
|
||||
#define ULTRANARROW_SPACING 19607
|
||||
#define PRECISE_SPACING 3921
|
||||
|
||||
/* vertical scrolling */
|
||||
#define VERTICAL_SHORT_STEP 16
|
||||
@@ -33,36 +36,40 @@
|
||||
#define MIN_VSCROLL 0
|
||||
#define DEFAULT_VSCROLL 48
|
||||
|
||||
/* frequencies in MHz */
|
||||
#define DEFAULT_FREQ 440
|
||||
#define WIDE_STEP 5
|
||||
#define NARROW_STEP 1
|
||||
#define ULTRAWIDE_STEP 20
|
||||
#define ULTRANARROW_STEP 1
|
||||
#define WIDE_MARGIN 13
|
||||
#define NARROW_MARGIN 3
|
||||
#define ULTRAWIDE_MARGIN 42
|
||||
#define ULTRANARROW_MARGIN 1
|
||||
/* frequencies in KHz */
|
||||
#define DEFAULT_FREQ 440000
|
||||
#define WIDE_STEP 5000
|
||||
#define NARROW_STEP 1000
|
||||
#define ULTRAWIDE_STEP 20000
|
||||
#define ULTRANARROW_STEP 500
|
||||
#define PRECISE_STEP 100
|
||||
|
||||
/* margin in KHz */
|
||||
#define WIDE_MARGIN 13000
|
||||
#define NARROW_MARGIN 3000
|
||||
#define ULTRAWIDE_MARGIN 42000
|
||||
#define ULTRANARROW_MARGIN 1000
|
||||
#define PRECISE_MARGIN 200
|
||||
|
||||
/* frequency bands supported by device */
|
||||
#define BAND_300 0
|
||||
#define BAND_400 1
|
||||
#define BAND_900 2
|
||||
|
||||
/* band limits in MHz */
|
||||
#define MIN_300 281
|
||||
#define CEN_300 315
|
||||
#define MAX_300 361
|
||||
#define MIN_400 378
|
||||
#define CEN_400 435
|
||||
#define MAX_400 481
|
||||
#define MIN_900 749
|
||||
#define CEN_900 855
|
||||
#define MAX_900 962
|
||||
/* band limits in KHz */
|
||||
#define MIN_300 281000
|
||||
#define CEN_300 315000
|
||||
#define MAX_300 361000
|
||||
#define MIN_400 378000
|
||||
#define CEN_400 435000
|
||||
#define MAX_400 481000
|
||||
#define MIN_900 749000
|
||||
#define CEN_900 855000
|
||||
#define MAX_900 962000
|
||||
|
||||
/* band transition points in MHz */
|
||||
#define EDGE_400 369
|
||||
#define EDGE_900 615
|
||||
/* band transition points in KHz */
|
||||
#define EDGE_400 369000
|
||||
#define EDGE_900 615000
|
||||
|
||||
/* VCO transition points in Hz */
|
||||
#define MID_300 318000000
|
||||
|
||||