mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
[CodeFactor] Apply fixes to commit 476597e
This commit is contained in:
parent
476597e792
commit
498a5c2e3c
1 changed files with 22 additions and 29 deletions
|
@ -116,41 +116,34 @@ export function processModemConfig(data) {
|
||||||
// For now its a hardcoded structure until we found a better way
|
// For now its a hardcoded structure until we found a better way
|
||||||
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
// chatGPT function for iterating through all items and asserting them to a function
|
// chatGPT function for iterating through all items and asserting them to a function
|
||||||
for (const category in data) {
|
for (const category in data) {
|
||||||
if (data.hasOwnProperty(category)) {
|
if (data.hasOwnProperty(category)) {
|
||||||
for (const setting in data[category]) {
|
for (const setting in data[category]) {
|
||||||
if (data[category].hasOwnProperty(setting)) {
|
if (data[category].hasOwnProperty(setting)) {
|
||||||
// Create a variable name combining the category and setting name
|
// Create a variable name combining the category and setting name
|
||||||
const variableName = setting;
|
const variableName = setting;
|
||||||
// Assign the value to the variable
|
// Assign the value to the variable
|
||||||
if(variableName == "mycall"){
|
if (variableName == "mycall") {
|
||||||
|
let mycall = data[category][setting];
|
||||||
let mycall = data[category][setting];
|
if (mycall.includes("-")) {
|
||||||
if (mycall.includes("-")) {
|
const splittedCallsign = mycall.split("-");
|
||||||
const splittedCallsign = mycall.split("-");
|
settings.mycall = splittedCallsign[0]; // The part before the hyphen
|
||||||
settings.mycall = splittedCallsign[0]; // The part before the hyphen
|
settings.myssid = parseInt(splittedCallsign[1], 10); // The part after the hyphen, converted to a number
|
||||||
settings.myssid = parseInt(splittedCallsign[1], 10); // The part after the hyphen, converted to a number
|
} else {
|
||||||
} else {
|
settings.mycall = mycall; // Use the original mycall if no SSID is present
|
||||||
settings.mycall = mycall; // Use the original mycall if no SSID is present
|
settings.myssid = 0; // Default SSID if not provided
|
||||||
settings.myssid = 0; // Default SSID if not provided
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
settings[variableName] = data[category][setting];
|
|
||||||
}
|
|
||||||
console.log(variableName + ': ' + settings[variableName]);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
settings[variableName] = data[category][setting];
|
||||||
|
}
|
||||||
|
console.log(variableName + ": " + settings[variableName]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// STATION SETTINGS
|
// STATION SETTINGS
|
||||||
// Extract the callsign and SSID
|
// Extract the callsign and SSID
|
||||||
if (data.STATION.mycall.includes("-")) {
|
if (data.STATION.mycall.includes("-")) {
|
||||||
|
|
Loading…
Reference in a new issue