moshe-braner / Open-Glider-Network-Groundstation

Open Glider Network Receiver based on TTGO T-Beam ESP32 hardware.
https://ros-it.ch/open-glider-network-base-station/
GNU General Public License v3.0
7 stars 4 forks source link

Master does not build #2

Closed schenlap closed 2 years ago

schenlap commented 2 years ago

Hi,

thanks for developing the repo. The current master does not build.

RF.cpp:65:34: error: 'RF_TIMING_INTERVAL' was not declared in this scope
 static uint8_t       RF_timing = RF_TIMING_INTERVAL;
schenlap commented 2 years ago

and now some further errors:

m_type         = RF_TIMING_2SLOTS_PPS_SYNC,  
                      ^
Protocol_Legacy.cpp:62:1: error: 'const rf_proto_desc_t {aka const RF_PROTOCOL}' has no non-static data member named 'air_time'
 };
 ^
RF.cpp:64:34: error: 'RF_TIMING_INTERVAL' was not declared in this scope
 static uint8_t       RF_timing = RF_TIMING_INTERVAL;   // default but we won't use it
                                  ^
/.../Open-Glider-Network-Groundstation/ognbase/RF.cpp: In function 'byte RF_setup()':
RF.cpp:174:32: error: 'const rf_proto_desc_t {aka const struct RF_PROTOCOL}' has no member named 'tm_type'
         RF_timing         = p->tm_type;

@moshe-braner Is there any file missing in the repo?

moshe-braner commented 2 years ago

The RF protocol definition is in strange places... The OGNbase code from Manuel had its own time-slots code, which I first abandoned to re-insert the SoftRF code, but then found out it is buggy. For now I am hardcoding the constants for the "Legacy" protocol in my completely new code to implement the time slots correctly. So I am not really using those symbols. But to make it all compile, note in my latest commit that I added these lines to the definition of the legacy_proto_desc structure in Protocol_legacy.cpp: .air_time = 5, // LEGACY_AIR_TIME, .tm_type = RF_TIMING_2SLOTS_PPS_SYNC,

schenlap commented 2 years ago

where is RF_TIMING_2SLOTS_PPS_SYNC defined? As i have problems with the original code of roema with GPS I want to get it running with your code and fix the gps issues. But until now I can not solve the build issues.

moshe-braner commented 2 years ago

That symbol - and the structure that is the data type rf_proto_desc_t - are defined in lmic_protocol.h which is in an obscure place, part of the Arduino-ESP32 library I think. Again, for my current version of OGNbase you can just skip that, comment it out, since I have new code that computes the time slots, with the needed "legacy protocol" constants hard coded. For now, my version ONLY supports that protocol, since it uses the "legacy" (FLARM) packet structure to implement the traffic and time relay systems.

schenlap commented 2 years ago

Thanks for your help. Why not delete unused code?

After commenting things out it does not find

RF.cpp:522:28: error: 'hal_init_softrf' was not declared in this scope
     hal_init_softrf(nullptr);

is there any lib missing in library folder?

From fbb7911928fcd7c30d30cdac0248e4841f065a8a Mon Sep 17 00:00:00 2001
From: <memo5@gmx.at>
Date: Sun, 22 May 2022 15:15:08 +0200
Subject: [PATCH] test compile

---
 ognbase/Protocol_Legacy.cpp | 3 +++
 ognbase/RF.cpp              | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ognbase/Protocol_Legacy.cpp b/ognbase/Protocol_Legacy.cpp
index 30da5e7..72fd7cd 100644
--- a/ognbase/Protocol_Legacy.cpp
+++ b/ognbase/Protocol_Legacy.cpp
@@ -33,6 +33,7 @@
 #include "EEPROM.h"
 #include "Log.h"

+#if 0
 const rf_proto_desc_t legacy_proto_desc = {
     "Legacy",
     .type            = RF_PROTOCOL_LEGACY,
@@ -61,6 +62,8 @@ const rf_proto_desc_t legacy_proto_desc = {
 //  .slot1           = {800, 1200}
 };

+#endif
+
 /* http://en.wikipedia.org/wiki/XXTEA */
 void btea(uint32_t* v, int8_t n, const uint32_t key[4])
 {
diff --git a/ognbase/RF.cpp b/ognbase/RF.cpp
index 8945a70..ea2d0a4 100644
--- a/ognbase/RF.cpp
+++ b/ognbase/RF.cpp
@@ -61,7 +61,7 @@ size_t (* protocol_encode)(void *, ufo_t *);
 bool   (* protocol_decode)(void *, ufo_t *, ufo_t *);

 static Slots_descr_t Time_Slots, *ts;
-static uint8_t       RF_timing = RF_TIMING_INTERVAL;   // default but we won't use it
+//static uint8_t       RF_timing = RF_TIMING_INTERVAL;   // default but we won't use it

 #if defined(TBEAM)
 extern const gnss_chip_ops_t *gnss_chip;
@@ -171,10 +171,10 @@ byte RF_setup(void)

 // >>> the new time slots code currently does NOT use these values.

-        RF_timing         = p->tm_type;
+//        RF_timing         = p->tm_type;

         ts                = &Time_Slots;
-        ts->air_time      = p->air_time;
+//        ts->air_time      = p->air_time;
         ts->interval_min  = p->tx_interval_min;
         ts->interval_max  = p->tx_interval_max;
         ts->interval_mid  = (p->tx_interval_max + p->tx_interval_min) / 2;
-- 
2.30.2
moshe-braner commented 2 years ago

This is all very new and experimental - I'll clean up the code later. I see that the LMIC library is here: https://github.com/moshe-braner/Open-Glider-Network-Groundstation/tree/main/libraries/arduino-lmic There was a symbol clash between that and the Arduino-ESP32 v2.x core library, so I've modified the name of that symbol to "hal_init_softrf" instead of "hal_init". I did that months ago for SoftRF, and didn't copy the modified library to the OGNbase repo. I'll try and do that later. (My compilation environment links to a copy of the libraries, that I put inside the "sketch" folder.) See here for the modified version - you can copy the files that were modified in the commit titled "improved sound alarms": https://github.com/moshe-braner/SoftRF/tree/master/software/firmware/source/libraries/arduino-lmic/src

moshe-braner commented 2 years ago

Now synched the lmic & basicmac libraries to the version I actually use to compile with. The differences are minor: had to rename hal_init() to hal_init_softrf() to avoid clashing with a function of same name in the Arduino-ESP32 Core v2.x library.

schenlap commented 2 years ago

Ok, thank you. I am coming closer to a solution. EEPROM.cpp / h refers to

#include <ti/drivers/NVS.h>
#include <ti/drivers/nvs/NVSCC26XX.h>

which library has this files?

For fute reference, I had to install the following additional libraries: ArduinoOTA AsyncUDP ESP32 ESPmDNS FS SPI SPIFFS Update WebServer WiFi Wire

moshe-braner commented 2 years ago

Hmmm, I didn't need to install any of those. And EEPROM.cpp only includes these:

include "SoC.h"

include "EEPROM.h"

include "RF.h"

include "Traffic.h"

include "Battery.h"

so whatever else you found there is indirect?

Seems like you are compiling for ESP32, but don't have the ESP32 "Core" libraries installed? What platform are you compiling on? I am using "Arduino" on Linux, and installed the Arduino-ESP32 "core", currently v2.0.3. That is via the Board Manager. And then choose "ESP32 dev module" as the board before compilation.

Manuel's repo had 4 libraries linked rather than copied, I had to download those manually to compile on my Linux PC. (There is probably a better way, but I am a beginner on git and github.) Those were:

Also note: there were several warnings from the compiler, some I have resolved, some still remain and I am ignoring for now. E.g., the AES library has a nasty-looking warning about storage in a zero-sized storage location. Be careful about warnings that a function is supposed to return a value but does not. I got CRASHES ("panic" and reboot) due to those, so had to fix them.

schenlap commented 2 years ago

I have installed a new setup and could now compile it.

The 4 libs are submodules, after checkout of ognbase you can do

git submodule init
git submodule update

no need to copy zip files :-)

My locale changes to compile:

diff --git a/ognbase/Protocol_Legacy.cpp b/ognbase/Protocol_Legacy.cpp
index 30da5e7..c489514 100644
--- a/ognbase/Protocol_Legacy.cpp
+++ b/ognbase/Protocol_Legacy.cpp
@@ -53,8 +53,8 @@ const rf_proto_desc_t legacy_proto_desc = {
     .whitening = RF_WHITENING_MANCHESTER,
     .bandwidth = RF_RX_BANDWIDTH_SS_125KHZ,

-  .air_time        = 5,   // LEGACY_AIR_TIME,
-  .tm_type         = RF_TIMING_2SLOTS_PPS_SYNC,  
+  //.air_time        = 5,   // LEGACY_AIR_TIME,
+  //.tm_type         = RF_TIMING_2SLOTS_PPS_SYNC,  
     .tx_interval_min = LEGACY_TX_INTERVAL_MIN,
     .tx_interval_max = LEGACY_TX_INTERVAL_MAX
 //  .slot0           = {400,  800},
diff --git a/ognbase/RF.cpp b/ognbase/RF.cpp
index 8945a70..0b66239 100644
--- a/ognbase/RF.cpp
+++ b/ognbase/RF.cpp
@@ -61,7 +61,7 @@ size_t (* protocol_encode)(void *, ufo_t *);
 bool   (* protocol_decode)(void *, ufo_t *, ufo_t *);

 static Slots_descr_t Time_Slots, *ts;
-static uint8_t       RF_timing = RF_TIMING_INTERVAL;   // default but we won't use it
+//static uint8_t       RF_timing = RF_TIMING_INTERVAL;   // default but we won't use it

 #if defined(TBEAM)
 extern const gnss_chip_ops_t *gnss_chip;
@@ -171,10 +171,10 @@ byte RF_setup(void)

 // >>> the new time slots code currently does NOT use these values.

-        RF_timing         = p->tm_type;
+        //RF_timing         = p->tm_type;

         ts                = &Time_Slots;
-        ts->air_time      = p->air_time;
+   //     ts->air_time      = p->air_time;
         ts->interval_min  = p->tx_interval_min;
         ts->interval_max  = p->tx_interval_max;
         ts->interval_mid  = (p->tx_interval_max + p->tx_interval_min) / 2;
diff --git a/ognbase/Web.cpp b/ognbase/Web.cpp
index e89ec5f..40cb0fa 100644
--- a/ognbase/Web.cpp
+++ b/ognbase/Web.cpp
@@ -376,8 +376,8 @@ void Web_setup(ufo_t* this_aircraft)
              (ogn_band == RF_BAND_CN ? "selected" : ""), RF_BAND_CN,
              (ogn_band == RF_BAND_UK ? "selected" : ""), RF_BAND_UK,
              (ogn_band == RF_BAND_IN ? "selected" : ""), RF_BAND_IN,
-             (ogn_band == RF_BAND_IL ? "selected" : ""), RF_BAND_IL,
-             (ogn_band == RF_BAND_KR ? "selected" : ""), RF_BAND_KR,
+//             (ogn_band == RF_BAND_IL ? "selected" : ""), RF_BAND_IL,
+ //            (ogn_band == RF_BAND_KR ? "selected" : ""), RF_BAND_KR,
              (ogn_protocol_1 == RF_PROTOCOL_LEGACY ? "selected" : ""),
              RF_PROTOCOL_LEGACY, legacy_proto_desc.name,
              (ogn_protocol_1 == RF_PROTOCOL_OGNTP ? "selected" : ""),