some fixes

This commit is contained in:
Ayzen
2025-09-29 16:02:06 +03:00
parent a43f949f24
commit 3b1aa988de
8 changed files with 44 additions and 25 deletions

View File

@ -1 +1 @@
config_inputs/s11_start100_stop8800_points1000_bw1khz.bin
config_inputs/s21_start100_stop8800_points1000_bw1khz.bin

View File

@ -1 +1 @@
s11_start100_stop8800_points1000_bw1khz/lol
s21_start100_stop8800_points1000_bw1khz/bambambum

View File

@ -1,10 +1,10 @@
{
"y_min": -30,
"y_max": 15,
"smoothing_enabled": false,
"smoothing_window": 11,
"marker_enabled": false,
"marker_frequency": 100000009.0,
"grid_enabled": false,
"y_min": -90,
"y_max": 20,
"smoothing_enabled": true,
"smoothing_window": 17,
"marker_enabled": true,
"marker_frequency": 300000009.0,
"grid_enabled": true,
"reset_smoothing": false
}

View File

@ -164,7 +164,8 @@ def generate_standards_magnitude_plots(
for standard_file in Path(calibration_path).glob("*.json"):
standard_name = standard_file.stem
if "metadata" in standard_name:
if "metadata" in standard_name or "calibration_info" in standard_name:
logger.debug(f"Skipping {standard_name=}")
continue
try:

View File

@ -61,14 +61,14 @@ export class AcquisitionManager {
const result = await response.json();
if (result.success) {
this.notifications.show(result.message, 'success');
this.notifications.show({type: 'success', message: result.message});
await this.updateStatus();
} else {
this.notifications.show(result.error || 'Failed to start acquisition', 'error');
this.notifications.show({type: 'error', message: result.error || 'Failed to start acquisition'});
}
} catch (error) {
console.error('Error starting acquisition:', error);
this.notifications.show('Failed to start acquisition', 'error');
this.notifications.show({type: 'error', message: 'Failed to start acquisition'});
} finally {
this.setButtonLoading(this.elements.startBtn, false);
}
@ -86,14 +86,14 @@ export class AcquisitionManager {
const result = await response.json();
if (result.success) {
this.notifications.show(result.message, 'success');
this.notifications.show({type: 'success', message: result.message});
await this.updateStatus();
} else {
this.notifications.show(result.error || 'Failed to stop acquisition', 'error');
this.notifications.show({type: 'error', message: result.error || 'Failed to stop acquisition'});
}
} catch (error) {
console.error('Error stopping acquisition:', error);
this.notifications.show('Failed to stop acquisition', 'error');
this.notifications.show({type: 'error', message: 'Failed to stop acquisition'});
} finally {
this.setButtonLoading(this.elements.stopBtn, false);
}
@ -111,14 +111,14 @@ export class AcquisitionManager {
const result = await response.json();
if (result.success) {
this.notifications.show(result.message, 'success');
this.notifications.show({type: 'success', message: result.message});
await this.updateStatus();
} else {
this.notifications.show(result.error || 'Failed to trigger single sweep', 'error');
this.notifications.show({type: 'error', message: result.error || 'Failed to trigger single sweep'});
}
} catch (error) {
console.error('Error triggering single sweep:', error);
this.notifications.show('Failed to trigger single sweep', 'error');
this.notifications.show({type: 'error', message: 'Failed to trigger single sweep'});
} finally {
this.setButtonLoading(this.elements.singleSweepBtn, false);
}

View File

@ -66,8 +66,21 @@ export class NotificationManager {
* Show a notification
*/
show(options) {
// Check for duplicate notifications within the last 2 seconds
// Validate options
if (!options || typeof options !== 'object') {
console.warn('⚠️ Invalid notification options:', options);
return null;
}
const { type = 'info', title, message } = options;
// Don't show notification if both title and message are empty
if (!title && !message) {
console.warn('⚠️ Skipping notification with empty title and message');
return null;
}
// Check for duplicate notifications within the last 2 seconds
const notificationKey = `${type}:${title}:${message}`;
const now = Date.now();
const lastShown = this.recentNotifications.get(notificationKey);

View File

@ -578,12 +578,12 @@ export class SettingsManager {
this.pendingStandard = standard;
this.websocket?.on?.('processor_result', this._boundHandleSweepForCalibration);
// Таймаут ожидания (30с)
// Таймаут ожидания (5с)
this._clearCalibrationTimeout();
this.calibrationTimeout = setTimeout(() => {
this._notify('warning', 'Calibration Timeout', `No sweep received within 30 seconds for ${standard.toUpperCase()}. Please try again.`);
this._notify('warning', 'Calibration Timeout', `No sweep received within 5 seconds for ${standard.toUpperCase()}. Please try again.`);
this._resetCalibrationCaptureState(standard);
}, 30000);
}, 5000);
} catch (e) {
console.error('Start standard capture failed:', e);
this._notify('error', 'Calibration Error', 'Failed to start calibration standard capture');

View File

@ -148,8 +148,8 @@ export class WebSocketManager {
console.error('JSON parse error:', jsonError);
this.notifications?.show?.({
type: 'error',
title: 'WebSocket Error',
message: 'Received invalid JSON from server'
title: 'JSON Parse Error',
message: `Failed to parse JSON: ${data.substring(0, 200)}${data.length > 200 ? '...' : ''}`
});
return;
}
@ -176,6 +176,11 @@ export class WebSocketManager {
} catch (e) {
console.error('❌ Failed to parse WebSocket JSON:', e);
console.log('📝 Raw message:', data);
this.notifications?.show?.({
type: 'error',
title: 'Message Processing Error',
message: `Error processing message: ${data.substring(0, 200)}${data.length > 200 ? '...' : ''}`
});
}
}