Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ESP32/dataEdit/www/battery.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function wsBatteryStatus(data) {
var batteryCapacityRemainingPercentage = status["batteryCapacityRemainingPercentage"];
var batteryCapacityRemaining = status["batteryCapacityRemaining"];
var batteryTemperature = status["batteryTemperature"];

document.getElementById("batteryVoltage").value = batteryVoltage;
document.getElementById("batteryCapacityRemaining").value = batteryCapacityRemaining;
document.getElementById("batteryCapacityRemainingPercentage").value = batteryCapacityRemainingPercentage;
Expand All @@ -55,7 +55,7 @@ function setBatterySettings() {
userSettings["batteryCapacityMax"] = parseFloat(document.getElementById('batteryCapacityMax').value);
setRestartRequired();
updateUserSettings();
}
}
function setBatteryFull() {
sendWebsocketCommand("setBatteryFull");
}
16 changes: 8 additions & 8 deletions ESP32/dataEdit/www/bldc-motor.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ function updateBLDCSettings() {
}

function updateBLDCPins() {
if(upDateTimeout !== null)
if(upDateTimeout !== null)
{
clearTimeout(upDateTimeout);
}
upDateTimeout = setTimeout(() =>
upDateTimeout = setTimeout(() =>
{
var pinValues = validateBLDCPins();
if(pinValues) {
Expand Down Expand Up @@ -101,7 +101,7 @@ function getBLDCPinValues() {
}

function validateBLDCPins() {
clearErrors("pinValidation");
clearErrors("pinValidation");
var assignedPins = [];
var duplicatePins = [];
var pwmErrors = [];
Expand All @@ -125,7 +125,7 @@ function validateBLDCPins() {
}
}
}
else
else
{
//assignedPins.push({name:"SPI1", pin:5});
assignedPins.push({name:"SPI CLK", pin:18});
Expand All @@ -143,7 +143,7 @@ function validateBLDCPins() {
// }
validatePin(pinValues.BLDC_Encoder_PIN, "Encoder", assignedPins, duplicatePins);


// if(pinValues.BLDC_ChipSelect_PIN > -1) {
// pinDupeIndex = assignedPins.findIndex(x => x.pin === pinValues.BLDC_ChipSelect_PIN);
// if(pinDupeIndex > -1)
Expand Down Expand Up @@ -199,7 +199,7 @@ function validateBLDCPins() {
// }
validatePin(pinValues.BLDC_HallEffect_PIN, "HallEffect", assignedPins, duplicatePins);
}

validateCommonPWMPins(assignedPins, duplicatePins, pinValues, pwmErrors);

var invalidPins = [];
Expand All @@ -217,10 +217,10 @@ function validateBLDCPins() {
if (pwmErrors.length) {
if(duplicatePins.length || invalidPins.length) {
errorString += "<br>";
}
}
errorString += "<div style='margin-left: 25px;'>The following pins are invalid PWM pins:<br><div style='color: white; margin-left: 25px;'>"+pwmErrors.join("<br>")+"</div></div>";
}

errorString += "</div>";
showError(errorString);
return undefined;
Expand Down
24 changes: 12 additions & 12 deletions ESP32/dataEdit/www/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ Buttons = {
document.getElementById("buttonAnalogDebounce").value = buttonSettings["buttonAnalogDebounce"];
removeByClass("buttonSetRow");
buttonSettings["buttonSets"].forEach((buttonSet, setIndex) => {

const buttons = buttonSet["buttons"];

//Main UI template
const buttonSetsDiv = document.getElementById("buttonControls");

let buttonSetNameRow = Utils.createTextFormRow(0, "Name", 'buttonSetName'+setIndex, buttonSet.name, 25, function(setIndex) {this.update(setIndex)}.bind(this, setIndex));
buttonSetNameRow.input.setAttribute("readonly", true);
let buttonSetPinRow = Utils.createNumericFormRow(0, "Pin", 'buttonSetPin'+setIndex, buttonSet.pin, -1, 255, function(setIndex) {this.update(setIndex)}.bind(this, setIndex));
Expand Down Expand Up @@ -72,7 +72,7 @@ Buttons = {
buttonSetsDiv.appendChild(buttonSetPinRow.row);
buttonSetsDiv.appendChild(buttonSetEditButton);


//Modal Template
var modalRootdiv = document.createElement("div");
modalRootdiv.classList.add("formTable");
Expand Down Expand Up @@ -100,7 +100,7 @@ Buttons = {
}.bind(this, setIndex));
buttonSetPinRowEdit.input.required = true;
buttonSetPinRowEdit.title = `The pin this button set is on`

buttonTableDiv.appendChild(buttonSetNameRowEdit.row);
buttonTableDiv.appendChild(buttonSetPinRowEdit.row);

Expand Down Expand Up @@ -141,7 +141,7 @@ Buttons = {
For example: '#motion-disable #resume #device-home #ok'
NOTE: There is currently no way to delay between the command execution.
`

modalParent.appendChild(buttonTable);
buttonTable.appendChild(buttonTableDiv);
modalParent.appendChild(span);
Expand All @@ -166,7 +166,7 @@ Buttons = {
buttonSettings["buttonSetsEnabled"] = setsEnabled;
showRestartRequired();
}

buttonSettings["bootButtonCommand"] = document.getElementById('bootButtonCommand').value.replace("\n", " ");
if(validateIntControl("buttonAnalogDebounce", buttonSettings, "buttonAnalogDebounce")) {
buttonSettings["buttonAnalogDebounce"] = parseInt(document.getElementById("buttonAnalogDebounce").value);
Expand Down Expand Up @@ -211,7 +211,7 @@ Buttons = {
modal.appendChild(this.templates[index]);
this.setbuttonSet(index);
const header = document.createElement("span");
header.innerText = "Edit button set"
header.innerText = "Edit button set"
header.setAttribute("slot", "title");
modal.appendChild(header);
modal.show();
Expand All @@ -222,31 +222,31 @@ Buttons = {
const buttonIndex = i;
const button = buttons[i];
document.getElementById('buttonName'+setIndex+buttonIndex).value = button.name;
document.getElementById('buttonCommand'+setIndex+buttonIndex).value = button.command;
document.getElementById('buttonCommand'+setIndex+buttonIndex).value = button.command;
// document.getElementById('buttonIndex'+setIndex+buttonIndex).value = button[i].index;
};
},
updatebuttonSet(setIndex) {
buttonSettings["buttonSets"][setIndex]["name"] = document.getElementById('buttonSetNameEdit'+setIndex).value;
buttonSettings["buttonSets"][setIndex]["pin"] = parseInt(document.getElementById('buttonSetPinEdit'+setIndex).value);
buttonSettings["buttonSets"][setIndex]["pin"] = parseInt(document.getElementById('buttonSetPinEdit'+setIndex).value);
const buttons = buttonSettings["buttonSets"][setIndex]["buttons"];
for(var i = 0; i < buttons.length; i++) {
const buttonIndex = i;
//const button = buttons[i];
const nameNode = document.getElementById('buttonName'+setIndex+buttonIndex);
if(nameNode) {
buttonSettings["buttonSets"][setIndex]["buttons"][i]["name"] = document.getElementById('buttonName'+setIndex+buttonIndex).value;
buttonSettings["buttonSets"][setIndex]["buttons"][i]["command"] = document.getElementById('buttonCommand'+setIndex+buttonIndex).value.replace("\n", " ");
buttonSettings["buttonSets"][setIndex]["buttons"][i]["command"] = document.getElementById('buttonCommand'+setIndex+buttonIndex).value.replace("\n", " ");
}
// document.getElementById('buttonIndex'+setIndex+buttonIndex).value = button[i].index;
};
},

setButtonSetName(profileIndex) {
if(this.setNameDebounce) {
clearTimeout(this.setNameDebounce);
}

this.setNameDebounce = setTimeout(function(profileIndex) {
if(validateStringControl("buttonSetName"+profileIndex, buttonSettings['buttonSets'][profileIndex], "name")) {
//updateMotionProfileName(profileIndex);
Expand Down
2 changes: 1 addition & 1 deletion ESP32/dataEdit/www/esp-timer-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ESPTimer = {
}
}, defaultDebounce);
}.bind(this, timerObj, timerFrequencyRow);

table.body.appendChild(timerFrequencyRow.row);
}
}
Expand Down
Loading