Skip to content
Closed
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
30 changes: 25 additions & 5 deletions web/extensions/ant_switch/ant_switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ var ant_sw = {
console.log('ant_switch: Antenna configuration');
var buttons_html = '';
var n_ant = 0;

// Add "Switch All Off" button at the top
buttons_html += w3_div('w3-valign w3-margin-T-8',
w3_button('id-ant-sw-btn', 'Switch All Off', 'ant_switch_select_groundall', 0),
w3_div('w3-margin-L-8', 'Ground all antennas')
);
n_ant++;

for (tmp = 1; tmp <= ant_sw.n_ant; tmp++) {
if (antdesc[tmp] == undefined || antdesc[tmp] == null || antdesc[tmp] == '') {
antdesc[tmp] = '';
Expand Down Expand Up @@ -296,12 +304,24 @@ var ant_sw = {

// update highlight
var selected_antennas_list = ant_selected_antenna.split(',');
var re=/^Antenna ([1]?[0-9]+)/i;

var re_antenna=/^Antenna ([1]?[0-9]+)/i;
var re_switch_off=/^Switch All Off$/i;

w3_els('id-ant-sw-btn',
function(el, i) {
if (!el.textContent.match(re)) return;
// Always unhighlight first
w3_unhighlight(el);

// Handle "Switch All Off" button
if (el.textContent.match(re_switch_off)) {
if (ant_selected_antenna == '0') {
w3_highlight(el);
}
return;
}

// Handle numbered antenna buttons
if (!el.textContent.match(re_antenna)) return;
var antN = el.textContent.parseIntEnd();
if (!isArray(selected_antennas_list)) return;
if (selected_antennas_list.indexOf(antN.toString()) < 0) return; // not currently selected
Expand Down Expand Up @@ -378,8 +398,8 @@ var ant_sw = {
w3_disable(el, lock);
}

// Ground All
var re=/^Ground all$/i;
// Switch All Off
Copy link
Copy Markdown
Contributor

@howard0su howard0su Aug 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ground All is same as Switch All Off. please scan the code to see if there is duplicated or dead logic around ground all. use them for switch all off. @copilot

var re=/^Switch All Off$/i;
if (el.textContent.match(re)) {
w3_disable(el, lock);
}
Expand Down