Skip to content

Commit 8b4987f

Browse files
committed
[ESP32-P4] start to fill Mode-S ring buffer when a reader is ready [skip ci]
1 parent 362e072 commit 8b4987f

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

software/firmware/source/SkyView/Platform_ESP32.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,6 +2692,7 @@ char STR_TMP_BUFFER[128];
26922692
StaticRingbuffer_t *buffer_struct = nullptr;
26932693
uint8_t *buffer_storage = nullptr;
26942694
RingbufHandle_t s_ringbuf_sdr;
2695+
bool rb_reader_is_ready = false;
26952696

26962697
extern int rtlsdr_is_connected;
26972698
extern mag_t maglut[129*129];
@@ -2754,8 +2755,10 @@ static void rtlsdr_callback(unsigned char *buf, uint32_t len, void *ctx)
27542755
rtlsdr_cancel_async(rtlsdr_dev);
27552756
}
27562757

2757-
if (xRingbufferSend(s_ringbuf_sdr, buf, len, pdMS_TO_TICKS(10)) != pdTRUE) {
2758-
Serial.println("Failed to send message into ring buffer!");
2758+
if (rb_reader_is_ready) {
2759+
if (xRingbufferSend(s_ringbuf_sdr, buf, len, pdMS_TO_TICKS(10)) != pdTRUE) {
2760+
Serial.println("Failed to send message into ring buffer!");
2761+
}
27592762
}
27602763
}
27612764

@@ -2918,6 +2921,8 @@ bool es1090_decode(void *pkt, traffic_t *this_aircraft, traffic_t *fop) {
29182921

29192922
static void ESP32PX_USB_loop()
29202923
{
2924+
if (!rb_reader_is_ready) { rb_reader_is_ready = true; }
2925+
29212926
if (rtlsdr_is_connected == 1) {
29222927
size_t receivedMessageSize;
29232928
uint8_t *receivedMessage;

software/firmware/source/SoftRF/src/platform/ESP32.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6600,6 +6600,7 @@ char STR_TMP_BUFFER[128];
66006600
StaticRingbuffer_t *buffer_struct = nullptr;
66016601
uint8_t *buffer_storage = nullptr;
66026602
RingbufHandle_t s_ringbuf_sdr;
6603+
bool rb_reader_is_ready = false;
66036604

66046605
extern int rtlsdr_is_connected;
66056606
extern mag_t maglut[129*129];
@@ -6662,8 +6663,10 @@ static void rtlsdr_callback(unsigned char *buf, uint32_t len, void *ctx)
66626663
rtlsdr_cancel_async(rtlsdr_dev);
66636664
}
66646665

6665-
if (xRingbufferSend(s_ringbuf_sdr, buf, len, pdMS_TO_TICKS(10)) != pdTRUE) {
6666-
Serial.println("Failed to send message into ring buffer!");
6666+
if (rb_reader_is_ready) {
6667+
if (xRingbufferSend(s_ringbuf_sdr, buf, len, pdMS_TO_TICKS(10)) != pdTRUE) {
6668+
Serial.println("Failed to send message into ring buffer!");
6669+
}
66676670
}
66686671
}
66696672

@@ -6791,6 +6794,8 @@ unsigned long ModeS_Time_Marker = 0;
67916794

67926795
static void ESP32PX_USB_loop()
67936796
{
6797+
if (!rb_reader_is_ready) { rb_reader_is_ready = true; }
6798+
67946799
if (rtlsdr_is_connected == 1) {
67956800
size_t receivedMessageSize;
67966801
uint8_t *receivedMessage;

software/firmware/source/SoftRF/src/platform/iomap/LilyGO_T3_STM32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#define SOC_GPIO_ANT_TX PB6 /* active HIGH */
4747

4848
/* button */
49-
#define SOC_GPIO_PIN_BUTTON PB5 // ext. button
49+
#define SOC_GPIO_PIN_BUTTON PH3 // BOOT0
5050

5151
/* 32768 Hz crystal */
5252
#define SOC_GPIO_PIN_XP PC14

software/firmware/source/SoftRF/src/platform/iomap/LilyGO_TMotion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@
7272
/* button */
7373
//#define SOC_GPIO_PIN_BUTTON SOC_UNUSED_PIN
7474
#define SOC_GPIO_PIN_BUTTON (hw_info.model == SOFTRF_MODEL_BRACELET ? \
75-
TTGO_TIMPULSE_GPIO_PAD_OUT : PC4)
75+
TTGO_TIMPULSE_GPIO_PAD_OUT : PC4) /* PH3 */
7676
//#define SOC_GPIO_PIN_BUTTON PA3

0 commit comments

Comments
 (0)