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/bin"
rm -rf "server.test/obj" rm -rf "server.test/obj"
rm -rf "dist" rm -rf "dist"
rm -rf "wwwroot"
update: update:
npm install 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: "sine", data: null },
{ name: "方波", type: "square", data: null }, { name: "方波", type: "square", data: null },
{ name: "三角波", type: "triangle", 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, eqps.boardPort,
0, 0,
currentWaveformIndex.value, currentWaveformIndex.value,
frequency.value * Math.pow(2, 32 - 20), toInteger( frequency.value * Math.pow(2, 32 - 20) / 10 ),
); );
if (!ret) { if (!ret) {
dialog.error("应用失败"); dialog.error("应用失败");

View File

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

View File

@ -410,36 +410,58 @@ async function handleComponentSelected(componentData: DiagramPart | null) {
if (moduleRef) { if (moduleRef) {
try { try {
// 使 //
const propConfigs: PropertyConfig[] = []; const propConfigs: PropertyConfig[] = [];
// 1. - DiagramPart //
const directPropConfigs = generatePropertyConfigs(componentData); const addedProps = new Set<string>();
propConfigs.push(...directPropConfigs);
// 2. 使getDefaultProps // 1. getDefaultProps
if (typeof moduleRef.getDefaultProps === "function") { if (typeof moduleRef.getDefaultProps === "function") {
// getDefaultProps
const defaultProps = moduleRef.getDefaultProps(); const defaultProps = moduleRef.getDefaultProps();
const defaultPropConfigs = generatePropsFromDefault(defaultProps); const defaultPropConfigs = generatePropsFromDefault(defaultProps);
propConfigs.push(...defaultPropConfigs);
selectedComponentConfig.value = { props: propConfigs }; //
console.log( defaultPropConfigs.forEach((config) => {
`Built config for ${componentData.type} from getDefaultProps:`, propConfigs.push(config);
selectedComponentConfig.value, addedProps.add(config.name);
); });
} 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 };
} }
// 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) { } catch (error) {
console.error( console.error(
`Error building config for ${componentData.type}:`, `Error building config for ${componentData.type}:`,