diff --git a/libraries/PrintSize/.github/FUNDING.yml b/libraries/PrintSize/.github/FUNDING.yml index 90d9ab4c..554358c3 100644 --- a/libraries/PrintSize/.github/FUNDING.yml +++ b/libraries/PrintSize/.github/FUNDING.yml @@ -1,4 +1,4 @@ # These are supported funding model platforms github: RobTillaart - +custom: "https://www.paypal.me/robtillaart" diff --git a/libraries/PrintSize/.github/workflows/arduino-lint.yml b/libraries/PrintSize/.github/workflows/arduino-lint.yml index 8a26f14a..7f8f4ef4 100644 --- a/libraries/PrintSize/.github/workflows/arduino-lint.yml +++ b/libraries/PrintSize/.github/workflows/arduino-lint.yml @@ -1,13 +1,13 @@ - name: Arduino-lint on: [push, pull_request] jobs: lint: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: arduino/arduino-lint-action@v1 with: library-manager: update - compliance: strict + compliance: strict \ No newline at end of file diff --git a/libraries/PrintSize/.github/workflows/arduino_test_runner.yml b/libraries/PrintSize/.github/workflows/arduino_test_runner.yml index fadfa904..89bc1ae7 100644 --- a/libraries/PrintSize/.github/workflows/arduino_test_runner.yml +++ b/libraries/PrintSize/.github/workflows/arduino_test_runner.yml @@ -1,4 +1,3 @@ ---- name: Arduino CI on: [push, pull_request] @@ -6,12 +5,14 @@ on: [push, pull_request] jobs: runTest: runs-on: ubuntu-latest + timeout-minutes: 20 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6 - run: | + sudo sysctl vm.mmap_rnd_bits=28 gem install arduino_ci arduino_ci.rb diff --git a/libraries/PrintSize/.github/workflows/jsoncheck.yml b/libraries/PrintSize/.github/workflows/jsoncheck.yml index 37a11298..1cbb5e2c 100644 --- a/libraries/PrintSize/.github/workflows/jsoncheck.yml +++ b/libraries/PrintSize/.github/workflows/jsoncheck.yml @@ -9,10 +9,10 @@ on: jobs: test: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: json-syntax-check - uses: limitusus/json-syntax-check@v1 + uses: limitusus/json-syntax-check@v2 with: - pattern: "\\.json$" - + pattern: "\\.json$" \ No newline at end of file diff --git a/libraries/PrintSize/CHANGELOG.md b/libraries/PrintSize/CHANGELOG.md index ae6888d3..7404eb86 100644 --- a/libraries/PrintSize/CHANGELOG.md +++ b/libraries/PrintSize/CHANGELOG.md @@ -6,10 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.3.4] - 2024-04-11 +- update GitHub actions +- minor edits + ## [0.3.4] - 2023-11-15 - update readme.md - ## [0.3.3] - 2022-11-22 - add changelog.md - add RP2040 to build-CI diff --git a/libraries/PrintSize/LICENSE b/libraries/PrintSize/LICENSE index 562b0ffe..a4357241 100644 --- a/libraries/PrintSize/LICENSE +++ b/libraries/PrintSize/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2023 Rob Tillaart +Copyright (c) 2017-2024 Rob Tillaart Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/libraries/PrintSize/PrintSize.h b/libraries/PrintSize/PrintSize.h index 36983bbb..fd171001 100644 --- a/libraries/PrintSize/PrintSize.h +++ b/libraries/PrintSize/PrintSize.h @@ -2,7 +2,7 @@ // // FILE: PrintSize.h // AUTHOR: Rob Tillaart -// VERSION: 0.3.4 +// VERSION: 0.3.5 // PURPOSE: Library to determine size of a printed variable. // DATE: 2017-12-09 // URL: https://github.com/RobTillaart/PrintSize @@ -11,7 +11,7 @@ #include "Arduino.h" #include "Print.h" -#define PRINTSIZE_VERSION (F("0.3.4")) +#define PRINTSIZE_VERSION (F("0.3.5")) class PrintSize: public Print @@ -26,7 +26,7 @@ public: size_t write(uint8_t c) // note: warning unused parameter { _total++; - return 1; + return sizeof(c); } @@ -37,10 +37,16 @@ public: } - void reset() { _total = 0; } + void reset() + { + _total = 0; + } - uint32_t total() { return _total; }; + uint32_t total() + { + return _total; + } private: diff --git a/libraries/PrintSize/examples/PrintSize1/PrintSize1.ino b/libraries/PrintSize/examples/PrintSize1/PrintSize1.ino index 6c5e7b3f..fc10f386 100644 --- a/libraries/PrintSize/examples/PrintSize1/PrintSize1.ino +++ b/libraries/PrintSize/examples/PrintSize1/PrintSize1.ino @@ -14,6 +14,9 @@ void setup() { Serial.begin(115200); Serial.println(__FILE__); + Serial.print("PRINTSIZE_VERSION: "); + Serial.println(PRINTSIZE_VERSION); + Serial.println(); Serial.println("Determine length of 10 random numbers and right "); Serial.println("align the numbers in a table with their sum."); @@ -39,6 +42,8 @@ void loop() printSpaces(15 - length); Serial.println(sum); Serial.println(); + + delay(1000); } @@ -48,5 +53,4 @@ void printSpaces(uint8_t n) } -// -- END OF FILE -- - +// -- END OF FILE -- diff --git a/libraries/PrintSize/examples/PrintSize_centering/PrintSize_centering.ino b/libraries/PrintSize/examples/PrintSize_centering/PrintSize_centering.ino index 379d660d..fd70180c 100644 --- a/libraries/PrintSize/examples/PrintSize_centering/PrintSize_centering.ino +++ b/libraries/PrintSize/examples/PrintSize_centering/PrintSize_centering.ino @@ -16,9 +16,10 @@ PrintSize ps; void setup() { Serial.begin(115200); - Serial.println(); - Serial.println(); Serial.println(__FILE__); + Serial.print("PRINTSIZE_VERSION: "); + Serial.println(PRINTSIZE_VERSION); + Serial.println(); Serial.println("Determine length of 10 random numbers and right "); Serial.println("align the numbers in a table with their sum."); diff --git a/libraries/PrintSize/examples/PrintSize_printf/PrintSize_printf.ino b/libraries/PrintSize/examples/PrintSize_printf/PrintSize_printf.ino index 035bafe1..a9d92c39 100644 --- a/libraries/PrintSize/examples/PrintSize_printf/PrintSize_printf.ino +++ b/libraries/PrintSize/examples/PrintSize_printf/PrintSize_printf.ino @@ -15,6 +15,9 @@ void setup() { Serial.begin(115200); Serial.println(__FILE__); + Serial.print("PRINTSIZE_VERSION: "); + Serial.println(PRINTSIZE_VERSION); + Serial.println(); Serial.println("Determine length of 10 random numbers and right "); Serial.println("align the numbers in a table with their sum."); diff --git a/libraries/PrintSize/examples/PrintSize_total/PrintSize_total.ino b/libraries/PrintSize/examples/PrintSize_total/PrintSize_total.ino index f67edf4b..574c08f6 100644 --- a/libraries/PrintSize/examples/PrintSize_total/PrintSize_total.ino +++ b/libraries/PrintSize/examples/PrintSize_total/PrintSize_total.ino @@ -30,9 +30,10 @@ PrintSize ps; void setup() { Serial.begin(115200); - Serial.println(); - Serial.println(); Serial.println(__FILE__); + Serial.print("PRINTSIZE_VERSION: "); + Serial.println(PRINTSIZE_VERSION); + Serial.println(); Serial.println("\nType words < 20 chars in the Serial monitor\n"); ps.reset(); @@ -64,7 +65,7 @@ void process(char * w, uint8_t maxLength) { // skip empty words. if (strlen(w) == 0) return; - + // remember position uint8_t prev = ps.total(); @@ -87,5 +88,5 @@ void process(char * w, uint8_t maxLength) } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/PrintSize/library.json b/libraries/PrintSize/library.json index 3deda72e..1c456487 100644 --- a/libraries/PrintSize/library.json +++ b/libraries/PrintSize/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/PrintSize.git" }, - "version": "0.3.4", + "version": "0.3.5", "license": "MIT", "frameworks": "*", "platforms": "*", diff --git a/libraries/PrintSize/library.properties b/libraries/PrintSize/library.properties index f233456d..5abfb0c0 100644 --- a/libraries/PrintSize/library.properties +++ b/libraries/PrintSize/library.properties @@ -1,5 +1,5 @@ name=PrintSize -version=0.3.4 +version=0.3.5 author=Rob Tillaart maintainer=Rob Tillaart sentence=Library to determine size of a printed variable. diff --git a/libraries/PrintSize/readme.md b/libraries/PrintSize/readme.md index 1e6c2858..c7ddde23 100644 --- a/libraries/PrintSize/readme.md +++ b/libraries/PrintSize/readme.md @@ -21,15 +21,15 @@ This includes printing of floats, integers in decimal or hex notation. Works for **print()**, **println()** and if supported **printf()** e.g. ESP32. -Finally since **0.2.0** it has a total counter to add up the characters "printed" since -the last **reset()** call. (see example) +Since **0.2.0** it has a total counter to add up the characters "printed" since +the last **reset()** call. See examples. #### 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) +- https://github.com/RobTillaart/PrintCharArray captures data in a char array buffer. +- https://github.com/RobTillaart/PrintSize counts length of a number of print commands. +- https://github.com/RobTillaart/PrintString captures data in a String. ## Interface @@ -49,9 +49,9 @@ Note: gives a warning unused parameter. ## Operational -Example shows the right alignment of 10 random numbers. +Example PrintSize1.ino shows the right alignment of 10 random numbers. -Example shows (elementary) line fitting. +Example PrintSize_total.ino shows (elementary) line fitting. ## Applications