- USB CDC 경로 복원: #define Serial Serial1 우회 제거 - rp2040js/avr8js/codemirror/xterm/monaco-editor vendor화 - /vendor 정적 라우팅 추가 (Express 5 catch-all 우회) - 부팅 완료 타임아웃 감지 (Serial 출력 없어도 8초 후 RAF 전환) - 리셋 시 Simulator 재생성으로 주변 장치 상태 초기화 - 시리얼 패널의 내부 메시지를 console.log로 이동
28 lines
905 B
JavaScript
28 lines
905 B
JavaScript
export function getCurrentMicroseconds() {
|
|
if (typeof performance != 'undefined') {
|
|
return Math.floor(performance.now() * 1000);
|
|
}
|
|
else {
|
|
return Math.floor(eval('require')('perf_hooks').performance.now() * 1000);
|
|
}
|
|
}
|
|
function leftPad(value, minLength, padChar = ' ') {
|
|
if (value.length < minLength) {
|
|
value = padChar + value;
|
|
}
|
|
return value;
|
|
}
|
|
function rightPad(value, minLength, padChar = ' ') {
|
|
if (value.length < minLength) {
|
|
value += padChar;
|
|
}
|
|
return value;
|
|
}
|
|
export function formatTime(date) {
|
|
const hours = leftPad(date.getHours().toString(), 2, '0');
|
|
const minutes = leftPad(date.getMinutes().toString(), 2, '0');
|
|
const seconds = leftPad(date.getSeconds().toString(), 2, '0');
|
|
const milliseconds = rightPad(date.getMilliseconds().toString(), 3);
|
|
return `${hours}:${minutes}:${seconds}.${milliseconds}`;
|
|
}
|