don't list non animation files
parent
5a9eee688b
commit
7a619886c6
35
script.js
35
script.js
|
|
@ -117,7 +117,7 @@ window.onload = () => {
|
|||
motorIDList.push(motor.ID);
|
||||
addDial(motor.ID, motor.NAME);
|
||||
}
|
||||
if (connectedRobot.motors.length > 0){
|
||||
if (connectedRobot.motors.length > 0) {
|
||||
setSelectedMotor(connectedRobot.motors[0].ID);
|
||||
}
|
||||
|
||||
|
|
@ -420,7 +420,9 @@ window.onload = () => {
|
|||
clearFileList();
|
||||
|
||||
files.forEach(filename => {
|
||||
if (filename) addFileToList(filename);
|
||||
if (filename && filename.toLowerCase().endsWith(".anim")) {
|
||||
addFileToList(filename);
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
|
|
@ -459,8 +461,8 @@ window.onload = () => {
|
|||
//console.log(stringPayload);
|
||||
document.getElementById('log').value += "MSG: " + stringPayload + `\n`;
|
||||
const logBox = document.getElementById('log');
|
||||
logBox.value += "MSG: " + stringPayload + `\n`;
|
||||
logBox.scrollTop = logBox.scrollHeight;
|
||||
logBox.value += "MSG: " + stringPayload + `\n`;
|
||||
logBox.scrollTop = logBox.scrollHeight;
|
||||
// 🔹 Do something with the file
|
||||
//handleLoadedFile(fileData);
|
||||
break;
|
||||
|
|
@ -517,20 +519,21 @@ logBox.scrollTop = logBox.scrollHeight;
|
|||
});
|
||||
|
||||
function handlePositionStreamPacket(data) {
|
||||
const motorCount = Math.floor(data.length / 2); // Each motor uses 2 bytes
|
||||
|
||||
for (let i = 0; i < motorCount; i++) {
|
||||
const high = data[i * 2]; // High byte
|
||||
const low = data[i * 2 + 1]; // Low byte
|
||||
const value = (high << 8) | low; // Combine into uint16_t
|
||||
|
||||
if (dials[i]) {
|
||||
dials[i].value = value;
|
||||
//console.log(data);
|
||||
const motorCount = Math.floor(data.length / 2); // Each motor uses 2 bytes
|
||||
let d = [];
|
||||
for (let i = 0; i < motorCount; i++) {
|
||||
const high = data[i * 2]; // High byte
|
||||
const low = data[i * 2 + 1]; // Low byte
|
||||
const value = (low << 8) | high; // Combine into uint16_t
|
||||
d.push(value);
|
||||
if (dials[i]) {
|
||||
dials[i].value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
}
|
||||
}
|
||||
|
||||
function handleLoadedFile(data) {
|
||||
const raw = new Uint8Array(data);
|
||||
|
|
@ -1121,7 +1124,7 @@ logBox.scrollTop = logBox.scrollHeight;
|
|||
|
||||
// If motor is in robot config already, grab the name
|
||||
let configMotor = connectedRobot.getMotor(motor.ID);
|
||||
if (configMotor != null){
|
||||
if (configMotor != null) {
|
||||
motor.NAME = configMotor.NAME;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue