diff --git a/FollowMe.cfg b/FollowMe.cfg index eba780c..7eb37fb 100644 --- a/FollowMe.cfg +++ b/FollowMe.cfg @@ -24,6 +24,7 @@ #define WITH_RFM95 // RF chip selection: both HELTEC and TTGO use sx1276 which is same as RFM95 +#define WITH_LORAWAN // #define WITH_SLEEP // with software sleep mode controlled by the long-press on the button // #define WITH_AXP // with AXP192 power controller (T-BEAM V1.0) @@ -52,7 +53,7 @@ // #define WITH_BMX055 // BMX055 magnetic and IMU sensor -#define WITH_FANET +// #define WITH_FANET #define WITH_PFLAA // PFLAU and PFLAA for compatibility with XCsoar and LK8000 // #define WITH_POGNT // #define WITH_GDL90 @@ -68,14 +69,20 @@ // #define WITH_VARIO #define WITH_SD // use the SD card in SPI mode and FAT file system -#define WITH_SPIFFS_FAT #define WITH_SPIFFS // use SPIFFS file system in Flash +#define WITH_SPIFFS_FAT // FAT system in internal flash #define WITH_LOG // log own positions and other received to SPIFFS #define WITH_SDLOG // log own position and other data to uSD card -// #define WITH_STRATUX // talk to Stratux via WiFi and port 30011 -#define WITH_BT_SPP // Bluetooth serial port for smartphone/tablet link -// #define WITH_WIFI // attempt to connect to the wifi router for uploading the log files +// #define WITH_BT_SPP // Bluetooth serial port for smartphone/tablet link + +// #define WITH_STRATUX // connect to Stratux as a client to send GPS and Pressure data +#define WITH_AP // WiFi AcessPoint and TCP decoder port +// #define WITH_APRS // attempt to connect to the wifi router and then APRS + +#if defined(WITH_STRATUX) || defined(WITH_APRS) || defined(WITH_AP) +#define WITH_WIFI +#endif // #define WITH_ENCRYPT // Encrypt (optionally) the position diff --git a/T-Beam_v10_LCD.cfg b/T-Beam_v10_LCD.cfg index 70c09b8..25bc7a1 100644 --- a/T-Beam_v10_LCD.cfg +++ b/T-Beam_v10_LCD.cfg @@ -18,11 +18,7 @@ // #define WITH_OLED2 // 2nd OLED display, I2C address next higher // #define WITH_U8G2_OLED // I2C OLED through the U8g2 library -#ifdef WITH_JACEK -#define WITH_RFM69 // Jacek design uses RFM69 -#else #define WITH_RFM95 // RF chip selection: both HELTEC and TTGO use sx1276 which is same as RFM95 -#endif // #define WITH_SLEEP // with software sleep mode controlled by the long-press on the button @@ -61,15 +57,23 @@ // #define WITH_KNOB // #define WITH_VARIO +#define WITH_LORAWAN + +// #define WITH_AP // #define WITH_STRATUX +#define WITH_BT_SPP // Bluetooth serial port for smartphone/tablet link +// #define WITH_APRS // attempt to connect to the wifi router for uploading the log files to APRS + // #define WITH_SD // use the SD card in SPI mode and FAT file system #define WITH_SPIFFS_FAT #define WITH_SPIFFS // use SPIFFS file system in Flash #define WITH_LOG // log own positions and other received to SPIFFS and possibly to uSD -// #define WITH_BT_SPP // Bluetooth serial port for smartphone/tablet link -// #define WITH_WIFI // attempt to connect to the wifi router for uploading the log files // #define WITH_SPIFFS_LOG // log transmitted and received packets to SPIFFS // #define WITH_ENCRYPT // Encrypt (optionally) the position +#if defined(WITH_STRATUX) || defined(WITH_APRS) || defined(WITH_AP) +#define WITH_WIFI +#endif + diff --git a/main/ap.cpp b/main/ap.cpp index 4fd0b44..573c3cc 100644 --- a/main/ap.cpp +++ b/main/ap.cpp @@ -88,7 +88,7 @@ static void ParmForm_Acft(httpd_req_t *Req) // produce HTML form for aircraft p httpd_resp_sendstr_chunk(Req, "\n"); const char *AcftTypeTable[16] = { "Unknown", "(moto)Glider", "Tow-plane", "Helicopter", "Parachute", "Drop-plane", "Hang-glider", "Para-glider", - "Powered-aircraft", "Jet-aircraft", "UFO", "Balloon", "Airship", "UAV", "Ground support", "Static object" } ; + "Powered-aircraft", "Jet-aircraft", "UFO", "Balloon", "Airship", "UAV/drone", "Ground support", "Static object" } ; httpd_resp_sendstr_chunk(Req, "Acft-Type\n"); SelectList(Req, "AcftType", AcftTypeTable, 16, Parameters.AcftType); httpd_resp_sendstr_chunk(Req, "\n"); @@ -160,7 +160,7 @@ static void ParmForm_AP(httpd_req_t *Req) // Wi-Fi access point parameters { cha httpd_resp_sendstr_chunk(Req, "\n"); } static esp_err_t parm_get_handler(httpd_req_t *Req) -{ // char Line[64]; +{ char Line[32]; int Len; uint16_t URLlen=httpd_req_get_url_query_len(Req); if(URLlen) { char *URL = (char *)malloc(URLlen+1); @@ -183,10 +183,16 @@ static esp_err_t parm_get_handler(httpd_req_t *Req) Parameters.WriteToNVS(); } httpd_resp_sendstr_chunk(Req, "\ \n\ -\n\ +\n\n\ OGN-Tracker config\n\ "); + httpd_resp_sendstr_chunk(Req, "

OGN-Tracker configuration

\n"); + httpd_resp_sendstr_chunk(Req, "CPU ID: "); + Len=Format_Hex(Line, getUniqueID()); + httpd_resp_send_chunk(Req, Line, Len); + httpd_resp_sendstr_chunk(Req, "
\n"); + httpd_resp_sendstr_chunk(Req, "\n\n\n\n\n\n
\n"); ParmForm_Acft(Req); httpd_resp_sendstr_chunk(Req, "\n"); @@ -195,8 +201,19 @@ static esp_err_t parm_get_handler(httpd_req_t *Req) ParmForm_Info(Req); httpd_resp_sendstr_chunk(Req, "\n"); ParmForm_Other(Req); - httpd_resp_sendstr_chunk(Req, "
\n"); - httpd_resp_sendstr_chunk(Req, "\n"); + httpd_resp_sendstr_chunk(Req, "\n\n\n"); + httpd_resp_sendstr_chunk(Req, "\n\n"); +/* + httpd_resp_sendstr_chunk(Req, "
\n"); + httpd_resp_sendstr_chunk(Req, "\n"); + httpd_resp_sendstr_chunk(Req, "\n"); + + httpd_resp_sendstr_chunk(Req, "\n"); + httpd_resp_sendstr_chunk(Req, "\n"); + httpd_resp_sendstr_chunk(Req, "\n"); +*/ httpd_resp_sendstr_chunk(Req, 0); return ESP_OK; } diff --git a/main/format.cpp b/main/format.cpp index b80a010..8f6ca20 100644 --- a/main/format.cpp +++ b/main/format.cpp @@ -216,11 +216,19 @@ uint8_t Format_HexBytes(char *Output, const uint8_t *Byte, uint8_t Bytes) return Len; } uint8_t Format_Hex( char *Output, uint16_t Word ) -{ Format_Hex(Output, (uint8_t)(Word>>8)); Format_Hex(Output+2, (uint8_t)Word); return 4; } +{ Format_Hex(Output, (uint8_t)(Word>>8)); + Format_Hex(Output+2, (uint8_t)Word); + return 4; } uint8_t Format_Hex( char *Output, uint32_t Word ) -{ Format_Hex(Output , (uint8_t)(Word>>24)); Format_Hex(Output+2, (uint8_t)(Word>>16)); - Format_Hex(Output+4, (uint8_t)(Word>> 8)); Format_Hex(Output+6, (uint8_t) Word ); return 8; } +{ Format_Hex(Output , (uint16_t)(Word>>16)); + Format_Hex(Output+4, (uint16_t)(Word )); + return 8; } + +uint8_t Format_Hex( char *Output, uint64_t Word ) +{ Format_Hex(Output , (uint32_t)(Word>>32)); + Format_Hex(Output+8, (uint32_t)(Word )); + return 16; } uint8_t Format_Hex( char *Output, uint32_t Word, uint8_t Digits) { for(uint8_t Idx=Digits; Idx>0; ) diff --git a/main/rf.cpp b/main/rf.cpp index 5793c35..96179aa 100644 --- a/main/rf.cpp +++ b/main/rf.cpp @@ -468,12 +468,13 @@ extern "C" TxTime = (RX_Random&0x3F)+1; TxTime*=6; // [ms] (1..64)*6 = 6..384ms #ifdef WITH_LORAWAN bool WANtx = 0; + uint16_t SlotEnd = 1250; if(WAN_BackOff) WAN_BackOff--; else // decide to transmit in this slot - { uint16_t SlotEnd = 1240; - if(WANdev.State==0 || WANdev.State==2) + { if(WANdev.State==0 || WANdev.State==2) { XorShift32(RX_Random); if((RX_Random&0x1F)==0x10) WANtx=1; SlotEnd=1200; } // random decision 1/32 - TimeSlot(TxChan, SlotEnd-TimeSync_msTime(), TxPktData1, TRX.averRSSI, 0, TxTime); } + } + TimeSlot(TxChan, SlotEnd-TimeSync_msTime(), TxPktData1, TRX.averRSSI, 0, TxTime); #else TimeSlot(TxChan, 1250-TimeSync_msTime(), TxPktData1, TRX.averRSSI, 0, TxTime); #endif