correct bugs AG

This commit is contained in:
2026-01-10 23:33:47 +01:00
parent bcf58b208b
commit 46ee44c6c9
11 changed files with 197 additions and 246 deletions

View File

@@ -20,22 +20,49 @@
async function selectAntenna(port, antennaNum) {
try {
await api.antenna.selectAntenna(port, antennaNum);
// Check if antenna is already selected on this port
const isAlreadySelected = (port === 1 && portA.rx_ant === antennaNum) ||
(port === 2 && portB.rx_ant === antennaNum);
if (isAlreadySelected) {
// Deselect: set rxant to 00
console.log(`Deselecting antenna ${antennaNum} from port ${port}`);
await api.antenna.deselectAntenna(port, antennaNum);
} else {
// Select normally
console.log(`Selecting antenna ${antennaNum} on port ${port}`);
await api.antenna.selectAntenna(port, antennaNum);
}
} catch (err) {
console.error('Failed to select antenna:', err);
alert('Failed to select antenna');
console.error('Failed to select/deselect antenna:', err);
// No popup, just log the error
}
}
// Debug TX state - only log when tx state changes, not on every update
let lastTxStateA = false;
let lastTxStateB = false;
$: if (status && (portA.tx !== lastTxStateA || portB.tx !== lastTxStateB)) {
console.log('AntennaGenius TX state changed:', {
portA_tx: portA.tx,
portB_tx: portB.tx,
portA_tx_ant: portA.tx_ant,
portB_tx_ant: portB.tx_ant
});
lastTxStateA = portA.tx;
lastTxStateB = portB.tx;
}
async function reboot() {
if (!confirm('Are you sure you want to reboot the Antenna Genius?')) {
return;
}
try {
await api.antenna.reboot();
console.log('Antenna Genius reboot command sent');
} catch (err) {
console.error('Failed to reboot:', err);
alert('Failed to reboot');
// No popup, just log
}
}
</script>
@@ -220,12 +247,6 @@
transition: all 0.3s;
}
.antenna-card.tx {
background: rgba(244, 67, 54, 0.2);
border-color: #f44336;
box-shadow: 0 0 20px rgba(244, 67, 54, 0.4);
}
.antenna-card.active-a {
background: rgba(76, 175, 80, 0.2);
border-color: #4caf50;
@@ -238,6 +259,13 @@
box-shadow: 0 0 20px rgba(33, 150, 243, 0.3);
}
/* TX must come AFTER active-a/active-b to override */
.antenna-card.tx {
background: rgba(244, 67, 54, 0.2) !important;
border-color: #f44336 !important;
box-shadow: 0 0 20px rgba(244, 67, 54, 0.4) !important;
}
.antenna-name {
font-size: 14px;
font-weight: 500;

View File

@@ -6,6 +6,16 @@
$: powerForward = status?.power_forward || 0;
$: powerReflected = status?.power_reflected || 0;
$: swr = status?.swr || 1.0;
// Debug logging
$: if (status) {
console.log('PowerGenius status update:', {
powerForward: status.power_forward,
swr: status.swr,
state: status.state,
connected: status.connected
});
}
$: voltage = status?.voltage || 0;
$: vdd = status?.vdd || 0;
$: current = status?.current || 0;
@@ -30,7 +40,7 @@
await api.power.setFanMode(mode);
} catch (err) {
console.error('Failed to set fan mode:', err);
alert('Failed to set fan mode');
// Removed alert popup - check console for errors
}
}
@@ -40,7 +50,7 @@
await api.power.setOperate(operateValue);
} catch (err) {
console.error('Failed to toggle operate:', err);
alert('Failed to toggle operate mode');
// Removed alert popup - check console for errors
}
}
</script>
@@ -323,125 +333,6 @@
margin-top: 2px;
}
.power-display {
display: flex;
flex-direction: column;
gap: 8px;
}
.power-main {
text-align: center;
}
.power-value {
font-size: 48px;
font-weight: 200;
color: var(--accent-cyan);
line-height: 1;
text-shadow: 0 0 20px rgba(79, 195, 247, 0.5);
}
.power-value .unit {
font-size: 20px;
color: var(--text-secondary);
margin-left: 4px;
}
.power-label {
font-size: 11px;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 1px;
margin-top: 4px;
}
.power-bar {
position: relative;
height: 8px;
background: var(--bg-tertiary);
border-radius: 4px;
overflow: hidden;
}
.power-bar-fill {
position: relative;
height: 100%;
background: linear-gradient(90deg, #4caf50, #ffc107, #ff9800, #f44336);
border-radius: 4px;
transition: width 0.3s ease;
}
.power-bar-glow {
position: absolute;
top: 0;
right: 0;
width: 20px;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5));
animation: shimmer 2s infinite;
}
@keyframes shimmer {
0% { transform: translateX(-100%); }
100% { transform: translateX(100%); }
}
.power-scale {
display: flex;
justify-content: space-between;
font-size: 9px;
color: var(--text-muted);
margin-top: 4px;
}
/* SWR Circle */
.swr-container {
display: flex;
align-items: center;
gap: 10px;
}
.swr-circle {
width: 80px;
height: 80px;
border-radius: 50%;
background: radial-gradient(circle, rgba(79, 195, 247, 0.1), transparent);
border: 3px solid var(--swr-color);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-shadow: 0 0 20px var(--swr-color);
}
.swr-value {
font-size: 20px;
font-weight: 300;
color: var(--swr-color);
}
.swr-label {
font-size: 10px;
color: var(--text-muted);
text-transform: uppercase;
}
.swr-status {
flex: 1;
}
.status-text {
font-size: 14px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.status-text.good { color: #4caf50; }
.status-text.ok { color: #ffc107; }
.status-text.warning { color: #ff9800; }
.status-text.danger { color: #f44336; }
/* Temperature */
.temp-group {
display: grid;

View File

@@ -359,22 +359,6 @@
gap: 8px;
}
.heading-input {
background: var(--bg-tertiary);
color: var(--text-primary);
border: 1px solid var(--border-color);
border-radius: 4px;
padding: 10px 12px;
font-size: 14px;
outline: none;
transition: all 0.2s;
}
.heading-input:focus {
border-color: var(--accent-cyan);
box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.2);
}
.go-btn {
padding: 10px 24px;
border-radius: 4px;
@@ -434,8 +418,4 @@
box-shadow: 0 6px 16px rgba(244, 67, 54, 0.5);
}
.arrow {
font-size: 20px;
line-height: 1;
}
</style>

View File

@@ -24,7 +24,7 @@
await api.tuner.autoTune();
} catch (err) {
console.error('Failed to tune:', err);
alert('Failed to start tuning');
// Removed alert popup - check console for errors
}
}
@@ -33,7 +33,7 @@
await api.tuner.setBypass(value);
} catch (err) {
console.error('Failed to set bypass:', err);
alert('Failed to set bypass');
// Removed alert popup - check console for errors
}
}
@@ -42,7 +42,7 @@
await api.tuner.setOperate(value);
} catch (err) {
console.error('Failed to set operate:', err);
alert('Failed to set operate');
// Removed alert popup - check console for errors
}
}
</script>
@@ -307,59 +307,14 @@
margin-top: 2px;
}
.power-display {
display: flex;
flex-direction: column;
gap: 8px;
}
/* SWR Circle */
.swr-container {
display: flex;
align-items: center;
gap: 10px;
}
.swr-circle {
width: 80px;
height: 80px;
border-radius: 50%;
background: radial-gradient(circle, rgba(79, 195, 247, 0.1), transparent);
border: 3px solid var(--swr-color);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-shadow: 0 0 20px var(--swr-color);
}
.swr-value {
font-size: 20px;
font-weight: 300;
color: var(--swr-color);
}
.swr-label {
font-size: 10px;
color: var(--text-muted);
text-transform: uppercase;
}
.swr-status {
flex: 1;
}
.status-text {
font-size: 14px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.status-text.good { color: #4caf50; }
.status-text.ok { color: #ffc107; }
.status-text.warning { color: #ff9800; }
.status-text.danger { color: #f44336; }
/* Capacitors */
.capacitors {

View File

@@ -64,6 +64,10 @@ export const api = {
method: 'POST',
body: JSON.stringify({ port, antenna }),
}),
deselectAntenna: (port, antenna) => request('/antenna/deselect', {
method: 'POST',
body: JSON.stringify({ port, antenna }),
}),
reboot: () => request('/antenna/reboot', { method: 'POST' }),
},
@@ -101,5 +105,9 @@ export const api = {
method: 'POST',
body: JSON.stringify({ enabled, threshold }),
}),
setDirection: (direction) => request('/ultrabeam/direction', {
method: 'POST',
body: JSON.stringify({ direction }),
}),
},
};