Skip to content

Commit 999b10c

Browse files
committed
[WebTop] add build infra for D1090 data protocol
1 parent 8a6e257 commit 999b10c

7 files changed

Lines changed: 231 additions & 3 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ jobs:
421421
if [[ "$BOARD" =~ "nrf54l15clean:nrf54l15clean:" ]]; then
422422
arduino --pref "boardsmanager.additional.urls=https://raw.githubusercontent.com/lolren/NRF54L15-Clean-Arduino-core/refs/heads/main/package_nrf54l15clean_index.json" --save-prefs ;
423423
# arduino --pref "boardsmanager.additional.urls=https://github.com/lolren/nrf54-arduino-core/releases/download/v0.7.0/package_nrf54l15clean_index.json" --save-prefs ;
424-
arduino --install-boards nrf54l15clean:nrf54l15clean:0.9.211 ;
424+
arduino --install-boards nrf54l15clean:nrf54l15clean:0.9.213 ;
425425
arduino --pref "custom_clean_cpu=xiao_nrf54l15_cpu128" --save-prefs ;
426426
arduino --pref "custom_clean_vpr=xiao_nrf54l15_off" --save-prefs ;
427427
arduino --pref "custom_clean_zigbee=xiao_nrf54l15_off" --save-prefs ;
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/*
2+
* D1090Helper.cpp
3+
* Copyright (C) 2016-2026 Linar Yusupov
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#include <adsb_encoder.h>
20+
#include <TimeLib.h>
21+
#include <protocol.h>
22+
23+
#include "SoCHelper.h"
24+
#include "D1090Helper.h"
25+
#include "GNSSHelper.h"
26+
#include "EEPROMHelper.h"
27+
#include "TrafficHelper.h"
28+
#include "WiFiHelper.h"
29+
30+
static unsigned long D1090_Data_TimeMarker = 0;
31+
32+
static void D1090_Parse_Character(char c)
33+
{
34+
/* TODO */
35+
}
36+
37+
void D1090_setup()
38+
{
39+
if (settings->m.protocol == PROTOCOL_D1090) {
40+
41+
switch (settings->m.connection)
42+
{
43+
case CON_SERIAL_MAIN:
44+
case CON_SERIAL_AUX:
45+
uint32_t SerialBaud;
46+
47+
switch (settings->m.baudrate)
48+
{
49+
case B4800:
50+
SerialBaud = 4800;
51+
break;
52+
case B9600:
53+
SerialBaud = 9600;
54+
break;
55+
case B19200:
56+
SerialBaud = 19200;
57+
break;
58+
case B57600:
59+
SerialBaud = 57600;
60+
break;
61+
case B115200:
62+
SerialBaud = 115200;
63+
break;
64+
case B2000000:
65+
SerialBaud = 2000000;
66+
break;
67+
case B38400:
68+
default:
69+
SerialBaud = 38400;
70+
break;
71+
}
72+
73+
SoC->swSer_begin(SerialBaud);
74+
break;
75+
case CON_BLUETOOTH:
76+
#if 0
77+
if (SoC->Bluetooth_ops) {
78+
SoC->Bluetooth_ops->setup();
79+
}
80+
#endif
81+
break;
82+
case CON_USB:
83+
case CON_NONE:
84+
case CON_WIFI_UDP:
85+
default:
86+
break;
87+
}
88+
89+
D1090_Data_TimeMarker = millis();
90+
}
91+
}
92+
93+
void D1090_loop()
94+
{
95+
size_t size;
96+
97+
switch (settings->m.connection)
98+
{
99+
case CON_SERIAL_MAIN:
100+
while (SerialInput.available() > 0) {
101+
char c = SerialInput.read();
102+
// Serial.print(c);
103+
D1090_Parse_Character(c);
104+
D1090_Data_TimeMarker = millis();
105+
}
106+
break;
107+
case CON_SERIAL_AUX:
108+
/* read data from Type-C USB port */
109+
while (Serial.available() > 0) {
110+
char c = Serial.read();
111+
// Serial.print(c);
112+
D1090_Parse_Character(c);
113+
D1090_Data_TimeMarker = millis();
114+
}
115+
break;
116+
case CON_USB:
117+
/* read data from Type-C USB port in Host mode */
118+
if (SoC->USB_ops) {
119+
while (SoC->USB_ops->available() > 0) {
120+
char c = SoC->USB_ops->read();
121+
// Serial.print(c);
122+
D1090_Parse_Character(c);
123+
D1090_Data_TimeMarker = millis();
124+
}
125+
}
126+
break;
127+
case CON_WIFI_UDP:
128+
size = SoC->WiFi_Receive_UDP((uint8_t *) UDPpacketBuffer, sizeof(UDPpacketBuffer));
129+
if (size > 0) {
130+
for (size_t i=0; i < size; i++) {
131+
// Serial.print(UDPpacketBuffer[i]);
132+
D1090_Parse_Character(UDPpacketBuffer[i]);
133+
}
134+
D1090_Data_TimeMarker = millis();
135+
}
136+
break;
137+
case CON_BLUETOOTH:
138+
if (SoC->Bluetooth_ops) {
139+
while (SoC->Bluetooth_ops->available() > 0) {
140+
char c = SoC->Bluetooth_ops->read();
141+
// Serial.print(c);
142+
D1090_Parse_Character(c);
143+
D1090_Data_TimeMarker = millis();
144+
}
145+
}
146+
break;
147+
case CON_NONE:
148+
default:
149+
break;
150+
}
151+
}
152+
153+
void D1090_Out(byte *buf, size_t size)
154+
{
155+
if (size > 0) {
156+
switch(settings->m.data_dest)
157+
{
158+
case D1090_UART:
159+
case D1090_USB:
160+
Serial.write(buf, size);
161+
break;
162+
case D1090_BLUETOOTH:
163+
{
164+
if (SoC->Bluetooth_ops) {
165+
SoC->Bluetooth_ops->write(buf, size);
166+
}
167+
}
168+
break;
169+
case D1090_UDP:
170+
{
171+
SoC->WiFi_transmit_UDP(D1090_DST_PORT, buf, size);
172+
}
173+
break;
174+
case D1090_TCP:
175+
case D1090_OFF:
176+
default:
177+
break;
178+
}
179+
}
180+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* D1090Helper.h
3+
* Copyright (C) 2016-2026 Linar Yusupov
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#ifndef D1090HELPER_H
20+
#define D1090HELPER_H
21+
22+
#define D1090_DST_PORT 47909
23+
24+
void D1090_setup(void);
25+
void D1090_loop(void);
26+
void D1090_Out(byte *, size_t);
27+
28+
#endif /* D1090HELPER_H */

software/firmware/source/SkyWatch/SkyWatch.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "WebHelper.h"
4646
#include "BatteryHelper.h"
4747
#include "GDL90Helper.h"
48+
#include "D1090Helper.h"
4849
#include "TFTHelper.h"
4950
#include "BaroHelper.h"
5051
#include "GNSSHelper.h"
@@ -158,6 +159,9 @@ void setup()
158159
case PROTOCOL_GDL90:
159160
GDL90_setup();
160161
break;
162+
case PROTOCOL_D1090:
163+
D1090_setup();
164+
break;
161165
case PROTOCOL_NMEA:
162166
default:
163167
NMEA_setup();
@@ -212,6 +216,9 @@ void normal_loop()
212216
case PROTOCOL_GDL90:
213217
GDL90_loop();
214218
break;
219+
case PROTOCOL_D1090:
220+
D1090_loop();
221+
break;
215222
case PROTOCOL_NMEA:
216223
default:
217224
NMEA_loop();

software/firmware/source/SkyWatch/WebHelper.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static const char settings_html[] PROGMEM = "<html>\
215215

216216
void handleSettings_master() {
217217

218-
size_t size = 7204;
218+
size_t size = 7240;
219219
char *offset;
220220
size_t len = 0;
221221
char *Settings_temp = (char *) malloc(size);
@@ -254,6 +254,7 @@ void handleSettings_master() {
254254
<select name='dprotocol'>\
255255
<option %s value='%d'>NMEA</option>\
256256
<option %s value='%d'>GDL90</option>\
257+
<option %s value='%d'>D1090</option>\
257258
</select>\
258259
</td>\
259260
</tr>\
@@ -276,6 +277,7 @@ void handleSettings_master() {
276277
(settings->m.connection == CON_BLUETOOTH ? "selected" : ""), CON_BLUETOOTH,
277278
(settings->m.protocol == PROTOCOL_NMEA ? "selected" : ""), PROTOCOL_NMEA,
278279
(settings->m.protocol == PROTOCOL_GDL90 ? "selected" : ""), PROTOCOL_GDL90,
280+
(settings->m.protocol == PROTOCOL_D1090 ? "selected" : ""), PROTOCOL_D1090,
279281
(settings->m.baudrate == B4800 ? "selected" : ""), B4800,
280282
(settings->m.baudrate == B9600 ? "selected" : ""), B9600,
281283
(settings->m.baudrate == B19200 ? "selected" : ""), B19200,
@@ -1600,6 +1602,12 @@ void handleStatus() {
16001602
GDL90_hasHeartBeat() ? "GDL90" : ""
16011603
);
16021604
break;
1605+
case PROTOCOL_D1090:
1606+
snprintf_P ( offset, size,
1607+
PSTR("\
1608+
<tr><th align=left>Connection status</th><td align=right>N/A</td></tr>")
1609+
);
1610+
break;
16031611
case PROTOCOL_NMEA:
16041612
default:
16051613
snprintf_P ( offset, size,

software/firmware/source/SoftRF/src/driver/RF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void RF_SetChannel(void)
294294
ts->current = 0;
295295
chan = (int8_t) RF_FreqPlan.getChannel(Time, ts->current, OGN | ADSL);
296296
}
297-
if ((ms_since_boot - ts->s1.tmarker) >= ts->interval_mid) {
297+
else if ((ms_since_boot - ts->s1.tmarker) >= ts->interval_mid) {
298298
ts->s1.tmarker = ref_time_ms + ts->s1.begin;
299299
ts->current = 1;
300300
chan = (int8_t) RF_FreqPlan.getChannel(Time, ts->current, OGN | ADSL);

software/firmware/source/SoftRF/src/protocol/radio/ADSL.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ bool adsl_decode(void *pkt, ufo_t *this_aircraft, ufo_t *fop) {
122122

123123
r.Descramble();
124124

125+
// iConspicuity
126+
if (r.Type != 0x02) {
127+
return false;
128+
}
129+
125130
fop->protocol = RF_PROTOCOL_ADSL_860;
126131

127132
fop->addr = r.getAddress();

0 commit comments

Comments
 (0)