diff --git a/main/ap.cpp b/main/ap.cpp
index 759e2ce..e7a9680 100644
--- a/main/ap.cpp
+++ b/main/ap.cpp
@@ -19,29 +19,107 @@
// ============================================================================================================
-static void RespChunk(httpd_req_t *Req, const char *Resp, int Len) { httpd_resp_send_chunk(Req, Resp, Len); }
-static void RespChunk(httpd_req_t *Req, const char *Resp) { httpd_resp_send_chunk(Req, Resp, strlen(Resp)); }
-static void RespEnd(httpd_req_t *Req) { httpd_resp_send_chunk(Req, 0, 0); };
+static void ParmForm(httpd_req_t *Req) // produce HTML form for parameters input
+{ char Line[16]; int Len;
-static esp_err_t status_get_handler(httpd_req_t *Req)
-{ char Line[64];
- RespChunk(Req, "\
-\r\n\
-\r\n\
-
OGN-Tracker status\r\n\
+ httpd_resp_sendstr_chunk(Req, "\n");
+}
+
+static esp_err_t parm_get_handler(httpd_req_t *Req)
+{ // char Line[64];
+ uint16_t URLlen=httpd_req_get_url_query_len(Req);
+ if(URLlen)
+ { char *URL = (char *)malloc(URLlen+1);
+ httpd_req_get_url_query_str(Req, URL, URLlen+1);
+#ifdef DEBUG_PRINT
+ xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
+ Format_String(CONS_UART_Write, "parm_get_handler() => [");
+ Format_SignDec(CONS_UART_Write, URLlen);
+ Format_String(CONS_UART_Write, "] ");
+ Format_String(CONS_UART_Write, URL);
+ Format_String(CONS_UART_Write, "\n");
+ xSemaphoreGive(CONS_Mutex);
+#endif
+ char *Line=URL;
+ for( ; ; )
+ { Parameters.ReadLine(Line);
+ Line = strchr(Line, '&'); if(Line==0) break;
+ Line++; }
+ free(URL); }
+ httpd_resp_sendstr_chunk(Req, "\
+\n\
+\n\
+OGN-Tracker status\n\
");
- int Len=Parameters.Print(Line);
- RespChunk(Req, Line, Len);
- RespChunk(Req, "\r\n");
- RespEnd(Req);
+ // int Len=Parameters.Print(Line);
+ // httpd_resp_send_chunk(Req, Line, Len);
+ ParmForm(Req);
+ httpd_resp_sendstr_chunk(Req, "\n");
+ httpd_resp_sendstr_chunk(Req, 0);
return ESP_OK; }
-static const httpd_uri_t HTTPstatus =
-{ .uri = "/status.html",
+/*
+static esp_err_t parm_get_handler(httpd_req_t *Req)
+{ char Line[32];
+ // int ContLen=Req->content_len;
+ xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
+ Format_String(CONS_UART_Write, "parm_get_handler() => [");
+ // Format_SignDec(CONS_UART_Write, ContLen, 1, 0, 1);
+ Format_String(CONS_UART_Write, "] ");
+ // for( ; ; )
+ // { int Ret = httpd_req_recv(Req, Line, 31); if(Len<=0) break;
+ // }
+ Format_String(CONS_UART_Write, "\n");
+ xSemaphoreGive(CONS_Mutex);
+ return ESP_OK; }
+*/
+
+static const httpd_uri_t HTTPparm =
+{ .uri = "/parm.html",
.method = HTTP_GET,
- .handler = status_get_handler,
+ .handler = parm_get_handler,
.user_ctx = 0 };
+/*
+static const httpd_uri_t HTTPsave =
+{ .uri = "/parm.html",
+ .method = HTTP_GET,
+ .handler = parm_get_handler,
+ .user_ctx = 0 };
+*/
+
static httpd_handle_t HTTPserver = 0;
static esp_err_t HTTP_Start(int MaxSockets=4, int Port=80)
@@ -50,7 +128,8 @@ static esp_err_t HTTP_Start(int MaxSockets=4, int Port=80)
Config.task_priority = tskIDLE_PRIORITY+3;
Config.max_open_sockets = MaxSockets;
esp_err_t Err=httpd_start(&HTTPserver, &Config); if(Err!=ESP_OK) return Err;
- httpd_register_uri_handler(HTTPserver, &HTTPstatus);
+ httpd_register_uri_handler(HTTPserver, &HTTPparm);
+ // httpd_register_uri_handler(HTTPserver, &HTTPsave);
return Err; }
static void HTTP_Stop(void)
diff --git a/main/hal.cpp b/main/hal.cpp
index 36f58d1..18cb28f 100644
--- a/main/hal.cpp
+++ b/main/hal.cpp
@@ -305,9 +305,9 @@ GPIO HELTEC TTGO JACEK M5_JACEK T-Beam T-Beamv10 Foll
#define LCD_PIN_CLK GPIO_NUM_13 // SCL
#endif // TBEAM
#ifdef WITH_TBEAM_V10 // new T-Beam
-#define LCD_PIN_MOSI GPIO_NUM_14 // 13 // SDA
+#define LCD_PIN_MOSI GPIO_NUM_14 // 13 // SDA
#define LCD_PIN_MISO GPIO_NUM_NC // MISO not connected
-#define LCD_PIN_CLK GPIO_NUM_13 // 2 // SCL
+#define LCD_PIN_CLK GPIO_NUM_13 // 2 // SCL
// #define LCD_PIN_MOSI GPIO_NUM_2 // 13 // SDA
// #define LCD_PIN_MISO GPIO_NUM_NC // MISO not connected
// #define LCD_PIN_CLK GPIO_NUM_13 // 14 // SCL
diff --git a/main/parameters.h b/main/parameters.h
index 520271b..600eed9 100644
--- a/main/parameters.h
+++ b/main/parameters.h
@@ -250,7 +250,7 @@ uint16_t StratuxPort;
#ifdef WITH_AP
getAprsCall(APname);
APpass[0]=0;
- APport = 30000;
+ APport = 2000;
APminSig = -70; // [dBm]
APtxPwr = 40; // [0.25dBm]
#endif
@@ -643,8 +643,10 @@ uint16_t StratuxPort;
char *NameEnd=Line; // remember where the parameter name ends
Line = (char *)SkipBlanks(Line); if((*Line)!='=') return 0; // next should be the equal sign
char *Value = (char *)SkipBlanks(Line+1); // if((*Value)<=' ') return 0;
- *NameEnd=0; // put NULL character just after the parameter name
- return ReadParam(Name, Value); }
+ char ch = *NameEnd; *NameEnd=0; // put NULL character just after the parameter name
+ bool OK = ReadParam(Name, Value);
+ *NameEnd = ch; // restore the erased character
+ return OK; }
int ReadFromFile(FILE *File)
{ char Line[80]; // line buffer