Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { DEFAULT_DEVICE_NAME } from '../../util/constants.js';
import { assertEnum, assertFloat, assertInt16, assertUInt16, assertUInt32, assertUInt8 } from '../assert.js';
import { resolveSwitchKeymapActions } from '../resolve-switch-keymap-actions.js';
import { UhkBuffer } from '../uhk-buffer.js';
Expand Down Expand Up @@ -537,7 +538,7 @@ export class UserConfiguration implements AdvancedSecondaryRoleConfiguration, Mo

private setDefaultDeviceName(): void {
if (!this.deviceName || this.deviceName.trim().length === 0) {
this.deviceName = 'My UHK';
this.deviceName = DEFAULT_DEVICE_NAME;
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/uhk-common/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ export const AGENT_CONTRIBUTORS_GITHUB_API_URL = 'https://api.github.com/repos/U
export const MAX_ALLOWED_MACROS = 255;
export const MAX_ALLOWED_MACROS_TOOLTIP = `No more than ${MAX_ALLOWED_MACROS} macros are supported.`;

export const DEFAULT_DEVICE_NAME = 'My UHK';

export const UHK_EEPROM_SIZE = 32768;
export const ERR_UPDATER_INVALID_SIGNATURE = 'ERR_UPDATER_INVALID_SIGNATURE'
5 changes: 4 additions & 1 deletion packages/uhk-web/src/app/store/effects/user-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { saveAs } from 'file-saver';
import {
BackupUserConfigurationInfo,
Buffer,
DEFAULT_DEVICE_NAME,
getHardwareConfigFromDeviceResponse,
getUserConfigFromDeviceResponse,
ConfigurationReply,
Expand Down Expand Up @@ -337,7 +338,9 @@ export class UserConfigEffects {

// Keep the connected keyboard's name when importing a config, so a single config
// can be shared across multiple keyboards while each retains its own name.
userConfig.deviceName = deviceName;
if (deviceName !== DEFAULT_DEVICE_NAME) {
userConfig.deviceName = deviceName;
}

if (payload.autoSave) {
return new ApplyUserConfigurationFromFileAction({
Expand Down
Loading