Compare commits

..

No commits in common. "37e847990f8145b592fc87f04a75c429cef5cdd2" and "307df511ad06f34b50b356ed772b48273e42235a" have entirely different histories.

3 changed files with 80 additions and 221 deletions

View file

@ -1,52 +0,0 @@
- start: 135.7
end: 137.8
power_a: 1 W ERP
- start: 472
end: 479
power_a: 1 W ERP
- start: 1810
end: 1850
power_a: 750 W PEP
power_e: 100 W PEP
- start: 1850
end: 1890
power_a: 75 W PEP
power_e: 75 W PEP
- start: 1890
end: 2000
power_a: 10 W PEP
power_e: 10 W PEP
- start: 3500
end: 3800
power_a: 750 W PEP
power_e: 100 W PEP
- start: 5351.5
end: 5366.5
power_a: 15 W EIRP
- start: 7000
end: 7100
power_a: 750 W PEP
- start: 7100
end: 7200
power_a: 750 W PEP
- start: 10100
end: 10150
power_a: 150 W PEP
- start: 14000
end: 14350
power_a: 750 W PEP
- start: 18068
end: 18168
power_a: 750 W PEP
- start: 21000
end: 21450
power_a: 750 W PEP
power_e: 100 W PEP
- start: 24890
end: 24990
power_a: 750 W PEP
- start: 28000
end: 29700
power_a: 750 W PEP
power_e: 100 W PEP
power_n: 10 W ERP

View file

@ -255,11 +255,11 @@
- band: 20 m - band: 20 m
mode: All modes mode: All modes
bandwidth: 2700 bandwidth: 2700
start: 14101 start: 141101
end: 14350 end: 14350
parts: parts:
- description: Digimodes, automatically controlled data stations (unattended) - description: Digimodes, automatically controlled data stations (unattended)
start: 14101 start: 141101
end: 14112 end: 14112
- start: 14112 - start: 14112
end: 14125 end: 14125

View file

@ -37,7 +37,7 @@ div#togglebuttons>button {
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
update_plan(); update_plan();
document.getElementById("base_plan").addEventListener("keydown", (event) => { document.getElementById("sel_plan").addEventListener("keydown", (event) => {
if (event.key === 'Enter') { if (event.key === 'Enter') {
update_plan() update_plan()
} }
@ -72,91 +72,29 @@ div#togglebuttons>button {
document.getElementById("error").innerText = e; document.getElementById("error").innerText = e;
} }
function isInRange(number, min, max) { function update_plan() {
return number >= min && number <= max; fetch(document.getElementById('sel_plan').value, {
mode: 'cors'
}).then((response) => {
if (!response.ok) {
throw new Error(response.status);
} }
return response.text();
function add_power(add, p) { }).then((data) => {
if (typeof add.power_a !== "undefined") { try {
p["power_a"] = add.power_a; const bands = yaml.load(data);
}
if (typeof add.power_e !== "undefined") {
p["power_e"] = add.power_e;
}
if (typeof add.power_n !== "undefined") {
p["power_n"] = add.power_n;
}
}
function debug_tdata(s, tdata) {
if (tdata.length > 0) {
console.log(s + " " + tdata.length + " " + tdata[tdata.length - 1].frequency + " " + tdata[tdata.length - 1].power_a);
//console.log(s + " " + tdata.length);
//tdata.forEach((t) => {
// console.log(s + " " + t.frequency);
//});
}
}
function update_table(bands, additions) {
var tdata = []; var tdata = [];
bands.forEach((band) => { bands.forEach((band) => {
band.parts.forEach((part) => { band.parts.forEach((part) => {
let p = { tdata.push({
"band": band.band, "band": band.band,
"mode": band.mode, "mode": band.mode,
//"band_start": band.start, //"band_start": band.start,
//"band_end": band.end, //"band_end": band.end,
"bandwidth": band.bandwidth, "bandwidth": band.bandwidth,
"description": part.description, "description": part.description,
"frequency": typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end, "frequency": typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end ,
//"at": part.at,
//"start": part.start,
//"end": part.end,
};
let parts_already_added = false;
additions.forEach((add) => {
if (typeof part.at !== "undefined") {
if (isInRange(part.at, add.start, add.end)) {
// at single frequency
add_power(add, p);
}
} else {
// frequeny range
if ((add.start == part.start) && (add.end == part.end)) {
// ranges are the same
add_power(add, p);
} else if (isInRange(part.start, add.start, add.end) && isInRange(part.end, add.start, add.end)) {
// range of part is inside of range of add
add_power(add, p);
} else {
// part range is split by add range
if (isInRange(add.start, part.start, part.end)) {
// part range starts below add range
let p_clone = structuredClone(p);
let start = add.start;
let end = part.end < add.end ? part.end : add.end;
p_clone["frequency"] = start + '\u2013' + end;
add_power(add, p_clone);
tdata.push(p_clone);
parts_already_added = true;
} else if (isInRange(add.end, part.start, part.end)) {
// add range starts below part range
let p_clone = structuredClone(p);
let start = part.start;
let end = add.end;
p_clone["frequency"] = start + '\u2013' + end;
add_power(add, p_clone);
tdata.push(p_clone);
parts_already_added = true;
}
}
}
}); });
if (!parts_already_added) {
tdata.push(p);
}
parts_already_added = false;
}); });
}); });
@ -181,9 +119,6 @@ div#togglebuttons>button {
//{title: "band_start", field: "band_start", headerFilter: "input"}, //{title: "band_start", field: "band_start", headerFilter: "input"},
//{title: "band_end", field: "band_end", headerFilter: "input"}, //{title: "band_end", field: "band_end", headerFilter: "input"},
{title: "description", field: "description", headerFilter: "input", headerFilterFunc: filter_with_not}, {title: "description", field: "description", headerFilter: "input", headerFilterFunc: filter_with_not},
{title: "power_a", field: "power_a", headerFilter: "input", headerFilterFunc: filter_with_not},
{title: "power_e", field: "power_e", headerFilter: "input", headerFilterFunc: filter_with_not},
{title: "power_n", field: "power_n", headerFilter: "input", headerFilterFunc: filter_with_not},
], ],
}); });
@ -194,7 +129,7 @@ div#togglebuttons>button {
} }
table.download( table.download(
"pdf", "pdf",
path.basename(document.getElementById('base_plan').value, '.yml') + '.pdf', path.basename(document.getElementById('sel_plan').value, '.yml') + '.pdf',
{ orientation:"portrait" }, { orientation:"portrait" },
download_range); download_range);
}); });
@ -213,30 +148,12 @@ div#togglebuttons>button {
}); });
}); });
document.getElementById("error").innerText = ""; document.getElementById("error").innerText = "";
}
function update_plan() {
Promise.all([
fetch(document.getElementById('base_plan').value, { mode: 'cors' }),
fetch(document.getElementById('additions_plan').value, { mode: 'cors' }),
]).then((res) => {
res.forEach((r) => {
if (!r.ok) {
throw new Error(r.status);
}
});
Promise.all([res[0].text(), res[1].text()]).then((d) => {
try {
update_table(yaml.load(d[0]),yaml.load(d[1]));
} catch (e) { } catch (e) {
display_error(e); display_error(e);
} }
}).catch((e) => { }).catch((e) => {
display_error(e); display_error(e);
}); });
}).catch((e) => {
display_error(e);
});
} }
// used in button // used in button
@ -251,14 +168,8 @@ div#togglebuttons>button {
} }
</script> </script>
<div> <div>
<label>Base Plan: <label>Plan:
<input name="plan" id="base_plan" type="text" value="band-plan-iaru_r1_hf.yml"> <input name="plan" id="sel_plan" type="text" value="band-plan-iaru_r1_hf.yml">
</label>
<button onclick="update_plan()">Change plan</button>
</div>
<div>
<label>Additions:
<input name="plan" id="additions_plan" type="text" value="band-plan-de.yml">
</label> </label>
<button onclick="update_plan()">Change plan</button> <button onclick="update_plan()">Change plan</button>
</div> </div>