kopia lustrzana https://github.com/pjalocha/esp32-ogn-tracker
HTTP updates the parameters in flash, fix timing bug in RF
rodzic
095ad91b0a
commit
06495d803d
17
FollowMe.cfg
17
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
27
main/ap.cpp
27
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, "</td></tr>\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, "<tr><td>Acft-Type</td><td>\n");
|
||||
SelectList(Req, "AcftType", AcftTypeTable, 16, Parameters.AcftType);
|
||||
httpd_resp_sendstr_chunk(Req, "</td></tr>\n");
|
||||
|
@ -160,7 +160,7 @@ static void ParmForm_AP(httpd_req_t *Req) // Wi-Fi access point parameters { cha
|
|||
httpd_resp_sendstr_chunk(Req, "</table></form>\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, "\
|
||||
<!DOCTYPE html>\n\
|
||||
<html><body>\n\
|
||||
<html>\n<body>\n\
|
||||
<title>OGN-Tracker config</title>\n\
|
||||
");
|
||||
|
||||
httpd_resp_sendstr_chunk(Req, "<h1>OGN-Tracker configuration</h1>\n");
|
||||
httpd_resp_sendstr_chunk(Req, "<b>CPU ID: ");
|
||||
Len=Format_Hex(Line, getUniqueID());
|
||||
httpd_resp_send_chunk(Req, Line, Len);
|
||||
httpd_resp_sendstr_chunk(Req, "</b><br />\n");
|
||||
|
||||
httpd_resp_sendstr_chunk(Req, "<table>\n<tr>\n<td>\n");
|
||||
ParmForm_Acft(Req);
|
||||
httpd_resp_sendstr_chunk(Req, "</td>\n<td>\n");
|
||||
|
@ -195,8 +201,19 @@ static esp_err_t parm_get_handler(httpd_req_t *Req)
|
|||
ParmForm_Info(Req);
|
||||
httpd_resp_sendstr_chunk(Req, "</td>\n<td>\n");
|
||||
ParmForm_Other(Req);
|
||||
httpd_resp_sendstr_chunk(Req, "</td>\n<tr>\n</table>\n");
|
||||
httpd_resp_sendstr_chunk(Req, "</body></html>\n");
|
||||
httpd_resp_sendstr_chunk(Req, "</td>\n</tr>\n</table>\n");
|
||||
httpd_resp_sendstr_chunk(Req, "</body>\n</html>\n");
|
||||
/*
|
||||
httpd_resp_sendstr_chunk(Req, "<form action=\"/parm.html\" method=\"get\" id=\"Defaults\">\n");
|
||||
httpd_resp_sendstr_chunk(Req, "<input type=\"submit\" value=\"Defaults\">\n");
|
||||
httpd_resp_sendstr_chunk(Req, "<input type=\"hidden\" name=\"Defaults\" value=\"1\"");
|
||||
httpd_resp_sendstr_chunk(Req, "</form>\n");
|
||||
|
||||
httpd_resp_sendstr_chunk(Req, "<form action=\"/parm.html\" method=\"get\" id=\"Restart\">\n");
|
||||
httpd_resp_sendstr_chunk(Req, "<input type=\"submit\" value=\"Restart\">\n");
|
||||
httpd_resp_sendstr_chunk(Req, "<input type=\"hidden\" name=\"Restart\" value=\"1\"");
|
||||
httpd_resp_sendstr_chunk(Req, "</form>\n");
|
||||
*/
|
||||
httpd_resp_sendstr_chunk(Req, 0);
|
||||
return ESP_OK; }
|
||||
|
||||
|
|
|
@ -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; )
|
||||
|
|
|
@ -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
|
||||
|
|
Ładowanie…
Reference in New Issue