Added beacon TX from web page as #64

This commit is contained in:
Sottosistema W10 2021-09-14 20:47:32 +02:00
parent 8dd7e45e40
commit 852737f0c6
3 changed files with 24 additions and 1 deletions

View File

@ -247,6 +247,11 @@
<input class="button-primary" type="submit" value="Factory reset">
</div>
</form>
<form action="/beacon" method="post" onsubmit="return confirmAction('send beacon');">
<div>
<input class="button-primary" type="submit" value="Send Beacon">
</div>
</form>
</div>
</article>
</section>

View File

@ -188,6 +188,9 @@ uint oled_timeout; // OLED Timeout, same as "Display show RX Time"
bool tempOled = true; // Turn ON OLED at first startup
ulong oled_timer = millis();
// Variable to manually send beacon from html page
bool manBeacon = false;
#define ANGLE_AVGS 3 // angle averaging - x times
float average_course[ANGLE_AVGS];
float avg_c_y, avg_c_x;
@ -863,6 +866,12 @@ void loop() {
}
}
if (manBeacon) {
enableOled();
writedisplaytext("((WEB TX))","","","","","");
sendpacket();
manBeacon=false;
}
// Only wake up OLED when necessary, note that DIM is to turn OFF the backlight
if (enabled_oled) {
display.dim(!tempOled);

View File

@ -16,6 +16,9 @@ extern const char web_style_css_end[] asm("_binary_data_embed_style_css_out_end"
extern const char web_js_js[] asm("_binary_data_embed_js_js_out_start");
extern const char web_js_js_end[] asm("_binary_data_embed_js_js_out_end");
// Variable needed to send beacon from html page
extern bool manBeacon;
QueueHandle_t webListReceivedQueue = nullptr;
std::list <tReceivedPacketData*> receivedPackets;
const int MAX_RECEIVED_LIST_SIZE = 50;
@ -130,8 +133,13 @@ void handle_Reboot() {
ESP.restart();
}
void handle_Shutdown() {
void handle_Beacon() {
server.sendHeader("Location", "/");
server.send(302,"text/html", "");
manBeacon=true;
}
void handle_Shutdown() {
#ifdef T_BEAM_V1_0
server.send(200,"text/html", "Shutdown");
axp.shutdown();
@ -291,6 +299,7 @@ void handle_saveDeviceCfg(){
server.on("/scan_wifi", handle_ScanWifi);
server.on("/save_wifi_cfg", handle_SaveWifiCfg);
server.on("/reboot", handle_Reboot);
server.on("/beacon", handle_Beacon);
server.on("/shutdown", handle_Shutdown);
server.on("/cfg", handle_Cfg);
server.on("/received_list", handle_ReceivedList);