2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
[![Arduino CI](https://github.com/RobTillaart/PrintString/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
2021-11-14 11:19:48 -05:00
|
|
|
[![Arduino-lint](https://github.com/RobTillaart/PrintString/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/PrintString/actions/workflows/arduino-lint.yml)
|
|
|
|
[![JSON check](https://github.com/RobTillaart/PrintString/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/PrintString/actions/workflows/jsoncheck.yml)
|
2023-11-16 04:39:56 -05:00
|
|
|
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/PrintString.svg)](https://github.com/RobTillaart/PrintString/issues)
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/PrintString/blob/master/LICENSE)
|
|
|
|
[![GitHub release](https://img.shields.io/github/release/RobTillaart/PrintString.svg?maxAge=3600)](https://github.com/RobTillaart/PrintString/releases)
|
2023-11-16 04:39:56 -05:00
|
|
|
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/PrintString.svg)](https://registry.platformio.org/libraries/robtillaart/PrintString)
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
2020-11-27 05:28:57 -05:00
|
|
|
# PrintString
|
|
|
|
|
2021-11-14 11:19:48 -05:00
|
|
|
Arduino library to print to a String.
|
2020-11-27 05:28:57 -05:00
|
|
|
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
## Description
|
2020-11-27 05:28:57 -05:00
|
|
|
|
|
|
|
PrintString is a class that buffers a number of print statements in a String.
|
|
|
|
This String can be requested to process later.
|
|
|
|
|
|
|
|
- buffer slowly generated data, and send it with minimum time between bytes
|
2021-11-14 11:19:48 -05:00
|
|
|
e.g. to maximize packets for Ethernet.
|
2020-11-27 05:28:57 -05:00
|
|
|
- print to buffer to see how many chars the output is;
|
|
|
|
use to prevent "display line overflow"
|
|
|
|
(e.g. floats)
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2023-11-16 04:39:56 -05:00
|
|
|
|
|
|
|
#### Related
|
|
|
|
|
|
|
|
- https://github.com/RobTillaart/PrintCharArray (captures data in a char buffer)
|
|
|
|
- https://github.com/RobTillaart/PrintSize (counts length of a number of print commands)
|
|
|
|
- https://github.com/RobTillaart/PrintString (captures data in a String)
|
2021-11-14 11:19:48 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
## Interface
|
|
|
|
|
2023-11-16 04:39:56 -05:00
|
|
|
```cpp
|
|
|
|
#include "PrintString.h"
|
|
|
|
```
|
|
|
|
|
2021-11-14 11:19:48 -05:00
|
|
|
- **PrintString()** constructor.
|
|
|
|
- **size_t write(uint8_t c)** workhorse I of Print interface.
|
|
|
|
- **size_t write(uint8_t \* str, uint8_t length)** workhorse II of Print interface.
|
2021-01-29 06:31:58 -05:00
|
|
|
- **void clear()** wipes the internal String buffer
|
2021-11-14 11:19:48 -05:00
|
|
|
- **int size()** current usage of the buffer.
|
2021-01-29 06:31:58 -05:00
|
|
|
- **String getString()** to access the buffer.
|
|
|
|
|
|
|
|
|
|
|
|
## Operational
|
2020-11-27 05:28:57 -05:00
|
|
|
|
2021-12-24 08:47:57 -05:00
|
|
|
See examples.
|
2021-11-14 11:19:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
## Future
|
|
|
|
|
2023-11-16 04:39:56 -05:00
|
|
|
#### Must
|
|
|
|
|
|
|
|
- documentation
|
|
|
|
|
|
|
|
#### Should
|
|
|
|
|
2021-11-14 11:19:48 -05:00
|
|
|
- testing
|
2021-12-24 08:47:57 -05:00
|
|
|
- examples
|
|
|
|
- add new ones
|
|
|
|
- rename examples
|
2021-11-14 11:19:48 -05:00
|
|
|
- add functions like **repeat(char c)** to inject e.g. 7 spaces etc.
|
|
|
|
- add error flag
|
2023-11-16 04:39:56 -05:00
|
|
|
|
|
|
|
#### Could
|
|
|
|
|
|
|
|
- PRINTSTRING_LIB_VERSION
|
|
|
|
|
|
|
|
#### Wont
|
|
|
|
|
|
|
|
|
|
|
|
## Support
|
|
|
|
|
|
|
|
If you appreciate my libraries, you can support the development and maintenance.
|
|
|
|
Improve the quality of the libraries by providing issues and Pull Requests, or
|
|
|
|
donate through PayPal or GitHub sponsors.
|
|
|
|
|
|
|
|
Thank you,
|
|
|
|
|