1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-01-30 14:13:07 +01:00

WIfiESP websock fix

This commit is contained in:
Asbelos 2025-01-17 13:16:29 +00:00
parent c4e2146bd1
commit 59418668e2
2 changed files with 27 additions and 28 deletions

View File

@ -392,19 +392,17 @@ void WifiESP::loop() {
int count=outboundRing->count();
auto wsHeaderLen=useWebsocket? Websockets::getOutboundHeaderSize(count) : 0;
{
byte buffer[wsHeaderLen + count + 1]; // one extra for '\0'
if (useWebsocket) Websockets::fillOutboundHeader(count, buffer);
for (int i = 0; i < count; i++) {
int c = outboundRing->read();
if (c >= 0) // Panic check, should never be false
// websocket implementations at browser end can barf at \b
if (websocket && (cout=='\n')) cout='\r';
buffer[i+wsHeaderLen] = (char)c;
else {
if (!c) {
DIAG(F("Ringread fail at %d"), i);
break;
}
// websocket implementations at browser end can barf at \n
if (useWebsocket && (c == '\n')) c = '\r';
buffer[i + wsHeaderLen] = (char)c;
}
// buffer filled, end with '\0' so we can use it as C string
buffer[wsHeaderLen+count]='\0';

View File

@ -1,16 +1,17 @@
ECHO ON
FOR /F "delims=" %%i IN ('dir %TMP%\arduino_build_* /b /ad-h /t:c /od') DO SET a=%%i
echo Most recent subfolder: %a% >%TMP%\OBJDUMP_%a%.txt
SET ELF=%TMP%\%a%\CommandStation-EX.ino.elf
FOR /F "delims=" %%i IN ('dir %TMP%\arduino\sketches\CommandStation-EX.ino.elf /s /b /o-D') DO SET ELF=%%i
SET DUMP=%TEMP%\OBJDUMP.txt
echo Most recent subfolder: %ELF% >%DUMP%
set PATH="C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\";%PATH%
avr-objdump --private=mem-usage %ELF% >>%TMP%\OBJDUMP_%a%.txt
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
avr-objdump -x -C %ELF% | find ".text" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
avr-objdump -x -C %ELF% | find ".data" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
avr-objdump -x -C %ELF% | find ".bss" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
avr-objdump -D -S %ELF% >>%TMP%\OBJDUMP_%a%.txt
%TMP%\OBJDUMP_%a%.txt
avr-objdump --private=mem-usage %ELF% >>%DUMP%
ECHO ++++++++++++++++++++++++++++++++++ >>%DUMP%
avr-objdump -x -C %ELF% | find ".text" | sort /+25 /R >>%DUMP%
ECHO ++++++++++++++++++++++++++++++++++ >>%DUMP%
avr-objdump -x -C %ELF% | find ".data" | sort /+25 /R >>%DUMP%
ECHO ++++++++++++++++++++++++++++++++++ >>%DUMP%
avr-objdump -x -C %ELF% | find ".bss" | sort /+25 /R >>%DUMP%
ECHO ++++++++++++++++++++++++++++++++++ >>%DUMP%
avr-objdump -D -S %ELF% >>%DUMP%
%DUMP%
EXIT