1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-01-30 22:23: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,21 +392,19 @@ void WifiESP::loop() {
int count=outboundRing->count(); int count=outboundRing->count();
auto wsHeaderLen=useWebsocket? Websockets::getOutboundHeaderSize(count) : 0; auto wsHeaderLen=useWebsocket? Websockets::getOutboundHeaderSize(count) : 0;
{ {
byte buffer[wsHeaderLen + count + 1]; // one extra for '\0'
byte buffer[wsHeaderLen+count+1]; // one extra for '\0' if (useWebsocket) Websockets::fillOutboundHeader(count, buffer);
if (useWebsocket) Websockets::fillOutboundHeader(count, buffer); for (int i = 0; i < count; i++) {
for(int i=0;i<count;i++) { int c = outboundRing->read();
int c = outboundRing->read(); if (!c) {
if (c >= 0) // Panic check, should never be false DIAG(F("Ringread fail at %d"), i);
// websocket implementations at browser end can barf at \b break;
if (websocket && (cout=='\n')) cout='\r'; }
buffer[i+wsHeaderLen] = (char)c; // websocket implementations at browser end can barf at \n
else { if (useWebsocket && (c == '\n')) c = '\r';
DIAG(F("Ringread fail at %d"),i); buffer[i + wsHeaderLen] = (char)c;
break; }
} // buffer filled, end with '\0' so we can use it as C string
}
// buffer filled, end with '\0' so we can use it as C string
buffer[wsHeaderLen+count]='\0'; buffer[wsHeaderLen+count]='\0';
if((unsigned int)clientId <= clients.size() && clients[clientId].active(clientId)) { if((unsigned int)clientId <= clients.size() && clients[clientId].active(clientId)) {
if (Diag::CMD || Diag::WITHROTTLE) if (Diag::CMD || Diag::WITHROTTLE)

View File

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