this only changes line endings. inspect this commit with command `git
show <commit-sha> --ignore-space-at-eol` and it will tell you that the
commit appears to be "empty" (since all changes are whitespace changes
near the end of a line, which are ignored in that git show command).
the files to be changed were found and updated using this command:
find lib src include webapp/src -type f | \
xargs grep --binary-files=without-match --files-with-matches \
$(printf '\r\n') | xargs dos2unix
the following files were restored afterwards, as they are using CRLF
line endings in the upstream as well:
- lib/CMT2300a/cmt2300a_defs.h
- lib/README
- include/README
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
#pragma once
|
|
|
|
#include <AsyncWebSocket.h>
|
|
#include <TaskSchedulerDeclarations.h>
|
|
#include <Print.h>
|
|
#include <freertos/task.h>
|
|
#include <mutex>
|
|
#include <vector>
|
|
#include <unordered_map>
|
|
#include <queue>
|
|
|
|
class MessageOutputClass : public Print {
|
|
public:
|
|
MessageOutputClass();
|
|
void init(Scheduler& scheduler);
|
|
size_t write(uint8_t c) override;
|
|
size_t write(const uint8_t* buffer, size_t size) override;
|
|
void register_ws_output(AsyncWebSocket* output);
|
|
|
|
private:
|
|
void loop();
|
|
|
|
Task _loopTask;
|
|
|
|
using message_t = std::vector<uint8_t>;
|
|
|
|
// we keep a buffer for every task and only write complete lines to the
|
|
// serial output and then move them to be pushed through the websocket.
|
|
// this way we prevent mangling of messages from different contexts.
|
|
std::unordered_map<TaskHandle_t, message_t> _task_messages;
|
|
std::queue<message_t> _lines;
|
|
|
|
AsyncWebSocket* _ws = nullptr;
|
|
|
|
std::mutex _msgLock;
|
|
|
|
void serialWrite(message_t const& m);
|
|
};
|
|
|
|
extern MessageOutputClass MessageOutput;
|