fix: DDS couldn't apply

This commit is contained in:
SikongJueluo 2025-05-17 13:10:00 +08:00
parent c39f688115
commit 9b2ee8ad46
No known key found for this signature in database
5 changed files with 512 additions and 390 deletions

View File

@ -12,6 +12,7 @@ clean:
rm -rf "server.test/bin"
rm -rf "server.test/obj"
rm -rf "dist"
rm -rf "wwwroot"
update:
npm install

File diff suppressed because it is too large Load Diff

View File

@ -253,7 +253,7 @@ const waveformSlots = ref<
{ name: "正弦波", type: "sine", data: null },
{ name: "方波", type: "square", data: null },
{ name: "三角波", type: "triangle", data: null },
{ name: "", type: "", data: null },
{ name: "锯齿波", type: "sawtooth", data: null },
]);
//
@ -408,7 +408,7 @@ async function applyOutputWave() {
eqps.boardPort,
0,
currentWaveformIndex.value,
frequency.value * Math.pow(2, 32 - 20),
toInteger( frequency.value * Math.pow(2, 32 - 20) / 10 ),
);
if (!ret) {
dialog.error("应用失败");

View File

@ -34,6 +34,9 @@ const eqps = useEquipments();
const bitstreamFile = ref<File | null>();
watchEffect(() => {
console.log(
`board监听改动: ${props.size} ${props.boardAddr}:${props.boardPort}`,
);
eqps.setAddr(props.boardAddr);
eqps.setPort(props.boardPort);
});
@ -64,14 +67,12 @@ defineExpose({
</script>
<script lang="tsx">
const eqps = useEquipments();
// props
export function getDefaultProps(): MotherBoardProps {
console.log(`board监听改动: ${eqps.boardAddr}:${eqps.boardPort}`);
return {
size: 1,
boardAddr: eqps.boardAddr,
boardPort: eqps.boardPort.toString(),
boardAddr: "127.0.0.1",
boardPort: "1234",
};
}
</script>

View File

@ -410,36 +410,58 @@ async function handleComponentSelected(componentData: DiagramPart | null) {
if (moduleRef) {
try {
// 使
//
const propConfigs: PropertyConfig[] = [];
// 1. - DiagramPart
const directPropConfigs = generatePropertyConfigs(componentData);
propConfigs.push(...directPropConfigs);
//
const addedProps = new Set<string>();
// 2. 使getDefaultProps
// 1. getDefaultProps
if (typeof moduleRef.getDefaultProps === "function") {
// getDefaultProps
const defaultProps = moduleRef.getDefaultProps();
const defaultPropConfigs = generatePropsFromDefault(defaultProps);
propConfigs.push(...defaultPropConfigs);
selectedComponentConfig.value = { props: propConfigs };
console.log(
`Built config for ${componentData.type} from getDefaultProps:`,
selectedComponentConfig.value,
);
} else {
console.warn(
`Component ${componentData.type} does not export getDefaultProps method.`,
);
//
const attrs = componentData.attrs || {};
const attrPropConfigs = generatePropsFromAttrs(attrs);
propConfigs.push(...attrPropConfigs);
selectedComponentConfig.value = { props: propConfigs };
//
defaultPropConfigs.forEach((config) => {
propConfigs.push(config);
addedProps.add(config.name);
});
}
// 2.
const directPropConfigs = generatePropertyConfigs(componentData);
//
const newDirectProps = directPropConfigs.filter(
(config) => !addedProps.has(config.name),
);
propConfigs.push(...newDirectProps);
// 3. attrs
if (componentData.attrs) {
const attrs = componentData.attrs;
const attrPropConfigs = generatePropsFromAttrs(attrs);
//
attrPropConfigs.forEach((attrConfig) => {
const existingIndex = propConfigs.findIndex(
(p) => p.name === attrConfig.name,
);
if (existingIndex >= 0) {
//
propConfigs[existingIndex] = attrConfig;
} else {
//
propConfigs.push(attrConfig);
}
});
}
selectedComponentConfig.value = { props: propConfigs };
console.log(
`Built config for ${componentData.type}:`,
selectedComponentConfig.value,
);
} catch (error) {
console.error(
`Error building config for ${componentData.type}:`,