Aligned columns on the serial monitor while keeping CSV on the SD card
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- arduino, cpp
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
Bắt đầu từ mã logger, nơi cùng một String hiện đang được gửi tới tệp SD và Serial, sau đó kiểm tra giao diện Arduino Print và điều kiện echo serial hiện có. Thêm adapter tại điểm echo đó, giữ nguyên việc ghi vào tệp, rồi xác minh rằng header và dữ liệu được căn chỉnh trên Serial trong khi thẻ vẫn nhận CSV ban đầu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Keep the SD card log as plain comma-separated values, but show the same lines on the serial monitor as aligned columns, so a person watching the logger can read them. Today the logger writes one String to both the file and Serial, which made alignment look hard. It is not: the alignment can be done on the byte stream on its way to Serial, with no change to the sensors, to getString(), or to what reaches the card.
Design
A small Print adapter sits in front of Serial. It passes bytes through, and at each comma pads the current field to a fixed column width. The file still receives the unmodified CSV.
class AlignedPrint : public Print { // pads each comma-separated field to a column
Print& _out; uint8_t _width, _col = 0;
public:
AlignedPrint(Print& out, uint8_t width = 24) : _out(out), _width(width) {}
size_t write(uint8_t c) override {
if (c == ',') { while (_col++ < _width) _out.write(' '); _col = 0; return 1; }
if (c == '\n') { _col = 0; }
else _col++;
return _out.write(c);
}
};
Use, in the logger, wherever a line is echoed today:
AlignedPrint monitor(Serial);
logFile.print(line); // CSV to the card, unchanged
monitor.print(line); // aligned columns on the serial monitor
The header line goes through the same adapter, so column names sit over their values provided the width covers the longest name (Pressure Atmos [mBar] is 21 characters, so a default of 24).
Cost
- About twenty lines; a few hundred bytes of flash; two bytes of RAM.
- The serial line is roughly twice as long as the CSV line: at 38400 baud a ten-field line takes ~60 ms instead of ~30 ms. Only the serial echo is affected; the SD path is untouched. It can sit behind the same condition that gates the serial echo now.
- No coupling to the sensor libraries or to the NW-Device-Specification work; can land independently.
Choices made here
- Fixed-width padding, not tab characters. Terminal tab stops are eight columns and a value such as
1013.25,already fills one, so tabs align unpredictably. - Left-aligned fields (pad after the value). Right-aligned numbers read slightly better but require holding each field back until its comma arrives: a ~24-byte buffer and about ten more lines. Start left-aligned; revisit if wanted.
Not in scope
Changing the CSV written to the card; changing any sensor library's getHeader()/getString() output.
🤖 Generated with Claude Code
- Ngôn ngữ chính
- C++
- Star
- 1
- Fork
- 0
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NorthernWidget/Okapi_Library
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 56/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Tất cả issue của NorthernWidget/Okapi_Library
Issue tương tự
-
nth_root does not restore the rounding mode and can return an upper bound below the true rootĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
1 type: problem 2 scope: firmware 3 good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
SpaceTeam/STS1_COBC_SW#511 ·
-
documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
imaaiagent/fumi#3 ·
-
[Performance]: Beam search re-materializes Result.output_token_ids from pybind once per beamĐang mởGeneral perf
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NVIDIA/TensorRT-LLM#20236 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
E3SM-Project/mam4xx#603 ·
Maintainer thường phản hồi trong vòng 1 ngày