Skip to content

Commit 742e29e

Browse files
committed
loggingcentral: cleanup
1 parent 6d8b754 commit 742e29e

3 files changed

Lines changed: 10 additions & 40 deletions

File tree

firmware/console/binary/tunerstudio.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -849,19 +849,12 @@ static void handleGetText(TsChannelBase* tsChannel) {
849849
tsState.textCommandCounter++;
850850

851851
printOverallStatus();
852-
853-
#if 0
854-
size_t outputSize = loggingGetOutputData(tsChannel->scratchBuffer + TS_PACKET_HEADER_SIZE, sizeof(tsChannel->scratchBuffer) - TS_PACKET_HEADER_SIZE - TS_PACKET_TAIL_SIZE);
855852
#if EFI_SIMULATOR
856-
logMsg("get test sending [%d]\r\n", outputSize);
857-
#endif
858-
859-
tsChannel->crcAndWriteBuffer(TS_RESPONSE_OK, outputSize);
860-
#else
861-
/* size_t outputSize = */loggingSendOutputData(tsChannel);
862-
#endif
853+
size_t outputSize =
854+
#endif // EFI_SIMULATOR
855+
loggingSendOutputData(tsChannel);
863856
#if EFI_SIMULATOR
864-
//logMsg("sent [%d]\r\n", outputSize);
857+
logMsg("sent [%d]\r\n", outputSize);
865858
#endif // EFI_SIMULATOR
866859
}
867860
#endif // EFI_TEXT_LOGGING

firmware/util/loggingcentral.cpp

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,16 @@ void LogLineBuffer::free() {
4646
freeBuffers.post(this, TIME_INFINITE);
4747
}
4848

49-
/**
50-
* Fill buffer with as much data as possible
51-
*
52-
* @return actual size to transfer
53-
*/
54-
size_t loggingGetOutputData(char *buffer, size_t size) {
55-
LogBufferBase* line;
56-
size_t offset = 0;
57-
// TODO: better?
58-
while (offset + 128 <= size) {
59-
// Fetch a queued message
60-
msg_t msg = filledBuffers.fetch(&line, TIME_IMMEDIATE);
61-
62-
if (msg != MSG_OK) {
63-
return offset;
64-
}
65-
66-
const char* content = line->getBuffer();
67-
size_t len = std::strlen(content);
68-
memcpy(buffer + offset, content, len);
69-
offset += len;
70-
71-
// Return this logging buffer to the owner
72-
line->free();
73-
}
74-
75-
return offset;
76-
}
7749

7850
// actually we can send much more in one packed. this is just a threshold that triggers current packet finalization
7951
constexpr size_t maxSend = scratchBuffer_SIZE;
8052

53+
/**
54+
* Write as much data as possible
55+
*
56+
* @return actual size transfered
57+
*/
58+
8159
size_t loggingSendOutputData(TsChannelBase* tsChannel) {
8260
// consolidate up to 16 line buffers in one TS packet
8361
LogBufferBase* bufs[16];

firmware/util/loggingcentral.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class Logging;
1515

1616
void startLoggingProcessor();
1717

18-
size_t loggingGetOutputData(char *buffer, size_t size);
1918
size_t loggingSendOutputData(TsChannelBase* tsChannel);
2019

2120
namespace priv

0 commit comments

Comments
 (0)