Lora added

This commit is contained in:
richonguzman 2024-09-30 15:58:57 -03:00
parent fb6c4ba2d4
commit da7a044e9e
9 changed files with 95 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -360,6 +360,32 @@
</div>
<hr />
<div class="row my-5 d-flex align-items-top">
<div class="col-lg-3 col-sm-12">
<h5>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
fill="currentColor"
class="bi bi-tv-fill"
viewBox="0 0 16 16"
>
<path
d="M2.5 13.5A.5.5 0 0 1 3 13h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5M2 2h12s2 0 2 2v6s0 2-2 2H2s-2 0-2-2V4s0-2 2-2"
/>
</svg>
LoRa
</h5>
<small>Remember to macht your boards posible Frequencies, SF, CR4.</small>
</div>
<div
id="lora-settings"
class="list-lora col-9">
</div>
</div>
<hr />
<div class="row my-5 d-flex align-items-top">
<div class="col-lg-3 col-sm-12">
<h5>

Binary file not shown.

View File

@ -65,6 +65,53 @@ function loadSettings(settings) {
document.getElementById("sendAltitude").checked = settings.other.sendAltitude ;
document.getElementById("disableGPS").checked = settings.other.disableGPS;
// LORA
const loraContainer = document.getElementById("lora-settings");
loraContainer.innerHTML = ""; // Clear previous content
settings.lora.forEach((lora, index) => {
const loraElement = document.createElement("div");
loraElement.classList.add("row", "lora", "border-bottom", "py-2");
loraElement.innerHTML = `
<div class="col-1 px-1 mb-2 d-flex align-items-center">
<strong>${index + 1})</strong> <!-- Adding numbering here -->
</div>
<div class="form-floating col-6 col-md-3 px-1 mb-2">
<input
type="number"
class="form-control form-control-sm"
name="lora.${index}.frequency"
id="lora.${index}.frequency"
value="${lora.frequency}">
<label for="lora.${index}.frequency">Frequency</label>
</div>
<div class="form-floating col-6 col-md-3 px-1 mb-2">
<input
type="number"
class="form-control form-control-sm"
name="lora.${index}.spreadingFactor"
id="lora.${index}.spreadingFactor"
value="${lora.spreadingFactor}"
min="9"
max="12">
<label for="lora.${index}.spreadingFactor">Spreading Factor</label>
</div>
<div class="form-floating col-6 col-md-3 px-1 mb-2">
<input
type="number"
class="form-control form-control-sm"
name="lora.${index}.codingRate4"
id="lora.${index}.codingRate4"
value="${lora.codingRate4}"
min="5"
max="7">
<label for="lora.${index}.codingRate4">Coding Rate</label>
</div>
`;
loraContainer.appendChild(loraElement);
});
// DISPLAY
document.getElementById("display.showSymbol").checked = settings.display.showSymbol;
document.getElementById("display.ecoMode").checked = settings.display.ecoMode;
@ -104,8 +151,6 @@ function loadSettings(settings) {
document.getElementById("notification.lowBatteryBeep").checked = settings.notification.lowBatteryBeep;
document.getElementById("notification.shutDownBeep").checked = settings.notification.shutDownBeep;
// LORA
// BLUETOOTH
document.getElementById("bluetooth.active").checked = settings.bluetooth.active;
document.getElementById("bluetooth.type").value = settings.bluetooth.type;
@ -339,6 +384,16 @@ document.getElementById("action.speed").addEventListener("change", function () {
}
});*/
const form = document.querySelector("form");
const saveModal = new bootstrap.Modal(document.getElementById("saveModal"), {

Binary file not shown.

Binary file not shown.

View File

@ -145,6 +145,18 @@ namespace WEB_Utils {
Config.wifiAP.password = request->getParam("wifiAP.password", true)->value();
//Config.wifiAP.active = false; // when Configuration is finished Tracker returns to normal mode.
Config.loraTypes[0].frequency = request->getParam("lora.0.frequency", true)->value().toDouble();
Config.loraTypes[0].spreadingFactor = request->getParam("lora.0.spreadingFactor", true)->value().toInt();
Config.loraTypes[0].codingRate4 = request->getParam("lora.0.codingRate4", true)->value().toInt();
Config.loraTypes[1].frequency = request->getParam("lora.1.frequency", true)->value().toDouble();
Config.loraTypes[1].spreadingFactor = request->getParam("lora.1.spreadingFactor", true)->value().toInt();
Config.loraTypes[1].codingRate4 = request->getParam("lora.1.codingRate4", true)->value().toInt();
Config.loraTypes[2].frequency = request->getParam("lora.2.frequency", true)->value().toDouble();
Config.loraTypes[2].spreadingFactor = request->getParam("lora.2.spreadingFactor", true)->value().toInt();
Config.loraTypes[2].codingRate4 = request->getParam("lora.2.codingRate4", true)->value().toInt();
Config.writeFile();
AsyncWebServerResponse *response = request->beginResponse(302, "text/html", "");