Skip to content

Commit 9c38bfa

Browse files
author
Akos Kitta
committed
dropped the network board address hack.
Signed-off-by: Akos Kitta <[email protected]>
1 parent 40923e2 commit 9c38bfa

File tree

1 file changed

+2
-47
lines changed

1 file changed

+2
-47
lines changed

arduino-ide-extension/src/node/board-discovery.ts

+2-47
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,10 @@ export class BoardDiscovery
317317
port,
318318
} as Board)
319319
);
320-
return maybeEnhancePortAddress({
320+
return {
321321
boards,
322322
port,
323-
});
323+
};
324324
}
325325

326326
private fromRpcPort(rpcPort: RpcPort): Port {
@@ -369,48 +369,3 @@ namespace DetectedPort {
369369
return !!arg.port && arg.port.protocol === 'network' && !arg.boards.length;
370370
}
371371
}
372-
373-
/**
374-
* Tries to enhance the port address if no boards were recognized for the port.
375-
* Basically, this method makes sure, that users will see more than an IP address
376-
* if the `'network'` board was not recognized by the Arduino CLI.
377-
*
378-
* See: https://github.com/arduino/arduino-ide/issues/1331
379-
*/
380-
export function maybeEnhancePortAddress(
381-
detectedPort: DetectedPort
382-
): DetectedPort {
383-
for (const enhancer of PortAddressEnhancers) {
384-
const enhanced = enhancer(detectedPort);
385-
if (enhanced) {
386-
return enhanced;
387-
}
388-
}
389-
return detectedPort;
390-
}
391-
392-
/**
393-
* Must return with `undefined` if the `arg` cannot be enhanced.
394-
*/
395-
type PortAddressEnhancer = (arg: DetectedPort) => DetectedPort | undefined;
396-
const PortAddressEnhancers: PortAddressEnhancer[] = [enhanceESP32_S2];
397-
398-
function enhanceESP32_S2(detectedPort: DetectedPort): DetectedPort | undefined {
399-
if (DetectedPort.isUnrecognizedNetwork(detectedPort)) {
400-
const { properties } = detectedPort.port;
401-
if (properties) {
402-
const board = properties['board']; // This is just a cheap hack. See https://github.com/arduino/arduino-ide/issues/567#issuecomment-1219494389
403-
if (board) {
404-
const { boards, port } = detectedPort;
405-
return {
406-
boards,
407-
port: {
408-
...port,
409-
address: `${board} at ${port.address}`,
410-
},
411-
};
412-
}
413-
}
414-
}
415-
return undefined;
416-
}

0 commit comments

Comments
 (0)